From a7d6c0355c28a38d2099d3706197aa47ba3155bc Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Wed, 10 Jan 2024 04:00:51 +0300 Subject: [PATCH] Revert to PIXI4 --- package-lock.json | 6 +- www/js/jsconfig.json | 2 +- www/js/libs/pixi-legacy.js | 44078 ------------- www/js/libs/pixi-legacy.js.map | 1 - www/js/libs/pixi-legacy.min.js | 9 - www/js/libs/pixi-legacy.min.js.map | 1 - www/js/libs/pixi-picture.js | 804 +- www/js/libs/pixi-tilemap.js | 1826 +- www/js/libs/pixi.js | 83858 ++++++++++++------------ www/js/libs/pixi.js.map | 1 - www/js/libs/pixi.min.js | 9 - www/js/libs/pixi.min.js.map | 1 - www/js/plugins/Archeia_CoreChanges.js | 2 +- www/js/plugins/GTP_OmoriFixes.js | 8 +- www/js/plugins/Omori Title Screen.js | 21 +- www/js/rpg_core.js | 922 +- www/js/rpg_managers.js | 66 +- www/js/rpg_objects.js | 1446 +- www/js/rpg_scenes.js | 3 +- www/js/rpg_sprites.js | 252 +- www/js/rpg_windows.js | 20 +- 21 files changed, 44598 insertions(+), 88738 deletions(-) delete mode 100644 www/js/libs/pixi-legacy.js delete mode 100644 www/js/libs/pixi-legacy.js.map delete mode 100644 www/js/libs/pixi-legacy.min.js delete mode 100644 www/js/libs/pixi-legacy.min.js.map delete mode 100644 www/js/libs/pixi.js.map delete mode 100644 www/js/libs/pixi.min.js delete mode 100644 www/js/libs/pixi.min.js.map diff --git a/package-lock.json b/package-lock.json index baefba4..4b592a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -92,9 +92,9 @@ } }, "node_modules/android-versions": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.8.2.tgz", - "integrity": "sha512-2MT/Y/mR3BLSbR9E3ugwvE/aA4k84XtjG2Iusu4pRKt4FwfpEvIEAHzm7ZBhL3/aTVNdx3PzZ+sAiK+Dbc4r9A==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.9.0.tgz", + "integrity": "sha512-13O2B6PQMEM4ej9n13ePRQeckrCoKbZrvuzlLvK+9s2QmncpHDbYzZxhgapN32sJNoifN6VAHexLnd/6CYrs7Q==", "dev": true, "dependencies": { "semver": "^7.5.2" diff --git a/www/js/jsconfig.json b/www/js/jsconfig.json index 8fe1e17..0b30db7 100644 --- a/www/js/jsconfig.json +++ b/www/js/jsconfig.json @@ -11,6 +11,6 @@ "./plugins_dev/*.js", "./plugins/*.js", "libs/yaml.js", - "require.js" + "porting/require.js" ] } \ No newline at end of file diff --git a/www/js/libs/pixi-legacy.js b/www/js/libs/pixi-legacy.js deleted file mode 100644 index 63f293b..0000000 --- a/www/js/libs/pixi-legacy.js +++ /dev/null @@ -1,44078 +0,0 @@ -/*! - * pixi.js-legacy - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * pixi.js-legacy is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ -var PIXI = (function (exports) { - 'use strict'; - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); - } - - function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - function getCjsExportFromNamespace (n) { - return n && n['default'] || n; - } - - var promise = createCommonjsModule(function (module, exports) { - (function(global){ - - // - // Check for native Promise and it has correct interface - // - - var NativePromise = global['Promise']; - var nativePromiseSupported = - NativePromise && - // Some of these methods are missing from - // Firefox/Chrome experimental implementations - 'resolve' in NativePromise && - 'reject' in NativePromise && - 'all' in NativePromise && - 'race' in NativePromise && - // Older version of the spec had a resolver object - // as the arg rather than a function - (function(){ - var resolve; - new NativePromise(function(r){ resolve = r; }); - return typeof resolve === 'function'; - })(); - - - // - // export if necessary - // - - if ('object' !== 'undefined' && exports) - { - // node.js - exports.Promise = nativePromiseSupported ? NativePromise : Promise; - exports.Polyfill = Promise; - } - else - { - // AMD - if (typeof undefined == 'function' && undefined.amd) - { - undefined(function(){ - return nativePromiseSupported ? NativePromise : Promise; - }); - } - else - { - // in browser add to global - if (!nativePromiseSupported) - { global['Promise'] = Promise; } - } - } - - - // - // Polyfill - // - - var PENDING = 'pending'; - var SEALED = 'sealed'; - var FULFILLED = 'fulfilled'; - var REJECTED = 'rejected'; - var NOOP = function(){}; - - function isArray(value) { - return Object.prototype.toString.call(value) === '[object Array]'; - } - - // async calls - var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout; - var asyncQueue = []; - var asyncTimer; - - function asyncFlush(){ - // run promise callbacks - for (var i = 0; i < asyncQueue.length; i++) - { asyncQueue[i][0](asyncQueue[i][1]); } - - // reset async asyncQueue - asyncQueue = []; - asyncTimer = false; - } - - function asyncCall(callback, arg){ - asyncQueue.push([callback, arg]); - - if (!asyncTimer) - { - asyncTimer = true; - asyncSetTimer(asyncFlush, 0); - } - } - - - function invokeResolver(resolver, promise) { - function resolvePromise(value) { - resolve(promise, value); - } - - function rejectPromise(reason) { - reject(promise, reason); - } - - try { - resolver(resolvePromise, rejectPromise); - } catch(e) { - rejectPromise(e); - } - } - - function invokeCallback(subscriber){ - var owner = subscriber.owner; - var settled = owner.state_; - var value = owner.data_; - var callback = subscriber[settled]; - var promise = subscriber.then; - - if (typeof callback === 'function') - { - settled = FULFILLED; - try { - value = callback(value); - } catch(e) { - reject(promise, e); - } - } - - if (!handleThenable(promise, value)) - { - if (settled === FULFILLED) - { resolve(promise, value); } - - if (settled === REJECTED) - { reject(promise, value); } - } - } - - function handleThenable(promise, value) { - var resolved; - - try { - if (promise === value) - { throw new TypeError('A promises callback cannot return that same promise.'); } - - if (value && (typeof value === 'function' || typeof value === 'object')) - { - var then = value.then; // then should be retrived only once - - if (typeof then === 'function') - { - then.call(value, function(val){ - if (!resolved) - { - resolved = true; - - if (value !== val) - { resolve(promise, val); } - else - { fulfill(promise, val); } - } - }, function(reason){ - if (!resolved) - { - resolved = true; - - reject(promise, reason); - } - }); - - return true; - } - } - } catch (e) { - if (!resolved) - { reject(promise, e); } - - return true; - } - - return false; - } - - function resolve(promise, value){ - if (promise === value || !handleThenable(promise, value)) - { fulfill(promise, value); } - } - - function fulfill(promise, value){ - if (promise.state_ === PENDING) - { - promise.state_ = SEALED; - promise.data_ = value; - - asyncCall(publishFulfillment, promise); - } - } - - function reject(promise, reason){ - if (promise.state_ === PENDING) - { - promise.state_ = SEALED; - promise.data_ = reason; - - asyncCall(publishRejection, promise); - } - } - - function publish(promise) { - var callbacks = promise.then_; - promise.then_ = undefined; - - for (var i = 0; i < callbacks.length; i++) { - invokeCallback(callbacks[i]); - } - } - - function publishFulfillment(promise){ - promise.state_ = FULFILLED; - publish(promise); - } - - function publishRejection(promise){ - promise.state_ = REJECTED; - publish(promise); - } - - /** - * @class - */ - function Promise(resolver){ - if (typeof resolver !== 'function') - { throw new TypeError('Promise constructor takes a function argument'); } - - if (this instanceof Promise === false) - { throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); } - - this.then_ = []; - - invokeResolver(resolver, this); - } - - Promise.prototype = { - constructor: Promise, - - state_: PENDING, - then_: null, - data_: undefined, - - then: function(onFulfillment, onRejection){ - var subscriber = { - owner: this, - then: new this.constructor(NOOP), - fulfilled: onFulfillment, - rejected: onRejection - }; - - if (this.state_ === FULFILLED || this.state_ === REJECTED) - { - // already resolved, call callback async - asyncCall(invokeCallback, subscriber); - } - else - { - // subscribe - this.then_.push(subscriber); - } - - return subscriber.then; - }, - - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - - Promise.all = function(promises){ - var Class = this; - - if (!isArray(promises)) - { throw new TypeError('You must pass an array to Promise.all().'); } - - return new Class(function(resolve, reject){ - var results = []; - var remaining = 0; - - function resolver(index){ - remaining++; - return function(value){ - results[index] = value; - if (!--remaining) - { resolve(results); } - }; - } - - for (var i = 0, promise; i < promises.length; i++) - { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') - { promise.then(resolver(i), reject); } - else - { results[i] = promise; } - } - - if (!remaining) - { resolve(results); } - }); - }; - - Promise.race = function(promises){ - var Class = this; - - if (!isArray(promises)) - { throw new TypeError('You must pass an array to Promise.race().'); } - - return new Class(function(resolve, reject) { - for (var i = 0, promise; i < promises.length; i++) - { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') - { promise.then(resolve, reject); } - else - { resolve(promise); } - } - }); - }; - - Promise.resolve = function(value){ - var Class = this; - - if (value && typeof value === 'object' && value.constructor === Class) - { return value; } - - return new Class(function(resolve){ - resolve(value); - }); - }; - - Promise.reject = function(reason){ - var Class = this; - - return new Class(function(resolve, reject){ - reject(reason); - }); - }; - - })(typeof window != 'undefined' ? window : typeof commonjsGlobal != 'undefined' ? commonjsGlobal : typeof self != 'undefined' ? self : commonjsGlobal); - }); - var promise_1 = promise.Promise; - var promise_2 = promise.Polyfill; - - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - - 'use strict'; - /* eslint-disable no-unused-vars */ - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { - var arguments$1 = arguments; - - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments$1[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - - /*! - * @pixi/polyfill - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/polyfill is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - // Support for IE 9 - 11 which does not include Promises - if (!window.Promise) { - window.Promise = promise_2; - } - - // References: - if (!Object.assign) { - Object.assign = objectAssign; - } - - // References: - // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - // https://gist.github.com/1579671 - // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision - // https://gist.github.com/timhall/4078614 - // https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame - // Expected to be used with Browserfiy - // Browserify automatically detects the use of `global` and passes the - // correct reference of `global`, `self`, and finally `window` - var ONE_FRAME_TIME = 16; - // Date.now - if (!(Date.now && Date.prototype.getTime)) { - Date.now = function now() { - return new Date().getTime(); - }; - } - // performance.now - if (!(window.performance && window.performance.now)) { - var startTime_1 = Date.now(); - if (!window.performance) { - window.performance = {}; - } - window.performance.now = function () { return Date.now() - startTime_1; }; - } - // requestAnimationFrame - var lastTime = Date.now(); - var vendors = ['ms', 'moz', 'webkit', 'o']; - for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - var p = vendors[x]; - window.requestAnimationFrame = window[p + "RequestAnimationFrame"]; - window.cancelAnimationFrame = window[p + "CancelAnimationFrame"] - || window[p + "CancelRequestAnimationFrame"]; - } - if (!window.requestAnimationFrame) { - window.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') { - throw new TypeError(callback + "is not a function"); - } - var currentTime = Date.now(); - var delay = ONE_FRAME_TIME + lastTime - currentTime; - if (delay < 0) { - delay = 0; - } - lastTime = currentTime; - return window.setTimeout(function () { - lastTime = Date.now(); - callback(performance.now()); - }, delay); - }; - } - if (!window.cancelAnimationFrame) { - window.cancelAnimationFrame = function (id) { return clearTimeout(id); }; - } - - // References: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - if (!Math.sign) { - Math.sign = function mathSign(x) { - x = Number(x); - if (x === 0 || isNaN(x)) { - return x; - } - return x > 0 ? 1 : -1; - }; - } - - // References: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger - if (!Number.isInteger) { - Number.isInteger = function numberIsInteger(value) { - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; - }; - } - - if (!window.ArrayBuffer) { - window.ArrayBuffer = Array; - } - if (!window.Float32Array) { - window.Float32Array = Array; - } - if (!window.Uint32Array) { - window.Uint32Array = Array; - } - if (!window.Uint16Array) { - window.Uint16Array = Array; - } - if (!window.Uint8Array) { - window.Uint8Array = Array; - } - if (!window.Int32Array) { - window.Int32Array = Array; - } - - var appleIphone = /iPhone/i; - var appleIpod = /iPod/i; - var appleTablet = /iPad/i; - var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; - var androidPhone = /\bAndroid(?:.+)Mobile\b/i; - var androidTablet = /Android/i; - var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; - var amazonTablet = /Silk/i; - var windowsPhone = /Windows Phone/i; - var windowsTablet = /\bWindows(?:.+)ARM\b/i; - var otherBlackBerry = /BlackBerry/i; - var otherBlackBerry10 = /BB10/i; - var otherOpera = /Opera Mini/i; - var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; - var otherFirefox = /Mobile(?:.+)Firefox\b/i; - var isAppleTabletOnIos13 = function (navigator) { - return (typeof navigator !== 'undefined' && - navigator.platform === 'MacIntel' && - typeof navigator.maxTouchPoints === 'number' && - navigator.maxTouchPoints > 1 && - typeof MSStream === 'undefined'); - }; - function createMatch(userAgent) { - return function (regex) { return regex.test(userAgent); }; - } - function isMobile(param) { - var nav = { - userAgent: '', - platform: '', - maxTouchPoints: 0 - }; - if (!param && typeof navigator !== 'undefined') { - nav = { - userAgent: navigator.userAgent, - platform: navigator.platform, - maxTouchPoints: navigator.maxTouchPoints || 0 - }; - } - else if (typeof param === 'string') { - nav.userAgent = param; - } - else if (param && param.userAgent) { - nav = { - userAgent: param.userAgent, - platform: param.platform, - maxTouchPoints: param.maxTouchPoints || 0 - }; - } - var userAgent = nav.userAgent; - var tmp = userAgent.split('[FBAN'); - if (typeof tmp[1] !== 'undefined') { - userAgent = tmp[0]; - } - tmp = userAgent.split('Twitter'); - if (typeof tmp[1] !== 'undefined') { - userAgent = tmp[0]; - } - var match = createMatch(userAgent); - var result = { - apple: { - phone: match(appleIphone) && !match(windowsPhone), - ipod: match(appleIpod), - tablet: !match(appleIphone) && - (match(appleTablet) || isAppleTabletOnIos13(nav)) && - !match(windowsPhone), - universal: match(appleUniversal), - device: (match(appleIphone) || - match(appleIpod) || - match(appleTablet) || - match(appleUniversal) || - isAppleTabletOnIos13(nav)) && - !match(windowsPhone) - }, - amazon: { - phone: match(amazonPhone), - tablet: !match(amazonPhone) && match(amazonTablet), - device: match(amazonPhone) || match(amazonTablet) - }, - android: { - phone: (!match(windowsPhone) && match(amazonPhone)) || - (!match(windowsPhone) && match(androidPhone)), - tablet: !match(windowsPhone) && - !match(amazonPhone) && - !match(androidPhone) && - (match(amazonTablet) || match(androidTablet)), - device: (!match(windowsPhone) && - (match(amazonPhone) || - match(amazonTablet) || - match(androidPhone) || - match(androidTablet))) || - match(/\bokhttp\b/i) - }, - windows: { - phone: match(windowsPhone), - tablet: match(windowsTablet), - device: match(windowsPhone) || match(windowsTablet) - }, - other: { - blackberry: match(otherBlackBerry), - blackberry10: match(otherBlackBerry10), - opera: match(otherOpera), - firefox: match(otherFirefox), - chrome: match(otherChrome), - device: match(otherBlackBerry) || - match(otherBlackBerry10) || - match(otherOpera) || - match(otherFirefox) || - match(otherChrome) - }, - any: false, - phone: false, - tablet: false - }; - result.any = - result.apple.device || - result.android.device || - result.windows.device || - result.other.device; - result.phone = - result.apple.phone || result.android.phone || result.windows.phone; - result.tablet = - result.apple.tablet || result.android.tablet || result.windows.tablet; - return result; - } - - /*! - * @pixi/settings - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/settings is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - // The ESM/CJS versions of ismobilejs only - var isMobile$1 = isMobile(window.navigator); - - /** - * The maximum recommended texture units to use. - * In theory the bigger the better, and for desktop we'll use as many as we can. - * But some mobile devices slow down if there is to many branches in the shader. - * So in practice there seems to be a sweet spot size that varies depending on the device. - * - * In v4, all mobile devices were limited to 4 texture units because for this. - * In v5, we allow all texture units to be used on modern Apple or Android devices. - * - * @private - * @param {number} max - * @returns {number} - */ - function maxRecommendedTextures(max) { - var allowMax = true; - if (isMobile$1.tablet || isMobile$1.phone) { - if (isMobile$1.apple.device) { - var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); - if (match) { - var majorVersion = parseInt(match[1], 10); - // Limit texture units on devices below iOS 11, which will be older hardware - if (majorVersion < 11) { - allowMax = false; - } - } - } - if (isMobile$1.android.device) { - var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); - if (match) { - var majorVersion = parseInt(match[1], 10); - // Limit texture units on devices below Android 7 (Nougat), which will be older hardware - if (majorVersion < 7) { - allowMax = false; - } - } - } - } - return allowMax ? max : 4; - } - - /** - * Uploading the same buffer multiple times in a single frame can cause performance issues. - * Apparent on iOS so only check for that at the moment - * This check may become more complex if this issue pops up elsewhere. - * - * @private - * @returns {boolean} - */ - function canUploadSameBuffer() { - return !isMobile$1.apple.device; - } - - /** - * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float precision, etc. - * @example - * // Use the native window resolution as the default resolution - * // will support high-density displays when rendering - * PIXI.settings.RESOLUTION = window.devicePixelRatio; - * - * // Disable interpolation when scaling, will make texture be pixelated - * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; - * @namespace PIXI.settings - */ - var settings = { - /** - * If set to true WebGL will attempt make textures mimpaped by default. - * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. - * - * @static - * @name MIPMAP_TEXTURES - * @memberof PIXI.settings - * @type {PIXI.MIPMAP_MODES} - * @default PIXI.MIPMAP_MODES.POW2 - */ - MIPMAP_TEXTURES: 1, - /** - * Default anisotropic filtering level of textures. - * Usually from 0 to 16 - * - * @static - * @name ANISOTROPIC_LEVEL - * @memberof PIXI.settings - * @type {number} - * @default 0 - */ - ANISOTROPIC_LEVEL: 0, - /** - * Default resolution / device pixel ratio of the renderer. - * - * @static - * @name RESOLUTION - * @memberof PIXI.settings - * @type {number} - * @default 1 - */ - RESOLUTION: 1, - /** - * Default filter resolution. - * - * @static - * @name FILTER_RESOLUTION - * @memberof PIXI.settings - * @type {number} - * @default 1 - */ - FILTER_RESOLUTION: 1, - /** - * The maximum textures that this device supports. - * - * @static - * @name SPRITE_MAX_TEXTURES - * @memberof PIXI.settings - * @type {number} - * @default 32 - */ - SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), - // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 - // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - /** - * The default sprite batch size. - * - * The default aims to balance desktop and mobile devices. - * - * @static - * @name SPRITE_BATCH_SIZE - * @memberof PIXI.settings - * @type {number} - * @default 4096 - */ - SPRITE_BATCH_SIZE: 4096, - /** - * The default render options if none are supplied to {@link PIXI.Renderer} - * or {@link PIXI.CanvasRenderer}. - * - * @static - * @name RENDER_OPTIONS - * @memberof PIXI.settings - * @type {object} - * @property {HTMLCanvasElement} view=null - * @property {number} resolution=1 - * @property {boolean} antialias=false - * @property {boolean} autoDensity=false - * @property {boolean} transparent=false - * @property {number} backgroundColor=0x000000 - * @property {boolean} clearBeforeRender=true - * @property {boolean} preserveDrawingBuffer=false - * @property {number} width=800 - * @property {number} height=600 - * @property {boolean} legacy=false - */ - RENDER_OPTIONS: { - view: null, - antialias: false, - autoDensity: false, - transparent: false, - backgroundColor: 0x000000, - clearBeforeRender: true, - preserveDrawingBuffer: false, - width: 800, - height: 600, - legacy: false, - }, - /** - * Default Garbage Collection mode. - * - * @static - * @name GC_MODE - * @memberof PIXI.settings - * @type {PIXI.GC_MODES} - * @default PIXI.GC_MODES.AUTO - */ - GC_MODE: 0, - /** - * Default Garbage Collection max idle. - * - * @static - * @name GC_MAX_IDLE - * @memberof PIXI.settings - * @type {number} - * @default 3600 - */ - GC_MAX_IDLE: 60 * 60, - /** - * Default Garbage Collection maximum check count. - * - * @static - * @name GC_MAX_CHECK_COUNT - * @memberof PIXI.settings - * @type {number} - * @default 600 - */ - GC_MAX_CHECK_COUNT: 60 * 10, - /** - * Default wrap modes that are supported by pixi. - * - * @static - * @name WRAP_MODE - * @memberof PIXI.settings - * @type {PIXI.WRAP_MODES} - * @default PIXI.WRAP_MODES.CLAMP - */ - WRAP_MODE: 33071, - /** - * Default scale mode for textures. - * - * @static - * @name SCALE_MODE - * @memberof PIXI.settings - * @type {PIXI.SCALE_MODES} - * @default PIXI.SCALE_MODES.LINEAR - */ - SCALE_MODE: 1, - /** - * Default specify float precision in vertex shader. - * - * @static - * @name PRECISION_VERTEX - * @memberof PIXI.settings - * @type {PIXI.PRECISION} - * @default PIXI.PRECISION.HIGH - */ - PRECISION_VERTEX: 'highp', - /** - * Default specify float precision in fragment shader. - * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 - * - * @static - * @name PRECISION_FRAGMENT - * @memberof PIXI.settings - * @type {PIXI.PRECISION} - * @default PIXI.PRECISION.MEDIUM - */ - PRECISION_FRAGMENT: isMobile$1.apple.device ? 'highp' : 'mediump', - /** - * Can we upload the same buffer in a single frame? - * - * @static - * @name CAN_UPLOAD_SAME_BUFFER - * @memberof PIXI.settings - * @type {boolean} - */ - CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), - /** - * Enables bitmap creation before image load. This feature is experimental. - * - * @static - * @name CREATE_IMAGE_BITMAP - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - CREATE_IMAGE_BITMAP: false, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * - * @static - * @constant - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - ROUND_PIXELS: false, - }; - - var eventemitter3 = createCommonjsModule(function (module) { - 'use strict'; - - var has = Object.prototype.hasOwnProperty - , prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) { prefix = false; } - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) { emitter._events[evt] = listener, emitter._eventsCount++; } - else if (!emitter._events[evt].fn) { emitter._events[evt].push(listener); } - else { emitter._events[evt] = [emitter._events[evt], listener]; } - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) { emitter._events = new Events(); } - else { delete emitter._events[evt]; } - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) { return names; } - - for (name in (events = this._events)) { - if (has.call(events, name)) { names.push(prefix ? name.slice(1) : name); } - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) { return []; } - if (handlers.fn) { return [handlers.fn]; } - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) { return 0; } - if (listeners.fn) { return 1; } - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var arguments$1 = arguments; - - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) { return false; } - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) { this.removeListener(event, listeners.fn, undefined, true); } - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments$1[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) { this.removeListener(event, listeners[i].fn, undefined, true); } - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) { for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments$1[j]; - } } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) { return this; } - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) { this._events[evt] = events.length === 1 ? events[0] : events; } - else { clearEvent(this, evt); } - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) { clearEvent(this, evt); } - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - if ('undefined' !== 'object') { - module.exports = EventEmitter; - } - }); - - 'use strict'; - - var earcut_1 = earcut; - var default_1 = earcut; - - function earcut(data, holeIndices, dim) { - - dim = dim || 2; - - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; - - if (!outerNode || outerNode.next === outerNode.prev) { return triangles; } - - var minX, minY, maxX, maxY, x, y, invSize; - - if (hasHoles) { outerNode = eliminateHoles(data, holeIndices, outerNode, dim); } - - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) { minX = x; } - if (y < minY) { minY = y; } - if (x > maxX) { maxX = x; } - if (y > maxY) { maxY = y; } - } - - // minX, minY and invSize are later used to transform coords into integers for z-order calculation - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 1 / invSize : 0; - } - - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); - - return triangles; - } - - // create a circular doubly linked list from polygon points in the specified winding order - function linkedList(data, start, end, dim, clockwise) { - var i, last; - - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) { last = insertNode(i, data[i], data[i + 1], last); } - } else { - for (i = end - dim; i >= start; i -= dim) { last = insertNode(i, data[i], data[i + 1], last); } - } - - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - - return last; - } - - // eliminate colinear or duplicate points - function filterPoints(start, end) { - if (!start) { return start; } - if (!end) { end = start; } - - var p = start, - again; - do { - again = false; - - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) { break; } - again = true; - - } else { - p = p.next; - } - } while (again || p !== end); - - return end; - } - - // main ear slicing loop which triangulates a polygon (given as a linked list) - function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) { return; } - - // interlink polygon nodes in z-order - if (!pass && invSize) { indexCurve(ear, minX, minY, invSize); } - - var stop = ear, - prev, next; - - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); - - removeNode(ear); - - // skipping the next vertex leads to less sliver triangles - ear = next.next; - stop = next.next; - - continue; - } - - ear = next; - - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } - - break; - } - } - } - - // check whether a polygon node forms a valid ear with adjacent nodes - function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear - - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; - - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.next; - } - - return true; - } - - function isEarHashed(ear, minX, minY, invSize) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear - - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); - - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - - var p = ear.prevZ, - n = ear.nextZ; - - // look for points inside the triangle in both directions - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.prevZ; - - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) { return false; } - n = n.nextZ; - } - - // look for remaining points in decreasing z-order - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.prevZ; - } - - // look for remaining points in increasing z-order - while (n && n.z <= maxZ) { - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) { return false; } - n = n.nextZ; - } - - return true; - } - - // go through all polygon nodes and cure small local self-intersections - function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; - - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); - - // remove two nodes involved - removeNode(p); - removeNode(p.next); - - p = start = b; - } - p = p.next; - } while (p !== start); - - return filterPoints(p); - } - - // try splitting polygon into two and triangulate them independently - function splitEarcut(start, triangles, dim, minX, minY, invSize) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); - - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, invSize); - earcutLinked(c, triangles, dim, minX, minY, invSize); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); - } - - // link every hole into the outer loop, producing a single-ring polygon without holes - function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) { list.steiner = true; } - queue.push(getLeftmost(list)); - } - - queue.sort(compareX); - - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } - - return outerNode; - } - - function compareX(a, b) { - return a.x - b.x; - } - - // find a bridge between vertices that connects hole with an outer ring and and link it - function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - - // filter collinear points around the cuts - filterPoints(outerNode, outerNode.next); - filterPoints(b, b.next); - } - } - - // David Eberly's algorithm for finding a bridge between hole and outer polygon - function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; - - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) { return p; } - if (hy === p.next.y) { return p.next; } - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); - - if (!m) { return null; } - - if (hx === qx) { return m; } // hole touches outer segment; pick leftmost endpoint - - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; - - p = m; - - do { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - - if (locallyInside(p, hole) && - (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { - m = p; - tanMin = tan; - } - } - - p = p.next; - } while (p !== stop); - - return m; - } - - // whether sector in vertex m contains sector in vertex p in the same coordinates - function sectorContainsSector(m, p) { - return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; - } - - // interlink polygon nodes in z-order - function indexCurve(start, minX, minY, invSize) { - var p = start; - do { - if (p.z === null) { p.z = zOrder(p.x, p.y, minX, minY, invSize); } - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - - p.prevZ.nextZ = null; - p.prevZ = null; - - sortLinked(p); - } - - // Simon Tatham's linked list merge sort algorithm - // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html - function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; - - do { - p = list; - list = null; - tail = null; - numMerges = 0; - - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) { break; } - } - qSize = inSize; - - while (pSize > 0 || (qSize > 0 && q)) { - - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - - if (tail) { tail.nextZ = e; } - else { list = e; } - - e.prevZ = tail; - tail = e; - } - - p = q; - } - - tail.nextZ = null; - inSize *= 2; - - } while (numMerges > 1); - - return list; - } - - // z-order of a point given coords and inverse of the longer side of data bbox - function zOrder(x, y, minX, minY, invSize) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) * invSize; - y = 32767 * (y - minY) * invSize; - - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; - - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; - - return x | (y << 1); - } - - // find the leftmost node of a polygon ring - function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) { leftmost = p; } - p = p.next; - } while (p !== start); - - return leftmost; - } - - // check if a point lies within a convex triangle - function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; - } - - // check if a diagonal between two polygon nodes is valid (lies in polygon interior) - function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges - (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible - (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors - equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case - } - - // signed area of a triangle - function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); - } - - // check if two points are equal - function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; - } - - // check if two segments intersect - function intersects(p1, q1, p2, q2) { - var o1 = sign(area(p1, q1, p2)); - var o2 = sign(area(p1, q1, q2)); - var o3 = sign(area(p2, q2, p1)); - var o4 = sign(area(p2, q2, q1)); - - if (o1 !== o2 && o3 !== o4) { return true; } // general case - - if (o1 === 0 && onSegment(p1, p2, q1)) { return true; } // p1, q1 and p2 are collinear and p2 lies on p1q1 - if (o2 === 0 && onSegment(p1, q2, q1)) { return true; } // p1, q1 and q2 are collinear and q2 lies on p1q1 - if (o3 === 0 && onSegment(p2, p1, q2)) { return true; } // p2, q2 and p1 are collinear and p1 lies on p2q2 - if (o4 === 0 && onSegment(p2, q1, q2)) { return true; } // p2, q2 and q1 are collinear and q1 lies on p2q2 - - return false; - } - - // for collinear points p, q, r, check if point q lies on segment pr - function onSegment(p, q, r) { - return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); - } - - function sign(num) { - return num > 0 ? 1 : num < 0 ? -1 : 0; - } - - // check if a polygon diagonal intersects any polygon segments - function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) { return true; } - p = p.next; - } while (p !== a); - - return false; - } - - // check if a polygon diagonal is locally inside the polygon - function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; - } - - // check if the middle point of a polygon diagonal is inside the polygon - function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - { inside = !inside; } - p = p.next; - } while (p !== a); - - return inside; - } - - // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; - // if one belongs to the outer ring and another to a hole, it merges it into a single ring - function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; - - a.next = b; - b.prev = a; - - a2.next = an; - an.prev = a2; - - b2.next = a2; - a2.prev = b2; - - bp.next = b2; - b2.prev = bp; - - return b2; - } - - // create a node and optionally link it with previous one (in a circular doubly linked list) - function insertNode(i, x, y, last) { - var p = new Node(i, x, y); - - if (!last) { - p.prev = p; - p.next = p; - - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; - } - - function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - - if (p.prevZ) { p.prevZ.nextZ = p.nextZ; } - if (p.nextZ) { p.nextZ.prevZ = p.prevZ; } - } - - function Node(i, x, y) { - // vertex index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertex nodes in a polygon ring - this.prev = null; - this.next = null; - - // z-order curve value - this.z = null; - - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; - - // indicates whether this is a steiner point - this.steiner = false; - } - - // return a percentage difference between the polygon area and its triangulation area; - // used to verify correctness of triangulation - earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; - - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } - - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } - - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); - }; - - function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; - } - - // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts - earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; - - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) { result.vertices.push(data[i][j][d]); } - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - return result; - }; - earcut_1.default = default_1; - - var punycode = createCommonjsModule(function (module, exports) { - /*! https://mths.be/punycode v1.3.2 by @mathias */ - ;(function(root) { - - /** Detect free variables */ - var freeExports = 'object' == 'object' && exports && - !exports.nodeType && exports; - var freeModule = 'object' == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * http://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.3.2', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof undefined == 'function' && - typeof undefined.amd == 'object' && - undefined.amd - ) { - undefined('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { // in Rhino or a web browser - root.punycode = punycode; - } - - }(commonjsGlobal)); - }); - - 'use strict'; - - var util = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } - }; - var util_1 = util.isString; - var util_2 = util.isObject; - var util_3 = util.isNull; - var util_4 = util.isNullOrUndefined; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - // If obj.hasOwnProperty has been overridden, then calling - // obj.hasOwnProperty(prop) will break. - // See: https://github.com/joyent/node/issues/1707 - function hasOwnProperty$1(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - - var decode = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty$1(obj, k)) { - obj[k] = v; - } else if (Array.isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; - }; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } - }; - - var encode = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return Object.keys(obj).map(function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (Array.isArray(obj[k])) { - return obj[k].map(function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) { return ''; } - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); - }; - - var querystring = createCommonjsModule(function (module, exports) { - 'use strict'; - - exports.decode = exports.parse = decode; - exports.encode = exports.stringify = encode; - }); - var querystring_1 = querystring.decode; - var querystring_2 = querystring.parse; - var querystring_3 = querystring.encode; - var querystring_4 = querystring.stringify; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - - - - var parse = urlParse; - var resolve = urlResolve; - var resolveObject = urlResolveObject; - var format = urlFormat; - - var Url_1 = Url; - - function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; - } - - // Reference: RFC 3986, RFC 1808, RFC 2396 - - // define these here so at least they only have to be - // compiled once on the first module load. - var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }; - - function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) { return url; } - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; - } - - Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - { hostEnd = hec; } - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - { hostEnd = hec; } - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - { hostEnd = rest.length; } - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) { continue; } - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - { continue; } - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) { this.pathname = rest; } - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; - }; - - // format a parsed object into a url string - function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) { obj = urlParse(obj); } - if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); } - return obj.format(); - } - - Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; } - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; } - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; } - if (search && search.charAt(0) !== '?') { search = '?' + search; } - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; - }; - - function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); - } - - Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); - }; - - function urlResolveObject(source, relative) { - if (!source) { return relative; } - return urlParse(source, false, true).resolveObject(relative); - } - - Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - { result[rkey] = relative[rkey]; } - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())){ ; } - if (!relative.host) { relative.host = ''; } - if (!relative.hostname) { relative.hostname = ''; } - if (relPath[0] !== '') { relPath.unshift(''); } - if (relPath.length < 2) { relPath.unshift(''); } - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') { srcPath[0] = result.host; } - else { srcPath.unshift(result.host); } - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') { relPath[0] = relative.host; } - else { relPath.unshift(relative.host); } - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) { srcPath = []; } - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - }; - - Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) { this.hostname = host; } - }; - - var url = { - parse: parse, - resolve: resolve, - resolveObject: resolveObject, - format: format, - Url: Url_1 - }; - - /*! - * @pixi/constants - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/constants is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * Different types of environments for WebGL. - * - * @static - * @memberof PIXI - * @name ENV - * @enum {number} - * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experience unexplained flickering prefer this environment. - * @property {number} WEBGL - Version 1 of WebGL - * @property {number} WEBGL2 - Version 2 of WebGL - */ - - (function (ENV) { - ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; - ENV[ENV["WEBGL"] = 1] = "WEBGL"; - ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; - })(exports.ENV || (exports.ENV = {})); - /** - * Constant to identify the Renderer Type. - * - * @static - * @memberof PIXI - * @name RENDERER_TYPE - * @enum {number} - * @property {number} UNKNOWN - Unknown render type. - * @property {number} WEBGL - WebGL render type. - * @property {number} CANVAS - Canvas render type. - */ - - (function (RENDERER_TYPE) { - RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; - RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; - RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; - })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {})); - /** - * Bitwise OR of masks that indicate the buffers to be cleared. - * - * @static - * @memberof PIXI - * @name BUFFER_BITS - * @enum {number} - * @property {number} COLOR - Indicates the buffers currently enabled for color writing. - * @property {number} DEPTH - Indicates the depth buffer. - * @property {number} STENCIL - Indicates the stencil buffer. - */ - - (function (BUFFER_BITS) { - BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; - BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; - BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; - })(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); - /** - * Various blend modes supported by PIXI. - * - * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. - * Anything else will silently act like NORMAL. - * - * @memberof PIXI - * @name BLEND_MODES - * @enum {number} - * @property {number} NORMAL - * @property {number} ADD - * @property {number} MULTIPLY - * @property {number} SCREEN - * @property {number} OVERLAY - * @property {number} DARKEN - * @property {number} LIGHTEN - * @property {number} COLOR_DODGE - * @property {number} COLOR_BURN - * @property {number} HARD_LIGHT - * @property {number} SOFT_LIGHT - * @property {number} DIFFERENCE - * @property {number} EXCLUSION - * @property {number} HUE - * @property {number} SATURATION - * @property {number} COLOR - * @property {number} LUMINOSITY - * @property {number} NORMAL_NPM - * @property {number} ADD_NPM - * @property {number} SCREEN_NPM - * @property {number} NONE - * @property {number} SRC_IN - * @property {number} SRC_OUT - * @property {number} SRC_ATOP - * @property {number} DST_OVER - * @property {number} DST_IN - * @property {number} DST_OUT - * @property {number} DST_ATOP - * @property {number} SUBTRACT - * @property {number} SRC_OVER - * @property {number} ERASE - * @property {number} XOR - */ - - (function (BLEND_MODES) { - BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; - BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; - BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; - BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; - BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; - BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; - BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; - BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; - BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; - BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; - BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; - BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; - BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; - BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; - BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; - BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; - BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; - BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; - BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; - BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; - BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; - BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; - BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; - BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; - BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; - BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; - BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; - BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; - BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; - BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; - BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; - BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; - })(exports.BLEND_MODES || (exports.BLEND_MODES = {})); - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @memberof PIXI - * @static - * @name DRAW_MODES - * @enum {number} - * @property {number} POINTS - * @property {number} LINES - * @property {number} LINE_LOOP - * @property {number} LINE_STRIP - * @property {number} TRIANGLES - * @property {number} TRIANGLE_STRIP - * @property {number} TRIANGLE_FAN - */ - - (function (DRAW_MODES) { - DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; - DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; - DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; - DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; - DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; - })(exports.DRAW_MODES || (exports.DRAW_MODES = {})); - /** - * Various GL texture/resources formats. - * - * @memberof PIXI - * @static - * @name FORMATS - * @enum {number} - * @property {number} RGBA=6408 - * @property {number} RGB=6407 - * @property {number} ALPHA=6406 - * @property {number} LUMINANCE=6409 - * @property {number} LUMINANCE_ALPHA=6410 - * @property {number} DEPTH_COMPONENT=6402 - * @property {number} DEPTH_STENCIL=34041 - */ - - (function (FORMATS) { - FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; - FORMATS[FORMATS["RGB"] = 6407] = "RGB"; - FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; - FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; - FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; - FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; - FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; - })(exports.FORMATS || (exports.FORMATS = {})); - /** - * Various GL target types. - * - * @memberof PIXI - * @static - * @name TARGETS - * @enum {number} - * @property {number} TEXTURE_2D=3553 - * @property {number} TEXTURE_CUBE_MAP=34067 - * @property {number} TEXTURE_2D_ARRAY=35866 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 - */ - - (function (TARGETS) { - TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; - TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; - })(exports.TARGETS || (exports.TARGETS = {})); - /** - * Various GL data format types. - * - * @memberof PIXI - * @static - * @name TYPES - * @enum {number} - * @property {number} UNSIGNED_BYTE=5121 - * @property {number} UNSIGNED_SHORT=5123 - * @property {number} UNSIGNED_SHORT_5_6_5=33635 - * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 - * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 - * @property {number} FLOAT=5126 - * @property {number} HALF_FLOAT=36193 - */ - - (function (TYPES) { - TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; - TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; - TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; - TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; - TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; - TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; - TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; - })(exports.TYPES || (exports.TYPES = {})); - /** - * The scale modes that are supported by pixi. - * - * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @memberof PIXI - * @static - * @name SCALE_MODES - * @enum {number} - * @property {number} LINEAR Smooth scaling - * @property {number} NEAREST Pixelating scaling - */ - - (function (SCALE_MODES) { - SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; - SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; - })(exports.SCALE_MODES || (exports.SCALE_MODES = {})); - /** - * The wrap modes that are supported by pixi. - * - * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as WebGL can - * only use REPEAT if the texture is po2. - * - * This property only affects WebGL. - * - * @name WRAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} CLAMP - The textures uvs are clamped - * @property {number} REPEAT - The texture uvs tile and repeat - * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring - */ - - (function (WRAP_MODES) { - WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; - WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; - WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; - })(exports.WRAP_MODES || (exports.WRAP_MODES = {})); - /** - * Mipmap filtering modes that are supported by pixi. - * - * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. - * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, - * or its `POW2` and texture dimensions are powers of 2. - * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. - * - * This property only affects WebGL. - * - * @name MIPMAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} OFF - No mipmaps - * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 - * @property {number} ON - Always generate mipmaps - */ - - (function (MIPMAP_MODES) { - MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; - MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; - MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; - })(exports.MIPMAP_MODES || (exports.MIPMAP_MODES = {})); - /** - * How to treat textures with premultiplied alpha - * - * @name ALPHA_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. - * Option for compressed and data textures that are created from typed arrays. - * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. - * Default option, used for all loaded images. - * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied - * Example: spine atlases with `_pma` suffix. - * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. - * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. - * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. - */ - - (function (ALPHA_MODES) { - ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; - ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; - ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; - ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; - })(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); - /** - * How to clear renderTextures in filter - * - * @name CLEAR_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} BLEND - Preserve the information in the texture, blend above - * @property {number} CLEAR - Must use `gl.clear` operation - * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia - * @property {number} NO - Alias for BLEND, same as `false` in earlier versions - * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions - * @property {number} AUTO - Alias for BLIT - */ - - (function (CLEAR_MODES) { - CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; - CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; - CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; - CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; - CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; - CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; - })(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); - /** - * The gc modes that are supported by pixi. - * - * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO - * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not - * used for a specified period of time they will be removed from the GPU. They will of course - * be uploaded again when they are required. This is a silent behind the scenes process that - * should ensure that the GPU does not get filled up. - * - * Handy for mobile devices! - * This property only affects WebGL. - * - * @name GC_MODES - * @enum {number} - * @static - * @memberof PIXI - * @property {number} AUTO - Garbage collection will happen periodically automatically - * @property {number} MANUAL - Garbage collection will need to be called manually - */ - - (function (GC_MODES) { - GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; - GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; - })(exports.GC_MODES || (exports.GC_MODES = {})); - /** - * Constants that specify float precision in shaders. - * - * @name PRECISION - * @memberof PIXI - * @constant - * @static - * @enum {string} - * @property {string} LOW='lowp' - * @property {string} MEDIUM='mediump' - * @property {string} HIGH='highp' - */ - - (function (PRECISION) { - PRECISION["LOW"] = "lowp"; - PRECISION["MEDIUM"] = "mediump"; - PRECISION["HIGH"] = "highp"; - })(exports.PRECISION || (exports.PRECISION = {})); - /** - * Constants for mask implementations. - * We use `type` suffix because it leads to very different behaviours - * - * @name MASK_TYPES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - Mask is ignored - * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap - * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil - * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture - */ - - (function (MASK_TYPES) { - MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; - MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; - MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; - MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; - })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); - /** - * Constants for multi-sampling antialiasing. - * - * @see PIXI.Framebuffer#multisample - * - * @name MSAA_QUALITY - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - No multisampling for this renderTexture - * @property {number} LOW - Try 2 samples - * @property {number} MEDIUM - Try 4 samples - * @property {number} HIGH - Try 8 samples - */ - - (function (MSAA_QUALITY) { - MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; - MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; - MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; - MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; - })(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); - - /*! - * @pixi/utils - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/utils is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The prefix that denotes a URL is for a retina asset. - * - * @static - * @name RETINA_PREFIX - * @memberof PIXI.settings - * @type {RegExp} - * @default /@([0-9\.]+)x/ - * @example `@2x` - */ - settings.RETINA_PREFIX = /@([0-9\.]+)x/; - /** - * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. - * For most scenarios this should be left as true, as otherwise the user may have a poor experience. - * However, it can be useful to disable under certain scenarios, such as headless unit tests. - * - * @static - * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT - * @memberof PIXI.settings - * @type {boolean} - * @default true - */ - settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true; - - var saidHello = false; - var VERSION = '5.3.8'; - /** - * Skips the hello message of renderers that are created after this is run. - * - * @function skipHello - * @memberof PIXI.utils - */ - function skipHello() { - saidHello = true; - } - /** - * Logs out the version and renderer information for this running instance of PIXI. - * If you don't want to see this message you can run `PIXI.utils.skipHello()` before - * creating your renderer. Keep in mind that doing that will forever make you a jerk face. - * - * @static - * @function sayHello - * @memberof PIXI.utils - * @param {string} type - The string renderer type to log. - */ - function sayHello(type) { - var _a; - if (saidHello) { - return; - } - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { - var args = [ - "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", - 'background: #ff66a5; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff66a5; background: #030307; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'background: #ffc3dc; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;' ]; - (_a = window.console).log.apply(_a, args); - } - else if (window.console) { - window.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); - } - saidHello = true; - } - - var supported; - /** - * Helper for checking for WebGL support. - * - * @memberof PIXI.utils - * @function isWebGLSupported - * @return {boolean} Is WebGL supported. - */ - function isWebGLSupported() { - if (typeof supported === 'undefined') { - supported = (function supported() { - var contextOptions = { - stencil: true, - failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, - }; - try { - if (!window.WebGLRenderingContext) { - return false; - } - var canvas = document.createElement('canvas'); - var gl = (canvas.getContext('webgl', contextOptions) - || canvas.getContext('experimental-webgl', contextOptions)); - var success = !!(gl && gl.getContextAttributes().stencil); - if (gl) { - var loseContext = gl.getExtension('WEBGL_lose_context'); - if (loseContext) { - loseContext.loseContext(); - } - } - gl = null; - return success; - } - catch (e) { - return false; - } - })(); - } - return supported; - } - - /** - * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). - * - * @example - * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] - * @memberof PIXI.utils - * @function hex2rgb - * @param {number} hex - The hexadecimal number to convert - * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one - * @return {number[]} An array representing the [R, G, B] of the color where all values are floats. - */ - function hex2rgb(hex, out) { - if (out === void 0) { out = []; } - out[0] = ((hex >> 16) & 0xFF) / 255; - out[1] = ((hex >> 8) & 0xFF) / 255; - out[2] = (hex & 0xFF) / 255; - return out; - } - /** - * Converts a hexadecimal color number to a string. - * - * @example - * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" - * @memberof PIXI.utils - * @function hex2string - * @param {number} hex - Number in hex (e.g., `0xffffff`) - * @return {string} The string color (e.g., `"#ffffff"`). - */ - function hex2string(hex) { - var hexString = hex.toString(16); - hexString = '000000'.substr(0, 6 - hexString.length) + hexString; - return "#" + hexString; - } - /** - * Converts a hexadecimal string to a hexadecimal color number. - * - * @example - * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff - * @memberof PIXI.utils - * @function string2hex - * @param {string} string - The string color (e.g., `"#ffffff"`) - * @return {number} Number in hexadecimal. - */ - function string2hex(string) { - if (typeof string === 'string' && string[0] === '#') { - string = string.substr(1); - } - return parseInt(string, 16); - } - /** - * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. - * - * @example - * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff - * @memberof PIXI.utils - * @function rgb2hex - * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. - * @return {number} Number in hexadecimal. - */ - function rgb2hex(rgb) { - return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); - } - - /** - * Corrects PixiJS blend, takes premultiplied alpha into account - * - * @memberof PIXI.utils - * @function mapPremultipliedBlendModes - * @private - * @return {Array} Mapped modes. - */ - function mapPremultipliedBlendModes() { - var pm = []; - var npm = []; - for (var i = 0; i < 32; i++) { - pm[i] = i; - npm[i] = i; - } - pm[exports.BLEND_MODES.NORMAL_NPM] = exports.BLEND_MODES.NORMAL; - pm[exports.BLEND_MODES.ADD_NPM] = exports.BLEND_MODES.ADD; - pm[exports.BLEND_MODES.SCREEN_NPM] = exports.BLEND_MODES.SCREEN; - npm[exports.BLEND_MODES.NORMAL] = exports.BLEND_MODES.NORMAL_NPM; - npm[exports.BLEND_MODES.ADD] = exports.BLEND_MODES.ADD_NPM; - npm[exports.BLEND_MODES.SCREEN] = exports.BLEND_MODES.SCREEN_NPM; - var array = []; - array.push(npm); - array.push(pm); - return array; - } - /** - * maps premultiply flag and blendMode to adjusted blendMode - * @memberof PIXI.utils - * @const premultiplyBlendMode - * @type {Array} - */ - var premultiplyBlendMode = mapPremultipliedBlendModes(); - /** - * changes blendMode according to texture format - * - * @memberof PIXI.utils - * @function correctBlendMode - * @param {number} blendMode - supposed blend mode - * @param {boolean} premultiplied - whether source is premultiplied - * @returns {number} true blend mode for this texture - */ - function correctBlendMode(blendMode, premultiplied) { - return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; - } - /** - * combines rgb and alpha to out array - * - * @memberof PIXI.utils - * @function premultiplyRgba - * @param {Float32Array|number[]} rgb - input rgb - * @param {number} alpha - alpha param - * @param {Float32Array} [out] - output - * @param {boolean} [premultiply=true] - do premultiply it - * @returns {Float32Array} vec4 rgba - */ - function premultiplyRgba(rgb, alpha, out, premultiply) { - out = out || new Float32Array(4); - if (premultiply || premultiply === undefined) { - out[0] = rgb[0] * alpha; - out[1] = rgb[1] * alpha; - out[2] = rgb[2] * alpha; - } - else { - out[0] = rgb[0]; - out[1] = rgb[1]; - out[2] = rgb[2]; - } - out[3] = alpha; - return out; - } - /** - * premultiplies tint - * - * @memberof PIXI.utils - * @function premultiplyTint - * @param {number} tint - integer RGB - * @param {number} alpha - floating point alpha (0.0-1.0) - * @returns {number} tint multiplied by alpha - */ - function premultiplyTint(tint, alpha) { - if (alpha === 1.0) { - return (alpha * 255 << 24) + tint; - } - if (alpha === 0.0) { - return 0; - } - var R = ((tint >> 16) & 0xFF); - var G = ((tint >> 8) & 0xFF); - var B = (tint & 0xFF); - R = ((R * alpha) + 0.5) | 0; - G = ((G * alpha) + 0.5) | 0; - B = ((B * alpha) + 0.5) | 0; - return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; - } - /** - * converts integer tint and float alpha to vec4 form, premultiplies by default - * - * @memberof PIXI.utils - * @function premultiplyTintToRgba - * @param {number} tint - input tint - * @param {number} alpha - alpha param - * @param {Float32Array} [out] output - * @param {boolean} [premultiply=true] - do premultiply it - * @returns {Float32Array} vec4 rgba - */ - function premultiplyTintToRgba(tint, alpha, out, premultiply) { - out = out || new Float32Array(4); - out[0] = ((tint >> 16) & 0xFF) / 255.0; - out[1] = ((tint >> 8) & 0xFF) / 255.0; - out[2] = (tint & 0xFF) / 255.0; - if (premultiply || premultiply === undefined) { - out[0] *= alpha; - out[1] *= alpha; - out[2] *= alpha; - } - out[3] = alpha; - return out; - } - - /** - * Generic Mask Stack data structure - * - * @memberof PIXI.utils - * @function createIndicesForQuads - * @param {number} size - Number of quads - * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` - * @return {Uint16Array|Uint32Array} - Resulting index buffer - */ - function createIndicesForQuads(size, outBuffer) { - if (outBuffer === void 0) { outBuffer = null; } - // the total number of indices in our array, there are 6 points per quad. - var totalIndices = size * 6; - outBuffer = outBuffer || new Uint16Array(totalIndices); - if (outBuffer.length !== totalIndices) { - throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); - } - // fill the indices with the quads to draw - for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { - outBuffer[i + 0] = j + 0; - outBuffer[i + 1] = j + 1; - outBuffer[i + 2] = j + 2; - outBuffer[i + 3] = j + 0; - outBuffer[i + 4] = j + 2; - outBuffer[i + 5] = j + 3; - } - return outBuffer; - } - - function getBufferType(array) { - if (array.BYTES_PER_ELEMENT === 4) { - if (array instanceof Float32Array) { - return 'Float32Array'; - } - else if (array instanceof Uint32Array) { - return 'Uint32Array'; - } - return 'Int32Array'; - } - else if (array.BYTES_PER_ELEMENT === 2) { - if (array instanceof Uint16Array) { - return 'Uint16Array'; - } - } - else if (array.BYTES_PER_ELEMENT === 1) { - if (array instanceof Uint8Array) { - return 'Uint8Array'; - } - } - // TODO map out the rest of the array elements! - return null; - } - - /* eslint-disable object-shorthand */ - var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; - function interleaveTypedArrays(arrays, sizes) { - var outSize = 0; - var stride = 0; - var views = {}; - for (var i = 0; i < arrays.length; i++) { - stride += sizes[i]; - outSize += arrays[i].length; - } - var buffer = new ArrayBuffer(outSize * 4); - var out = null; - var littleOffset = 0; - for (var i = 0; i < arrays.length; i++) { - var size = sizes[i]; - var array = arrays[i]; - /* - @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way - or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? - */ - var type = getBufferType(array); - if (!views[type]) { - views[type] = new map[type](buffer); - } - out = views[type]; - for (var j = 0; j < array.length; j++) { - var indexStart = ((j / size | 0) * stride) + littleOffset; - var index = j % size; - out[indexStart + index] = array[j]; - } - littleOffset += size; - } - return new Float32Array(buffer); - } - - // Taken from the bit-twiddle package - /** - * Rounds to next power of two. - * - * @function nextPow2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {number} - */ - function nextPow2(v) { - v += v === 0 ? 1 : 0; - --v; - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - return v + 1; - } - /** - * Checks if a number is a power of two. - * - * @function isPow2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {boolean} `true` if value is power of two - */ - function isPow2(v) { - return !(v & (v - 1)) && (!!v); - } - /** - * Computes ceil of log base 2 - * - * @function log2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {number} logarithm base 2 - */ - function log2(v) { - var r = (v > 0xFFFF ? 1 : 0) << 4; - v >>>= r; - var shift = (v > 0xFF ? 1 : 0) << 3; - v >>>= shift; - r |= shift; - shift = (v > 0xF ? 1 : 0) << 2; - v >>>= shift; - r |= shift; - shift = (v > 0x3 ? 1 : 0) << 1; - v >>>= shift; - r |= shift; - return r | (v >> 1); - } - - /** - * Remove items from a javascript array without generating garbage - * - * @function removeItems - * @memberof PIXI.utils - * @param {Array} arr - Array to remove elements from - * @param {number} startIdx - starting index - * @param {number} removeCount - how many to remove - */ - function removeItems(arr, startIdx, removeCount) { - var length = arr.length; - var i; - if (startIdx >= length || removeCount === 0) { - return; - } - removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); - var len = length - removeCount; - for (i = startIdx; i < len; ++i) { - arr[i] = arr[i + removeCount]; - } - arr.length = len; - } - - /** - * Returns sign of number - * - * @memberof PIXI.utils - * @function sign - * @param {number} n - the number to check the sign of - * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive - */ - function sign$1(n) { - if (n === 0) - { return 0; } - return n < 0 ? -1 : 1; - } - - var nextUid = 0; - /** - * Gets the next unique identifier - * - * @memberof PIXI.utils - * @function uid - * @return {number} The next unique identifier to use. - */ - function uid() { - return ++nextUid; - } - - // A map of warning messages already fired - var warnings = {}; - /** - * Helper for warning developers about deprecated features & settings. - * A stack track for warnings is given; useful for tracking-down where - * deprecated methods/properties/classes are being used within the code. - * - * @memberof PIXI.utils - * @function deprecation - * @param {string} version - The version where the feature became deprecated - * @param {string} message - Message should include what is deprecated, where, and the new solution - * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack - * this is mostly to ignore internal deprecation calls. - */ - function deprecation(version, message, ignoreDepth) { - if (ignoreDepth === void 0) { ignoreDepth = 3; } - // Ignore duplicat - if (warnings[message]) { - return; - } - /* eslint-disable no-console */ - var stack = new Error().stack; - // Handle IE < 10 and Safari < 6 - if (typeof stack === 'undefined') { - console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); - } - else { - // chop off the stack trace which includes PixiJS internal calls - stack = stack.split('\n').splice(ignoreDepth).join('\n'); - if (console.groupCollapsed) { - console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); - console.warn(stack); - console.groupEnd(); - } - else { - console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); - console.warn(stack); - } - } - /* eslint-enable no-console */ - warnings[message] = true; - } - - /** - * @todo Describe property usage - * - * @static - * @name ProgramCache - * @memberof PIXI.utils - * @type {Object} - */ - var ProgramCache = {}; - /** - * @todo Describe property usage - * - * @static - * @name TextureCache - * @memberof PIXI.utils - * @type {Object} - */ - var TextureCache = Object.create(null); - /** - * @todo Describe property usage - * - * @static - * @name BaseTextureCache - * @memberof PIXI.utils - * @type {Object} - */ - var BaseTextureCache = Object.create(null); - /** - * Destroys all texture in the cache - * - * @memberof PIXI.utils - * @function destroyTextureCache - */ - function destroyTextureCache() { - var key; - for (key in TextureCache) { - TextureCache[key].destroy(); - } - for (key in BaseTextureCache) { - BaseTextureCache[key].destroy(); - } - } - /** - * Removes all textures from cache, but does not destroy them - * - * @memberof PIXI.utils - * @function clearTextureCache - */ - function clearTextureCache() { - var key; - for (key in TextureCache) { - delete TextureCache[key]; - } - for (key in BaseTextureCache) { - delete BaseTextureCache[key]; - } - } - - /** - * Creates a Canvas element of the given size to be used as a target for rendering to. - * - * @class - * @memberof PIXI.utils - */ - var CanvasRenderTarget = /** @class */ (function () { - /** - * @param {number} width - the width for the newly created canvas - * @param {number} height - the height for the newly created canvas - * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas - */ - function CanvasRenderTarget(width, height, resolution) { - /** - * The Canvas object that belongs to this CanvasRenderTarget. - * - * @member {HTMLCanvasElement} - */ - this.canvas = document.createElement('canvas'); - /** - * A CanvasRenderingContext2D object representing a two-dimensional rendering context. - * - * @member {CanvasRenderingContext2D} - */ - this.context = this.canvas.getContext('2d'); - this.resolution = resolution || settings.RESOLUTION; - this.resize(width, height); - } - /** - * Clears the canvas that was created by the CanvasRenderTarget class. - * - * @private - */ - CanvasRenderTarget.prototype.clear = function () { - this.context.setTransform(1, 0, 0, 1, 0, 0); - this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); - }; - /** - * Resizes the canvas to the specified width and height. - * - * @param {number} width - the new width of the canvas - * @param {number} height - the new height of the canvas - */ - CanvasRenderTarget.prototype.resize = function (width, height) { - this.canvas.width = width * this.resolution; - this.canvas.height = height * this.resolution; - }; - /** - * Destroys this canvas. - * - */ - CanvasRenderTarget.prototype.destroy = function () { - this.context = null; - this.canvas = null; - }; - Object.defineProperty(CanvasRenderTarget.prototype, "width", { - /** - * The width of the canvas buffer in pixels. - * - * @member {number} - */ - get: function () { - return this.canvas.width; - }, - set: function (val) { - this.canvas.width = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(CanvasRenderTarget.prototype, "height", { - /** - * The height of the canvas buffer in pixels. - * - * @member {number} - */ - get: function () { - return this.canvas.height; - }, - set: function (val) { - this.canvas.height = val; - }, - enumerable: false, - configurable: true - }); - return CanvasRenderTarget; - }()); - - /** - * Trim transparent borders from a canvas - * - * @memberof PIXI.utils - * @function trimCanvas - * @param {HTMLCanvasElement} canvas - the canvas to trim - * @returns {object} Trim data - */ - function trimCanvas(canvas) { - // https://gist.github.com/remy/784508 - var width = canvas.width; - var height = canvas.height; - var context = canvas.getContext('2d'); - var imageData = context.getImageData(0, 0, width, height); - var pixels = imageData.data; - var len = pixels.length; - var bound = { - top: null, - left: null, - right: null, - bottom: null, - }; - var data = null; - var i; - var x; - var y; - for (i = 0; i < len; i += 4) { - if (pixels[i + 3] !== 0) { - x = (i / 4) % width; - y = ~~((i / 4) / width); - if (bound.top === null) { - bound.top = y; - } - if (bound.left === null) { - bound.left = x; - } - else if (x < bound.left) { - bound.left = x; - } - if (bound.right === null) { - bound.right = x + 1; - } - else if (bound.right < x) { - bound.right = x + 1; - } - if (bound.bottom === null) { - bound.bottom = y; - } - else if (bound.bottom < y) { - bound.bottom = y; - } - } - } - if (bound.top !== null) { - width = bound.right - bound.left; - height = bound.bottom - bound.top + 1; - data = context.getImageData(bound.left, bound.top, width, height); - } - return { - height: height, - width: width, - data: data, - }; - } - - /** - * Regexp for data URI. - * Based on: {@link https://github.com/ragingwind/data-uri-regex} - * - * @static - * @constant {RegExp|string} DATA_URI - * @memberof PIXI - * @example data:image/png;base64 - */ - var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; - - /** - * @memberof PIXI.utils - * @interface DecomposedDataUri - */ - /** - * type, eg. `image` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} mediaType - */ - /** - * Sub type, eg. `png` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} subType - */ - /** - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} charset - */ - /** - * Data encoding, eg. `base64` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} encoding - */ - /** - * The actual data - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} data - */ - /** - * Split a data URI into components. Returns undefined if - * parameter `dataUri` is not a valid data URI. - * - * @memberof PIXI.utils - * @function decomposeDataUri - * @param {string} dataUri - the data URI to check - * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined - */ - function decomposeDataUri(dataUri) { - var dataUriMatch = DATA_URI.exec(dataUri); - if (dataUriMatch) { - return { - mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, - subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, - charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, - encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, - data: dataUriMatch[5], - }; - } - return undefined; - } - - var tempAnchor; - /** - * Sets the `crossOrigin` property for this resource based on if the url - * for this resource is cross-origin. If crossOrigin was manually set, this - * function does nothing. - * Nipped from the resource loader! - * - * @ignore - * @param {string} url - The url to test. - * @param {object} [loc=window.location] - The location object to test against. - * @return {string} The crossOrigin value to use (or empty string for none). - */ - function determineCrossOrigin(url, loc) { - if (loc === void 0) { loc = window.location; } - // data: and javascript: urls are considered same-origin - if (url.indexOf('data:') === 0) { - return ''; - } - // default is window.location - loc = loc || window.location; - if (!tempAnchor) { - tempAnchor = document.createElement('a'); - } - // let the browser determine the full href for the url of this resource and then - // parse with the node url lib, we can't use the properties of the anchor element - // because they don't work in IE9 :( - tempAnchor.href = url; - var parsedUrl = parse(tempAnchor.href); - var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); - // if cross origin - if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { - return 'anonymous'; - } - return ''; - } - - /** - * get the resolution / device pixel ratio of an asset by looking for the prefix - * used by spritesheets and image urls - * - * @memberof PIXI.utils - * @function getResolutionOfUrl - * @param {string} url - the image path - * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. - * @return {number} resolution / device pixel ratio of an asset - */ - function getResolutionOfUrl(url, defaultValue) { - var resolution = settings.RETINA_PREFIX.exec(url); - if (resolution) { - return parseFloat(resolution[1]); - } - return defaultValue !== undefined ? defaultValue : 1; - } - - var utils_es = ({ - BaseTextureCache: BaseTextureCache, - CanvasRenderTarget: CanvasRenderTarget, - DATA_URI: DATA_URI, - ProgramCache: ProgramCache, - TextureCache: TextureCache, - clearTextureCache: clearTextureCache, - correctBlendMode: correctBlendMode, - createIndicesForQuads: createIndicesForQuads, - decomposeDataUri: decomposeDataUri, - deprecation: deprecation, - destroyTextureCache: destroyTextureCache, - determineCrossOrigin: determineCrossOrigin, - getBufferType: getBufferType, - getResolutionOfUrl: getResolutionOfUrl, - hex2rgb: hex2rgb, - hex2string: hex2string, - interleaveTypedArrays: interleaveTypedArrays, - isPow2: isPow2, - isWebGLSupported: isWebGLSupported, - log2: log2, - nextPow2: nextPow2, - premultiplyBlendMode: premultiplyBlendMode, - premultiplyRgba: premultiplyRgba, - premultiplyTint: premultiplyTint, - premultiplyTintToRgba: premultiplyTintToRgba, - removeItems: removeItems, - rgb2hex: rgb2hex, - sayHello: sayHello, - sign: sign$1, - skipHello: skipHello, - string2hex: string2hex, - trimCanvas: trimCanvas, - uid: uid, - isMobile: isMobile$1, - EventEmitter: eventemitter3, - earcut: earcut_1, - url: url - }); - - /*! - * @pixi/math - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/math is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * Two Pi. - * - * @static - * @constant {number} PI_2 - * @memberof PIXI - */ - var PI_2 = Math.PI * 2; - /** - * Conversion factor for converting radians to degrees. - * - * @static - * @constant {number} RAD_TO_DEG - * @memberof PIXI - */ - var RAD_TO_DEG = 180 / Math.PI; - /** - * Conversion factor for converting degrees to radians. - * - * @static - * @constant {number} DEG_TO_RAD - * @memberof PIXI - */ - var DEG_TO_RAD = Math.PI / 180; - - (function (SHAPES) { - SHAPES[SHAPES["POLY"] = 0] = "POLY"; - SHAPES[SHAPES["RECT"] = 1] = "RECT"; - SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; - SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; - SHAPES[SHAPES["RREC"] = 4] = "RREC"; - })(exports.SHAPES || (exports.SHAPES = {})); - /** - * Constants that identify shapes, mainly to prevent `instanceof` calls. - * - * @static - * @constant - * @name SHAPES - * @memberof PIXI - * @type {enum} - * @property {number} POLY Polygon - * @property {number} RECT Rectangle - * @property {number} CIRC Circle - * @property {number} ELIP Ellipse - * @property {number} RREC Rounded Rectangle - * @enum {number} - */ - - /** - * Size object, contains width and height - * - * @memberof PIXI - * @typedef {object} ISize - * @property {number} width - Width component - * @property {number} height - Height component - */ - /** - * Rectangle object is an area defined by its position, as indicated by its top-left corner - * point (x, y) and by its width and its height. - * - * @class - * @memberof PIXI - */ - var Rectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle - * @param {number} [width=0] - The overall width of this rectangle - * @param {number} [height=0] - The overall height of this rectangle - */ - function Rectangle(x, y, width, height) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = Number(x); - /** - * @member {number} - * @default 0 - */ - this.y = Number(y); - /** - * @member {number} - * @default 0 - */ - this.width = Number(width); - /** - * @member {number} - * @default 0 - */ - this.height = Number(height); - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.RECT - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RECT; - } - Object.defineProperty(Rectangle.prototype, "left", { - /** - * returns the left edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "right", { - /** - * returns the right edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x + this.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "top", { - /** - * returns the top edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "bottom", { - /** - * returns the bottom edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y + this.height; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle, "EMPTY", { - /** - * A constant empty rectangle. - * - * @static - * @constant - * @member {PIXI.Rectangle} - * @return {PIXI.Rectangle} An empty rectangle - */ - get: function () { - return new Rectangle(0, 0, 0, 0); - }, - enumerable: false, - configurable: true - }); - /** - * Creates a clone of this Rectangle - * - * @return {PIXI.Rectangle} a copy of the rectangle - */ - Rectangle.prototype.clone = function () { - return new Rectangle(this.x, this.y, this.width, this.height); - }; - /** - * Copies another rectangle to this one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy from. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.copyFrom = function (rectangle) { - this.x = rectangle.x; - this.y = rectangle.y; - this.width = rectangle.width; - this.height = rectangle.height; - return this; - }; - /** - * Copies this rectangle to another one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy to. - * @return {PIXI.Rectangle} Returns given parameter. - */ - Rectangle.prototype.copyTo = function (rectangle) { - rectangle.x = this.x; - rectangle.y = this.y; - rectangle.width = this.width; - rectangle.height = this.height; - return rectangle; - }; - /** - * Checks whether the x and y coordinates given are contained within this Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rectangle - */ - Rectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x < this.x + this.width) { - if (y >= this.y && y < this.y + this.height) { - return true; - } - } - return false; - }; - /** - * Pads the rectangle making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.pad = function (paddingX, paddingY) { - if (paddingX === void 0) { paddingX = 0; } - if (paddingY === void 0) { paddingY = paddingX; } - this.x -= paddingX; - this.y -= paddingY; - this.width += paddingX * 2; - this.height += paddingY * 2; - return this; - }; - /** - * Fits this rectangle around the passed one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to fit. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.fit = function (rectangle) { - var x1 = Math.max(this.x, rectangle.x); - var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.max(this.y, rectangle.y); - var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = Math.max(x2 - x1, 0); - this.y = y1; - this.height = Math.max(y2 - y1, 0); - return this; - }; - /** - * Enlarges rectangle that way its corners lie on grid - * - * @param {number} [resolution=1] resolution - * @param {number} [eps=0.001] precision - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.ceil = function (resolution, eps) { - if (resolution === void 0) { resolution = 1; } - if (eps === void 0) { eps = 0.001; } - var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; - var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; - this.x = Math.floor((this.x + eps) * resolution) / resolution; - this.y = Math.floor((this.y + eps) * resolution) / resolution; - this.width = x2 - this.x; - this.height = y2 - this.y; - return this; - }; - /** - * Enlarges this rectangle to include the passed rectangle. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to include. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.enlarge = function (rectangle) { - var x1 = Math.min(this.x, rectangle.x); - var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.min(this.y, rectangle.y); - var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = x2 - x1; - this.y = y1; - this.height = y2 - y1; - return this; - }; - return Rectangle; - }()); - - /** - * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Circle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this circle - * @param {number} [y=0] - The Y coordinate of the center of this circle - * @param {number} [radius=0] - The radius of the circle - */ - function Circle(x, y, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (radius === void 0) { radius = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.CIRC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.CIRC; - } - /** - * Creates a clone of this Circle instance - * - * @return {PIXI.Circle} a copy of the Circle - */ - Circle.prototype.clone = function () { - return new Circle(this.x, this.y, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this circle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Circle - */ - Circle.prototype.contains = function (x, y) { - if (this.radius <= 0) { - return false; - } - var r2 = this.radius * this.radius; - var dx = (this.x - x); - var dy = (this.y - y); - dx *= dx; - dy *= dy; - return (dx + dy <= r2); - }; - /** - * Returns the framing rectangle of the circle as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Circle.prototype.getBounds = function () { - return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); - }; - return Circle; - }()); - - /** - * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Ellipse = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this ellipse - * @param {number} [y=0] - The Y coordinate of the center of this ellipse - * @param {number} [halfWidth=0] - The half width of this ellipse - * @param {number} [halfHeight=0] - The half height of this ellipse - */ - function Ellipse(x, y, halfWidth, halfHeight) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (halfWidth === void 0) { halfWidth = 0; } - if (halfHeight === void 0) { halfHeight = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = halfWidth; - /** - * @member {number} - * @default 0 - */ - this.height = halfHeight; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.ELIP - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.ELIP; - } - /** - * Creates a clone of this Ellipse instance - * - * @return {PIXI.Ellipse} a copy of the ellipse - */ - Ellipse.prototype.clone = function () { - return new Ellipse(this.x, this.y, this.width, this.height); - }; - /** - * Checks whether the x and y coordinates given are contained within this ellipse - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coords are within this ellipse - */ - Ellipse.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - // normalize the coords to an ellipse with center 0,0 - var normx = ((x - this.x) / this.width); - var normy = ((y - this.y) / this.height); - normx *= normx; - normy *= normy; - return (normx + normy <= 1); - }; - /** - * Returns the framing rectangle of the ellipse as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Ellipse.prototype.getBounds = function () { - return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); - }; - return Ellipse; - }()); - - /** - * A class to define a shape via user defined co-orinates. - * - * @class - * @memberof PIXI - */ - var Polygon = /** @class */ (function () { - /** - * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points - * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or - * the arguments passed can be all the points of the polygon e.g. - * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat - * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. - */ - function Polygon() { - var arguments$1 = arguments; - - var points = []; - for (var _i = 0; _i < arguments.length; _i++) { - points[_i] = arguments$1[_i]; - } - var flat = Array.isArray(points[0]) ? points[0] : points; - // if this is an array of points, convert it to a flat array of numbers - if (typeof flat[0] !== 'number') { - var p = []; - for (var i = 0, il = flat.length; i < il; i++) { - p.push(flat[i].x, flat[i].y); - } - flat = p; - } - /** - * An array of the points of this polygon - * - * @member {number[]} - */ - this.points = flat; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.POLY - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.POLY; - /** - * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. - * @member {boolean} - * @default true - */ - this.closeStroke = true; - } - /** - * Creates a clone of this polygon - * - * @return {PIXI.Polygon} a copy of the polygon - */ - Polygon.prototype.clone = function () { - var points = this.points.slice(); - var polygon = new Polygon(points); - polygon.closeStroke = this.closeStroke; - return polygon; - }; - /** - * Checks whether the x and y coordinates passed to this function are contained within this polygon - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this polygon - */ - Polygon.prototype.contains = function (x, y) { - var inside = false; - // use some raycasting to test hits - // https://github.com/substack/point-in-polygon/blob/master/index.js - var length = this.points.length / 2; - for (var i = 0, j = length - 1; i < length; j = i++) { - var xi = this.points[i * 2]; - var yi = this.points[(i * 2) + 1]; - var xj = this.points[j * 2]; - var yj = this.points[(j * 2) + 1]; - var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); - if (intersect) { - inside = !inside; - } - } - return inside; - }; - return Polygon; - }()); - - /** - * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its - * top-left corner point (x, y) and by its width and its height and its radius. - * - * @class - * @memberof PIXI - */ - var RoundedRectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle - * @param {number} [width=0] - The overall width of this rounded rectangle - * @param {number} [height=0] - The overall height of this rounded rectangle - * @param {number} [radius=20] - Controls the radius of the rounded corners - */ - function RoundedRectangle(x, y, width, height, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - if (radius === void 0) { radius = 20; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = width; - /** - * @member {number} - * @default 0 - */ - this.height = height; - /** - * @member {number} - * @default 20 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readonly - * @default PIXI.SHAPES.RREC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RREC; - } - /** - * Creates a clone of this Rounded Rectangle - * - * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle - */ - RoundedRectangle.prototype.clone = function () { - return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this Rounded Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle - */ - RoundedRectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x <= this.x + this.width) { - if (y >= this.y && y <= this.y + this.height) { - if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius) - || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) { - return true; - } - var dx = x - (this.x + this.radius); - var dy = y - (this.y + this.radius); - var radius2 = this.radius * this.radius; - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.width - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dy = y - (this.y + this.height - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - } - } - return false; - }; - return RoundedRectangle; - }()); - - /** - * Common interface for points. Both Point and ObservablePoint implement it - * @memberof PIXI - * @interface IPointData - */ - /** - * X coord - * @memberof PIXI.IPointData# - * @member {number} x - */ - /** - * Y coord - * @memberof PIXI.IPointData# - * @member {number} y - */ - - /** - * Common interface for points. Both Point and ObservablePoint implement it - * @memberof PIXI - * @interface IPoint - * @extends PIXI.IPointData - */ - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @method set - * @memberof PIXI.IPoint# - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - */ - /** - * Copies x and y from the given point - * @method copyFrom - * @memberof PIXI.IPoint# - * @param {PIXI.IPointData} p - The point to copy from - * @returns {this} Returns itself. - */ - /** - * Copies x and y into the given point - * @method copyTo - * @memberof PIXI.IPoint# - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - /** - * Returns true if the given point is equal to this point - * - * @method equals - * @memberof PIXI.IPoint# - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - - /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. - * - * @class - * @memberof PIXI - * @implements IPoint - */ - var Point = /** @class */ (function () { - /** - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=0] - position of the point on the y axis - */ - function Point(x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - } - /** - * Creates a clone of this point - * - * @return {PIXI.Point} a copy of the point - */ - Point.prototype.clone = function () { - return new Point(this.x, this.y); - }; - /** - * Copies x and y from the given point - * - * @param {PIXI.IPointData} p - The point to copy from - * @returns {this} Returns itself. - */ - Point.prototype.copyFrom = function (p) { - this.set(p.x, p.y); - return this; - }; - /** - * Copies x and y into the given point - * - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - Point.prototype.copyTo = function (p) { - p.set(this.x, this.y); - return p; - }; - /** - * Returns true if the given point is equal to this point - * - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - Point.prototype.equals = function (p) { - return (p.x === this.x) && (p.y === this.y); - }; - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - * @returns {this} Returns itself. - */ - Point.prototype.set = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = x; } - this.x = x; - this.y = y; - return this; - }; - return Point; - }()); - - /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. - * - * An ObservablePoint is a point that triggers a callback when the point's position is changed. - * - * @class - * @memberof PIXI - * @implements IPoint - */ - var ObservablePoint = /** @class */ (function () { - /** - * @param {Function} cb - callback when changed - * @param {object} scope - owner of callback - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=0] - position of the point on the y axis - */ - function ObservablePoint(cb, scope, x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - this._x = x; - this._y = y; - this.cb = cb; - this.scope = scope; - } - /** - * Creates a clone of this point. - * The callback and scope params can be overidden otherwise they will default - * to the clone object's values. - * - * @override - * @param {Function} [cb=null] - callback when changed - * @param {object} [scope=null] - owner of callback - * @return {PIXI.ObservablePoint} a copy of the point - */ - ObservablePoint.prototype.clone = function (cb, scope) { - if (cb === void 0) { cb = this.cb; } - if (scope === void 0) { scope = this.scope; } - return new ObservablePoint(cb, scope, this._x, this._y); - }; - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - * @returns {this} Returns itself. - */ - ObservablePoint.prototype.set = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = x; } - if (this._x !== x || this._y !== y) { - this._x = x; - this._y = y; - this.cb.call(this.scope); - } - return this; - }; - /** - * Copies x and y from the given point - * - * @param {PIXI.IPointData} p - The point to copy from. - * @returns {this} Returns itself. - */ - ObservablePoint.prototype.copyFrom = function (p) { - if (this._x !== p.x || this._y !== p.y) { - this._x = p.x; - this._y = p.y; - this.cb.call(this.scope); - } - return this; - }; - /** - * Copies x and y into the given point - * - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - ObservablePoint.prototype.copyTo = function (p) { - p.set(this._x, this._y); - return p; - }; - /** - * Returns true if the given point is equal to this point - * - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - ObservablePoint.prototype.equals = function (p) { - return (p.x === this._x) && (p.y === this._y); - }; - Object.defineProperty(ObservablePoint.prototype, "x", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * - * @member {number} - */ - get: function () { - return this._x; - }, - set: function (value) { - if (this._x !== value) { - this._x = value; - this.cb.call(this.scope); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ObservablePoint.prototype, "y", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * - * @member {number} - */ - get: function () { - return this._y; - }, - set: function (value) { - if (this._y !== value) { - this._y = value; - this.cb.call(this.scope); - } - }, - enumerable: false, - configurable: true - }); - return ObservablePoint; - }()); - - /** - * The PixiJS Matrix as a class makes it a lot faster. - * - * Here is a representation of it: - * ```js - * | a | c | tx| - * | b | d | ty| - * | 0 | 0 | 1 | - * ``` - * @class - * @memberof PIXI - */ - var Matrix = /** @class */ (function () { - /** - * @param {number} [a=1] - x scale - * @param {number} [b=0] - x skew - * @param {number} [c=0] - y skew - * @param {number} [d=1] - y scale - * @param {number} [tx=0] - x translation - * @param {number} [ty=0] - y translation - */ - function Matrix(a, b, c, d, tx, ty) { - if (a === void 0) { a = 1; } - if (b === void 0) { b = 0; } - if (c === void 0) { c = 0; } - if (d === void 0) { d = 1; } - if (tx === void 0) { tx = 0; } - if (ty === void 0) { ty = 0; } - this.array = null; - /** - * @member {number} - * @default 1 - */ - this.a = a; - /** - * @member {number} - * @default 0 - */ - this.b = b; - /** - * @member {number} - * @default 0 - */ - this.c = c; - /** - * @member {number} - * @default 1 - */ - this.d = d; - /** - * @member {number} - * @default 0 - */ - this.tx = tx; - /** - * @member {number} - * @default 0 - */ - this.ty = ty; - } - /** - * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: - * - * a = array[0] - * b = array[1] - * c = array[3] - * d = array[4] - * tx = array[2] - * ty = array[5] - * - * @param {number[]} array - The array that the matrix will be populated from. - */ - Matrix.prototype.fromArray = function (array) { - this.a = array[0]; - this.b = array[1]; - this.c = array[3]; - this.d = array[4]; - this.tx = array[2]; - this.ty = array[5]; - }; - /** - * sets the matrix properties - * - * @param {number} a - Matrix component - * @param {number} b - Matrix component - * @param {number} c - Matrix component - * @param {number} d - Matrix component - * @param {number} tx - Matrix component - * @param {number} ty - Matrix component - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.set = function (a, b, c, d, tx, ty) { - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.tx = tx; - this.ty = ty; - return this; - }; - /** - * Creates an array from the current Matrix object. - * - * @param {boolean} transpose - Whether we need to transpose the matrix or not - * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out - * @return {number[]} the newly created array which contains the matrix - */ - Matrix.prototype.toArray = function (transpose, out) { - if (!this.array) { - this.array = new Float32Array(9); - } - var array = out || this.array; - if (transpose) { - array[0] = this.a; - array[1] = this.b; - array[2] = 0; - array[3] = this.c; - array[4] = this.d; - array[5] = 0; - array[6] = this.tx; - array[7] = this.ty; - array[8] = 1; - } - else { - array[0] = this.a; - array[1] = this.c; - array[2] = this.tx; - array[3] = this.b; - array[4] = this.d; - array[5] = this.ty; - array[6] = 0; - array[7] = 0; - array[8] = 1; - } - return array; - }; - /** - * Get a new position with the current transformation applied. - * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) - * - * @param {PIXI.IPointData} pos - The origin - * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) - * @return {PIXI.Point} The new point, transformed through this matrix - */ - Matrix.prototype.apply = function (pos, newPos) { - newPos = (newPos || new Point()); - var x = pos.x; - var y = pos.y; - newPos.x = (this.a * x) + (this.c * y) + this.tx; - newPos.y = (this.b * x) + (this.d * y) + this.ty; - return newPos; - }; - /** - * Get a new position with the inverse of the current transformation applied. - * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) - * - * @param {PIXI.IPointData} pos - The origin - * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) - * @return {PIXI.Point} The new point, inverse-transformed through this matrix - */ - Matrix.prototype.applyInverse = function (pos, newPos) { - newPos = (newPos || new Point()); - var id = 1 / ((this.a * this.d) + (this.c * -this.b)); - var x = pos.x; - var y = pos.y; - newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); - newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); - return newPos; - }; - /** - * Translates the matrix on the x and y. - * - * @param {number} x - How much to translate x by - * @param {number} y - How much to translate y by - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.translate = function (x, y) { - this.tx += x; - this.ty += y; - return this; - }; - /** - * Applies a scale transformation to the matrix. - * - * @param {number} x - The amount to scale horizontally - * @param {number} y - The amount to scale vertically - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.scale = function (x, y) { - this.a *= x; - this.d *= y; - this.c *= x; - this.b *= y; - this.tx *= x; - this.ty *= y; - return this; - }; - /** - * Applies a rotation transformation to the matrix. - * - * @param {number} angle - The angle in radians. - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.rotate = function (angle) { - var cos = Math.cos(angle); - var sin = Math.sin(angle); - var a1 = this.a; - var c1 = this.c; - var tx1 = this.tx; - this.a = (a1 * cos) - (this.b * sin); - this.b = (a1 * sin) + (this.b * cos); - this.c = (c1 * cos) - (this.d * sin); - this.d = (c1 * sin) + (this.d * cos); - this.tx = (tx1 * cos) - (this.ty * sin); - this.ty = (tx1 * sin) + (this.ty * cos); - return this; - }; - /** - * Appends the given Matrix to this Matrix. - * - * @param {PIXI.Matrix} matrix - The matrix to append. - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.append = function (matrix) { - var a1 = this.a; - var b1 = this.b; - var c1 = this.c; - var d1 = this.d; - this.a = (matrix.a * a1) + (matrix.b * c1); - this.b = (matrix.a * b1) + (matrix.b * d1); - this.c = (matrix.c * a1) + (matrix.d * c1); - this.d = (matrix.c * b1) + (matrix.d * d1); - this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; - this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; - return this; - }; - /** - * Sets the matrix based on all the available properties - * - * @param {number} x - Position on the x axis - * @param {number} y - Position on the y axis - * @param {number} pivotX - Pivot on the x axis - * @param {number} pivotY - Pivot on the y axis - * @param {number} scaleX - Scale on the x axis - * @param {number} scaleY - Scale on the y axis - * @param {number} rotation - Rotation in radians - * @param {number} skewX - Skew on the x axis - * @param {number} skewY - Skew on the y axis - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { - this.a = Math.cos(rotation + skewY) * scaleX; - this.b = Math.sin(rotation + skewY) * scaleX; - this.c = -Math.sin(rotation - skewX) * scaleY; - this.d = Math.cos(rotation - skewX) * scaleY; - this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); - this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); - return this; - }; - /** - * Prepends the given Matrix to this Matrix. - * - * @param {PIXI.Matrix} matrix - The matrix to prepend - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.prepend = function (matrix) { - var tx1 = this.tx; - if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { - var a1 = this.a; - var c1 = this.c; - this.a = (a1 * matrix.a) + (this.b * matrix.c); - this.b = (a1 * matrix.b) + (this.b * matrix.d); - this.c = (c1 * matrix.a) + (this.d * matrix.c); - this.d = (c1 * matrix.b) + (this.d * matrix.d); - } - this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; - this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; - return this; - }; - /** - * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. - * - * @param {PIXI.Transform} transform - The transform to apply the properties to. - * @return {PIXI.Transform} The transform with the newly applied properties - */ - Matrix.prototype.decompose = function (transform) { - // sort out rotation / skew.. - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var skewX = -Math.atan2(-c, d); - var skewY = Math.atan2(b, a); - var delta = Math.abs(skewX + skewY); - if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { - transform.rotation = skewY; - transform.skew.x = transform.skew.y = 0; - } - else { - transform.rotation = 0; - transform.skew.x = skewX; - transform.skew.y = skewY; - } - // next set scale - transform.scale.x = Math.sqrt((a * a) + (b * b)); - transform.scale.y = Math.sqrt((c * c) + (d * d)); - // next set position - transform.position.x = this.tx; - transform.position.y = this.ty; - return transform; - }; - /** - * Inverts this matrix - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.invert = function () { - var a1 = this.a; - var b1 = this.b; - var c1 = this.c; - var d1 = this.d; - var tx1 = this.tx; - var n = (a1 * d1) - (b1 * c1); - this.a = d1 / n; - this.b = -b1 / n; - this.c = -c1 / n; - this.d = a1 / n; - this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; - this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; - return this; - }; - /** - * Resets this Matrix to an identity (default) matrix. - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.identity = function () { - this.a = 1; - this.b = 0; - this.c = 0; - this.d = 1; - this.tx = 0; - this.ty = 0; - return this; - }; - /** - * Creates a new Matrix object with the same values as this one. - * - * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls. - */ - Matrix.prototype.clone = function () { - var matrix = new Matrix(); - matrix.a = this.a; - matrix.b = this.b; - matrix.c = this.c; - matrix.d = this.d; - matrix.tx = this.tx; - matrix.ty = this.ty; - return matrix; - }; - /** - * Changes the values of the given matrix to be the same as the ones in this matrix - * - * @param {PIXI.Matrix} matrix - The matrix to copy to. - * @return {PIXI.Matrix} The matrix given in parameter with its values updated. - */ - Matrix.prototype.copyTo = function (matrix) { - matrix.a = this.a; - matrix.b = this.b; - matrix.c = this.c; - matrix.d = this.d; - matrix.tx = this.tx; - matrix.ty = this.ty; - return matrix; - }; - /** - * Changes the values of the matrix to be the same as the ones in given matrix - * - * @param {PIXI.Matrix} matrix - The matrix to copy from. - * @return {PIXI.Matrix} this - */ - Matrix.prototype.copyFrom = function (matrix) { - this.a = matrix.a; - this.b = matrix.b; - this.c = matrix.c; - this.d = matrix.d; - this.tx = matrix.tx; - this.ty = matrix.ty; - return this; - }; - Object.defineProperty(Matrix, "IDENTITY", { - /** - * A default (identity) matrix - * - * @static - * @const - * @member {PIXI.Matrix} - */ - get: function () { - return new Matrix(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Matrix, "TEMP_MATRIX", { - /** - * A temp matrix - * - * @static - * @const - * @member {PIXI.Matrix} - */ - get: function () { - return new Matrix(); - }, - enumerable: false, - configurable: true - }); - return Matrix; - }()); - - // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group - /* - * Transform matrix for operation n is: - * | ux | vx | - * | uy | vy | - */ - var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; - var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; - var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; - var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; - /** - * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} - * for the composition of each rotation in the dihederal group D8. - * - * @type number[][] - * @private - */ - var rotationCayley = []; - /** - * Matrices for each `GD8Symmetry` rotation. - * - * @type Matrix[] - * @private - */ - var rotationMatrices = []; - /* - * Alias for {@code Math.sign}. - */ - var signum = Math.sign; - /* - * Initializes `rotationCayley` and `rotationMatrices`. It is called - * only once below. - */ - function init() { - for (var i = 0; i < 16; i++) { - var row = []; - rotationCayley.push(row); - for (var j = 0; j < 16; j++) { - /* Multiplies rotation matrices i and j. */ - var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); - var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); - var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); - var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); - /* Finds rotation matrix matching the product and pushes it. */ - for (var k = 0; k < 16; k++) { - if (ux[k] === _ux && uy[k] === _uy - && vx[k] === _vx && vy[k] === _vy) { - row.push(k); - break; - } - } - } - } - for (var i = 0; i < 16; i++) { - var mat = new Matrix(); - mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); - rotationMatrices.push(mat); - } - } - init(); - /** - * @memberof PIXI - * @typedef {number} GD8Symmetry - * @see PIXI.groupD8 - */ - /** - * Implements the dihedral group D8, which is similar to - * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; - * D8 is the same but with diagonals, and it is used for texture - * rotations. - * - * The directions the U- and V- axes after rotation - * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` - * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. - * - * **Origin:**
- * This is the small part of gameofbombs.com portal system. It works. - * - * @see PIXI.groupD8.E - * @see PIXI.groupD8.SE - * @see PIXI.groupD8.S - * @see PIXI.groupD8.SW - * @see PIXI.groupD8.W - * @see PIXI.groupD8.NW - * @see PIXI.groupD8.N - * @see PIXI.groupD8.NE - * @author Ivan @ivanpopelyshev - * @namespace PIXI.groupD8 - * @memberof PIXI - */ - var groupD8 = { - /** - * | Rotation | Direction | - * |----------|-----------| - * | 0° | East | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - E: 0, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 45°↻ | Southeast | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - SE: 1, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 90°↻ | South | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - S: 2, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 135°↻ | Southwest | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - SW: 3, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 180° | West | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - W: 4, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -135°/225°↻ | Northwest | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - NW: 5, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -90°/270°↻ | North | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - N: 6, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -45°/315°↻ | Northeast | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - NE: 7, - /** - * Reflection about Y-axis. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MIRROR_VERTICAL: 8, - /** - * Reflection about the main diagonal. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MAIN_DIAGONAL: 10, - /** - * Reflection about X-axis. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MIRROR_HORIZONTAL: 12, - /** - * Reflection about reverse diagonal. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - REVERSE_DIAGONAL: 14, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The X-component of the U-axis - * after rotating the axes. - */ - uX: function (ind) { return ux[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The Y-component of the U-axis - * after rotating the axes. - */ - uY: function (ind) { return uy[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The X-component of the V-axis - * after rotating the axes. - */ - vX: function (ind) { return vx[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The Y-component of the V-axis - * after rotating the axes. - */ - vY: function (ind) { return vy[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite - * is needed. Only rotations have opposite symmetries while - * reflections don't. - * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation` - */ - inv: function (rotation) { - if (rotation & 8) // true only if between 8 & 15 (reflections) - { - return rotation & 15; // or rotation % 16 - } - return (-rotation) & 7; // or (8 - rotation) % 8 - }, - /** - * Composes the two D8 operations. - * - * Taking `^` as reflection: - * - * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | - * |-------|-----|-----|-----|-----|------|-------|-------|-------| - * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | - * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | - * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | - * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | - * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | - * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | - * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | - * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | - * - * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which - * is the row in the above cayley table. - * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which - * is the column in the above cayley table. - * @return {PIXI.GD8Symmetry} Composed operation - */ - add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, - /** - * Reverse of `add`. - * - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotationSecond - Second operation - * @param {PIXI.GD8Symmetry} rotationFirst - First operation - * @return {PIXI.GD8Symmetry} Result - */ - sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, - /** - * Adds 180 degrees to rotation, which is a commutative - * operation. - * - * @memberof PIXI.groupD8 - * @param {number} rotation - The number to rotate. - * @returns {number} Rotated number - */ - rotate180: function (rotation) { return rotation ^ 4; }, - /** - * Checks if the rotation angle is vertical, i.e. south - * or north. It doesn't work for reflections. - * - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotation - The number to check. - * @returns {boolean} Whether or not the direction is vertical - */ - isVertical: function (rotation) { return (rotation & 3) === 2; }, - /** - * Approximates the vector `V(dx,dy)` into one of the - * eight directions provided by `groupD8`. - * - * @memberof PIXI.groupD8 - * @param {number} dx - X-component of the vector - * @param {number} dy - Y-component of the vector - * @return {PIXI.GD8Symmetry} Approximation of the vector into - * one of the eight symmetries. - */ - byDirection: function (dx, dy) { - if (Math.abs(dx) * 2 <= Math.abs(dy)) { - if (dy >= 0) { - return groupD8.S; - } - return groupD8.N; - } - else if (Math.abs(dy) * 2 <= Math.abs(dx)) { - if (dx > 0) { - return groupD8.E; - } - return groupD8.W; - } - else if (dy > 0) { - if (dx > 0) { - return groupD8.SE; - } - return groupD8.SW; - } - else if (dx > 0) { - return groupD8.NE; - } - return groupD8.NW; - }, - /** - * Helps sprite to compensate texture packer rotation. - * - * @memberof PIXI.groupD8 - * @param {PIXI.Matrix} matrix - sprite world matrix - * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. - * @param {number} tx - sprite anchoring - * @param {number} ty - sprite anchoring - */ - matrixAppendRotationInv: function (matrix, rotation, tx, ty) { - if (tx === void 0) { tx = 0; } - if (ty === void 0) { ty = 0; } - // Packer used "rotation", we use "inv(rotation)" - var mat = rotationMatrices[groupD8.inv(rotation)]; - mat.tx = tx; - mat.ty = ty; - matrix.append(mat); - }, - }; - - /** - * Transform that takes care about its versions - * - * @class - * @memberof PIXI - */ - var Transform = /** @class */ (function () { - function Transform() { - /** - * The world transformation matrix. - * - * @member {PIXI.Matrix} - */ - this.worldTransform = new Matrix(); - /** - * The local transformation matrix. - * - * @member {PIXI.Matrix} - */ - this.localTransform = new Matrix(); - /** - * The coordinate of the object relative to the local coordinates of the parent. - * - * @member {PIXI.ObservablePoint} - */ - this.position = new ObservablePoint(this.onChange, this, 0, 0); - /** - * The scale factor of the object. - * - * @member {PIXI.ObservablePoint} - */ - this.scale = new ObservablePoint(this.onChange, this, 1, 1); - /** - * The pivot point of the displayObject that it rotates around. - * - * @member {PIXI.ObservablePoint} - */ - this.pivot = new ObservablePoint(this.onChange, this, 0, 0); - /** - * The skew amount, on the x and y axis. - * - * @member {PIXI.ObservablePoint} - */ - this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); - /** - * The rotation amount. - * - * @protected - * @member {number} - */ - this._rotation = 0; - /** - * The X-coordinate value of the normalized local X axis, - * the first column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._cx = 1; - /** - * The Y-coordinate value of the normalized local X axis, - * the first column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._sx = 0; - /** - * The X-coordinate value of the normalized local Y axis, - * the second column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._cy = 0; - /** - * The Y-coordinate value of the normalized local Y axis, - * the second column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._sy = 1; - /** - * The locally unique ID of the local transform. - * - * @protected - * @member {number} - */ - this._localID = 0; - /** - * The locally unique ID of the local transform - * used to calculate the current local transformation matrix. - * - * @protected - * @member {number} - */ - this._currentLocalID = 0; - /** - * The locally unique ID of the world transform. - * - * @protected - * @member {number} - */ - this._worldID = 0; - /** - * The locally unique ID of the parent's world transform - * used to calculate the current world transformation matrix. - * - * @protected - * @member {number} - */ - this._parentID = 0; - } - /** - * Called when a value changes. - * - * @protected - */ - Transform.prototype.onChange = function () { - this._localID++; - }; - /** - * Called when the skew or the rotation changes. - * - * @protected - */ - Transform.prototype.updateSkew = function () { - this._cx = Math.cos(this._rotation + this.skew.y); - this._sx = Math.sin(this._rotation + this.skew.y); - this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 - this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 - this._localID++; - }; - /** - * Updates the local transformation matrix. - */ - Transform.prototype.updateLocalTransform = function () { - var lt = this.localTransform; - if (this._localID !== this._currentLocalID) { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cx * this.scale.x; - lt.b = this._sx * this.scale.x; - lt.c = this._cy * this.scale.y; - lt.d = this._sy * this.scale.y; - lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); - lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); - this._currentLocalID = this._localID; - // force an update.. - this._parentID = -1; - } - }; - /** - * Updates the local and the world transformation matrices. - * - * @param {PIXI.Transform} parentTransform - The parent transform - */ - Transform.prototype.updateTransform = function (parentTransform) { - var lt = this.localTransform; - if (this._localID !== this._currentLocalID) { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cx * this.scale.x; - lt.b = this._sx * this.scale.x; - lt.c = this._cy * this.scale.y; - lt.d = this._sy * this.scale.y; - lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); - lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); - this._currentLocalID = this._localID; - // force an update.. - this._parentID = -1; - } - if (this._parentID !== parentTransform._worldID) { - // concat the parent matrix with the objects transform. - var pt = parentTransform.worldTransform; - var wt = this.worldTransform; - wt.a = (lt.a * pt.a) + (lt.b * pt.c); - wt.b = (lt.a * pt.b) + (lt.b * pt.d); - wt.c = (lt.c * pt.a) + (lt.d * pt.c); - wt.d = (lt.c * pt.b) + (lt.d * pt.d); - wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx; - wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty; - this._parentID = parentTransform._worldID; - // update the id of the transform.. - this._worldID++; - } - }; - /** - * Decomposes a matrix and sets the transforms properties based on it. - * - * @param {PIXI.Matrix} matrix - The matrix to decompose - */ - Transform.prototype.setFromMatrix = function (matrix) { - matrix.decompose(this); - this._localID++; - }; - Object.defineProperty(Transform.prototype, "rotation", { - /** - * The rotation of the object in radians. - * - * @member {number} - */ - get: function () { - return this._rotation; - }, - set: function (value) { - if (this._rotation !== value) { - this._rotation = value; - this.updateSkew(); - } - }, - enumerable: false, - configurable: true - }); - /** - * A default (identity) transform - * - * @static - * @constant - * @member {PIXI.Transform} - */ - Transform.IDENTITY = new Transform(); - return Transform; - }()); - - /*! - * @pixi/display - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/display is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Sets the default value for the container property 'sortableChildren'. - * If set to true, the container will sort its children by zIndex value - * when updateTransform() is called, or manually if sortChildren() is called. - * - * This actually changes the order of elements in the array, so should be treated - * as a basic solution that is not performant compared to other solutions, - * such as @link https://github.com/pixijs/pixi-display - * - * Also be aware of that this may not work nicely with the addChildAt() function, - * as the zIndex sorting may cause the child to automatically sorted to another position. - * - * @static - * @constant - * @name SORTABLE_CHILDREN - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - settings.SORTABLE_CHILDREN = false; - - /** - * 'Builder' pattern for bounds rectangles. - * - * This could be called an Axis-Aligned Bounding Box. - * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. - * - * @class - * @memberof PIXI - */ - var Bounds = /** @class */ (function () { - function Bounds() { - /** - * @member {number} - * @default 0 - */ - this.minX = Infinity; - /** - * @member {number} - * @default 0 - */ - this.minY = Infinity; - /** - * @member {number} - * @default 0 - */ - this.maxX = -Infinity; - /** - * @member {number} - * @default 0 - */ - this.maxY = -Infinity; - this.rect = null; - /** - * It is updated to _boundsID of corresponding object to keep bounds in sync with content. - * Updated from outside, thus public modifier. - * - * @member {number} - * @public - */ - this.updateID = -1; - } - /** - * Checks if bounds are empty. - * - * @return {boolean} True if empty. - */ - Bounds.prototype.isEmpty = function () { - return this.minX > this.maxX || this.minY > this.maxY; - }; - /** - * Clears the bounds and resets. - * - */ - Bounds.prototype.clear = function () { - this.minX = Infinity; - this.minY = Infinity; - this.maxX = -Infinity; - this.maxY = -Infinity; - }; - /** - * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle - * It is not guaranteed that it will return tempRect - * - * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty - * @returns {PIXI.Rectangle} A rectangle of the bounds - */ - Bounds.prototype.getRectangle = function (rect) { - if (this.minX > this.maxX || this.minY > this.maxY) { - return Rectangle.EMPTY; - } - rect = rect || new Rectangle(0, 0, 1, 1); - rect.x = this.minX; - rect.y = this.minY; - rect.width = this.maxX - this.minX; - rect.height = this.maxY - this.minY; - return rect; - }; - /** - * This function should be inlined when its possible. - * - * @param {PIXI.IPointData} point - The point to add. - */ - Bounds.prototype.addPoint = function (point) { - this.minX = Math.min(this.minX, point.x); - this.maxX = Math.max(this.maxX, point.x); - this.minY = Math.min(this.minY, point.y); - this.maxY = Math.max(this.maxY, point.y); - }; - /** - * Adds a quad, not transformed - * - * @param {Float32Array} vertices - The verts to add. - */ - Bounds.prototype.addQuad = function (vertices) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - var x = vertices[0]; - var y = vertices[1]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[2]; - y = vertices[3]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[4]; - y = vertices[5]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[6]; - y = vertices[7]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds sprite frame, transformed. - * - * @param {PIXI.Transform} transform - transform to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { - this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); - }; - /** - * Adds sprite frame, multiplied by matrix - * - * @param {PIXI.Matrix} matrix - matrix to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - var x = (a * x0) + (c * y0) + tx; - var y = (b * x0) + (d * y0) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x1) + (c * y0) + tx; - y = (b * x1) + (d * y0) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x0) + (c * y1) + tx; - y = (b * x0) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x1) + (c * y1) + tx; - y = (b * x1) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds screen vertices from array - * - * @param {Float32Array} vertexData - calculated vertices - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - for (var i = beginOffset; i < endOffset; i += 2) { - var x = vertexData[i]; - var y = vertexData[i + 1]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Add an array of mesh vertices - * - * @param {PIXI.Transform} transform - mesh transform - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { - this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); - }; - /** - * Add an array of mesh vertices. - * - * @param {PIXI.Matrix} matrix - mesh matrix - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - * @param {number} [padX=0] - x padding - * @param {number} [padY=0] - y padding - */ - Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { - if (padX === void 0) { padX = 0; } - if (padY === void 0) { padY = padX; } - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - for (var i = beginOffset; i < endOffset; i += 2) { - var rawX = vertices[i]; - var rawY = vertices[i + 1]; - var x = (a * rawX) + (c * rawY) + tx; - var y = (d * rawY) + (b * rawX) + ty; - minX = Math.min(minX, x - padX); - maxX = Math.max(maxX, x + padX); - minY = Math.min(minY, y - padY); - maxY = Math.max(maxY, y + padY); - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds other Bounds. - * - * @param {PIXI.Bounds} bounds - The Bounds to be added - */ - Bounds.prototype.addBounds = function (bounds) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = bounds.minX < minX ? bounds.minX : minX; - this.minY = bounds.minY < minY ? bounds.minY : minY; - this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; - this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; - }; - /** - * Adds other Bounds, masked with Bounds. - * - * @param {PIXI.Bounds} bounds - The Bounds to be added. - * @param {PIXI.Bounds} mask - TODO - */ - Bounds.prototype.addBoundsMask = function (bounds, mask) { - var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; - var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; - var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; - var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; - if (_minX <= _maxX && _minY <= _maxY) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - /** - * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. - * - * @param {PIXI.Bounds} bounds - other bounds - * @param {PIXI.Matrix} matrix - multiplicator - */ - Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { - this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); - }; - /** - * Adds other Bounds, masked with Rectangle. - * - * @param {PIXI.Bounds} bounds - TODO - * @param {PIXI.Rectangle} area - TODO - */ - Bounds.prototype.addBoundsArea = function (bounds, area) { - var _minX = bounds.minX > area.x ? bounds.minX : area.x; - var _minY = bounds.minY > area.y ? bounds.minY : area.y; - var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); - var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); - if (_minX <= _maxX && _minY <= _maxY) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - /** - * Pads bounds object, making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - */ - Bounds.prototype.pad = function (paddingX, paddingY) { - if (paddingX === void 0) { paddingX = 0; } - if (paddingY === void 0) { paddingY = paddingX; } - if (!this.isEmpty()) { - this.minX -= paddingX; - this.maxX += paddingX; - this.minY -= paddingY; - this.maxY += paddingY; - } - }; - /** - * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) - * - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - * @param {number} padX - padding X - * @param {number} padY - padding Y - */ - Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { - x0 -= padX; - y0 -= padY; - x1 += padX; - y1 += padY; - this.minX = this.minX < x0 ? this.minX : x0; - this.maxX = this.maxX > x1 ? this.maxX : x1; - this.minY = this.minY < y0 ? this.minY : y0; - this.maxY = this.maxY > y1 ? this.maxY : y1; - }; - return Bounds; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * The base class for all objects that are rendered on the screen. - * - * This is an abstract class and should not be used on its own; rather it should b e extended. - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var DisplayObject = /** @class */ (function (_super) { - __extends(DisplayObject, _super); - function DisplayObject() { - var _this = _super.call(this) || this; - _this.tempDisplayObjectParent = null; - // TODO: need to create Transform from factory - /** - * World transform and local transform of this object. - * This will become read-only later, please do not assign anything there unless you know what are you doing. - * - * @member {PIXI.Transform} - */ - _this.transform = new Transform(); - /** - * The opacity of the object. - * - * @member {number} - */ - _this.alpha = 1; - /** - * The visibility of the object. If false the object will not be drawn, and - * the updateTransform function will not be called. - * - * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually. - * - * @member {boolean} - */ - _this.visible = true; - /** - * Can this object be rendered, if false the object will not be drawn but the updateTransform - * methods will still be called. - * - * Only affects recursive calls from parent. You can ask for bounds manually. - * - * @member {boolean} - */ - _this.renderable = true; - /** - * The display object container that contains this display object. - * - * @member {PIXI.Container} - */ - _this.parent = null; - /** - * The multiplied alpha of the displayObject. - * - * @member {number} - * @readonly - */ - _this.worldAlpha = 1; - /** - * Which index in the children array the display component was before the previous zIndex sort. - * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. - * - * @member {number} - * @protected - */ - _this._lastSortedIndex = 0; - /** - * The zIndex of the displayObject. - * A higher value will mean it will be rendered on top of other displayObjects within the same container. - * - * @member {number} - * @protected - */ - _this._zIndex = 0; - /** - * The area the filter is applied to. This is used as more of an optimization - * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle. - * - * Also works as an interaction mask. - * - * @member {?PIXI.Rectangle} - */ - _this.filterArea = null; - /** - * Sets the filters for the displayObject. - * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * To remove filters simply set this property to `'null'`. - * - * @member {?PIXI.Filter[]} - */ - _this.filters = null; - /** - * Currently enabled filters - * @member {PIXI.Filter[]} - * @protected - */ - _this._enabledFilters = null; - /** - * The bounds object, this is used to calculate and store the bounds of the displayObject. - * - * @member {PIXI.Bounds} - */ - _this._bounds = new Bounds(); - /** - * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. - * - * @member {PIXI.Bounds} - */ - _this._localBounds = null; - /** - * Flags the cached bounds as dirty. - * - * @member {number} - * @protected - */ - _this._boundsID = 0; - /** - * Cache of this display-object's bounds-rectangle. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._boundsRect = null; - /** - * Cache of this display-object's local-bounds rectangle. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._localBoundsRect = null; - /** - * The original, cached mask of the object. - * - * @member {PIXI.Container|PIXI.MaskData|null} - * @protected - */ - _this._mask = null; - /** - * Fired when this DisplayObject is added to a Container. - * - * @event PIXI.DisplayObject#added - * @param {PIXI.Container} container - The container added to. - */ - /** - * Fired when this DisplayObject is removed from a Container. - * - * @event PIXI.DisplayObject#removed - * @param {PIXI.Container} container - The container removed from. - */ - /** - * If the object has been destroyed via destroy(). If true, it should not be used. - * - * @member {boolean} - * @protected - */ - _this._destroyed = false; - /** - * used to fast check if a sprite is.. a sprite! - * @member {boolean} - */ - _this.isSprite = false; - /** - * Does any other displayObject use this object as a mask? - * @member {boolean} - */ - _this.isMask = false; - return _this; - } - /** - * Mixes all enumerable properties and methods from a source object to DisplayObject. - * - * @param {object} source - The source of properties and methods to mix in. - */ - DisplayObject.mixin = function (source) { - // in ES8/ES2017, this would be really easy: - // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); - // get all the enumerable property keys - var keys = Object.keys(source); - // loop through properties - for (var i = 0; i < keys.length; ++i) { - var propertyName = keys[i]; - // Set the property using the property descriptor - this works for accessors and normal value properties - Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); - } - }; - /** - * Recursively updates transform of all objects from the root to this one - * internal function for toLocal() - */ - DisplayObject.prototype._recursivePostUpdateTransform = function () { - if (this.parent) { - this.parent._recursivePostUpdateTransform(); - this.transform.updateTransform(this.parent.transform); - } - else { - this.transform.updateTransform(this._tempDisplayObjectParent.transform); - } - }; - /** - * Updates the object transform for rendering. - * - * TODO - Optimization pass! - */ - DisplayObject.prototype.updateTransform = function () { - this._boundsID++; - this.transform.updateTransform(this.parent.transform); - // multiply the alphas.. - this.worldAlpha = this.alpha * this.parent.worldAlpha; - }; - /** - * Retrieves the bounds of the displayObject as a rectangle object. - * - * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from - * being updated. This means the calculation returned MAY be out of date BUT will give you a - * nice performance boost. - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - DisplayObject.prototype.getBounds = function (skipUpdate, rect) { - if (!skipUpdate) { - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.updateTransform(); - this.parent = null; - } - else { - this._recursivePostUpdateTransform(); - this.updateTransform(); - } - } - if (this._bounds.updateID !== this._boundsID) { - this.calculateBounds(); - this._bounds.updateID = this._boundsID; - } - if (!rect) { - if (!this._boundsRect) { - this._boundsRect = new Rectangle(); - } - rect = this._boundsRect; - } - return this._bounds.getRectangle(rect); - }; - /** - * Retrieves the local bounds of the displayObject as a rectangle object. - * - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - DisplayObject.prototype.getLocalBounds = function (rect) { - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - if (!this._localBounds) { - this._localBounds = new Bounds(); - } - var transformRef = this.transform; - var parentRef = this.parent; - this.parent = null; - this.transform = this._tempDisplayObjectParent.transform; - var worldBounds = this._bounds; - var worldBoundsID = this._boundsID; - this._bounds = this._localBounds; - var bounds = this.getBounds(false, rect); - this.parent = parentRef; - this.transform = transformRef; - this._bounds = worldBounds; - this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects - return bounds; - }; - /** - * Calculates the global position of the display object. - * - * @param {PIXI.IPointData} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional - * (otherwise will create a new Point). - * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. - */ - DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { - if (skipUpdate === void 0) { skipUpdate = false; } - if (!skipUpdate) { - this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. - // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly - // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.displayObjectUpdateTransform(); - this.parent = null; - } - else { - this.displayObjectUpdateTransform(); - } - } - // don't need to update the lot - return this.worldTransform.apply(position, point); - }; - /** - * Calculates the local position of the display object relative to another point. - * - * @param {PIXI.IPointData} position - The world origin to calculate from. - * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional - * (otherwise will create a new Point). - * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object - */ - DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { - if (from) { - position = from.toGlobal(position, point, skipUpdate); - } - if (!skipUpdate) { - this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. - // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly - // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.displayObjectUpdateTransform(); - this.parent = null; - } - else { - this.displayObjectUpdateTransform(); - } - } - // simply apply the matrix.. - return this.worldTransform.applyInverse(position, point); - }; - /** - * Set the parent Container of this DisplayObject. - * - * @param {PIXI.Container} container - The Container to add this DisplayObject to. - * @return {PIXI.Container} The Container that this DisplayObject was added to. - */ - DisplayObject.prototype.setParent = function (container) { - if (!container || !container.addChild) { - throw new Error('setParent: Argument must be a Container'); - } - container.addChild(this); - return container; - }; - /** - * Convenience function to set the position, scale, skew and pivot at once. - * - * @param {number} [x=0] - The X position - * @param {number} [y=0] - The Y position - * @param {number} [scaleX=1] - The X scale value - * @param {number} [scaleY=1] - The Y scale value - * @param {number} [rotation=0] - The rotation - * @param {number} [skewX=0] - The X skew value - * @param {number} [skewY=0] - The Y skew value - * @param {number} [pivotX=0] - The X pivot value - * @param {number} [pivotY=0] - The Y pivot value - * @return {PIXI.DisplayObject} The DisplayObject instance - */ - DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (scaleX === void 0) { scaleX = 1; } - if (scaleY === void 0) { scaleY = 1; } - if (rotation === void 0) { rotation = 0; } - if (skewX === void 0) { skewX = 0; } - if (skewY === void 0) { skewY = 0; } - if (pivotX === void 0) { pivotX = 0; } - if (pivotY === void 0) { pivotY = 0; } - this.position.x = x; - this.position.y = y; - this.scale.x = !scaleX ? 1 : scaleX; - this.scale.y = !scaleY ? 1 : scaleY; - this.rotation = rotation; - this.skew.x = skewX; - this.skew.y = skewY; - this.pivot.x = pivotX; - this.pivot.y = pivotY; - return this; - }; - /** - * Base destroy method for generic display objects. This will automatically - * remove the display object from its parent Container as well as remove - * all current event listeners and internal references. Do not use a DisplayObject - * after calling `destroy()`. - * - */ - DisplayObject.prototype.destroy = function (_options) { - if (this.parent) { - this.parent.removeChild(this); - } - this.removeAllListeners(); - this.transform = null; - this.parent = null; - this._bounds = null; - this._mask = null; - this.filters = null; - this.filterArea = null; - this.hitArea = null; - this.interactive = false; - this.interactiveChildren = false; - this._destroyed = true; - }; - Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { - /** - * @protected - * @member {PIXI.Container} - */ - get: function () { - if (this.tempDisplayObjectParent === null) { - // eslint-disable-next-line no-use-before-define - this.tempDisplayObjectParent = new TemporaryDisplayObject(); - } - return this.tempDisplayObjectParent; - }, - enumerable: false, - configurable: true - }); - /** - * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root - * - * ``` - * const cacheParent = elem.enableTempParent(); - * elem.updateTransform(); - * elem.disableTempParent(cacheParent); - * ``` - * - * @returns {PIXI.DisplayObject} current parent - */ - DisplayObject.prototype.enableTempParent = function () { - var myParent = this.parent; - this.parent = this._tempDisplayObjectParent; - return myParent; - }; - /** - * Pair method for `enableTempParent` - * @param {PIXI.DisplayObject} cacheParent actual parent of element - */ - DisplayObject.prototype.disableTempParent = function (cacheParent) { - this.parent = cacheParent; - }; - Object.defineProperty(DisplayObject.prototype, "x", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * An alias to position.x - * - * @member {number} - */ - get: function () { - return this.position.x; - }, - set: function (value) { - this.transform.position.x = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "y", { - /** - * The position of the displayObject on the y axis relative to the local coordinates of the parent. - * An alias to position.y - * - * @member {number} - */ - get: function () { - return this.position.y; - }, - set: function (value) { - this.transform.position.y = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "worldTransform", { - /** - * Current transform of the object based on world (parent) factors. - * - * @member {PIXI.Matrix} - * @readonly - */ - get: function () { - return this.transform.worldTransform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "localTransform", { - /** - * Current transform of the object based on local factors: position, scale, other stuff. - * - * @member {PIXI.Matrix} - * @readonly - */ - get: function () { - return this.transform.localTransform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "position", { - /** - * The coordinate of the object relative to the local coordinates of the parent. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.position; - }, - set: function (value) { - this.transform.position.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "scale", { - /** - * The scale factor of the object. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.scale; - }, - set: function (value) { - this.transform.scale.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "pivot", { - /** - * The pivot point of the displayObject that it rotates around. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.pivot; - }, - set: function (value) { - this.transform.pivot.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "skew", { - /** - * The skew factor for the object in radians. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.skew; - }, - set: function (value) { - this.transform.skew.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "rotation", { - /** - * The rotation of the object in radians. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - get: function () { - return this.transform.rotation; - }, - set: function (value) { - this.transform.rotation = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "angle", { - /** - * The angle of the object in degrees. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - get: function () { - return this.transform.rotation * RAD_TO_DEG; - }, - set: function (value) { - this.transform.rotation = value * DEG_TO_RAD; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "zIndex", { - /** - * The zIndex of the displayObject. - * If a container has the sortableChildren property set to true, children will be automatically - * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, - * and thus rendered on top of other displayObjects within the same container. - * - * @member {number} - */ - get: function () { - return this._zIndex; - }, - set: function (value) { - this._zIndex = value; - if (this.parent) { - this.parent.sortDirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "worldVisible", { - /** - * Indicates if the object is globally visible. - * - * @member {boolean} - * @readonly - */ - get: function () { - var item = this; - do { - if (!item.visible) { - return false; - } - item = item.parent; - } while (item); - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "mask", { - /** - * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PixiJS a regular mask must be a - * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it - * utilities shape clipping. To remove a mask, set this property to `null`. - * - * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. - * @example - * const graphics = new PIXI.Graphics(); - * graphics.beginFill(0xFF3300); - * graphics.drawRect(50, 250, 100, 100); - * graphics.endFill(); - * - * const sprite = new PIXI.Sprite(texture); - * sprite.mask = graphics; - * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. - * - * @member {PIXI.Container|PIXI.MaskData|null} - */ - get: function () { - return this._mask; - }, - set: function (value) { - if (this._mask) { - var maskObject = (this._mask.maskObject || this._mask); - maskObject.renderable = true; - maskObject.isMask = false; - } - this._mask = value; - if (this._mask) { - var maskObject = (this._mask.maskObject || this._mask); - maskObject.renderable = false; - maskObject.isMask = true; - } - }, - enumerable: false, - configurable: true - }); - return DisplayObject; - }(eventemitter3)); - var TemporaryDisplayObject = /** @class */ (function (_super) { - __extends(TemporaryDisplayObject, _super); - function TemporaryDisplayObject() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.sortDirty = null; - return _this; - } - return TemporaryDisplayObject; - }(DisplayObject)); - /** - * DisplayObject default updateTransform, does not update children of container. - * Will crash if there's no parent element. - * - * @memberof PIXI.DisplayObject# - * @function displayObjectUpdateTransform - */ - DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; - - function sortChildren(a, b) { - if (a.zIndex === b.zIndex) { - return a._lastSortedIndex - b._lastSortedIndex; - } - return a.zIndex - b.zIndex; - } - /** - * A Container represents a collection of display objects. - * - * It is the base class of all display objects that act as a container for other objects (like Sprites). - * - *```js - * let container = new PIXI.Container(); - * container.addChild(sprite); - * ``` - * - * @class - * @extends PIXI.DisplayObject - * @memberof PIXI - */ - var Container = /** @class */ (function (_super) { - __extends(Container, _super); - function Container() { - var _this = _super.call(this) || this; - /** - * The array of children of this container. - * - * @member {PIXI.DisplayObject[]} - * @readonly - */ - _this.children = []; - /** - * If set to true, the container will sort its children by zIndex value - * when updateTransform() is called, or manually if sortChildren() is called. - * - * This actually changes the order of elements in the array, so should be treated - * as a basic solution that is not performant compared to other solutions, - * such as @link https://github.com/pixijs/pixi-display - * - * Also be aware of that this may not work nicely with the addChildAt() function, - * as the zIndex sorting may cause the child to automatically sorted to another position. - * - * @see PIXI.settings.SORTABLE_CHILDREN - * - * @member {boolean} - */ - _this.sortableChildren = settings.SORTABLE_CHILDREN; - /** - * Should children be sorted by zIndex at the next updateTransform call. - * Will get automatically set to true if a new child is added, or if a child's zIndex changes. - * - * @member {boolean} - */ - _this.sortDirty = false; - return _this; - /** - * Fired when a DisplayObject is added to this Container. - * - * @event PIXI.Container#childAdded - * @param {PIXI.DisplayObject} child - The child added to the Container. - * @param {PIXI.Container} container - The container that added the child. - * @param {number} index - The children's index of the added child. - */ - /** - * Fired when a DisplayObject is removed from this Container. - * - * @event PIXI.DisplayObject#removedFrom - * @param {PIXI.DisplayObject} child - The child removed from the Container. - * @param {PIXI.Container} container - The container that removed removed the child. - * @param {number} index - The former children's index of the removed child - */ - } - /** - * Overridable method that can be used by Container subclasses whenever the children array is modified - * - * @protected - */ - Container.prototype.onChildrenChange = function (_length) { - /* empty */ - }; - /** - * Adds one or more children to the container. - * - * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` - * - * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container - * @return {PIXI.DisplayObject} The first child that was added. - */ - Container.prototype.addChild = function () { - var arguments$1 = arguments; - - var children = []; - for (var _i = 0; _i < arguments.length; _i++) { - children[_i] = arguments$1[_i]; - } - // if there is only one argument we can bypass looping through the them - if (children.length > 1) { - // loop through the array and add all children - for (var i = 0; i < children.length; i++) { - // eslint-disable-next-line prefer-rest-params - this.addChild(children[i]); - } - } - else { - var child = children[0]; - // if the child has a parent then lets remove it as PixiJS objects can only exist in one place - if (child.parent) { - child.parent.removeChild(child); - } - child.parent = this; - this.sortDirty = true; - // ensure child transform will be recalculated - child.transform._parentID = -1; - this.children.push(child); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(this.children.length - 1); - this.emit('childAdded', child, this, this.children.length - 1); - child.emit('added', this); - } - return children[0]; - }; - /** - * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown - * - * @param {PIXI.DisplayObject} child - The child to add - * @param {number} index - The index to place the child in - * @return {PIXI.DisplayObject} The child that was added. - */ - Container.prototype.addChildAt = function (child, index) { - if (index < 0 || index > this.children.length) { - throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); - } - if (child.parent) { - child.parent.removeChild(child); - } - child.parent = this; - this.sortDirty = true; - // ensure child transform will be recalculated - child.transform._parentID = -1; - this.children.splice(index, 0, child); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('added', this); - this.emit('childAdded', child, this, index); - return child; - }; - /** - * Swaps the position of 2 Display Objects within this container. - * - * @param {PIXI.DisplayObject} child - First display object to swap - * @param {PIXI.DisplayObject} child2 - Second display object to swap - */ - Container.prototype.swapChildren = function (child, child2) { - if (child === child2) { - return; - } - var index1 = this.getChildIndex(child); - var index2 = this.getChildIndex(child2); - this.children[index1] = child2; - this.children[index2] = child; - this.onChildrenChange(index1 < index2 ? index1 : index2); - }; - /** - * Returns the index position of a child DisplayObject instance - * - * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify - * @return {number} The index position of the child display object to identify - */ - Container.prototype.getChildIndex = function (child) { - var index = this.children.indexOf(child); - if (index === -1) { - throw new Error('The supplied DisplayObject must be a child of the caller'); - } - return index; - }; - /** - * Changes the position of an existing child in the display object container - * - * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number - * @param {number} index - The resulting index number for the child display object - */ - Container.prototype.setChildIndex = function (child, index) { - if (index < 0 || index >= this.children.length) { - throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); - } - var currentIndex = this.getChildIndex(child); - removeItems(this.children, currentIndex, 1); // remove from old position - this.children.splice(index, 0, child); // add at new position - this.onChildrenChange(index); - }; - /** - * Returns the child at the specified index - * - * @param {number} index - The index to get the child at - * @return {PIXI.DisplayObject} The child at the given index, if any. - */ - Container.prototype.getChildAt = function (index) { - if (index < 0 || index >= this.children.length) { - throw new Error("getChildAt: Index (" + index + ") does not exist."); - } - return this.children[index]; - }; - /** - * Removes one or more children from the container. - * - * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove - * @return {PIXI.DisplayObject} The first child that was removed. - */ - Container.prototype.removeChild = function () { - var arguments$1 = arguments; - - var children = []; - for (var _i = 0; _i < arguments.length; _i++) { - children[_i] = arguments$1[_i]; - } - // if there is only one argument we can bypass looping through the them - if (children.length > 1) { - // loop through the arguments property and remove all children - for (var i = 0; i < children.length; i++) { - this.removeChild(children[i]); - } - } - else { - var child = children[0]; - var index = this.children.indexOf(child); - if (index === -1) - { return null; } - child.parent = null; - // ensure child transform will be recalculated - child.transform._parentID = -1; - removeItems(this.children, index, 1); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('removed', this); - this.emit('childRemoved', child, this, index); - } - return children[0]; - }; - /** - * Removes a child from the specified index position. - * - * @param {number} index - The index to get the child from - * @return {PIXI.DisplayObject} The child that was removed. - */ - Container.prototype.removeChildAt = function (index) { - var child = this.getChildAt(index); - // ensure child transform will be recalculated.. - child.parent = null; - child.transform._parentID = -1; - removeItems(this.children, index, 1); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('removed', this); - this.emit('childRemoved', child, this, index); - return child; - }; - /** - * Removes all children from this container that are within the begin and end indexes. - * - * @param {number} [beginIndex=0] - The beginning position. - * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container. - * @returns {PIXI.DisplayObject[]} List of removed children - */ - Container.prototype.removeChildren = function (beginIndex, endIndex) { - if (beginIndex === void 0) { beginIndex = 0; } - if (endIndex === void 0) { endIndex = this.children.length; } - var begin = beginIndex; - var end = endIndex; - var range = end - begin; - var removed; - if (range > 0 && range <= end) { - removed = this.children.splice(begin, range); - for (var i = 0; i < removed.length; ++i) { - removed[i].parent = null; - if (removed[i].transform) { - removed[i].transform._parentID = -1; - } - } - this._boundsID++; - this.onChildrenChange(beginIndex); - for (var i = 0; i < removed.length; ++i) { - removed[i].emit('removed', this); - this.emit('childRemoved', removed[i], this, i); - } - return removed; - } - else if (range === 0 && this.children.length === 0) { - return []; - } - throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); - }; - /** - * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex. - */ - Container.prototype.sortChildren = function () { - var sortRequired = false; - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - child._lastSortedIndex = i; - if (!sortRequired && child.zIndex !== 0) { - sortRequired = true; - } - } - if (sortRequired && this.children.length > 1) { - this.children.sort(sortChildren); - } - this.sortDirty = false; - }; - /** - * Updates the transform on all children of this container for rendering - */ - Container.prototype.updateTransform = function () { - if (this.sortableChildren && this.sortDirty) { - this.sortChildren(); - } - this._boundsID++; - this.transform.updateTransform(this.parent.transform); - // TODO: check render flags, how to process stuff here - this.worldAlpha = this.alpha * this.parent.worldAlpha; - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - if (child.visible) { - child.updateTransform(); - } - } - }; - /** - * Recalculates the bounds of the container. - * - */ - Container.prototype.calculateBounds = function () { - this._bounds.clear(); - this._calculateBounds(); - for (var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if (!child.visible || !child.renderable) { - continue; - } - child.calculateBounds(); - // TODO: filter+mask, need to mask both somehow - if (child._mask) { - var maskObject = (child._mask.maskObject || child._mask); - maskObject.calculateBounds(); - this._bounds.addBoundsMask(child._bounds, maskObject._bounds); - } - else if (child.filterArea) { - this._bounds.addBoundsArea(child._bounds, child.filterArea); - } - else { - this._bounds.addBounds(child._bounds); - } - } - this._bounds.updateID = this._boundsID; - }; - /** - * Retrieves the local bounds of the displayObject as a rectangle object. - * - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms, - * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { - if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } - var result = _super.prototype.getLocalBounds.call(this, rect); - if (!skipChildrenUpdate) { - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - if (child.visible) { - child.updateTransform(); - } - } - } - return result; - }; - /** - * Recalculates the bounds of the object. Override this to - * calculate the bounds of the specific object (not including children). - * - * @protected - */ - Container.prototype._calculateBounds = function () { - // FILL IN// - }; - /** - * Renders the object using the WebGL renderer - * - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype.render = function (renderer) { - // if the object is not visible or the alpha is 0 then no need to render this element - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - // do a quick check to see if this element has a mask or a filter. - if (this._mask || (this.filters && this.filters.length)) { - this.renderAdvanced(renderer); - } - else { - this._render(renderer); - // simple render children! - for (var i = 0, j = this.children.length; i < j; ++i) { - this.children[i].render(renderer); - } - } - }; - /** - * Render the object using the WebGL renderer and advanced features. - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype.renderAdvanced = function (renderer) { - renderer.batch.flush(); - var filters = this.filters; - var mask = this._mask; - // push filter first as we need to ensure the stencil buffer is correct for any masking - if (filters) { - if (!this._enabledFilters) { - this._enabledFilters = []; - } - this._enabledFilters.length = 0; - for (var i = 0; i < filters.length; i++) { - if (filters[i].enabled) { - this._enabledFilters.push(filters[i]); - } - } - if (this._enabledFilters.length) { - renderer.filter.push(this, this._enabledFilters); - } - } - if (mask) { - renderer.mask.push(this, this._mask); - } - // add this object to the batch, only rendered if it has a texture. - this._render(renderer); - // now loop through the children and make sure they get rendered - for (var i = 0, j = this.children.length; i < j; i++) { - this.children[i].render(renderer); - } - renderer.batch.flush(); - if (mask) { - renderer.mask.pop(this); - } - if (filters && this._enabledFilters && this._enabledFilters.length) { - renderer.filter.pop(); - } - }; - /** - * To be overridden by the subclasses. - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype._render = function (_renderer) { - // this is where content itself gets rendered... - }; - /** - * Removes all internal references and listeners as well as removes children from the display list. - * Do not use a Container after calling `destroy`. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - Container.prototype.destroy = function (options) { - _super.prototype.destroy.call(this); - this.sortDirty = false; - var destroyChildren = typeof options === 'boolean' ? options : options && options.children; - var oldChildren = this.removeChildren(0, this.children.length); - if (destroyChildren) { - for (var i = 0; i < oldChildren.length; ++i) { - oldChildren[i].destroy(options); - } - } - }; - Object.defineProperty(Container.prototype, "width", { - /** - * The width of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this.scale.x * this.getLocalBounds().width; - }, - set: function (value) { - var width = this.getLocalBounds().width; - if (width !== 0) { - this.scale.x = value / width; - } - else { - this.scale.x = 1; - } - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Container.prototype, "height", { - /** - * The height of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this.scale.y * this.getLocalBounds().height; - }, - set: function (value) { - var height = this.getLocalBounds().height; - if (height !== 0) { - this.scale.y = value / height; - } - else { - this.scale.y = 1; - } - this._height = value; - }, - enumerable: false, - configurable: true - }); - return Container; - }(DisplayObject)); - /** - * Container default updateTransform, does update children of container. - * Will crash if there's no parent element. - * - * @memberof PIXI.Container# - * @function containerUpdateTransform - */ - Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; - - /*! - * @pixi/accessibility - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/accessibility is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Default property values of accessible objects - * used by {@link PIXI.AccessibilityManager}. - * - * @private - * @function accessibleTarget - * @memberof PIXI - * @type {Object} - * @example - * function MyObject() {} - * - * Object.assign( - * MyObject.prototype, - * PIXI.accessibleTarget - * ); - */ - var accessibleTarget = { - /** - * Flag for if the object is accessible. If true AccessibilityManager will overlay a - * shadow div with attributes set - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - accessible: false, - /** - * Sets the title attribute of the shadow div - * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' - * - * @member {?string} - * @memberof PIXI.DisplayObject# - */ - accessibleTitle: null, - /** - * Sets the aria-label attribute of the shadow div - * - * @member {string} - * @memberof PIXI.DisplayObject# - */ - accessibleHint: null, - /** - * @member {number} - * @memberof PIXI.DisplayObject# - * @private - * @todo Needs docs. - */ - tabIndex: 0, - /** - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @todo Needs docs. - */ - _accessibleActive: false, - /** - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @todo Needs docs. - */ - _accessibleDiv: null, - /** - * Specify the type of div the accessible layer is. Screen readers treat the element differently - * depending on this type. Defaults to button. - * - * @member {string} - * @memberof PIXI.DisplayObject# - * @default 'button' - */ - accessibleType: 'button', - /** - * Specify the pointer-events the accessible div will use - * Defaults to auto. - * - * @member {string} - * @memberof PIXI.DisplayObject# - * @default 'auto' - */ - accessiblePointerEvents: 'auto', - /** - * Setting to false will prevent any children inside this container to - * be accessible. Defaults to true. - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @default true - */ - accessibleChildren: true, - renderId: -1, - }; - - // add some extra variables to the container.. - DisplayObject.mixin(accessibleTarget); - var KEY_CODE_TAB = 9; - var DIV_TOUCH_SIZE = 100; - var DIV_TOUCH_POS_X = 0; - var DIV_TOUCH_POS_Y = 0; - var DIV_TOUCH_ZINDEX = 2; - var DIV_HOOK_SIZE = 1; - var DIV_HOOK_POS_X = -1000; - var DIV_HOOK_POS_Y = -1000; - var DIV_HOOK_ZINDEX = 2; - /** - * The Accessibility manager recreates the ability to tab and have content read by screen readers. - * This is very important as it can possibly help people with disabilities access PixiJS content. - * - * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the - * events as if the mouse was being used, minimizing the effort required to implement. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` - * - * @class - * @memberof PIXI - */ - var AccessibilityManager = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer - */ - function AccessibilityManager(renderer) { - /** - * @type {?HTMLElement} - * @private - */ - this._hookDiv = null; - if (isMobile$1.tablet || isMobile$1.phone) { - this.createTouchHook(); - } - // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. - var div = document.createElement('div'); - div.style.width = DIV_TOUCH_SIZE + "px"; - div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.position = 'absolute'; - div.style.top = DIV_TOUCH_POS_X + "px"; - div.style.left = DIV_TOUCH_POS_Y + "px"; - div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); - /** - * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. - * - * @type {HTMLElement} - * @private - */ - this.div = div; - /** - * A simple pool for storing divs. - * - * @type {*} - * @private - */ - this.pool = []; - /** - * This is a tick used to check if an object is no longer being rendered. - * - * @type {Number} - * @private - */ - this.renderId = 0; - /** - * Setting this to true will visually show the divs. - * - * @type {boolean} - */ - this.debug = false; - /** - * The renderer this accessibility manager works for. - * - * @member {PIXI.AbstractRenderer} - */ - this.renderer = renderer; - /** - * The array of currently active accessible items. - * - * @member {Array<*>} - * @private - */ - this.children = []; - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onKeyDown = this._onKeyDown.bind(this); - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onMouseMove = this._onMouseMove.bind(this); - this._isActive = false; - this._isMobileAccessibility = false; - /** - * count to throttle div updates on android devices - * @type number - * @private - */ - this.androidUpdateCount = 0; - /** - * the frequency to update the div elements () - * @private - */ - this.androidUpdateFrequency = 500; // 2fps - // let listen for tab.. once pressed we can fire up and show the accessibility layer - window.addEventListener('keydown', this._onKeyDown, false); - } - Object.defineProperty(AccessibilityManager.prototype, "isActive", { - /** - * A flag - * @member {boolean} - * @readonly - */ - get: function () { - return this._isActive; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AccessibilityManager.prototype, "isMobileAccessibility", { - /** - * A flag - * @member {boolean} - * @readonly - */ - get: function () { - return this._isMobileAccessibility; - }, - enumerable: false, - configurable: true - }); - /** - * Creates the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.createTouchHook = function () { - var _this = this; - var hookDiv = document.createElement('button'); - hookDiv.style.width = DIV_HOOK_SIZE + "px"; - hookDiv.style.height = DIV_HOOK_SIZE + "px"; - hookDiv.style.position = 'absolute'; - hookDiv.style.top = DIV_HOOK_POS_X + "px"; - hookDiv.style.left = DIV_HOOK_POS_Y + "px"; - hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(); - hookDiv.style.backgroundColor = '#FF0000'; - hookDiv.title = 'select to enable accessability for this content'; - hookDiv.addEventListener('focus', function () { - _this._isMobileAccessibility = true; - _this.activate(); - _this.destroyTouchHook(); - }); - document.body.appendChild(hookDiv); - this._hookDiv = hookDiv; - }; - /** - * Destroys the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.destroyTouchHook = function () { - if (!this._hookDiv) { - return; - } - document.body.removeChild(this._hookDiv); - this._hookDiv = null; - }; - /** - * Activating will cause the Accessibility layer to be shown. - * This is called when a user presses the tab key. - * - * @private - */ - AccessibilityManager.prototype.activate = function () { - if (this._isActive) { - return; - } - this._isActive = true; - window.document.addEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown, false); - // TODO: Remove casting when CanvasRenderer is converted - this.renderer.on('postrender', this.update, this); - if (this.renderer.view.parentNode) { - this.renderer.view.parentNode.appendChild(this.div); - } - }; - /** - * Deactivating will cause the Accessibility layer to be hidden. - * This is called when a user moves the mouse. - * - * @private - */ - AccessibilityManager.prototype.deactivate = function () { - if (!this._isActive || this._isMobileAccessibility) { - return; - } - this._isActive = false; - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.addEventListener('keydown', this._onKeyDown, false); - // TODO: Remove casting when CanvasRenderer is converted - this.renderer.off('postrender', this.update); - if (this.div.parentNode) { - this.div.parentNode.removeChild(this.div); - } - }; - /** - * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. - * - * @private - * @param {PIXI.Container} displayObject - The DisplayObject to check. - */ - AccessibilityManager.prototype.updateAccessibleObjects = function (displayObject) { - if (!displayObject.visible || !displayObject.accessibleChildren) { - return; - } - if (displayObject.accessible && displayObject.interactive) { - if (!displayObject._accessibleActive) { - this.addChild(displayObject); - } - displayObject.renderId = this.renderId; - } - var children = displayObject.children; - for (var i = 0; i < children.length; i++) { - this.updateAccessibleObjects(children[i]); - } - }; - /** - * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. - * - * @private - */ - AccessibilityManager.prototype.update = function () { - /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex, - * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate, - * so I am just running update every half a second, seems to fix it. - */ - var now = performance.now(); - if (isMobile$1.android.device && now < this.androidUpdateCount) { - return; - } - this.androidUpdateCount = now + this.androidUpdateFrequency; - if (!this.renderer.renderingToScreen) { - return; - } - // update children... - if (this.renderer._lastObjectRendered) { - this.updateAccessibleObjects(this.renderer._lastObjectRendered); - } - // TODO: Remove casting when CanvasRenderer is converted - var rect = this.renderer.view.getBoundingClientRect(); - var resolution = this.renderer.resolution; - var sx = (rect.width / this.renderer.width) * resolution; - var sy = (rect.height / this.renderer.height) * resolution; - var div = this.div; - div.style.left = rect.left + "px"; - div.style.top = rect.top + "px"; - div.style.width = this.renderer.width + "px"; - div.style.height = this.renderer.height + "px"; - for (var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if (child.renderId !== this.renderId) { - child._accessibleActive = false; - removeItems(this.children, i, 1); - this.div.removeChild(child._accessibleDiv); - this.pool.push(child._accessibleDiv); - child._accessibleDiv = null; - i--; - } - else { - // map div to display.. - div = child._accessibleDiv; - var hitArea = child.hitArea; - var wt = child.worldTransform; - if (child.hitArea) { - div.style.left = (wt.tx + (hitArea.x * wt.a)) * sx + "px"; - div.style.top = (wt.ty + (hitArea.y * wt.d)) * sy + "px"; - div.style.width = hitArea.width * wt.a * sx + "px"; - div.style.height = hitArea.height * wt.d * sy + "px"; - } - else { - hitArea = child.getBounds(); - this.capHitArea(hitArea); - div.style.left = hitArea.x * sx + "px"; - div.style.top = hitArea.y * sy + "px"; - div.style.width = hitArea.width * sx + "px"; - div.style.height = hitArea.height * sy + "px"; - // update button titles and hints if they exist and they've changed - if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) { - div.title = child.accessibleTitle; - } - if (div.getAttribute('aria-label') !== child.accessibleHint - && child.accessibleHint !== null) { - div.setAttribute('aria-label', child.accessibleHint); - } - } - // the title or index may have changed, if so lets update it! - if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) { - div.title = child.accessibleTitle; - div.tabIndex = child.tabIndex; - if (this.debug) - { this.updateDebugHTML(div); } - } - } - } - // increment the render id.. - this.renderId++; - }; - /** - * private function that will visually add the information to the - * accessability div - * - * @param {HTMLElement} div - */ - AccessibilityManager.prototype.updateDebugHTML = function (div) { - div.innerHTML = "type: " + div.type + "
title : " + div.title + "
tabIndex: " + div.tabIndex; - }; - /** - * Adjust the hit area based on the bounds of a display object - * - * @param {PIXI.Rectangle} hitArea - Bounds of the child - */ - AccessibilityManager.prototype.capHitArea = function (hitArea) { - if (hitArea.x < 0) { - hitArea.width += hitArea.x; - hitArea.x = 0; - } - if (hitArea.y < 0) { - hitArea.height += hitArea.y; - hitArea.y = 0; - } - // TODO: Remove casting when CanvasRenderer is converted - if (hitArea.x + hitArea.width > this.renderer.width) { - hitArea.width = this.renderer.width - hitArea.x; - } - if (hitArea.y + hitArea.height > this.renderer.height) { - hitArea.height = this.renderer.height - hitArea.y; - } - }; - /** - * Adds a DisplayObject to the accessibility manager - * - * @private - * @param {PIXI.DisplayObject} displayObject - The child to make accessible. - */ - AccessibilityManager.prototype.addChild = function (displayObject) { - // this.activate(); - var div = this.pool.pop(); - if (!div) { - div = document.createElement('button'); - div.style.width = DIV_TOUCH_SIZE + "px"; - div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent'; - div.style.position = 'absolute'; - div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); - div.style.borderStyle = 'none'; - // ARIA attributes ensure that button title and hint updates are announced properly - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { - // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. - div.setAttribute('aria-live', 'off'); - } - else { - div.setAttribute('aria-live', 'polite'); - } - if (navigator.userAgent.match(/rv:.*Gecko\//)) { - // FireFox needs this to announce only the new button name - div.setAttribute('aria-relevant', 'additions'); - } - else { - // required by IE, other browsers don't much care - div.setAttribute('aria-relevant', 'text'); - } - div.addEventListener('click', this._onClick.bind(this)); - div.addEventListener('focus', this._onFocus.bind(this)); - div.addEventListener('focusout', this._onFocusOut.bind(this)); - } - // set pointer events - div.style.pointerEvents = displayObject.accessiblePointerEvents; - // set the type, this defaults to button! - div.type = displayObject.accessibleType; - if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) { - div.title = displayObject.accessibleTitle; - } - else if (!displayObject.accessibleHint - || displayObject.accessibleHint === null) { - div.title = "displayObject " + displayObject.tabIndex; - } - if (displayObject.accessibleHint - && displayObject.accessibleHint !== null) { - div.setAttribute('aria-label', displayObject.accessibleHint); - } - if (this.debug) - { this.updateDebugHTML(div); } - displayObject._accessibleActive = true; - displayObject._accessibleDiv = div; - div.displayObject = displayObject; - this.children.push(displayObject); - this.div.appendChild(displayObject._accessibleDiv); - displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; - }; - /** - * Maps the div button press to pixi's InteractionManager (click) - * - * @private - * @param {MouseEvent} e - The click event. - */ - AccessibilityManager.prototype._onClick = function (e) { - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData); - }; - /** - * Maps the div focus events to pixi's InteractionManager (mouseover) - * - * @private - * @param {FocusEvent} e - The focus event. - */ - AccessibilityManager.prototype._onFocus = function (e) { - if (!e.target.getAttribute('aria-live')) { - e.target.setAttribute('aria-live', 'assertive'); - } - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); - }; - /** - * Maps the div focus events to pixi's InteractionManager (mouseout) - * - * @private - * @param {FocusEvent} e - The focusout event. - */ - AccessibilityManager.prototype._onFocusOut = function (e) { - if (!e.target.getAttribute('aria-live')) { - e.target.setAttribute('aria-live', 'polite'); - } - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); - }; - /** - * Is called when a key is pressed - * - * @private - * @param {KeyboardEvent} e - The keydown event. - */ - AccessibilityManager.prototype._onKeyDown = function (e) { - if (e.keyCode !== KEY_CODE_TAB) { - return; - } - this.activate(); - }; - /** - * Is called when the mouse moves across the renderer element - * - * @private - * @param {MouseEvent} e - The mouse event. - */ - AccessibilityManager.prototype._onMouseMove = function (e) { - if (e.movementX === 0 && e.movementY === 0) { - return; - } - this.deactivate(); - }; - /** - * Destroys the accessibility manager - * - */ - AccessibilityManager.prototype.destroy = function () { - this.destroyTouchHook(); - this.div = null; - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown); - this.pool = null; - this.children = null; - this.renderer = null; - }; - return AccessibilityManager; - }()); - - /*! - * @pixi/ticker - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/ticker is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Target frames per millisecond. - * - * @static - * @name TARGET_FPMS - * @memberof PIXI.settings - * @type {number} - * @default 0.06 - */ - settings.TARGET_FPMS = 0.06; - - /** - * Represents the update priorities used by internal PIXI classes when registered with - * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower - * priority items, such as render, should go later. - * - * @static - * @constant - * @name UPDATE_PRIORITY - * @memberof PIXI - * @enum {number} - * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager} - * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} - * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}. - * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering. - * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility. - */ - - (function (UPDATE_PRIORITY) { - UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; - UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; - UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; - UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; - UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; - })(exports.UPDATE_PRIORITY || (exports.UPDATE_PRIORITY = {})); - - /** - * Internal class for handling the priority sorting of ticker handlers. - * - * @private - * @class - * @memberof PIXI - */ - var TickerListener = /** @class */ (function () { - /** - * Constructor - * @private - * @param {Function} fn - The listener function to be added for one update - * @param {*} [context=null] - The listener context - * @param {number} [priority=0] - The priority for emitting - * @param {boolean} [once=false] - If the handler should fire once - */ - function TickerListener(fn, context, priority, once) { - if (context === void 0) { context = null; } - if (priority === void 0) { priority = 0; } - if (once === void 0) { once = false; } - /** - * The handler function to execute. - * @private - * @member {Function} - */ - this.fn = fn; - /** - * The calling to execute. - * @private - * @member {*} - */ - this.context = context; - /** - * The current priority. - * @private - * @member {number} - */ - this.priority = priority; - /** - * If this should only execute once. - * @private - * @member {boolean} - */ - this.once = once; - /** - * The next item in chain. - * @private - * @member {TickerListener} - */ - this.next = null; - /** - * The previous item in chain. - * @private - * @member {TickerListener} - */ - this.previous = null; - /** - * `true` if this listener has been destroyed already. - * @member {boolean} - * @private - */ - this._destroyed = false; - } - /** - * Simple compare function to figure out if a function and context match. - * @private - * @param {Function} fn - The listener function to be added for one update - * @param {any} [context] - The listener context - * @return {boolean} `true` if the listener match the arguments - */ - TickerListener.prototype.match = function (fn, context) { - if (context === void 0) { context = null; } - return this.fn === fn && this.context === context; - }; - /** - * Emit by calling the current function. - * @private - * @param {number} deltaTime - time since the last emit. - * @return {TickerListener} Next ticker - */ - TickerListener.prototype.emit = function (deltaTime) { - if (this.fn) { - if (this.context) { - this.fn.call(this.context, deltaTime); - } - else { - this.fn(deltaTime); - } - } - var redirect = this.next; - if (this.once) { - this.destroy(true); - } - // Soft-destroying should remove - // the next reference - if (this._destroyed) { - this.next = null; - } - return redirect; - }; - /** - * Connect to the list. - * @private - * @param {TickerListener} previous - Input node, previous listener - */ - TickerListener.prototype.connect = function (previous) { - this.previous = previous; - if (previous.next) { - previous.next.previous = this; - } - this.next = previous.next; - previous.next = this; - }; - /** - * Destroy and don't use after this. - * @private - * @param {boolean} [hard = false] `true` to remove the `next` reference, this - * is considered a hard destroy. Soft destroy maintains the next reference. - * @return {TickerListener} The listener to redirect while emitting or removing. - */ - TickerListener.prototype.destroy = function (hard) { - if (hard === void 0) { hard = false; } - this._destroyed = true; - this.fn = null; - this.context = null; - // Disconnect, hook up next and previous - if (this.previous) { - this.previous.next = this.next; - } - if (this.next) { - this.next.previous = this.previous; - } - // Redirect to the next item - var redirect = this.next; - // Remove references - this.next = hard ? null : redirect; - this.previous = null; - return redirect; - }; - return TickerListener; - }()); - - /** - * A Ticker class that runs an update loop that other objects listen to. - * - * This class is composed around listeners meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. - * - * @class - * @memberof PIXI - */ - var Ticker = /** @class */ (function () { - function Ticker() { - var _this = this; - /** - * The first listener. All new listeners added are chained on this. - * @private - * @type {TickerListener} - */ - this._head = new TickerListener(null, null, Infinity); - /** - * Internal current frame request ID - * @type {?number} - * @private - */ - this._requestId = null; - /** - * Internal value managed by minFPS property setter and getter. - * This is the maximum allowed milliseconds between updates. - * @type {number} - * @private - */ - this._maxElapsedMS = 100; - /** - * Internal value managed by maxFPS property setter and getter. - * This is the minimum allowed milliseconds between updates. - * @type {number} - * @private - */ - this._minElapsedMS = 0; - /** - * Whether or not this ticker should invoke the method - * {@link PIXI.Ticker#start} automatically - * when a listener is added. - * - * @member {boolean} - * @default false - */ - this.autoStart = false; - /** - * Scalar time value from last frame to this frame. - * This value is capped by setting {@link PIXI.Ticker#minFPS} - * and is scaled with {@link PIXI.Ticker#speed}. - * **Note:** The cap may be exceeded by scaling. - * - * @member {number} - * @default 1 - */ - this.deltaTime = 1; - /** - * Scaler time elapsed in milliseconds from last frame to this frame. - * This value is capped by setting {@link PIXI.Ticker#minFPS} - * and is scaled with {@link PIXI.Ticker#speed}. - * **Note:** The cap may be exceeded by scaling. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * Defaults to target frame time - * - * @member {number} - * @default 16.66 - */ - this.deltaMS = 1 / settings.TARGET_FPMS; - /** - * Time elapsed in milliseconds from last frame to this frame. - * Opposed to what the scalar {@link PIXI.Ticker#deltaTime} - * is based, this value is neither capped nor scaled. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * Defaults to target frame time - * - * @member {number} - * @default 16.66 - */ - this.elapsedMS = 1 / settings.TARGET_FPMS; - /** - * The last time {@link PIXI.Ticker#update} was invoked. - * This value is also reset internally outside of invoking - * update, but only when a new animation frame is requested. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * - * @member {number} - * @default -1 - */ - this.lastTime = -1; - /** - * Factor of current {@link PIXI.Ticker#deltaTime}. - * @example - * // Scales ticker.deltaTime to what would be - * // the equivalent of approximately 120 FPS - * ticker.speed = 2; - * - * @member {number} - * @default 1 - */ - this.speed = 1; - /** - * Whether or not this ticker has been started. - * `true` if {@link PIXI.Ticker#start} has been called. - * `false` if {@link PIXI.Ticker#stop} has been called. - * While `false`, this value may change to `true` in the - * event of {@link PIXI.Ticker#autoStart} being `true` - * and a listener is added. - * - * @member {boolean} - * @default false - */ - this.started = false; - /** - * If enabled, deleting is disabled. - * @member {boolean} - * @default false - * @private - */ - this._protected = false; - /** - * The last time keyframe was executed. - * Maintains a relatively fixed interval with the previous value. - * @member {number} - * @default -1 - * @private - */ - this._lastFrame = -1; - /** - * Internal tick method bound to ticker instance. - * This is because in early 2015, Function.bind - * is still 60% slower in high performance scenarios. - * Also separating frame requests from update method - * so listeners may be called at any time and with - * any animation API, just invoke ticker.update(time). - * - * @private - * @param {number} time - Time since last tick. - */ - this._tick = function (time) { - _this._requestId = null; - if (_this.started) { - // Invoke listeners now - _this.update(time); - // Listener side effects may have modified ticker state. - if (_this.started && _this._requestId === null && _this._head.next) { - _this._requestId = requestAnimationFrame(_this._tick); - } - } - }; - } - /** - * Conditionally requests a new animation frame. - * If a frame has not already been requested, and if the internal - * emitter has listeners, a new frame is requested. - * - * @private - */ - Ticker.prototype._requestIfNeeded = function () { - if (this._requestId === null && this._head.next) { - // ensure callbacks get correct delta - this.lastTime = performance.now(); - this._lastFrame = this.lastTime; - this._requestId = requestAnimationFrame(this._tick); - } - }; - /** - * Conditionally cancels a pending animation frame. - * - * @private - */ - Ticker.prototype._cancelIfNeeded = function () { - if (this._requestId !== null) { - cancelAnimationFrame(this._requestId); - this._requestId = null; - } - }; - /** - * Conditionally requests a new animation frame. - * If the ticker has been started it checks if a frame has not already - * been requested, and if the internal emitter has listeners. If these - * conditions are met, a new frame is requested. If the ticker has not - * been started, but autoStart is `true`, then the ticker starts now, - * and continues with the previous conditions to request a new frame. - * - * @private - */ - Ticker.prototype._startIfPossible = function () { - if (this.started) { - this._requestIfNeeded(); - } - else if (this.autoStart) { - this.start(); - } - }; - /** - * Register a handler for tick events. Calls continuously unless - * it is removed or the ticker is stopped. - * - * @param {Function} fn - The listener function to be added for updates - * @param {*} [context] - The listener context - * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.add = function (fn, context, priority) { - if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } - return this._addListener(new TickerListener(fn, context, priority)); - }; - /** - * Add a handler for the tick event which is only execute once. - * - * @param {Function} fn - The listener function to be added for one update - * @param {*} [context] - The listener context - * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.addOnce = function (fn, context, priority) { - if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } - return this._addListener(new TickerListener(fn, context, priority, true)); - }; - /** - * Internally adds the event handler so that it can be sorted by priority. - * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run - * before the rendering. - * - * @private - * @param {TickerListener} listener - Current listener being added. - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype._addListener = function (listener) { - // For attaching to head - var current = this._head.next; - var previous = this._head; - // Add the first item - if (!current) { - listener.connect(previous); - } - else { - // Go from highest to lowest priority - while (current) { - if (listener.priority > current.priority) { - listener.connect(previous); - break; - } - previous = current; - current = current.next; - } - // Not yet connected - if (!listener.previous) { - listener.connect(previous); - } - } - this._startIfPossible(); - return this; - }; - /** - * Removes any handlers matching the function and context parameters. - * If no handlers are left after removing, then it cancels the animation frame. - * - * @param {Function} fn - The listener function to be removed - * @param {*} [context] - The listener context to be removed - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.remove = function (fn, context) { - var listener = this._head.next; - while (listener) { - // We found a match, lets remove it - // no break to delete all possible matches - // incase a listener was added 2+ times - if (listener.match(fn, context)) { - listener = listener.destroy(); - } - else { - listener = listener.next; - } - } - if (!this._head.next) { - this._cancelIfNeeded(); - } - return this; - }; - Object.defineProperty(Ticker.prototype, "count", { - /** - * The number of listeners on this ticker, calculated by walking through linked list - * - * @readonly - * @member {number} - */ - get: function () { - if (!this._head) { - return 0; - } - var count = 0; - var current = this._head; - while ((current = current.next)) { - count++; - } - return count; - }, - enumerable: false, - configurable: true - }); - /** - * Starts the ticker. If the ticker has listeners - * a new animation frame is requested at this point. - */ - Ticker.prototype.start = function () { - if (!this.started) { - this.started = true; - this._requestIfNeeded(); - } - }; - /** - * Stops the ticker. If the ticker has requested - * an animation frame it is canceled at this point. - */ - Ticker.prototype.stop = function () { - if (this.started) { - this.started = false; - this._cancelIfNeeded(); - } - }; - /** - * Destroy the ticker and don't use after this. Calling - * this method removes all references to internal events. - */ - Ticker.prototype.destroy = function () { - if (!this._protected) { - this.stop(); - var listener = this._head.next; - while (listener) { - listener = listener.destroy(true); - } - this._head.destroy(); - this._head = null; - } - }; - /** - * Triggers an update. An update entails setting the - * current {@link PIXI.Ticker#elapsedMS}, - * the current {@link PIXI.Ticker#deltaTime}, - * invoking all listeners with current deltaTime, - * and then finally setting {@link PIXI.Ticker#lastTime} - * with the value of currentTime that was provided. - * This method will be called automatically by animation - * frame callbacks if the ticker instance has been started - * and listeners are added. - * - * @param {number} [currentTime=performance.now()] - the current time of execution - */ - Ticker.prototype.update = function (currentTime) { - if (currentTime === void 0) { currentTime = performance.now(); } - var elapsedMS; - // If the difference in time is zero or negative, we ignore most of the work done here. - // If there is no valid difference, then should be no reason to let anyone know about it. - // A zero delta, is exactly that, nothing should update. - // - // The difference in time can be negative, and no this does not mean time traveling. - // This can be the result of a race condition between when an animation frame is requested - // on the current JavaScript engine event loop, and when the ticker's start method is invoked - // (which invokes the internal _requestIfNeeded method). If a frame is requested before - // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, - // can receive a time argument that can be less than the lastTime value that was set within - // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. - // - // This check covers this browser engine timing issue, as well as if consumers pass an invalid - // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. - if (currentTime > this.lastTime) { - // Save uncapped elapsedMS for measurement - elapsedMS = this.elapsedMS = currentTime - this.lastTime; - // cap the milliseconds elapsed used for deltaTime - if (elapsedMS > this._maxElapsedMS) { - elapsedMS = this._maxElapsedMS; - } - elapsedMS *= this.speed; - // If not enough time has passed, exit the function. - // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS - // adjustment to ensure a relatively stable interval. - if (this._minElapsedMS) { - var delta = currentTime - this._lastFrame | 0; - if (delta < this._minElapsedMS) { - return; - } - this._lastFrame = currentTime - (delta % this._minElapsedMS); - } - this.deltaMS = elapsedMS; - this.deltaTime = this.deltaMS * settings.TARGET_FPMS; - // Cache a local reference, in-case ticker is destroyed - // during the emit, we can still check for head.next - var head = this._head; - // Invoke listeners added to internal emitter - var listener = head.next; - while (listener) { - listener = listener.emit(this.deltaTime); - } - if (!head.next) { - this._cancelIfNeeded(); - } - } - else { - this.deltaTime = this.deltaMS = this.elapsedMS = 0; - } - this.lastTime = currentTime; - }; - Object.defineProperty(Ticker.prototype, "FPS", { - /** - * The frames per second at which this ticker is running. - * The default is approximately 60 in most modern browsers. - * **Note:** This does not factor in the value of - * {@link PIXI.Ticker#speed}, which is specific - * to scaling {@link PIXI.Ticker#deltaTime}. - * - * @member {number} - * @readonly - */ - get: function () { - return 1000 / this.elapsedMS; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker.prototype, "minFPS", { - /** - * Manages the maximum amount of milliseconds allowed to - * elapse between invoking {@link PIXI.Ticker#update}. - * This value is used to cap {@link PIXI.Ticker#deltaTime}, - * but does not effect the measured value of {@link PIXI.Ticker#FPS}. - * When setting this property it is clamped to a value between - * `0` and `PIXI.settings.TARGET_FPMS * 1000`. - * - * @member {number} - * @default 10 - */ - get: function () { - return 1000 / this._maxElapsedMS; - }, - set: function (fps) { - // Minimum must be below the maxFPS - var minFPS = Math.min(this.maxFPS, fps); - // Must be at least 0, but below 1 / settings.TARGET_FPMS - var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS); - this._maxElapsedMS = 1 / minFPMS; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker.prototype, "maxFPS", { - /** - * Manages the minimum amount of milliseconds required to - * elapse between invoking {@link PIXI.Ticker#update}. - * This will effect the measured value of {@link PIXI.Ticker#FPS}. - * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. - * Otherwise it will be at least `minFPS` - * - * @member {number} - * @default 0 - */ - get: function () { - if (this._minElapsedMS) { - return Math.round(1000 / this._minElapsedMS); - } - return 0; - }, - set: function (fps) { - if (fps === 0) { - this._minElapsedMS = 0; - } - else { - // Max must be at least the minFPS - var maxFPS = Math.max(this.minFPS, fps); - this._minElapsedMS = 1 / (maxFPS / 1000); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker, "shared", { - /** - * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by - * {@link PIXI.VideoResource} to update animation frames / video textures. - * - * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. - * - * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. - * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. - * - * @example - * let ticker = PIXI.Ticker.shared; - * // Set this to prevent starting this ticker when listeners are added. - * // By default this is true only for the PIXI.Ticker.shared instance. - * ticker.autoStart = false; - * // FYI, call this to ensure the ticker is stopped. It should be stopped - * // if you have not attempted to render anything yet. - * ticker.stop(); - * // Call this when you are ready for a running shared ticker. - * ticker.start(); - * - * @example - * // You may use the shared ticker to render... - * let renderer = PIXI.autoDetectRenderer(); - * let stage = new PIXI.Container(); - * document.body.appendChild(renderer.view); - * ticker.add(function (time) { - * renderer.render(stage); - * }); - * - * @example - * // Or you can just update it manually. - * ticker.autoStart = false; - * ticker.stop(); - * function animate(time) { - * ticker.update(time); - * renderer.render(stage); - * requestAnimationFrame(animate); - * } - * animate(performance.now()); - * - * @member {PIXI.Ticker} - * @static - */ - get: function () { - if (!Ticker._shared) { - var shared = Ticker._shared = new Ticker(); - shared.autoStart = true; - shared._protected = true; - } - return Ticker._shared; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker, "system", { - /** - * The system ticker instance used by {@link PIXI.InteractionManager} and by - * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, - * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. - * - * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. - * - * @member {PIXI.Ticker} - * @static - */ - get: function () { - if (!Ticker._system) { - var system = Ticker._system = new Ticker(); - system.autoStart = true; - system._protected = true; - } - return Ticker._system; - }, - enumerable: false, - configurable: true - }); - return Ticker; - }()); - - /** - * Middleware for for Application Ticker. - * - * @example - * import {TickerPlugin} from '@pixi/ticker'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(TickerPlugin); - * - * @class - * @memberof PIXI - */ - var TickerPlugin = /** @class */ (function () { - function TickerPlugin() { - } - /** - * Initialize the plugin with scope of application instance - * - * @static - * @private - * @param {object} [options] - See application options - */ - TickerPlugin.init = function (options) { - var _this = this; - // Set default - options = Object.assign({ - autoStart: true, - sharedTicker: false, - }, options); - // Create ticker setter - Object.defineProperty(this, 'ticker', { - set: function (ticker) { - if (this._ticker) { - this._ticker.remove(this.render, this); - } - this._ticker = ticker; - if (ticker) { - ticker.add(this.render, this, exports.UPDATE_PRIORITY.LOW); - } - }, - get: function () { - return this._ticker; - }, - }); - /** - * Convenience method for stopping the render. - * - * @method PIXI.Application#stop - */ - this.stop = function () { - _this._ticker.stop(); - }; - /** - * Convenience method for starting the render. - * - * @method PIXI.Application#start - */ - this.start = function () { - _this._ticker.start(); - }; - /** - * Internal reference to the ticker. - * - * @type {PIXI.Ticker} - * @name _ticker - * @memberof PIXI.Application# - * @private - */ - this._ticker = null; - /** - * Ticker for doing render updates. - * - * @type {PIXI.Ticker} - * @name ticker - * @memberof PIXI.Application# - * @default PIXI.Ticker.shared - */ - this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); - // Start the rendering - if (options.autoStart) { - this.start(); - } - }; - /** - * Clean up the ticker, scoped to application. - * - * @static - * @private - */ - TickerPlugin.destroy = function () { - if (this._ticker) { - var oldTicker = this._ticker; - this.ticker = null; - oldTicker.destroy(); - } - }; - return TickerPlugin; - }()); - - /*! - * @pixi/interaction - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/interaction is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Holds all information related to an Interaction event - * - * @class - * @memberof PIXI - */ - var InteractionData = /** @class */ (function () { - function InteractionData() { - this.pressure = 0; - this.rotationAngle = 0; - this.twist = 0; - this.tangentialPressure = 0; - /** - * This point stores the global coords of where the touch/mouse event happened - * - * @member {PIXI.Point} - */ - this.global = new Point(); - /** - * The target Sprite that was interacted with - * - * @member {PIXI.Sprite} - */ - this.target = null; - /** - * When passed to an event handler, this will be the original DOM Event that was captured - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent - * @member {MouseEvent|TouchEvent|PointerEvent} - */ - this.originalEvent = null; - /** - * Unique identifier for this interaction - * - * @member {number} - */ - this.identifier = null; - /** - * Indicates whether or not the pointer device that created the event is the primary pointer. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary - * @type {Boolean} - */ - this.isPrimary = false; - /** - * Indicates which button was pressed on the mouse or pointer device to trigger the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - * @type {number} - */ - this.button = 0; - /** - * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons - * @type {number} - */ - this.buttons = 0; - /** - * The width of the pointer's contact along the x-axis, measured in CSS pixels. - * radiusX of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width - * @type {number} - */ - this.width = 0; - /** - * The height of the pointer's contact along the y-axis, measured in CSS pixels. - * radiusY of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height - * @type {number} - */ - this.height = 0; - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX - * @type {number} - */ - this.tiltX = 0; - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY - * @type {number} - */ - this.tiltY = 0; - /** - * The type of pointer that triggered the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType - * @type {string} - */ - this.pointerType = null; - /** - * Pressure applied by the pointing device during the event. A Touch's force property - * will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure - * @type {number} - */ - this.pressure = 0; - /** - * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. - * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle - * @type {number} - */ - this.rotationAngle = 0; - /** - * Twist of a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.twist = 0; - /** - * Barrel pressure on a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.tangentialPressure = 0; - } - Object.defineProperty(InteractionData.prototype, "pointerId", { - /** - * The unique identifier of the pointer. It will be the same as `identifier`. - * @readonly - * @member {number} - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId - */ - get: function () { - return this.identifier; - }, - enumerable: false, - configurable: true - }); - /** - * This will return the local coordinates of the specified displayObject for this InteractionData - * - * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local - * coords off - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise - * will create a new point) - * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional - * (otherwise will use the current global coords) - * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative - * to the DisplayObject - */ - InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) { - return displayObject.worldTransform.applyInverse(globalPos || this.global, point); - }; - /** - * Copies properties from normalized event data. - * - * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data - */ - InteractionData.prototype.copyEvent = function (event) { - // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite - // it with "false" on later events when our shim for it on touch events might not be - // accurate - if ('isPrimary' in event && event.isPrimary) { - this.isPrimary = true; - } - this.button = 'button' in event && event.button; - // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard - // event.which property instead, which conveys the same information. - var buttons = 'buttons' in event && event.buttons; - this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which; - this.width = 'width' in event && event.width; - this.height = 'height' in event && event.height; - this.tiltX = 'tiltX' in event && event.tiltX; - this.tiltY = 'tiltY' in event && event.tiltY; - this.pointerType = 'pointerType' in event && event.pointerType; - this.pressure = 'pressure' in event && event.pressure; - this.rotationAngle = 'rotationAngle' in event && event.rotationAngle; - this.twist = ('twist' in event && event.twist) || 0; - this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0; - }; - /** - * Resets the data for pooling. - */ - InteractionData.prototype.reset = function () { - // isPrimary is the only property that we really need to reset - everything else is - // guaranteed to be overwritten - this.isPrimary = false; - }; - return InteractionData; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$1 = function(d, b) { - extendStatics$1 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$1(d, b); - }; - - function __extends$1(d, b) { - extendStatics$1(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Event class that mimics native DOM events. - * - * @class - * @memberof PIXI - */ - var InteractionEvent = /** @class */ (function () { - function InteractionEvent() { - /** - * Whether this event will continue propagating in the tree. - * - * Remaining events for the {@link stopsPropagatingAt} object - * will still be dispatched. - * - * @member {boolean} - */ - this.stopped = false; - /** - * At which object this event stops propagating. - * - * @private - * @member {PIXI.DisplayObject} - */ - this.stopsPropagatingAt = null; - /** - * Whether we already reached the element we want to - * stop propagating at. This is important for delayed events, - * where we start over deeper in the tree again. - * - * @private - * @member {boolean} - */ - this.stopPropagationHint = false; - /** - * The object which caused this event to be dispatched. - * For listener callback see {@link PIXI.InteractionEvent.currentTarget}. - * - * @member {PIXI.DisplayObject} - */ - this.target = null; - /** - * The object whose event listener’s callback is currently being invoked. - * - * @member {PIXI.DisplayObject} - */ - this.currentTarget = null; - /** - * Type of the event - * - * @member {string} - */ - this.type = null; - /** - * InteractionData related to this event - * - * @member {PIXI.InteractionData} - */ - this.data = null; - } - /** - * Prevents event from reaching any objects other than the current object. - * - */ - InteractionEvent.prototype.stopPropagation = function () { - this.stopped = true; - this.stopPropagationHint = true; - this.stopsPropagatingAt = this.currentTarget; - }; - /** - * Resets the event. - */ - InteractionEvent.prototype.reset = function () { - this.stopped = false; - this.stopsPropagatingAt = null; - this.stopPropagationHint = false; - this.currentTarget = null; - this.target = null; - }; - return InteractionEvent; - }()); - - /** - * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions - * - * @class - * @private - * @memberof PIXI - */ - var InteractionTrackingData = /** @class */ (function () { - /** - * @param {number} pointerId - Unique pointer id of the event - * @private - */ - function InteractionTrackingData(pointerId) { - this._pointerId = pointerId; - this._flags = InteractionTrackingData.FLAGS.NONE; - } - /** - * - * @private - * @param {number} flag - The interaction flag to set - * @param {boolean} yn - Should the flag be set or unset - */ - InteractionTrackingData.prototype._doSet = function (flag, yn) { - if (yn) { - this._flags = this._flags | flag; - } - else { - this._flags = this._flags & (~flag); - } - }; - Object.defineProperty(InteractionTrackingData.prototype, "pointerId", { - /** - * Unique pointer id of the event - * - * @readonly - * @private - * @member {number} - */ - get: function () { - return this._pointerId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "flags", { - /** - * State of the tracking data, expressed as bit flags - * - * @private - * @member {number} - */ - get: function () { - return this._flags; - }, - set: function (flags) { - this._flags = flags; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "none", { - /** - * Is the tracked event inactive (not over or down)? - * - * @private - * @member {number} - */ - get: function () { - return this._flags === InteractionTrackingData.FLAGS.NONE; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "over", { - /** - * Is the tracked event over the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.OVER, yn); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "rightDown", { - /** - * Did the right mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "leftDown", { - /** - * Did the left mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn); - }, - enumerable: false, - configurable: true - }); - InteractionTrackingData.FLAGS = Object.freeze({ - NONE: 0, - OVER: 1 << 0, - LEFT_DOWN: 1 << 1, - RIGHT_DOWN: 1 << 2, - }); - return InteractionTrackingData; - }()); - - /** - * Strategy how to search through stage tree for interactive objects - * - * @private - * @class - * @memberof PIXI - */ - var TreeSearch = /** @class */ (function () { - function TreeSearch() { - this._tempPoint = new Point(); - } - /** - * Recursive implementation for findHit - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @param {boolean} [interactive] - Whether the displayObject is interactive - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.recursiveFindHit = function (interactionEvent, displayObject, func, hitTest, interactive) { - if (!displayObject || !displayObject.visible) { - return false; - } - var point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ - // - // This function will now loop through all objects and then only hit test the objects it HAS - // to, not all of them. MUCH faster.. - // An object will be hit test if the following is true: - // - // 1: It is interactive. - // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // - // As another little optimization once an interactive object has been hit we can carry on - // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimization is that an object is not hit test directly if a child has already been hit. - interactive = displayObject.interactive || interactive; - var hit = false; - var interactiveParent = interactive; - // Flag here can set to false if the event is outside the parents hitArea or mask - var hitTestChildren = true; - // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea - // There is also no longer a need to hitTest children. - if (displayObject.hitArea) { - if (hitTest) { - displayObject.worldTransform.applyInverse(point, this._tempPoint); - if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) { - hitTest = false; - hitTestChildren = false; - } - else { - hit = true; - } - } - interactiveParent = false; - } - // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. - // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. - // https://github.com/pixijs/pixi.js/issues/5135 - else if (displayObject._mask) { - if (hitTest) { - if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) { - hitTest = false; - } - } - } - // ** FREE TIP **! If an object is not interactive or has no buttons in it - // (such as a game scene!) set interactiveChildren to false for that displayObject. - // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. - if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) { - var children = displayObject.children; - for (var i = children.length - 1; i >= 0; i--) { - var child = children[i]; - // time to get recursive.. if this function will return if something is hit.. - var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); - if (childHit) { - // its a good idea to check if a child has lost its parent. - // this means it has been removed whilst looping so its best - if (!child.parent) { - continue; - } - // we no longer need to hit test any more objects in this container as we we - // now know the parent has been hit - interactiveParent = false; - // If the child is interactive , that means that the object hit was actually - // interactive and not just the child of an interactive object. - // This means we no longer need to hit test anything else. We still need to run - // through all objects, but we don't need to perform any hit tests. - if (childHit) { - if (interactionEvent.target) { - hitTest = false; - } - hit = true; - } - } - } - } - // no point running this if the item is not interactive or does not have an interactive parent. - if (interactive) { - // if we are hit testing (as in we have no hit any objects yet) - // We also don't need to worry about hit testing if once of the displayObjects children - // has already been hit - but only if it was interactive, otherwise we need to keep - // looking for an interactive child, just in case we hit one - if (hitTest && !interactionEvent.target) { - // already tested against hitArea if it is defined - if (!displayObject.hitArea && displayObject.containsPoint) { - if (displayObject.containsPoint(point)) { - hit = true; - } - } - } - if (displayObject.interactive) { - if (hit && !interactionEvent.target) { - interactionEvent.target = displayObject; - } - if (func) { - func(interactionEvent, displayObject, !!hit); - } - } - } - return hit; - }; - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.findHit = function (interactionEvent, displayObject, func, hitTest) { - this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); - }; - return TreeSearch; - }()); - - /** - * Interface for classes that represent a hit area. - * - * It is implemented by the following classes: - * - {@link PIXI.Circle} - * - {@link PIXI.Ellipse} - * - {@link PIXI.Polygon} - * - {@link PIXI.RoundedRectangle} - * - * @interface IHitArea - * @memberof PIXI - */ - /** - * Checks whether the x and y coordinates given are contained within this area - * - * @method - * @name contains - * @memberof PIXI.IHitArea# - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this area - */ - /** - * Default property values of interactive objects - * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties - * - * @private - * @name interactiveTarget - * @type {Object} - * @memberof PIXI - * @example - * function MyObject() {} - * - * Object.assign( - * DisplayObject.prototype, - * PIXI.interactiveTarget - * ); - */ - var interactiveTarget = { - /** - * Enable interaction events for the DisplayObject. Touch, pointer and mouse - * events will not be emitted unless `interactive` is set to `true`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.on('tap', (event) => { - * //handle event - * }); - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - interactive: false, - /** - * Determines if the children to the displayObject can be clicked/touched - * Setting this to false allows PixiJS to bypass a recursive `hitTest` function - * - * @member {boolean} - * @memberof PIXI.Container# - */ - interactiveChildren: true, - /** - * Interaction shape. Children will be hit first, then this shape will be checked. - * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); - * @member {PIXI.IHitArea} - * @memberof PIXI.DisplayObject# - */ - hitArea: null, - /** - * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive - * Setting this changes the 'cursor' property to `'pointer'`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.buttonMode = true; - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - get buttonMode() { - return this.cursor === 'pointer'; - }, - set buttonMode(value) { - if (value) { - this.cursor = 'pointer'; - } - else if (this.cursor === 'pointer') { - this.cursor = null; - } - }, - /** - * This defines what cursor mode is used when the mouse cursor - * is hovered over the displayObject. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.cursor = 'wait'; - * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor - * - * @member {string} - * @memberof PIXI.DisplayObject# - */ - cursor: null, - /** - * Internal set of all active pointers, by identifier - * - * @member {Map} - * @memberof PIXI.DisplayObject# - * @private - */ - get trackedPointers() { - if (this._trackedPointers === undefined) - { this._trackedPointers = {}; } - return this._trackedPointers; - }, - /** - * Map of all tracked pointers, by identifier. Use trackedPointers to access. - * - * @private - * @type {Map} - */ - _trackedPointers: undefined, - }; - - // Mix interactiveTarget into DisplayObject.prototype, - // after deprecation has been handled - DisplayObject.mixin(interactiveTarget); - var MOUSE_POINTER_ID = 1; - // helpers for hitTest() - only used inside hitTest() - var hitTestEvent = { - target: null, - data: { - global: null, - }, - }; - /** - * The interaction manager deals with mouse, touch and pointer events. - * - * Any DisplayObject can be interactive if its `interactive` property is set to true. - * - * This manager also supports multitouch. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var InteractionManager = /** @class */ (function (_super) { - __extends$1(InteractionManager, _super); - /** - * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer - * @param {object} [options] - The options for the manager. - * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions. - * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked. - * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}. - */ - function InteractionManager(renderer, options) { - var _this = _super.call(this) || this; - options = options || {}; - /** - * The renderer this interaction manager works for. - * - * @member {PIXI.AbstractRenderer} - */ - _this.renderer = renderer; - /** - * Should default browser actions automatically be prevented. - * Does not apply to pointer events for backwards compatibility - * preventDefault on pointer events stops mouse events from firing - * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. - * - * @member {boolean} - * @default true - */ - _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; - /** - * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}. - * - * @member {number} - * @default 10 - */ - _this.interactionFrequency = options.interactionFrequency || 10; - /** - * The mouse data - * - * @member {PIXI.InteractionData} - */ - _this.mouse = new InteractionData(); - _this.mouse.identifier = MOUSE_POINTER_ID; - // setting the mouse to start off far off screen will mean that mouse over does - // not get called before we even move the mouse. - _this.mouse.global.set(-999999); - /** - * Actively tracked InteractionData - * - * @private - * @member {Object.} - */ - _this.activeInteractionData = {}; - _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse; - /** - * Pool of unused InteractionData - * - * @private - * @member {PIXI.InteractionData[]} - */ - _this.interactionDataPool = []; - /** - * An event data object to handle all the event tracking/dispatching - * - * @member {object} - */ - _this.eventData = new InteractionEvent(); - /** - * The DOM element to bind to. - * - * @protected - * @member {HTMLElement} - */ - _this.interactionDOMElement = null; - /** - * This property determines if mousemove and touchmove events are fired only when the cursor - * is over the object. - * Setting to true will make things work more in line with how the DOM version works. - * Setting to false can make things easier for things like dragging - * It is currently set to false as this is how PixiJS used to work. This will be set to true in - * future versions of pixi. - * - * @member {boolean} - * @default false - */ - _this.moveWhenInside = false; - /** - * Have events been attached to the dom element? - * - * @protected - * @member {boolean} - */ - _this.eventsAdded = false; - /** - * Has the system ticker been added? - * - * @protected - * @member {boolean} - */ - _this.tickerAdded = false; - /** - * Is the mouse hovering over the renderer? - * - * @protected - * @member {boolean} - */ - _this.mouseOverRenderer = false; - /** - * Does the device support touch events - * https://www.w3.org/TR/touch-events/ - * - * @readonly - * @member {boolean} - */ - _this.supportsTouchEvents = 'ontouchstart' in window; - /** - * Does the device support pointer events - * https://www.w3.org/Submission/pointer-events/ - * - * @readonly - * @member {boolean} - */ - _this.supportsPointerEvents = !!window.PointerEvent; - // this will make it so that you don't have to call bind all the time - /** - * @private - * @member {Function} - */ - _this.onPointerUp = _this.onPointerUp.bind(_this); - _this.processPointerUp = _this.processPointerUp.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerCancel = _this.onPointerCancel.bind(_this); - _this.processPointerCancel = _this.processPointerCancel.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerDown = _this.onPointerDown.bind(_this); - _this.processPointerDown = _this.processPointerDown.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerMove = _this.onPointerMove.bind(_this); - _this.processPointerMove = _this.processPointerMove.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerOut = _this.onPointerOut.bind(_this); - _this.processPointerOverOut = _this.processPointerOverOut.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerOver = _this.onPointerOver.bind(_this); - /** - * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor - * values, objects are handled as dictionaries of CSS values for interactionDOMElement, - * and functions are called instead of changing the CSS. - * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.} - */ - _this.cursorStyles = { - default: 'inherit', - pointer: 'pointer', - }; - /** - * The mode of the cursor that is being used. - * The value of this is a key from the cursorStyles dictionary. - * - * @member {string} - */ - _this.currentCursorMode = null; - /** - * Internal cached let. - * - * @private - * @member {string} - */ - _this.cursor = null; - /** - * The current resolution / device pixel ratio. - * - * @member {number} - * @default 1 - */ - _this.resolution = 1; - /** - * Delayed pointer events. Used to guarantee correct ordering of over/out events. - * - * @private - * @member {Array} - */ - _this.delayedEvents = []; - /** - * TreeSearch component that is used to hitTest stage tree - * - * @private - * @member {PIXI.TreeSearch} - */ - _this.search = new TreeSearch(); - /** - * Used as a last rendered object in case renderer doesnt have _lastObjectRendered - * @member {DisplayObject} - * @private - */ - _this._tempDisplayObject = new TemporaryDisplayObject(); - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display - * object. - * - * @event PIXI.InteractionManager#mousedown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. - * - * @event PIXI.InteractionManager#rightdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. - * - * @event PIXI.InteractionManager#mouseup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. - * - * @event PIXI.InteractionManager#rightup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. - * - * @event PIXI.InteractionManager#click - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. - * - * @event PIXI.InteractionManager#rightclick - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.InteractionManager#event:mousedown}. - * - * @event PIXI.InteractionManager#mouseupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.InteractionManager#event:rightdown}. - * - * @event PIXI.InteractionManager#rightupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object - * - * @event PIXI.InteractionManager#mousemove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object - * - * @event PIXI.InteractionManager#mouseover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved off the display object - * - * @event PIXI.InteractionManager#mouseout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed on the display object. - * - * @event PIXI.InteractionManager#pointerdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released over the display object. - * Not always fired when some buttons are held down while others are released. In those cases, - * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and - * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead. - * - * @event PIXI.InteractionManager#pointerup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a pointer event - * - * @event PIXI.InteractionManager#pointercancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed and released on the display object. - * - * @event PIXI.InteractionManager#pointertap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}. - * - * @event PIXI.InteractionManager#pointerupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved while over the display object - * - * @event PIXI.InteractionManager#pointermove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved onto the display object - * - * @event PIXI.InteractionManager#pointerover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved off the display object - * - * @event PIXI.InteractionManager#pointerout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed on the display object. - * - * @event PIXI.InteractionManager#touchstart - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed from the display object. - * - * @event PIXI.InteractionManager#touchend - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a touch - * - * @event PIXI.InteractionManager#touchcancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed and removed from the display object. - * - * @event PIXI.InteractionManager#tap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}. - * - * @event PIXI.InteractionManager#touchendoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is moved along the display object. - * - * @event PIXI.InteractionManager#touchmove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousedown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#click - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightclick - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousemove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a pointer event. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointercancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed and released on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointertap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointermove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchstart - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchend - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a touch. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchcancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed and removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#tap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchendoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is moved along the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchmove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - _this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; - _this.setTargetElement(_this.renderer.view, _this.renderer.resolution); - return _this; - } - Object.defineProperty(InteractionManager.prototype, "useSystemTicker", { - /** - * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. - * - * @member {boolean} - * @default true - */ - get: function () { - return this._useSystemTicker; - }, - set: function (useSystemTicker) { - this._useSystemTicker = useSystemTicker; - if (useSystemTicker) { - this.addTickerListener(); - } - else { - this.removeTickerListener(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionManager.prototype, "lastObjectRendered", { - /** - * Last rendered object or temp object - * @readonly - * @protected - * @member {PIXI.DisplayObject} - */ - get: function () { - return this.renderer._lastObjectRendered || this._tempDisplayObject; - }, - enumerable: false, - configurable: true - }); - /** - * Hit tests a point against the display tree, returning the first interactive object that is hit. - * - * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. - * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults - * to the last rendered root of the associated renderer. - * @return {PIXI.DisplayObject} The hit display object, if any. - */ - InteractionManager.prototype.hitTest = function (globalPoint, root) { - // clear the target for our hit test - hitTestEvent.target = null; - // assign the global point - hitTestEvent.data.global = globalPoint; - // ensure safety of the root - if (!root) { - root = this.lastObjectRendered; - } - // run the hit test - this.processInteractive(hitTestEvent, root, null, true); - // return our found object - it'll be null if we didn't hit anything - return hitTestEvent.target; - }; - /** - * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate - * another DOM element to receive those events. - * - * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. - * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). - */ - InteractionManager.prototype.setTargetElement = function (element, resolution) { - if (resolution === void 0) { resolution = 1; } - this.removeTickerListener(); - this.removeEvents(); - this.interactionDOMElement = element; - this.resolution = resolution; - this.addEvents(); - this.addTickerListener(); - }; - /** - * Add the ticker listener - * - * @private - */ - InteractionManager.prototype.addTickerListener = function () { - if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) { - return; - } - Ticker.system.add(this.tickerUpdate, this, exports.UPDATE_PRIORITY.INTERACTION); - this.tickerAdded = true; - }; - /** - * Remove the ticker listener - * - * @private - */ - InteractionManager.prototype.removeTickerListener = function () { - if (!this.tickerAdded) { - return; - } - Ticker.system.remove(this.tickerUpdate, this); - this.tickerAdded = false; - }; - /** - * Registers all the DOM events - * - * @private - */ - InteractionManager.prototype.addEvents = function () { - if (this.eventsAdded || !this.interactionDOMElement) { - return; - } - var style = this.interactionDOMElement.style; - if (window.navigator.msPointerEnabled) { - style.msContentZooming = 'none'; - style.msTouchAction = 'none'; - } - else if (this.supportsPointerEvents) { - style.touchAction = 'none'; - } - /** - * These events are added first, so that if pointer events are normalized, they are fired - * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd - */ - if (this.supportsPointerEvents) { - window.document.addEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); - // pointerout is fired in addition to pointerup (for touch events) and pointercancel - // we already handle those, so for the purposes of what we do in onPointerOut, we only - // care about the pointerleave event - this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); - window.addEventListener('pointercancel', this.onPointerCancel, true); - window.addEventListener('pointerup', this.onPointerUp, true); - } - else { - window.document.addEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); - window.addEventListener('mouseup', this.onPointerUp, true); - } - // always look directly for touch events so that we can provide original data - // In a future version we should change this to being just a fallback and rely solely on - // PointerEvents whenever available - if (this.supportsTouchEvents) { - this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); - } - this.eventsAdded = true; - }; - /** - * Removes all the DOM events that were previously registered - * - * @private - */ - InteractionManager.prototype.removeEvents = function () { - if (!this.eventsAdded || !this.interactionDOMElement) { - return; - } - var style = this.interactionDOMElement.style; - if (window.navigator.msPointerEnabled) { - style.msContentZooming = ''; - style.msTouchAction = ''; - } - else if (this.supportsPointerEvents) { - style.touchAction = ''; - } - if (this.supportsPointerEvents) { - window.document.removeEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); - window.removeEventListener('pointercancel', this.onPointerCancel, true); - window.removeEventListener('pointerup', this.onPointerUp, true); - } - else { - window.document.removeEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); - window.removeEventListener('mouseup', this.onPointerUp, true); - } - if (this.supportsTouchEvents) { - this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); - } - this.interactionDOMElement = null; - this.eventsAdded = false; - }; - /** - * Updates the state of interactive objects if at least {@link interactionFrequency} - * milliseconds have passed since the last invocation. - * - * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}. - * - * @param {number} deltaTime - time delta since the last call - */ - InteractionManager.prototype.tickerUpdate = function (deltaTime) { - this._deltaTime += deltaTime; - if (this._deltaTime < this.interactionFrequency) { - return; - } - this._deltaTime = 0; - this.update(); - }; - /** - * Updates the state of interactive objects. - */ - InteractionManager.prototype.update = function () { - if (!this.interactionDOMElement) { - return; - } - // if the user move the mouse this check has already been done using the mouse move! - if (this._didMove) { - this._didMove = false; - return; - } - this.cursor = null; - // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, - // but there was a scenario of a display object moving under a static mouse cursor. - // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function - for (var k in this.activeInteractionData) { - // eslint-disable-next-line no-prototype-builtins - if (this.activeInteractionData.hasOwnProperty(k)) { - var interactionData = this.activeInteractionData[k]; - if (interactionData.originalEvent && interactionData.pointerType !== 'touch') { - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData); - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true); - } - } - } - this.setCursorMode(this.cursor); - }; - /** - * Sets the current cursor mode, handling any callbacks or CSS style changes. - * - * @param {string} mode - cursor mode, a key from the cursorStyles dictionary - */ - InteractionManager.prototype.setCursorMode = function (mode) { - mode = mode || 'default'; - // if the mode didn't actually change, bail early - if (this.currentCursorMode === mode) { - return; - } - this.currentCursorMode = mode; - var style = this.cursorStyles[mode]; - // only do things if there is a cursor style for it - if (style) { - switch (typeof style) { - case 'string': - // string styles are handled as cursor CSS - this.interactionDOMElement.style.cursor = style; - break; - case 'function': - // functions are just called, and passed the cursor mode - style(mode); - break; - case 'object': - // if it is an object, assume that it is a dictionary of CSS styles, - // apply it to the interactionDOMElement - Object.assign(this.interactionDOMElement.style, style); - break; - } - } - else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) { - // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry - // for the mode, then assume that the dev wants it to be CSS for the cursor. - this.interactionDOMElement.style.cursor = mode; - } - }; - /** - * Dispatches an event on the display object that was interacted with - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {PIXI.InteractionEvent} eventData - the event data object - * @private - */ - InteractionManager.prototype.dispatchEvent = function (displayObject, eventString, eventData) { - // Even if the event was stopped, at least dispatch any remaining events - // for the same display object. - if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) { - eventData.currentTarget = displayObject; - eventData.type = eventString; - displayObject.emit(eventString, eventData); - if (displayObject[eventString]) { - displayObject[eventString](eventData); - } - } - }; - /** - * Puts a event on a queue to be dispatched later. This is used to guarantee correct - * ordering of over/out events. - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {object} eventData - the event data object - * @private - */ - InteractionManager.prototype.delayDispatchEvent = function (displayObject, eventString, eventData) { - this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); - }; - /** - * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The - * resulting value is stored in the point. This takes into account the fact that the DOM - * element could be scaled and positioned anywhere on the screen. - * - * @param {PIXI.IPointData} point - the point that the result will be stored in - * @param {number} x - the x coord of the position to map - * @param {number} y - the y coord of the position to map - */ - InteractionManager.prototype.mapPositionToPoint = function (point, x, y) { - var rect; - // IE 11 fix - if (!this.interactionDOMElement.parentElement) { - rect = { x: 0, y: 0, width: 0, height: 0 }; - } - else { - rect = this.interactionDOMElement.getBoundingClientRect(); - } - var resolutionMultiplier = 1.0 / this.resolution; - point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; - point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; - }; - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @protected - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - indicates whether we want to calculate hits - * or just iterate through all interactive objects - */ - InteractionManager.prototype.processInteractive = function (interactionEvent, displayObject, func, hitTest) { - var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); - var delayedEvents = this.delayedEvents; - if (!delayedEvents.length) { - return hit; - } - // Reset the propagation hint, because we start deeper in the tree again. - interactionEvent.stopPropagationHint = false; - var delayedLen = delayedEvents.length; - this.delayedEvents = []; - for (var i = 0; i < delayedLen; i++) { - var _a = delayedEvents[i], displayObject_1 = _a.displayObject, eventString = _a.eventString, eventData = _a.eventData; - // When we reach the object we wanted to stop propagating at, - // set the propagation hint. - if (eventData.stopsPropagatingAt === displayObject_1) { - eventData.stopPropagationHint = true; - } - this.dispatchEvent(displayObject_1, eventString, eventData); - } - return hit; - }; - /** - * Is called when the pointer button is pressed down on the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down - */ - InteractionManager.prototype.onPointerDown = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - /** - * No need to prevent default on natural pointer events, as there are no side effects - * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, - * so still need to be prevented. - */ - // Guaranteed that there will be at least one event in events, and all events must have the same pointer type - if (this.autoPreventDefault && events[0].isNormalized) { - var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); - if (cancelable) { - originalEvent.preventDefault(); - } - } - var eventLen = events.length; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true); - this.emit('pointerdown', interactionEvent); - if (event.pointerType === 'touch') { - this.emit('touchstart', interactionEvent); - } - // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event - else if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - var isRightButton = event.button === 2; - this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); - } - } - }; - /** - * Processes the result of the pointer down check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerDown = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - if (hit) { - if (!displayObject.trackedPointers[id]) { - displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); - if (data.pointerType === 'touch') { - this.dispatchEvent(displayObject, 'touchstart', interactionEvent); - } - else if (data.pointerType === 'mouse' || data.pointerType === 'pen') { - var isRightButton = data.button === 2; - if (isRightButton) { - displayObject.trackedPointers[id].rightDown = true; - } - else { - displayObject.trackedPointers[id].leftDown = true; - } - this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); - } - } - }; - /** - * Is called when the pointer button is released on the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released - * @param {boolean} cancelled - true if the pointer is cancelled - * @param {Function} func - Function passed to {@link processInteractive} - */ - InteractionManager.prototype.onPointerComplete = function (originalEvent, cancelled, func) { - var events = this.normalizeToPointerData(originalEvent); - var eventLen = events.length; - // if the event wasn't targeting our canvas, then consider it to be pointerupoutside - // in all cases (unless it was a pointercancel) - var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - // perform hit testing for events targeting our canvas or cancel events - this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend); - this.emit(cancelled ? 'pointercancel' : "pointerup" + eventAppend, interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - var isRightButton = event.button === 2; - this.emit(isRightButton ? "rightup" + eventAppend : "mouseup" + eventAppend, interactionEvent); - } - else if (event.pointerType === 'touch') { - this.emit(cancelled ? 'touchcancel' : "touchend" + eventAppend, interactionEvent); - this.releaseInteractionDataForPointerId(event.pointerId); - } - } - }; - /** - * Is called when the pointer button is cancelled - * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released - */ - InteractionManager.prototype.onPointerCancel = function (event) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') - { return; } - this.onPointerComplete(event, true, this.processPointerCancel); - }; - /** - * Processes the result of the pointer cancel check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - */ - InteractionManager.prototype.processPointerCancel = function (interactionEvent, displayObject) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - if (displayObject.trackedPointers[id] !== undefined) { - delete displayObject.trackedPointers[id]; - this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); - if (data.pointerType === 'touch') { - this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); - } - } - }; - /** - * Is called when the pointer button is released on the renderer element - * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released - */ - InteractionManager.prototype.onPointerUp = function (event) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') - { return; } - this.onPointerComplete(event, false, this.processPointerUp); - }; - /** - * Processes the result of the pointer up check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerUp = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var trackingData = displayObject.trackedPointers[id]; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - // need to track mouse down status in the mouse block so that we can emit - // event in a later block - var isMouseTap = false; - // Mouse only - if (isMouse) { - var isRightButton = data.button === 2; - var flags = InteractionTrackingData.FLAGS; - var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; - var isDown = trackingData !== undefined && (trackingData.flags & test); - if (hit) { - this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); - if (isDown) { - this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); - // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap - isMouseTap = true; - } - } - else if (isDown) { - this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); - } - // update the down state of the tracking data - if (trackingData) { - if (isRightButton) { - trackingData.rightDown = false; - } - else { - trackingData.leftDown = false; - } - } - } - // Pointers and Touches, and Mouse - if (hit) { - this.dispatchEvent(displayObject, 'pointerup', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } - if (trackingData) { - // emit pointertap if not a mouse, or if the mouse block decided it was a tap - if (!isMouse || isMouseTap) { - this.dispatchEvent(displayObject, 'pointertap', interactionEvent); - } - if (isTouch) { - this.dispatchEvent(displayObject, 'tap', interactionEvent); - // touches are no longer over (if they ever were) when we get the touchend - // so we should ensure that we don't keep pretending that they are - trackingData.over = false; - } - } - } - else if (trackingData) { - this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } - } - // Only remove the tracking data if there is no over/down state still associated with it - if (trackingData && trackingData.none) { - delete displayObject.trackedPointers[id]; - } - }; - /** - * Is called when the pointer moves across the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer moving - */ - InteractionManager.prototype.onPointerMove = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') { - this._didMove = true; - this.cursor = null; - } - var eventLen = events.length; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true); - this.emit('pointermove', interactionEvent); - if (event.pointerType === 'touch') - { this.emit('touchmove', interactionEvent); } - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { this.emit('mousemove', interactionEvent); } - } - if (events[0].pointerType === 'mouse') { - this.setCursorMode(this.cursor); - // TODO BUG for parents interactive object (border order issue) - } - }; - /** - * Processes the result of the pointer move check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerMove = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - if (isMouse) { - this.processPointerOverOut(interactionEvent, displayObject, hit); - } - if (!this.moveWhenInside || hit) { - this.dispatchEvent(displayObject, 'pointermove', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } - if (isMouse) - { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } - } - }; - /** - * Is called when the pointer is moved out of the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out - */ - InteractionManager.prototype.onPointerOut = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOut, so events will always be length 1 - var event = events[0]; - if (event.pointerType === 'mouse') { - this.mouseOverRenderer = false; - this.setCursorMode(null); - } - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false); - this.emit('pointerout', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - this.emit('mouseout', interactionEvent); - } - else { - // we can get touchleave events after touchend, so we want to make sure we don't - // introduce memory leaks - this.releaseInteractionDataForPointerId(interactionData.identifier); - } - }; - /** - * Processes the result of the pointer over/out check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerOverOut = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - var trackingData = displayObject.trackedPointers[id]; - // if we just moused over the display object, then we need to track that state - if (hit && !trackingData) { - trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - if (trackingData === undefined) - { return; } - if (hit && this.mouseOverRenderer) { - if (!trackingData.over) { - trackingData.over = true; - this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); - if (isMouse) { - this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); - } - } - // only change the cursor if it has not already been changed (by something deeper in the - // display tree) - if (isMouse && this.cursor === null) { - this.cursor = displayObject.cursor; - } - } - else if (trackingData.over) { - trackingData.over = false; - this.dispatchEvent(displayObject, 'pointerout', this.eventData); - if (isMouse) { - this.dispatchEvent(displayObject, 'mouseout', interactionEvent); - } - // if there is no mouse down information for the pointer, then it is safe to delete - if (trackingData.none) { - delete displayObject.trackedPointers[id]; - } - } - }; - /** - * Is called when the pointer is moved into the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view - */ - InteractionManager.prototype.onPointerOver = function (originalEvent) { - var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOver, so events will always be length 1 - var event = events[0]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - if (event.pointerType === 'mouse') { - this.mouseOverRenderer = true; - } - this.emit('pointerover', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - this.emit('mouseover', interactionEvent); - } - }; - /** - * Get InteractionData for a given pointerId. Store that data as well - * - * @private - * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData - * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier - */ - InteractionManager.prototype.getInteractionDataForPointerId = function (event) { - var pointerId = event.pointerId; - var interactionData; - if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') { - interactionData = this.mouse; - } - else if (this.activeInteractionData[pointerId]) { - interactionData = this.activeInteractionData[pointerId]; - } - else { - interactionData = this.interactionDataPool.pop() || new InteractionData(); - interactionData.identifier = pointerId; - this.activeInteractionData[pointerId] = interactionData; - } - // copy properties from the event, so that we can make sure that touch/pointer specific - // data is available - interactionData.copyEvent(event); - return interactionData; - }; - /** - * Return unused InteractionData to the pool, for a given pointerId - * - * @private - * @param {number} pointerId - Identifier from a pointer event - */ - InteractionManager.prototype.releaseInteractionDataForPointerId = function (pointerId) { - var interactionData = this.activeInteractionData[pointerId]; - if (interactionData) { - delete this.activeInteractionData[pointerId]; - interactionData.reset(); - this.interactionDataPool.push(interactionData); - } - }; - /** - * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured - * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent - * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired - * with the InteractionEvent - * @return {PIXI.InteractionEvent} the interaction event that was passed in - */ - InteractionManager.prototype.configureInteractionEventForDOMEvent = function (interactionEvent, pointerEvent, interactionData) { - interactionEvent.data = interactionData; - this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); - // Not really sure why this is happening, but it's how a previous version handled things - if (pointerEvent.pointerType === 'touch') { - pointerEvent.globalX = interactionData.global.x; - pointerEvent.globalY = interactionData.global.y; - } - interactionData.originalEvent = pointerEvent; - interactionEvent.reset(); - return interactionEvent; - }; - /** - * Ensures that the original event object contains all data that a regular pointer event would have - * - * @private - * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event - * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer - * or mouse event, or a multiple normalized pointer events if there are multiple changed touches - */ - InteractionManager.prototype.normalizeToPointerData = function (event) { - var normalizedEvents = []; - if (this.supportsTouchEvents && event instanceof TouchEvent) { - for (var i = 0, li = event.changedTouches.length; i < li; i++) { - var touch = event.changedTouches[i]; - if (typeof touch.button === 'undefined') - { touch.button = event.touches.length ? 1 : 0; } - if (typeof touch.buttons === 'undefined') - { touch.buttons = event.touches.length ? 1 : 0; } - if (typeof touch.isPrimary === 'undefined') { - touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; - } - if (typeof touch.width === 'undefined') - { touch.width = touch.radiusX || 1; } - if (typeof touch.height === 'undefined') - { touch.height = touch.radiusY || 1; } - if (typeof touch.tiltX === 'undefined') - { touch.tiltX = 0; } - if (typeof touch.tiltY === 'undefined') - { touch.tiltY = 0; } - if (typeof touch.pointerType === 'undefined') - { touch.pointerType = 'touch'; } - if (typeof touch.pointerId === 'undefined') - { touch.pointerId = touch.identifier || 0; } - if (typeof touch.pressure === 'undefined') - { touch.pressure = touch.force || 0.5; } - if (typeof touch.twist === 'undefined') - { touch.twist = 0; } - if (typeof touch.tangentialPressure === 'undefined') - { touch.tangentialPressure = 0; } - // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven - // support, and the fill ins are not quite the same - // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top - // left is not 0,0 on the page - if (typeof touch.layerX === 'undefined') - { touch.layerX = touch.offsetX = touch.clientX; } - if (typeof touch.layerY === 'undefined') - { touch.layerY = touch.offsetY = touch.clientY; } - // mark the touch as normalized, just so that we know we did it - touch.isNormalized = true; - normalizedEvents.push(touch); - } - } - // apparently PointerEvent subclasses MouseEvent, so yay - else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) { - var tempEvent = event; - if (typeof tempEvent.isPrimary === 'undefined') - { tempEvent.isPrimary = true; } - if (typeof tempEvent.width === 'undefined') - { tempEvent.width = 1; } - if (typeof tempEvent.height === 'undefined') - { tempEvent.height = 1; } - if (typeof tempEvent.tiltX === 'undefined') - { tempEvent.tiltX = 0; } - if (typeof tempEvent.tiltY === 'undefined') - { tempEvent.tiltY = 0; } - if (typeof tempEvent.pointerType === 'undefined') - { tempEvent.pointerType = 'mouse'; } - if (typeof tempEvent.pointerId === 'undefined') - { tempEvent.pointerId = MOUSE_POINTER_ID; } - if (typeof tempEvent.pressure === 'undefined') - { tempEvent.pressure = 0.5; } - if (typeof tempEvent.twist === 'undefined') - { tempEvent.twist = 0; } - if (typeof tempEvent.tangentialPressure === 'undefined') - { tempEvent.tangentialPressure = 0; } - // mark the mouse event as normalized, just so that we know we did it - tempEvent.isNormalized = true; - normalizedEvents.push(tempEvent); - } - else { - normalizedEvents.push(event); - } - return normalizedEvents; - }; - /** - * Destroys the interaction manager - * - */ - InteractionManager.prototype.destroy = function () { - this.removeEvents(); - this.removeTickerListener(); - this.removeAllListeners(); - this.renderer = null; - this.mouse = null; - this.eventData = null; - this.interactionDOMElement = null; - this.onPointerDown = null; - this.processPointerDown = null; - this.onPointerUp = null; - this.processPointerUp = null; - this.onPointerCancel = null; - this.processPointerCancel = null; - this.onPointerMove = null; - this.processPointerMove = null; - this.onPointerOut = null; - this.processPointerOverOut = null; - this.onPointerOver = null; - this.search = null; - }; - return InteractionManager; - }(eventemitter3)); - - /*! - * @pixi/runner - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/runner is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * A Runner is a highly performant and simple alternative to signals. Best used in situations - * where events are dispatched to many objects at high frequency (say every frame!) - * - * - * like a signal.. - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myObject = { - * loaded: new Runner('loaded') - * } - * - * const listener = { - * loaded: function(){ - * // thin - * } - * } - * - * myObject.update.add(listener); - * - * myObject.loaded.emit(); - * ``` - * - * Or for handling calling the same function on many items - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myGame = { - * update: new Runner('update') - * } - * - * const gameObject = { - * update: function(time){ - * // update my gamey state - * } - * } - * - * myGame.update.add(gameObject1); - * - * myGame.update.emit(time); - * ``` - * @class - * @memberof PIXI - */ - var Runner = /** @class */ (function () { - /** - * @param {string} name - the function name that will be executed on the listeners added to this Runner. - */ - function Runner(name) { - this.items = []; - this._name = name; - this._aliasCount = 0; - } - /** - * Dispatch/Broadcast Runner to all listeners added to the queue. - * @param {...any} params - optional parameters to pass to each listener - * @return {PIXI.Runner} - */ - Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { - if (arguments.length > 8) { - throw new Error('max arguments reached'); - } - var _a = this, name = _a.name, items = _a.items; - this._aliasCount++; - for (var i = 0, len = items.length; i < len; i++) { - items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); - } - if (items === this.items) { - this._aliasCount--; - } - return this; - }; - Runner.prototype.ensureNonAliasedItems = function () { - if (this._aliasCount > 0 && this.items.length > 1) { - this._aliasCount = 0; - this.items = this.items.slice(0); - } - }; - /** - * Add a listener to the Runner - * - * Runners do not need to have scope or functions passed to them. - * All that is required is to pass the listening object and ensure that it has contains a function that has the same name - * as the name provided to the Runner when it was created. - * - * Eg A listener passed to this Runner will require a 'complete' function. - * - * ``` - * import { Runner } from '@pixi/runner'; - * - * const complete = new Runner('complete'); - * ``` - * - * The scope used will be the object itself. - * - * @param {any} item - The object that will be listening. - * @return {PIXI.Runner} - */ - Runner.prototype.add = function (item) { - if (item[this._name]) { - this.ensureNonAliasedItems(); - this.remove(item); - this.items.push(item); - } - return this; - }; - /** - * Remove a single listener from the dispatch queue. - * @param {any} item - The listenr that you would like to remove. - * @return {PIXI.Runner} - */ - Runner.prototype.remove = function (item) { - var index = this.items.indexOf(item); - if (index !== -1) { - this.ensureNonAliasedItems(); - this.items.splice(index, 1); - } - return this; - }; - /** - * Check to see if the listener is already in the Runner - * @param {any} item - The listener that you would like to check. - */ - Runner.prototype.contains = function (item) { - return this.items.indexOf(item) !== -1; - }; - /** - * Remove all listeners from the Runner - * @return {PIXI.Runner} - */ - Runner.prototype.removeAll = function () { - this.ensureNonAliasedItems(); - this.items.length = 0; - return this; - }; - /** - * Remove all references, don't use after this. - */ - Runner.prototype.destroy = function () { - this.removeAll(); - this.items = null; - this._name = null; - }; - Object.defineProperty(Runner.prototype, "empty", { - /** - * `true` if there are no this Runner contains no listeners - * - * @member {boolean} - * @readonly - */ - get: function () { - return this.items.length === 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Runner.prototype, "name", { - /** - * The name of the runner. - * - * @member {string} - * @readonly - */ - get: function () { - return this._name; - }, - enumerable: false, - configurable: true - }); - return Runner; - }()); - Object.defineProperties(Runner.prototype, { - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method dispatch - * @see PIXI.Runner#emit - */ - dispatch: { value: Runner.prototype.emit }, - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method run - * @see PIXI.Runner#emit - */ - run: { value: Runner.prototype.emit }, - }); - - /*! - * @pixi/core - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/core is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The maximum support for using WebGL. If a device does not - * support WebGL version, for instance WebGL 2, it will still - * attempt to fallback support to WebGL 1. If you want to - * explicitly remove feature support to target a more stable - * baseline, prefer a lower environment. - * - * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} - * we disable webgl2 by default for all non-apple mobile devices. - * - * @static - * @name PREFER_ENV - * @memberof PIXI.settings - * @type {number} - * @default PIXI.ENV.WEBGL2 - */ - settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; - /** - * If set to `true`, *only* Textures and BaseTexture objects stored - * in the caches ({@link PIXI.utils.TextureCache TextureCache} and - * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be - * used when calling {@link PIXI.Texture.from Texture.from} or - * {@link PIXI.BaseTexture.from BaseTexture.from}. - * Otherwise, these `from` calls throw an exception. Using this property - * can be useful if you want to enforce preloading all assets with - * {@link PIXI.Loader Loader}. - * - * @static - * @name STRICT_TEXTURE_CACHE - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - settings.STRICT_TEXTURE_CACHE = false; - - /** - * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}. - * @example - * class CustomResource extends PIXI.resources.Resource { - * // MUST have source, options constructor signature - * // for auto-detected resources to be created. - * constructor(source, options) { - * super(); - * } - * upload(renderer, baseTexture, glTexture) { - * // upload with GL - * return true; - * } - * // used to auto-detect resource - * static test(source, extension) { - * return extension === 'xyz'|| source instanceof SomeClass; - * } - * } - * // Install the new resource type - * PIXI.resources.INSTALLED.push(CustomResource); - * - * @name PIXI.resources.INSTALLED - * @type {Array<*>} - * @static - * @readonly - */ - var INSTALLED = []; - /** - * Create a resource element from a single source element. This - * auto-detects which type of resource to create. All resources that - * are auto-detectable must have a static `test` method and a constructor - * with the arguments `(source, options?)`. Currently, the supported - * resources for auto-detection include: - * - {@link PIXI.resources.ImageResource} - * - {@link PIXI.resources.CanvasResource} - * - {@link PIXI.resources.VideoResource} - * - {@link PIXI.resources.SVGResource} - * - {@link PIXI.resources.BufferResource} - * @static - * @function PIXI.resources.autoDetectResource - * @param {string|*} source - Resource source, this can be the URL to the resource, - * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri - * or any other resource that can be auto-detected. If not resource is - * detected, it's assumed to be an ImageResource. - * @param {object} [options] - Pass-through options to use for Resource - * @param {number} [options.width] - Width of BufferResource or SVG rasterization - * @param {number} [options.height] - Height of BufferResource or SVG rasterization - * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading - * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height - * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object - * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin - * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately - * @param {number} [options.updateFPS=0] - Video option to update how many times a second the - * texture should be updated from the video. Leave at 0 to update at every render - * @return {PIXI.resources.Resource} The created resource. - */ - function autoDetectResource(source, options) { - if (!source) { - return null; - } - var extension = ''; - if (typeof source === 'string') { - // search for file extension: period, 3-4 chars, then ?, # or EOL - var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); - if (result) { - extension = result[1].toLowerCase(); - } - } - for (var i = INSTALLED.length - 1; i >= 0; --i) { - var ResourcePlugin = INSTALLED[i]; - if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { - return new ResourcePlugin(source, options); - } - } - throw new Error('Unrecognized source type to auto-detect Resource'); - } - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$2 = function(d, b) { - extendStatics$2 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$2(d, b); - }; - - function __extends$2(d, b) { - extendStatics$2(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Base resource class for textures that manages validation and uploading, depending on its type. - * - * Uploading of a base texture to the GPU is required. - * - * @class - * @memberof PIXI.resources - */ - var Resource = /** @class */ (function () { - /** - * @param {number} [width=0] - Width of the resource - * @param {number} [height=0] - Height of the resource - */ - function Resource(width, height) { - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - /** - * Internal width of the resource - * @member {number} - * @protected - */ - this._width = width; - /** - * Internal height of the resource - * @member {number} - * @protected - */ - this._height = height; - /** - * If resource has been destroyed - * @member {boolean} - * @readonly - * @default false - */ - this.destroyed = false; - /** - * `true` if resource is created by BaseTexture - * useful for doing cleanup with BaseTexture destroy - * and not cleaning up resources that were created - * externally. - * @member {boolean} - * @protected - */ - this.internal = false; - /** - * Mini-runner for handling resize events - * accepts 2 parameters: width, height - * - * @member {Runner} - * @private - */ - this.onResize = new Runner('setRealSize'); - /** - * Mini-runner for handling update events - * - * @member {Runner} - * @private - */ - this.onUpdate = new Runner('update'); - /** - * Handle internal errors, such as loading errors - * accepts 1 param: error - * - * @member {Runner} - * @private - */ - this.onError = new Runner('onError'); - } - /** - * Bind to a parent BaseTexture - * - * @param {PIXI.BaseTexture} baseTexture - Parent texture - */ - Resource.prototype.bind = function (baseTexture) { - this.onResize.add(baseTexture); - this.onUpdate.add(baseTexture); - this.onError.add(baseTexture); - // Call a resize immediate if we already - // have the width and height of the resource - if (this._width || this._height) { - this.onResize.emit(this._width, this._height); - } - }; - /** - * Unbind to a parent BaseTexture - * - * @param {PIXI.BaseTexture} baseTexture - Parent texture - */ - Resource.prototype.unbind = function (baseTexture) { - this.onResize.remove(baseTexture); - this.onUpdate.remove(baseTexture); - this.onError.remove(baseTexture); - }; - /** - * Trigger a resize event - * @param {number} width - X dimension - * @param {number} height - Y dimension - */ - Resource.prototype.resize = function (width, height) { - if (width !== this._width || height !== this._height) { - this._width = width; - this._height = height; - this.onResize.emit(width, height); - } - }; - Object.defineProperty(Resource.prototype, "valid", { - /** - * Has been validated - * @readonly - * @member {boolean} - */ - get: function () { - return !!this._width && !!this._height; - }, - enumerable: false, - configurable: true - }); - /** - * Has been updated trigger event - */ - Resource.prototype.update = function () { - if (!this.destroyed) { - this.onUpdate.emit(); - } - }; - /** - * This can be overridden to start preloading a resource - * or do any other prepare step. - * @protected - * @return {Promise} Handle the validate event - */ - Resource.prototype.load = function () { - return Promise.resolve(this); - }; - Object.defineProperty(Resource.prototype, "width", { - /** - * The width of the resource. - * - * @member {number} - * @readonly - */ - get: function () { - return this._width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resource.prototype, "height", { - /** - * The height of the resource. - * - * @member {number} - * @readonly - */ - get: function () { - return this._height; - }, - enumerable: false, - configurable: true - }); - /** - * Set the style, optional to override - * - * @param {PIXI.Renderer} renderer - yeah, renderer! - * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context - * @returns {boolean} `true` is success - */ - Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { - return false; - }; - /** - * Clean up anything, this happens when destroying is ready. - * - * @protected - */ - Resource.prototype.dispose = function () { - // override - }; - /** - * Call when destroying resource, unbind any BaseTexture object - * before calling this method, as reference counts are maintained - * internally. - */ - Resource.prototype.destroy = function () { - if (!this.destroyed) { - this.destroyed = true; - this.dispose(); - this.onError.removeAll(); - this.onError = null; - this.onResize.removeAll(); - this.onResize = null; - this.onUpdate.removeAll(); - this.onUpdate = null; - } - }; - /** - * Abstract, used to auto-detect resource type - * - * @static - * @param {*} source - The source object - * @param {string} extension - The extension of source, if set - */ - Resource.test = function (_source, _extension) { - return false; - }; - return Resource; - }()); - - /** - * @interface SharedArrayBuffer - */ - /** - * Buffer resource with data of typed array. - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - */ - var BufferResource = /** @class */ (function (_super) { - __extends$2(BufferResource, _super); - /** - * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer - * @param {object} options - Options - * @param {number} options.width - Width of the texture - * @param {number} options.height - Height of the texture - */ - function BufferResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - if (!width || !height) { - throw new Error('BufferResource width or height invalid'); - } - _this = _super.call(this, width, height) || this; - /** - * Source array - * Cannot be ClampedUint8Array because it cant be uploaded to WebGL - * - * @member {Float32Array|Uint8Array|Uint32Array} - */ - _this.data = source; - return _this; - } - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - glTexture - * @returns {boolean} true is success - */ - BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { - var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { - gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); - } - else { - glTexture.width = baseTexture.width; - glTexture.height = baseTexture.height; - gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.width, baseTexture.height, 0, baseTexture.format, glTexture.type, this.data); - } - return true; - }; - /** - * Destroy and don't use after this - * @override - */ - BufferResource.prototype.dispose = function () { - this.data = null; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {*} source - The source object - * @return {boolean} `true` if - */ - BufferResource.test = function (source) { - return source instanceof Float32Array - || source instanceof Uint8Array - || source instanceof Uint32Array; - }; - return BufferResource; - }(Resource)); - - var defaultBufferOptions = { - scaleMode: exports.SCALE_MODES.NEAREST, - format: exports.FORMATS.RGBA, - alphaMode: exports.ALPHA_MODES.NPM, - }; - /** - * A Texture stores the information that represents an image. - * All textures have a base texture, which contains information about the source. - * Therefore you can have many textures all using a single BaseTexture - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - * The current resource to use, for things that aren't Resource objects, will be converted - * into a Resource. - * @param {Object} [options] - Collection of options - * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture - * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture - * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures - * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest - * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type - * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type - * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target - * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha - * @param {number} [options.width=0] - Width of the texture - * @param {number} [options.height=0] - Height of the texture - * @param {number} [options.resolution] - Resolution of the base texture - * @param {object} [options.resourceOptions] - Optional resource options, - * see {@link PIXI.resources.autoDetectResource autoDetectResource} - */ - var BaseTexture = /** @class */ (function (_super) { - __extends$2(BaseTexture, _super); - function BaseTexture(resource, options) { - if (resource === void 0) { resource = null; } - if (options === void 0) { options = null; } - var _this = _super.call(this) || this; - options = options || {}; - var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; - // Convert the resource to a Resource object - if (resource && !(resource instanceof Resource)) { - resource = autoDetectResource(resource, resourceOptions); - resource.internal = true; - } - /** - * The width of the base texture set when the image has loaded - * - * @readonly - * @member {number} - */ - _this.width = width || 0; - /** - * The height of the base texture set when the image has loaded - * - * @readonly - * @member {number} - */ - _this.height = height || 0; - /** - * The resolution / device pixel ratio of the texture - * - * @member {number} - * @default PIXI.settings.RESOLUTION - */ - _this.resolution = resolution || settings.RESOLUTION; - /** - * Mipmap mode of the texture, affects downscaled images - * - * @member {PIXI.MIPMAP_MODES} - * @default PIXI.settings.MIPMAP_TEXTURES - */ - _this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; - /** - * Anisotropic filtering level of texture - * - * @member {number} - * @default PIXI.settings.ANISOTROPIC_LEVEL - */ - _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; - /** - * How the texture wraps - * @member {number} - */ - _this.wrapMode = wrapMode || settings.WRAP_MODE; - /** - * The scale mode to apply when scaling this texture - * - * @member {PIXI.SCALE_MODES} - * @default PIXI.settings.SCALE_MODE - */ - _this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; - /** - * The pixel format of the texture - * - * @member {PIXI.FORMATS} - * @default PIXI.FORMATS.RGBA - */ - _this.format = format || exports.FORMATS.RGBA; - /** - * The type of resource data - * - * @member {PIXI.TYPES} - * @default PIXI.TYPES.UNSIGNED_BYTE - */ - _this.type = type || exports.TYPES.UNSIGNED_BYTE; - /** - * The target type - * - * @member {PIXI.TARGETS} - * @default PIXI.TARGETS.TEXTURE_2D - */ - _this.target = target || exports.TARGETS.TEXTURE_2D; - /** - * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}. - * - * @member {PIXI.ALPHA_MODES} - * @default PIXI.ALPHA_MODES.UNPACK - */ - _this.alphaMode = alphaMode !== undefined ? alphaMode : exports.ALPHA_MODES.UNPACK; - if (options.premultiplyAlpha !== undefined) { - // triggers deprecation - _this.premultiplyAlpha = options.premultiplyAlpha; - } - /** - * Global unique identifier for this BaseTexture - * - * @member {number} - * @protected - */ - _this.uid = uid(); - /** - * Used by automatic texture Garbage Collection, stores last GC tick when it was bound - * - * @member {number} - * @protected - */ - _this.touched = 0; - /** - * Whether or not the texture is a power of two, try to use power of two textures as much - * as you can - * - * @readonly - * @member {boolean} - * @default false - */ - _this.isPowerOfTwo = false; - _this._refreshPOT(); - /** - * The map of render context textures where this is bound - * - * @member {Object} - * @private - */ - _this._glTextures = {}; - /** - * Used by TextureSystem to only update texture to the GPU when needed. - * Please call `update()` to increment it. - * - * @readonly - * @member {number} - */ - _this.dirtyId = 0; - /** - * Used by TextureSystem to only update texture style when needed. - * - * @protected - * @member {number} - */ - _this.dirtyStyleId = 0; - /** - * Currently default cache ID. - * - * @member {string} - */ - _this.cacheId = null; - /** - * Generally speaking means when resource is loaded. - * @readonly - * @member {boolean} - */ - _this.valid = width > 0 && height > 0; - /** - * The collection of alternative cache ids, since some BaseTextures - * can have more than one ID, short name and longer full URL - * - * @member {Array} - * @readonly - */ - _this.textureCacheIds = []; - /** - * Flag if BaseTexture has been destroyed. - * - * @member {boolean} - * @readonly - */ - _this.destroyed = false; - /** - * The resource used by this BaseTexture, there can only - * be one resource per BaseTexture, but textures can share - * resources. - * - * @member {PIXI.resources.Resource} - * @readonly - */ - _this.resource = null; - /** - * Number of the texture batch, used by multi-texture renderers - * - * @member {number} - */ - _this._batchEnabled = 0; - /** - * Location inside texture batch, used by multi-texture renderers - * - * @member {number} - */ - _this._batchLocation = 0; - /** - * Whether its a part of another texture, handled by ArrayResource or CubeResource - * - * @member {PIXI.BaseTexture} - */ - _this.parentTextureArray = null; - /** - * Fired when a not-immediately-available source finishes loading. - * - * @protected - * @event PIXI.BaseTexture#loaded - * @param {PIXI.BaseTexture} baseTexture - Resource loaded. - */ - /** - * Fired when a not-immediately-available source fails to load. - * - * @protected - * @event PIXI.BaseTexture#error - * @param {PIXI.BaseTexture} baseTexture - Resource errored. - * @param {ErrorEvent} event - Load error event. - */ - /** - * Fired when BaseTexture is updated. - * - * @protected - * @event PIXI.BaseTexture#loaded - * @param {PIXI.BaseTexture} baseTexture - Resource loaded. - */ - /** - * Fired when BaseTexture is updated. - * - * @protected - * @event PIXI.BaseTexture#update - * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. - */ - /** - * Fired when BaseTexture is destroyed. - * - * @protected - * @event PIXI.BaseTexture#dispose - * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. - */ - // Set the resource - _this.setResource(resource); - return _this; - } - Object.defineProperty(BaseTexture.prototype, "realWidth", { - /** - * Pixel width of the source of this texture - * - * @readonly - * @member {number} - */ - get: function () { - return Math.ceil((this.width * this.resolution) - 1e-4); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BaseTexture.prototype, "realHeight", { - /** - * Pixel height of the source of this texture - * - * @readonly - * @member {number} - */ - get: function () { - return Math.ceil((this.height * this.resolution) - 1e-4); - }, - enumerable: false, - configurable: true - }); - /** - * Changes style options of BaseTexture - * - * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode - * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { - var dirty; - if (scaleMode !== undefined && scaleMode !== this.scaleMode) { - this.scaleMode = scaleMode; - dirty = true; - } - if (mipmap !== undefined && mipmap !== this.mipmap) { - this.mipmap = mipmap; - dirty = true; - } - if (dirty) { - this.dirtyStyleId++; - } - return this; - }; - /** - * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. - * - * @param {number} width - Visual width - * @param {number} height - Visual height - * @param {number} [resolution] - Optionally set resolution - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setSize = function (width, height, resolution) { - this.resolution = resolution || this.resolution; - this.width = width; - this.height = height; - this._refreshPOT(); - this.update(); - return this; - }; - /** - * Sets real size of baseTexture, preserves current resolution. - * - * @param {number} realWidth - Full rendered width - * @param {number} realHeight - Full rendered height - * @param {number} [resolution] - Optionally set resolution - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { - this.resolution = resolution || this.resolution; - this.width = realWidth / this.resolution; - this.height = realHeight / this.resolution; - this._refreshPOT(); - this.update(); - return this; - }; - /** - * Refresh check for isPowerOfTwo texture based on size - * - * @private - */ - BaseTexture.prototype._refreshPOT = function () { - this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight); - }; - /** - * Changes resolution - * - * @param {number} resolution - res - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setResolution = function (resolution) { - var oldResolution = this.resolution; - if (oldResolution === resolution) { - return this; - } - this.resolution = resolution; - if (this.valid) { - this.width = this.width * oldResolution / resolution; - this.height = this.height * oldResolution / resolution; - this.emit('update', this); - } - this._refreshPOT(); - return this; - }; - /** - * Sets the resource if it wasn't set. Throws error if resource already present - * - * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setResource = function (resource) { - if (this.resource === resource) { - return this; - } - if (this.resource) { - throw new Error('Resource can be set only once'); - } - resource.bind(this); - this.resource = resource; - return this; - }; - /** - * Invalidates the object. Texture becomes valid if width and height are greater than zero. - */ - BaseTexture.prototype.update = function () { - if (!this.valid) { - if (this.width > 0 && this.height > 0) { - this.valid = true; - this.emit('loaded', this); - this.emit('update', this); - } - } - else { - this.dirtyId++; - this.dirtyStyleId++; - this.emit('update', this); - } - }; - /** - * Handle errors with resources. - * @private - * @param {ErrorEvent} event - Error event emitted. - */ - BaseTexture.prototype.onError = function (event) { - this.emit('error', this, event); - }; - /** - * Destroys this base texture. - * The method stops if resource doesn't want this texture to be destroyed. - * Removes texture from all caches. - */ - BaseTexture.prototype.destroy = function () { - // remove and destroy the resource - if (this.resource) { - this.resource.unbind(this); - // only destroy resourced created internally - if (this.resource.internal) { - this.resource.destroy(); - } - this.resource = null; - } - if (this.cacheId) { - delete BaseTextureCache[this.cacheId]; - delete TextureCache[this.cacheId]; - this.cacheId = null; - } - // finally let the WebGL renderer know.. - this.dispose(); - BaseTexture.removeFromCache(this); - this.textureCacheIds = null; - this.destroyed = true; - }; - /** - * Frees the texture from WebGL memory without destroying this texture object. - * This means you can still use the texture later which will upload it to GPU - * memory again. - * - * @fires PIXI.BaseTexture#dispose - */ - BaseTexture.prototype.dispose = function () { - this.emit('dispose', this); - }; - /** - * Utility function for BaseTexture|Texture cast - */ - BaseTexture.prototype.castToBaseTexture = function () { - return this; - }; - /** - * Helper function that creates a base texture based on the source you provide. - * The source can be - image url, image element, canvas element. If the - * source is an image url or an image element and not in the base texture - * cache, it will be created and loaded. - * - * @static - * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The - * source to create base texture from. - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. - * @returns {PIXI.BaseTexture} The new base texture. - */ - BaseTexture.from = function (source, options, strict) { - if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } - var isFrame = typeof source === 'string'; - var cacheId = null; - if (isFrame) { - cacheId = source; - } - else { - if (!source._pixiId) { - source._pixiId = "pixiid_" + uid(); - } - cacheId = source._pixiId; - } - var baseTexture = BaseTextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !baseTexture) { - throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); - } - if (!baseTexture) { - baseTexture = new BaseTexture(source, options); - baseTexture.cacheId = cacheId; - BaseTexture.addToCache(baseTexture, cacheId); - } - return baseTexture; - }; - /** - * Create a new BaseTexture with a BufferResource from a Float32Array. - * RGBA values are floats from 0 to 1. - * @static - * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data - * is provided, a new Float32Array is created. - * @param {number} width - Width of the resource - * @param {number} height - Height of the resource - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The resulting new BaseTexture - */ - BaseTexture.fromBuffer = function (buffer, width, height, options) { - buffer = buffer || new Float32Array(width * height * 4); - var resource = new BufferResource(buffer, { width: width, height: height }); - var type = buffer instanceof Float32Array ? exports.TYPES.FLOAT : exports.TYPES.UNSIGNED_BYTE; - return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type })); - }; - /** - * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. - * - * @static - * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. - * @param {string} id - The id that the BaseTexture will be stored against. - */ - BaseTexture.addToCache = function (baseTexture, id) { - if (id) { - if (baseTexture.textureCacheIds.indexOf(id) === -1) { - baseTexture.textureCacheIds.push(id); - } - if (BaseTextureCache[id]) { - // eslint-disable-next-line no-console - console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); - } - BaseTextureCache[id] = baseTexture; - } - }; - /** - * Remove a BaseTexture from the global BaseTextureCache. - * - * @static - * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. - * @return {PIXI.BaseTexture|null} The BaseTexture that was removed. - */ - BaseTexture.removeFromCache = function (baseTexture) { - if (typeof baseTexture === 'string') { - var baseTextureFromCache = BaseTextureCache[baseTexture]; - if (baseTextureFromCache) { - var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); - if (index > -1) { - baseTextureFromCache.textureCacheIds.splice(index, 1); - } - delete BaseTextureCache[baseTexture]; - return baseTextureFromCache; - } - } - else if (baseTexture && baseTexture.textureCacheIds) { - for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { - delete BaseTextureCache[baseTexture.textureCacheIds[i]]; - } - baseTexture.textureCacheIds.length = 0; - return baseTexture; - } - return null; - }; - /** - * Global number of the texture batch, used by multi-texture renderers - * - * @static - * @member {number} - */ - BaseTexture._globalBatch = 0; - return BaseTexture; - }(eventemitter3)); - - /** - * Resource that can manage several resource (items) inside. - * All resources need to have the same pixel size. - * Parent class for CubeResource and ArrayResource - * - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - * @param {object} [options] Options to for Resource constructor - * @param {number} [options.width] - Width of the resource - * @param {number} [options.height] - Height of the resource - */ - var AbstractMultiResource = /** @class */ (function (_super) { - __extends$2(AbstractMultiResource, _super); - function AbstractMultiResource(length, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - _this = _super.call(this, width, height) || this; - /** - * Collection of partial baseTextures that correspond to resources - * @member {Array} - * @readonly - */ - _this.items = []; - /** - * Dirty IDs for each part - * @member {Array} - * @readonly - */ - _this.itemDirtyIds = []; - for (var i = 0; i < length; i++) { - var partTexture = new BaseTexture(); - _this.items.push(partTexture); - // -2 - first run of texture array upload - // -1 - texture item was allocated - // >=0 - texture item uploaded , in sync with items[i].dirtyId - _this.itemDirtyIds.push(-2); - } - /** - * Number of elements in array - * - * @member {number} - * @readonly - */ - _this.length = length; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - /** - * Bound baseTexture, there can only be one - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = null; - return _this; - } - /** - * used from ArrayResource and CubeResource constructors - * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. , - * length should be same as constructor length - * @param {object} [options] - detect options for resources - * @protected - */ - AbstractMultiResource.prototype.initFromArray = function (resources, options) { - for (var i = 0; i < this.length; i++) { - if (!resources[i]) { - continue; - } - if (resources[i].castToBaseTexture) { - this.addBaseTextureAt(resources[i].castToBaseTexture(), i); - } - else if (resources[i] instanceof Resource) { - this.addResourceAt(resources[i], i); - } - else { - this.addResourceAt(autoDetectResource(resources[i], options), i); - } - } - }; - /** - * Destroy this BaseImageResource - * @override - */ - AbstractMultiResource.prototype.dispose = function () { - for (var i = 0, len = this.length; i < len; i++) { - this.items[i].destroy(); - } - this.items = null; - this.itemDirtyIds = null; - this._load = null; - }; - /** - * Set a resource by ID - * - * @param {PIXI.resources.Resource} resource - * @param {number} index - Zero-based index of resource to set - * @return {PIXI.resources.ArrayResource} Instance for chaining - */ - AbstractMultiResource.prototype.addResourceAt = function (resource, index) { - if (!this.items[index]) { - throw new Error("Index " + index + " is out of bounds"); - } - // Inherit the first resource dimensions - if (resource.valid && !this.valid) { - this.resize(resource.width, resource.height); - } - this.items[index].setResource(resource); - return this; - }; - /** - * Set the parent base texture - * @member {PIXI.BaseTexture} - * @override - */ - AbstractMultiResource.prototype.bind = function (baseTexture) { - if (this.baseTexture !== null) { - throw new Error('Only one base texture per TextureArray is allowed'); - } - _super.prototype.bind.call(this, baseTexture); - for (var i = 0; i < this.length; i++) { - this.items[i].parentTextureArray = baseTexture; - this.items[i].on('update', baseTexture.update, baseTexture); - } - }; - /** - * Unset the parent base texture - * @member {PIXI.BaseTexture} - * @override - */ - AbstractMultiResource.prototype.unbind = function (baseTexture) { - _super.prototype.unbind.call(this, baseTexture); - for (var i = 0; i < this.length; i++) { - this.items[i].parentTextureArray = null; - this.items[i].off('update', baseTexture.update, baseTexture); - } - }; - /** - * Load all the resources simultaneously - * @override - * @return {Promise} When load is resolved - */ - AbstractMultiResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); - // TODO: also implement load part-by-part strategy - var promises = resources.map(function (item) { return item.load(); }); - this._load = Promise.all(promises) - .then(function () { - var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; - _this.resize(realWidth, realHeight); - return Promise.resolve(_this); - }); - return this._load; - }; - return AbstractMultiResource; - }(Resource)); - - /** - * A resource that contains a number of sources. - * - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - * @param {number|Array<*>} source - Number of items in array or the collection - * of image URLs to use. Can also be resources, image elements, canvas, etc. - * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource} - * @param {number} [options.width] - Width of the resource - * @param {number} [options.height] - Height of the resource - */ - var ArrayResource = /** @class */ (function (_super) { - __extends$2(ArrayResource, _super); - function ArrayResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - var urls; - var length; - if (Array.isArray(source)) { - urls = source; - length = source.length; - } - else { - length = source; - } - _this = _super.call(this, length, { width: width, height: height }) || this; - if (urls) { - _this.initFromArray(urls, options); - } - return _this; - } - /** - * Set a baseTexture by ID, - * ArrayResource just takes resource from it, nothing more - * - * @param {PIXI.BaseTexture} baseTexture - * @param {number} index - Zero-based index of resource to set - * @return {PIXI.resources.ArrayResource} Instance for chaining - */ - ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { - if (baseTexture.resource) { - this.addResourceAt(baseTexture.resource, index); - } - else { - throw new Error('ArrayResource does not support RenderTexture'); - } - return this; - }; - /** - * Add binding - * @member {PIXI.BaseTexture} - * @override - */ - ArrayResource.prototype.bind = function (baseTexture) { - _super.prototype.bind.call(this, baseTexture); - baseTexture.target = exports.TARGETS.TEXTURE_2D_ARRAY; - }; - /** - * Upload the resources to the GPU. - * @param {PIXI.Renderer} renderer - * @param {PIXI.BaseTexture} texture - * @param {PIXI.GLTexture} glTexture - * @returns {boolean} whether texture was uploaded - */ - ArrayResource.prototype.upload = function (renderer, texture, glTexture) { - var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; - var gl = renderer.gl; - if (glTexture.dirtyId < 0) { - gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, texture.format, this._width, this._height, length, 0, texture.format, texture.type, null); - } - for (var i = 0; i < length; i++) { - var item = items[i]; - if (itemDirtyIds[i] < item.dirtyId) { - itemDirtyIds[i] = item.dirtyId; - if (item.valid) { - gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset - 0, // yoffset - i, // zoffset - item.resource.width, item.resource.height, 1, texture.format, texture.type, item.resource.source); - } - } - } - return true; - }; - return ArrayResource; - }(AbstractMultiResource)); - - /** - * Base for all the image/canvas resources - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - */ - var BaseImageResource = /** @class */ (function (_super) { - __extends$2(BaseImageResource, _super); - /** - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source - */ - function BaseImageResource(source) { - var _this = this; - var sourceAny = source; - var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; - var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; - _this = _super.call(this, width, height) || this; - /** - * The source element - * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} - * @readonly - */ - _this.source = source; - /** - * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. - * Certain types of media (e.g. video) using `texImage2D` is more performant. - * @member {boolean} - * @default false - * @private - */ - _this.noSubImage = false; - return _this; - } - /** - * Set cross origin based detecting the url and the crossorigin - * @protected - * @param {HTMLElement} element - Element to apply crossOrigin - * @param {string} url - URL to check - * @param {boolean|string} [crossorigin=true] - Cross origin value to use - */ - BaseImageResource.crossOrigin = function (element, url, crossorigin) { - if (crossorigin === undefined && url.indexOf('data:') !== 0) { - element.crossOrigin = determineCrossOrigin(url); - } - else if (crossorigin !== false) { - element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; - } - }; - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) - * @returns {boolean} true is success - */ - BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { - var gl = renderer.gl; - var width = baseTexture.realWidth; - var height = baseTexture.realHeight; - source = source || this.source; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (!this.noSubImage - && baseTexture.target === gl.TEXTURE_2D - && glTexture.width === width - && glTexture.height === height) { - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source); - } - else { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source); - } - return true; - }; - /** - * Checks if source width/height was changed, resize can cause extra baseTexture update. - * Triggers one update in any case. - */ - BaseImageResource.prototype.update = function () { - if (this.destroyed) { - return; - } - var source = this.source; - var width = source.naturalWidth || source.videoWidth || source.width; - var height = source.naturalHeight || source.videoHeight || source.height; - this.resize(width, height); - _super.prototype.update.call(this); - }; - /** - * Destroy this BaseImageResource - * @override - */ - BaseImageResource.prototype.dispose = function () { - this.source = null; - }; - return BaseImageResource; - }(Resource)); - - /** - * @interface OffscreenCanvas - */ - /** - * Resource type for HTMLCanvasElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {HTMLCanvasElement} source - Canvas element to use - */ - var CanvasResource = /** @class */ (function (_super) { - __extends$2(CanvasResource, _super); - function CanvasResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object - * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas - */ - CanvasResource.test = function (source) { - var OffscreenCanvas = window.OffscreenCanvas; - // Check for browsers that don't yet support OffscreenCanvas - if (OffscreenCanvas && source instanceof OffscreenCanvas) { - return true; - } - return source instanceof HTMLCanvasElement; - }; - return CanvasResource; - }(BaseImageResource)); - - /** - * Resource for a CubeTexture which contains six resources. - * - * @class - * @extends PIXI.resources.ArrayResource - * @memberof PIXI.resources - * @param {Array} [source] - Collection of URLs or resources - * to use as the sides of the cube. - * @param {object} [options] - ImageResource options - * @param {number} [options.width] - Width of resource - * @param {number} [options.height] - Height of resource - * @param {number} [options.autoLoad=true] - Whether to auto-load resources - * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, - * whether to copy them or use - */ - var CubeResource = /** @class */ (function (_super) { - __extends$2(CubeResource, _super); - function CubeResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; - if (source && source.length !== CubeResource.SIDES) { - throw new Error("Invalid length. Got " + source.length + ", expected 6"); - } - _this = _super.call(this, 6, { width: width, height: height }) || this; - for (var i = 0; i < CubeResource.SIDES; i++) { - _this.items[i].target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; - } - /** - * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself - * @member {boolean} - * @protected - */ - _this.linkBaseTexture = linkBaseTexture !== false; - if (source) { - _this.initFromArray(source, options); - } - if (autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * Add binding - * - * @override - * @param {PIXI.BaseTexture} baseTexture - parent base texture - */ - CubeResource.prototype.bind = function (baseTexture) { - _super.prototype.bind.call(this, baseTexture); - baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP; - }; - CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { - if (linkBaseTexture === undefined) { - linkBaseTexture = this.linkBaseTexture; - } - if (!this.items[index]) { - throw new Error("Index " + index + " is out of bounds"); - } - if (!this.linkBaseTexture - || baseTexture.parentTextureArray - || Object.keys(baseTexture._glTextures).length > 0) { - // copy mode - if (baseTexture.resource) { - this.addResourceAt(baseTexture.resource, index); - } - else { - throw new Error("CubeResource does not support copying of renderTexture."); - } - } - else { - // link mode, the difficult one! - baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; - baseTexture.parentTextureArray = this.baseTexture; - this.items[index] = baseTexture; - } - if (baseTexture.valid && !this.valid) { - this.resize(baseTexture.realWidth, baseTexture.realHeight); - } - this.items[index] = baseTexture; - return this; - }; - /** - * Upload the resource - * - * @returns {boolean} true is success - */ - CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { - var dirty = this.itemDirtyIds; - for (var i = 0; i < CubeResource.SIDES; i++) { - var side = this.items[i]; - if (dirty[i] < side.dirtyId) { - if (side.valid && side.resource) { - side.resource.upload(renderer, side, glTexture); - dirty[i] = side.dirtyId; - } - else if (dirty[i] < -1) { - // either item is not valid yet, either its a renderTexture - // allocate the memory - renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); - dirty[i] = -1; - } - } - } - return true; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {object} source - The source object - * @return {boolean} `true` if source is an array of 6 elements - */ - CubeResource.test = function (source) { - return Array.isArray(source) && source.length === CubeResource.SIDES; - }; - /** - * Number of texture sides to store for CubeResources - * - * @name PIXI.resources.CubeResource.SIDES - * @static - * @member {number} - * @default 6 - */ - CubeResource.SIDES = 6; - return CubeResource; - }(AbstractMultiResource)); - - /** - * Resource type for HTMLImageElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - */ - var ImageResource = /** @class */ (function (_super) { - __extends$2(ImageResource, _super); - /** - * @param {HTMLImageElement|string} source - image source or URL - * @param {object} [options] - * @param {boolean} [options.autoLoad=true] - start loading process - * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create - * a bitmap before upload - * @param {boolean} [options.crossorigin=true] - Load image using cross origin - * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap - */ - function ImageResource(source, options) { - var _this = this; - options = options || {}; - if (!(source instanceof HTMLImageElement)) { - var imageElement = new Image(); - BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); - imageElement.src = source; - source = imageElement; - } - _this = _super.call(this, source) || this; - // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height - // to non-zero values before its loading completes if images are in a cache. - // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. - // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). - if (!source.complete && !!_this._width && !!_this._height) { - _this._width = 0; - _this._height = 0; - } - /** - * URL of the image source - * @member {string} - */ - _this.url = source.src; - /** - * When process is completed - * @member {Promise} - * @private - */ - _this._process = null; - /** - * If the image should be disposed after upload - * @member {boolean} - * @default false - */ - _this.preserveBitmap = false; - /** - * If capable, convert the image using createImageBitmap API - * @member {boolean} - * @default PIXI.settings.CREATE_IMAGE_BITMAP - */ - _this.createBitmap = (options.createBitmap !== undefined - ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap; - /** - * Controls texture alphaMode field - * Copies from options - * Default is `null`, copies option from baseTexture - * - * @member {PIXI.ALPHA_MODES|null} - * @readonly - */ - _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; - if (options.premultiplyAlpha !== undefined) { - // triggers deprecation - _this.premultiplyAlpha = options.premultiplyAlpha; - } - /** - * The ImageBitmap element created for HTMLImageElement - * @member {ImageBitmap} - * @default null - */ - _this.bitmap = null; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * returns a promise when image will be loaded and processed - * - * @param {boolean} [createBitmap] - whether process image into bitmap - * @returns {Promise} - */ - ImageResource.prototype.load = function (createBitmap) { - var _this = this; - if (this._load) { - return this._load; - } - if (createBitmap !== undefined) { - this.createBitmap = createBitmap; - } - this._load = new Promise(function (resolve, reject) { - var source = _this.source; - _this.url = source.src; - var completed = function () { - if (_this.destroyed) { - return; - } - source.onload = null; - source.onerror = null; - _this.resize(source.width, source.height); - _this._load = null; - if (_this.createBitmap) { - resolve(_this.process()); - } - else { - resolve(_this); - } - }; - if (source.complete && source.src) { - completed(); - } - else { - source.onload = completed; - source.onerror = function (event) { - // Avoids Promise freezing when resource broken - reject(event); - _this.onError.emit(event); - }; - } - }); - return this._load; - }; - /** - * Called when we need to convert image into BitmapImage. - * Can be called multiple times, real promise is cached inside. - * - * @returns {Promise} cached promise to fill that bitmap - */ - ImageResource.prototype.process = function () { - var _this = this; - var source = this.source; - if (this._process !== null) { - return this._process; - } - if (this.bitmap !== null || !window.createImageBitmap) { - return Promise.resolve(this); - } - this._process = window.createImageBitmap(source, 0, 0, source.width, source.height, { - premultiplyAlpha: this.alphaMode === exports.ALPHA_MODES.UNPACK ? 'premultiply' : 'none', - }) - .then(function (bitmap) { - if (_this.destroyed) { - return Promise.reject(); - } - _this.bitmap = bitmap; - _this.update(); - _this._process = null; - return Promise.resolve(_this); - }); - return this._process; - }; - /** - * Upload the image resource to GPU. - * - * @param {PIXI.Renderer} renderer - Renderer to upload to - * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.GLTexture} glTexture - GLTexture to use - * @returns {boolean} true is success - */ - ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { - if (typeof this.alphaMode === 'number') { - // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it - baseTexture.alphaMode = this.alphaMode; - } - if (!this.createBitmap) { - return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); - } - if (!this.bitmap) { - // yeah, ignore the output - this.process(); - if (!this.bitmap) { - return false; - } - } - _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); - if (!this.preserveBitmap) { - // checks if there are other renderers that possibly need this bitmap - var flag = true; - var glTextures = baseTexture._glTextures; - for (var key in glTextures) { - var otherTex = glTextures[key]; - if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { - flag = false; - break; - } - } - if (flag) { - if (this.bitmap.close) { - this.bitmap.close(); - } - this.bitmap = null; - } - } - return true; - }; - /** - * Destroys this texture - * @override - */ - ImageResource.prototype.dispose = function () { - this.source.onload = null; - this.source.onerror = null; - _super.prototype.dispose.call(this); - if (this.bitmap) { - this.bitmap.close(); - this.bitmap = null; - } - this._process = null; - this._load = null; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {string|HTMLImageElement} source - The source object - * @return {boolean} `true` if source is string or HTMLImageElement - */ - ImageResource.test = function (source) { - return typeof source === 'string' || source instanceof HTMLImageElement; - }; - return ImageResource; - }(BaseImageResource)); - - /** - * Resource type for SVG elements and graphics. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {string} source - Base64 encoded SVG element or URL for SVG file. - * @param {object} [options] - Options to use - * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... - * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. - * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. - * @param {boolean} [options.autoLoad=true] - Start loading right away. - */ - var SVGResource = /** @class */ (function (_super) { - __extends$2(SVGResource, _super); - function SVGResource(sourceBase64, options) { - var _this = this; - options = options || {}; - _this = _super.call(this, document.createElement('canvas')) || this; - _this._width = 0; - _this._height = 0; - /** - * Base64 encoded SVG element or URL for SVG file - * @readonly - * @member {string} - */ - _this.svg = sourceBase64; - /** - * The source scale to apply when rasterizing on load - * @readonly - * @member {number} - */ - _this.scale = options.scale || 1; - /** - * A width override for rasterization on load - * @readonly - * @member {number} - */ - _this._overrideWidth = options.width; - /** - * A height override for rasterization on load - * @readonly - * @member {number} - */ - _this._overrideHeight = options.height; - /** - * Call when completely loaded - * @private - * @member {function} - */ - _this._resolve = null; - /** - * Cross origin value to use - * @private - * @member {boolean|string} - */ - _this._crossorigin = options.crossorigin; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - SVGResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - this._load = new Promise(function (resolve) { - // Save this until after load is finished - _this._resolve = function () { - _this.resize(_this.source.width, _this.source.height); - resolve(_this); - }; - // Convert SVG inline string to data-uri - if ((/^\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len - return SVGResource; - }(BaseImageResource)); - - /** - * Resource type for HTMLVideoElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {HTMLVideoElement|object|string|Array} source - Video element to use. - * @param {object} [options] - Options to use - * @param {boolean} [options.autoLoad=true] - Start loading the video immediately - * @param {boolean} [options.autoPlay=true] - Start playing video immediately - * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. - * Leave at 0 to update at every render. - * @param {boolean} [options.crossorigin=true] - Load image using cross origin - */ - var VideoResource = /** @class */ (function (_super) { - __extends$2(VideoResource, _super); - function VideoResource(source, options) { - var _this = this; - options = options || {}; - if (!(source instanceof HTMLVideoElement)) { - var videoElement = document.createElement('video'); - // workaround for https://github.com/pixijs/pixi.js/issues/5996 - videoElement.setAttribute('preload', 'auto'); - videoElement.setAttribute('webkit-playsinline', ''); - videoElement.setAttribute('playsinline', ''); - if (typeof source === 'string') { - source = [source]; - } - var firstSrc = source[0].src || source[0]; - BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); - // array of objects or strings - for (var i = 0; i < source.length; ++i) { - var sourceElement = document.createElement('source'); - var _a = source[i], src = _a.src, mime = _a.mime; - src = src || source[i]; - var baseSrc = src.split('?').shift().toLowerCase(); - var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1); - mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; - sourceElement.src = src; - sourceElement.type = mime; - videoElement.appendChild(sourceElement); - } - // Override the source - source = videoElement; - } - _this = _super.call(this, source) || this; - _this.noSubImage = true; - /** - * `true` to use PIXI.Ticker.shared to auto update the base texture. - * - * @type {boolean} - * @default true - * @private - */ - _this._autoUpdate = true; - /** - * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture. - * - * @type {boolean} - * @default false - * @private - */ - _this._isConnectedToTicker = false; - _this._updateFPS = options.updateFPS || 0; - _this._msToNextUpdate = 0; - /** - * When set to true will automatically play videos used by this texture once - * they are loaded. If false, it will not modify the playing state. - * - * @member {boolean} - * @default true - */ - _this.autoPlay = options.autoPlay !== false; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - /** - * Callback when completed with load. - * @member {function} - * @private - */ - _this._resolve = null; - // Bind for listeners - _this._onCanPlay = _this._onCanPlay.bind(_this); - _this._onError = _this._onError.bind(_this); - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * Trigger updating of the texture - * - * @param {number} [deltaTime=0] - time delta since last tick - */ - VideoResource.prototype.update = function (_deltaTime) { - if (_deltaTime === void 0) { _deltaTime = 0; } - if (!this.destroyed) { - // account for if video has had its playbackRate changed - var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate; - this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); - if (!this._updateFPS || this._msToNextUpdate <= 0) { - _super.prototype.update.call(this); - this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; - } - } - }; - /** - * Start preloading the video resource. - * - * @protected - * @return {Promise} Handle the validate event - */ - VideoResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - var source = this.source; - if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) - && source.width && source.height) { - source.complete = true; - } - source.addEventListener('play', this._onPlayStart.bind(this)); - source.addEventListener('pause', this._onPlayStop.bind(this)); - if (!this._isSourceReady()) { - source.addEventListener('canplay', this._onCanPlay); - source.addEventListener('canplaythrough', this._onCanPlay); - source.addEventListener('error', this._onError, true); - } - else { - this._onCanPlay(); - } - this._load = new Promise(function (resolve) { - if (_this.valid) { - resolve(_this); - } - else { - _this._resolve = resolve; - source.load(); - } - }); - return this._load; - }; - /** - * Handle video error events. - * - * @private - */ - VideoResource.prototype._onError = function (event) { - this.source.removeEventListener('error', this._onError, true); - this.onError.emit(event); - }; - /** - * Returns true if the underlying source is playing. - * - * @private - * @return {boolean} True if playing. - */ - VideoResource.prototype._isSourcePlaying = function () { - var source = this.source; - return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2); - }; - /** - * Returns true if the underlying source is ready for playing. - * - * @private - * @return {boolean} True if ready. - */ - VideoResource.prototype._isSourceReady = function () { - var source = this.source; - return source.readyState === 3 || source.readyState === 4; - }; - /** - * Runs the update loop when the video is ready to play - * - * @private - */ - VideoResource.prototype._onPlayStart = function () { - // Just in case the video has not received its can play even yet.. - if (!this.valid) { - this._onCanPlay(); - } - if (this.autoUpdate && !this._isConnectedToTicker) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - }; - /** - * Fired when a pause event is triggered, stops the update loop - * - * @private - */ - VideoResource.prototype._onPlayStop = function () { - if (this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - }; - /** - * Fired when the video is loaded and ready to play - * - * @private - */ - VideoResource.prototype._onCanPlay = function () { - var source = this.source; - source.removeEventListener('canplay', this._onCanPlay); - source.removeEventListener('canplaythrough', this._onCanPlay); - var valid = this.valid; - this.resize(source.videoWidth, source.videoHeight); - // prevent multiple loaded dispatches.. - if (!valid && this._resolve) { - this._resolve(this); - this._resolve = null; - } - if (this._isSourcePlaying()) { - this._onPlayStart(); - } - else if (this.autoPlay) { - source.play(); - } - }; - /** - * Destroys this texture - * @override - */ - VideoResource.prototype.dispose = function () { - if (this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - } - var source = this.source; - if (source) { - source.removeEventListener('error', this._onError, true); - source.pause(); - source.src = ''; - source.load(); - } - _super.prototype.dispose.call(this); - }; - Object.defineProperty(VideoResource.prototype, "autoUpdate", { - /** - * Should the base texture automatically update itself, set to true by default - * - * @member {boolean} - */ - get: function () { - return this._autoUpdate; - }, - set: function (value) { - if (value !== this._autoUpdate) { - this._autoUpdate = value; - if (!this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VideoResource.prototype, "updateFPS", { - /** - * How many times a second to update the texture from the video. Leave at 0 to update at every render. - * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. - * - * @member {number} - */ - get: function () { - return this._updateFPS; - }, - set: function (value) { - if (value !== this._updateFPS) { - this._updateFPS = value; - } - }, - enumerable: false, - configurable: true - }); - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {*} source - The source object - * @param {string} extension - The extension of source, if set - * @return {boolean} `true` if video source - */ - VideoResource.test = function (source, extension) { - return (source instanceof HTMLVideoElement) - || VideoResource.TYPES.indexOf(extension) > -1; - }; - /** - * List of common video file extensions supported by VideoResource. - * @constant - * @member {Array} - * @static - * @readonly - */ - VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; - /** - * Map of video MIME types that can't be directly derived from file extensions. - * @constant - * @member {object} - * @static - * @readonly - */ - VideoResource.MIME_TYPES = { - ogv: 'video/ogg', - mov: 'video/quicktime', - m4v: 'video/mp4', - }; - return VideoResource; - }(BaseImageResource)); - - /** - * Resource type for ImageBitmap. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {ImageBitmap} source - Image element to use - */ - var ImageBitmapResource = /** @class */ (function (_super) { - __extends$2(ImageBitmapResource, _super); - function ImageBitmapResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {ImageBitmap} source - The source object - * @return {boolean} `true` if source is an ImageBitmap - */ - ImageBitmapResource.test = function (source) { - return !!window.createImageBitmap && source instanceof ImageBitmap; - }; - return ImageBitmapResource; - }(BaseImageResource)); - - INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); - - var index = ({ - Resource: Resource, - BaseImageResource: BaseImageResource, - INSTALLED: INSTALLED, - autoDetectResource: autoDetectResource, - AbstractMultiResource: AbstractMultiResource, - ArrayResource: ArrayResource, - BufferResource: BufferResource, - CanvasResource: CanvasResource, - CubeResource: CubeResource, - ImageResource: ImageResource, - SVGResource: SVGResource, - VideoResource: VideoResource, - ImageBitmapResource: ImageBitmapResource - }); - - /** - * System is a base class used for extending systems used by the {@link PIXI.Renderer} - * - * @see PIXI.Renderer#addSystem - * @class - * @memberof PIXI - */ - var System = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. - */ - function System(renderer) { - /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} - */ - this.renderer = renderer; - } - /** - * Generic destroy methods to be overridden by the subclass - */ - System.prototype.destroy = function () { - this.renderer = null; - }; - return System; - }()); - - /** - * Resource type for DepthTexture. - * @class - * @extends PIXI.resources.BufferResource - * @memberof PIXI.resources - */ - var DepthResource = /** @class */ (function (_super) { - __extends$2(DepthResource, _super); - function DepthResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - glTexture - * @returns {boolean} true is success - */ - DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { - var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { - gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); - } - else { - glTexture.width = baseTexture.width; - glTexture.height = baseTexture.height; - gl.texImage2D(baseTexture.target, 0, - // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0 - renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, baseTexture.width, baseTexture.height, 0, baseTexture.format, baseTexture.type, this.data); - } - return true; - }; - return DepthResource; - }(BufferResource)); - - /** - * Frame buffer used by the BaseRenderTexture - * - * @class - * @memberof PIXI - */ - var Framebuffer = /** @class */ (function () { - /** - * @param {number} width - Width of the frame buffer - * @param {number} height - Height of the frame buffer - */ - function Framebuffer(width, height) { - /** - * Width of framebuffer in pixels - * @member {number} - */ - this.width = Math.ceil(width || 100); - /** - * Height of framebuffer in pixels - * @member {number} - */ - this.height = Math.ceil(height || 100); - this.stencil = false; - this.depth = false; - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - this.depthTexture = null; - this.colorTextures = []; - this.glFramebuffers = {}; - this.disposeRunner = new Runner('disposeFramebuffer'); - /** - * Desired number of samples for antialiasing. 0 means AA should not be used. - * - * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. - * Antialiasing is the same as for main buffer with renderer `antialias:true` options. - * Seriously affects GPU memory consumption and GPU performance. - * - *```js - * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH; - * //... - * renderer.render(renderTexture, myContainer); - * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture - * ``` - * - * @member {PIXI.MSAA_QUALITY} - * @default PIXI.MSAA_QUALITY.NONE - */ - this.multisample = exports.MSAA_QUALITY.NONE; - } - Object.defineProperty(Framebuffer.prototype, "colorTexture", { - /** - * Reference to the colorTexture. - * - * @member {PIXI.BaseTexture[]} - * @readonly - */ - get: function () { - return this.colorTextures[0]; - }, - enumerable: false, - configurable: true - }); - /** - * Add texture to the colorTexture array - * - * @param {number} [index=0] - Index of the array to add the texture to - * @param {PIXI.BaseTexture} [texture] - Texture to add to the array - */ - Framebuffer.prototype.addColorTexture = function (index, texture) { - if (index === void 0) { index = 0; } - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index] = texture || new BaseTexture(null, { - scaleMode: exports.SCALE_MODES.NEAREST, - resolution: 1, - mipmap: exports.MIPMAP_MODES.OFF, - width: this.width, - height: this.height, - }); - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Add a depth texture to the frame buffer - * - * @param {PIXI.BaseTexture} [texture] - Texture to add - */ - Framebuffer.prototype.addDepthTexture = function (texture) { - /* eslint-disable max-len */ - this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { - scaleMode: exports.SCALE_MODES.NEAREST, - resolution: 1, - width: this.width, - height: this.height, - mipmap: exports.MIPMAP_MODES.OFF, - format: exports.FORMATS.DEPTH_COMPONENT, - type: exports.TYPES.UNSIGNED_SHORT, - }); - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Enable depth on the frame buffer - */ - Framebuffer.prototype.enableDepth = function () { - this.depth = true; - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Enable stencil on the frame buffer - */ - Framebuffer.prototype.enableStencil = function () { - this.stencil = true; - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Resize the frame buffer - * - * @param {number} width - Width of the frame buffer to resize to - * @param {number} height - Height of the frame buffer to resize to - */ - Framebuffer.prototype.resize = function (width, height) { - width = Math.ceil(width); - height = Math.ceil(height); - if (width === this.width && height === this.height) - { return; } - this.width = width; - this.height = height; - this.dirtyId++; - this.dirtySize++; - for (var i = 0; i < this.colorTextures.length; i++) { - var texture = this.colorTextures[i]; - var resolution = texture.resolution; - // take into acount the fact the texture may have a different resolution.. - texture.setSize(width / resolution, height / resolution); - } - if (this.depthTexture) { - var resolution = this.depthTexture.resolution; - this.depthTexture.setSize(width / resolution, height / resolution); - } - }; - /** - * Disposes WebGL resources that are connected to this geometry - */ - Framebuffer.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys and removes the depth texture added to this framebuffer. - */ - Framebuffer.prototype.destroyDepthTexture = function () { - if (this.depthTexture) { - this.depthTexture.destroy(); - this.depthTexture = null; - ++this.dirtyId; - ++this.dirtyFormat; - } - }; - return Framebuffer; - }()); - - /** - * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. - * - * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded - * otherwise black rectangles will be drawn instead. - * - * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position - * and rotation of the given Display Objects is ignored. For example: - * - * ```js - * let renderer = PIXI.autoDetectRenderer(); - * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); - * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); - * let sprite = PIXI.Sprite.from("spinObj_01.png"); - * - * sprite.position.x = 800/2; - * sprite.position.y = 600/2; - * sprite.anchor.x = 0.5; - * sprite.anchor.y = 0.5; - * - * renderer.render(sprite, renderTexture); - * ``` - * - * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 - * you can clear the transform - * - * ```js - * - * sprite.setTransform() - * - * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); - * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); - * - * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture - * ``` - * - * @class - * @extends PIXI.BaseTexture - * @memberof PIXI - */ - var BaseRenderTexture = /** @class */ (function (_super) { - __extends$2(BaseRenderTexture, _super); - /** - * @param {object} [options] - * @param {number} [options.width=100] - The width of the base render texture. - * @param {number} [options.height=100] - The height of the base render texture. - * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated. - */ - function BaseRenderTexture(options) { - var _this = this; - if (typeof options === 'number') { - /* eslint-disable prefer-rest-params */ - // Backward compatibility of signature - var width_1 = arguments[0]; - var height_1 = arguments[1]; - var scaleMode = arguments[2]; - var resolution = arguments[3]; - options = { width: width_1, height: height_1, scaleMode: scaleMode, resolution: resolution }; - /* eslint-enable prefer-rest-params */ - } - _this = _super.call(this, null, options) || this; - var _a = options || {}, width = _a.width, height = _a.height; - // Set defaults - _this.mipmap = 0; - _this.width = Math.ceil(width) || 100; - _this.height = Math.ceil(height) || 100; - _this.valid = true; - _this.clearColor = [0, 0, 0, 0]; - _this.framebuffer = new Framebuffer(_this.width * _this.resolution, _this.height * _this.resolution) - .addColorTexture(0, _this); - // TODO - could this be added the systems? - /** - * The data structure for the stencil masks. - * - * @member {PIXI.MaskData[]} - */ - _this.maskStack = []; - /** - * The data structure for the filters. - * - * @member {Object[]} - */ - _this.filterStack = [{}]; - return _this; - } - /** - * Resizes the BaseRenderTexture. - * - * @param {number} width - The width to resize to. - * @param {number} height - The height to resize to. - */ - BaseRenderTexture.prototype.resize = function (width, height) { - width = Math.ceil(width); - height = Math.ceil(height); - this.framebuffer.resize(width * this.resolution, height * this.resolution); - }; - /** - * Frees the texture and framebuffer from WebGL memory without destroying this texture object. - * This means you can still use the texture later which will upload it to GPU - * memory again. - * - * @fires PIXI.BaseTexture#dispose - */ - BaseRenderTexture.prototype.dispose = function () { - this.framebuffer.dispose(); - _super.prototype.dispose.call(this); - }; - /** - * Destroys this texture. - */ - BaseRenderTexture.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.framebuffer.destroyDepthTexture(); - this.framebuffer = null; - }; - return BaseRenderTexture; - }(BaseTexture)); - - /** - * Stores a texture's frame in UV coordinates, in - * which everything lies in the rectangle `[(0,0), (1,0), - * (1,1), (0,1)]`. - * - * | Corner | Coordinates | - * |--------------|-------------| - * | Top-Left | `(x0,y0)` | - * | Top-Right | `(x1,y1)` | - * | Bottom-Right | `(x2,y2)` | - * | Bottom-Left | `(x3,y3)` | - * - * @class - * @protected - * @memberof PIXI - */ - var TextureUvs = /** @class */ (function () { - function TextureUvs() { - /** - * X-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.x0 = 0; - /** - * Y-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.y0 = 0; - /** - * X-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.x1 = 1; - /** - * Y-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.y1 = 0; - /** - * X-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.x2 = 1; - /** - * Y-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.y2 = 1; - /** - * X-component of bottom-left corner `(x3,y3)`. - * - * @member {number} - */ - this.x3 = 0; - /** - * Y-component of bottom-right corner `(x3,y3)`. - * - * @member {number} - */ - this.y3 = 1; - this.uvsFloat32 = new Float32Array(8); - } - /** - * Sets the texture Uvs based on the given frame information. - * - * @protected - * @param {PIXI.Rectangle} frame - The frame of the texture - * @param {PIXI.Rectangle} baseFrame - The base frame of the texture - * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8} - */ - TextureUvs.prototype.set = function (frame, baseFrame, rotate) { - var tw = baseFrame.width; - var th = baseFrame.height; - if (rotate) { - // width and height div 2 div baseFrame size - var w2 = frame.width / 2 / tw; - var h2 = frame.height / 2 / th; - // coordinates of center - var cX = (frame.x / tw) + w2; - var cY = (frame.y / th) + h2; - rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner - this.x0 = cX + (w2 * groupD8.uX(rotate)); - this.y0 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise - this.x1 = cX + (w2 * groupD8.uX(rotate)); - this.y1 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - this.x2 = cX + (w2 * groupD8.uX(rotate)); - this.y2 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - this.x3 = cX + (w2 * groupD8.uX(rotate)); - this.y3 = cY + (h2 * groupD8.uY(rotate)); - } - else { - this.x0 = frame.x / tw; - this.y0 = frame.y / th; - this.x1 = (frame.x + frame.width) / tw; - this.y1 = frame.y / th; - this.x2 = (frame.x + frame.width) / tw; - this.y2 = (frame.y + frame.height) / th; - this.x3 = frame.x / tw; - this.y3 = (frame.y + frame.height) / th; - } - this.uvsFloat32[0] = this.x0; - this.uvsFloat32[1] = this.y0; - this.uvsFloat32[2] = this.x1; - this.uvsFloat32[3] = this.y1; - this.uvsFloat32[4] = this.x2; - this.uvsFloat32[5] = this.y2; - this.uvsFloat32[6] = this.x3; - this.uvsFloat32[7] = this.y3; - }; - return TextureUvs; - }()); - - var DEFAULT_UVS = new TextureUvs(); - /** - * A texture stores the information that represents an image or part of an image. - * - * It cannot be added to the display list directly; instead use it as the texture for a Sprite. - * If no frame is provided for a texture, then the whole image is used. - * - * You can directly create a texture from an image and then reuse it multiple times like this : - * - * ```js - * let texture = PIXI.Texture.from('assets/image.png'); - * let sprite1 = new PIXI.Sprite(texture); - * let sprite2 = new PIXI.Sprite(texture); - * ``` - * - * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: - * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. - * - * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. - * You can check for this by checking the sprite's _textureID property. - * ```js - * var texture = PIXI.Texture.from('assets/image.svg'); - * var sprite1 = new PIXI.Sprite(texture); - * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file - * ``` - * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var Texture = /** @class */ (function (_super) { - __extends$2(Texture, _super); - /** - * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from - * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show - * @param {PIXI.Rectangle} [orig] - The area of original texture - * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture - * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} - * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation - */ - function Texture(baseTexture, frame, orig, trim, rotate, anchor) { - var _this = _super.call(this) || this; - /** - * Does this Texture have any frame data assigned to it? - * - * This mode is enabled automatically if no frame was passed inside constructor. - * - * In this mode texture is subscribed to baseTexture events, and fires `update` on any change. - * - * Beware, after loading or resize of baseTexture event can fired two times! - * If you want more control, subscribe on baseTexture itself. - * - * ```js - * texture.on('update', () => {}); - * ``` - * - * Any assignment of `frame` switches off `noFrame` mode. - * - * @member {boolean} - */ - _this.noFrame = false; - if (!frame) { - _this.noFrame = true; - frame = new Rectangle(0, 0, 1, 1); - } - if (baseTexture instanceof Texture) { - baseTexture = baseTexture.baseTexture; - } - /** - * The base texture that this texture uses. - * - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = baseTexture; - /** - * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, - * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) - * - * @member {PIXI.Rectangle} - */ - _this._frame = frame; - /** - * This is the trimmed area of original texture, before it was put in atlas - * Please call `updateUvs()` after you change coordinates of `trim` manually. - * - * @member {PIXI.Rectangle} - */ - _this.trim = trim; - /** - * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. - * - * @member {boolean} - */ - _this.valid = false; - /** - * The WebGL UV data cache. Can be used as quad UV - * - * @member {PIXI.TextureUvs} - * @protected - */ - _this._uvs = DEFAULT_UVS; - /** - * Default TextureMatrix instance for this texture - * By default that object is not created because its heavy - * - * @member {PIXI.TextureMatrix} - */ - _this.uvMatrix = null; - /** - * This is the area of original texture, before it was put in atlas - * - * @member {PIXI.Rectangle} - */ - _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); - _this._rotate = Number(rotate || 0); - if (rotate === true) { - // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures - _this._rotate = 2; - } - else if (_this._rotate % 2 !== 0) { - throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); - } - /** - * Anchor point that is used as default if sprite is created with this texture. - * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. - * @member {PIXI.Point} - * @default {0,0} - */ - _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); - /** - * Update ID is observed by sprites and TextureMatrix instances. - * Call updateUvs() to increment it. - * - * @member {number} - * @protected - */ - _this._updateID = 0; - /** - * The ids under which this Texture has been added to the texture cache. This is - * automatically set as long as Texture.addToCache is used, but may not be set if a - * Texture is added directly to the TextureCache array. - * - * @member {string[]} - */ - _this.textureCacheIds = []; - if (!baseTexture.valid) { - baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); - } - else if (_this.noFrame) { - // if there is no frame we should monitor for any base texture changes.. - if (baseTexture.valid) { - _this.onBaseTextureUpdated(baseTexture); - } - } - else { - _this.frame = frame; - } - if (_this.noFrame) { - baseTexture.on('update', _this.onBaseTextureUpdated, _this); - } - return _this; - } - /** - * Updates this texture on the gpu. - * - * Calls the TextureResource update. - * - * If you adjusted `frame` manually, please call `updateUvs()` instead. - * - */ - Texture.prototype.update = function () { - if (this.baseTexture.resource) { - this.baseTexture.resource.update(); - } - }; - /** - * Called when the base texture is updated - * - * @protected - * @param {PIXI.BaseTexture} baseTexture - The base texture. - */ - Texture.prototype.onBaseTextureUpdated = function (baseTexture) { - if (this.noFrame) { - if (!this.baseTexture.valid) { - return; - } - this._frame.width = baseTexture.width; - this._frame.height = baseTexture.height; - this.valid = true; - this.updateUvs(); - } - else { - // TODO this code looks confusing.. boo to abusing getters and setters! - // if user gave us frame that has bigger size than resized texture it can be a problem - this.frame = this._frame; - } - this.emit('update', this); - }; - /** - * Destroys this texture - * - * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well - */ - Texture.prototype.destroy = function (destroyBase) { - if (this.baseTexture) { - if (destroyBase) { - var resource = this.baseTexture; - // delete the texture if it exists in the texture cache.. - // this only needs to be removed if the base texture is actually destroyed too.. - if (resource && resource.url && TextureCache[resource.url]) { - Texture.removeFromCache(resource.url); - } - this.baseTexture.destroy(); - } - this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); - this.baseTexture.off('update', this.onBaseTextureUpdated, this); - this.baseTexture = null; - } - this._frame = null; - this._uvs = null; - this.trim = null; - this.orig = null; - this.valid = false; - Texture.removeFromCache(this); - this.textureCacheIds = null; - }; - /** - * Creates a new texture object that acts the same as this one. - * - * @return {PIXI.Texture} The new texture - */ - Texture.prototype.clone = function () { - return new Texture(this.baseTexture, this.frame.clone(), this.orig.clone(), this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); - }; - /** - * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. - * Call it after changing the frame - */ - Texture.prototype.updateUvs = function () { - if (this._uvs === DEFAULT_UVS) { - this._uvs = new TextureUvs(); - } - this._uvs.set(this._frame, this.baseTexture, this.rotate); - this._updateID++; - }; - /** - * Helper function that creates a new Texture based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - * Source to create texture from - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. - * @return {PIXI.Texture} The newly created texture - */ - Texture.from = function (source, options, strict) { - if (options === void 0) { options = {}; } - if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } - var isFrame = typeof source === 'string'; - var cacheId = null; - if (isFrame) { - cacheId = source; - } - else { - if (!source._pixiId) { - source._pixiId = "pixiid_" + uid(); - } - cacheId = source._pixiId; - } - var texture = TextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !texture) { - throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); - } - if (!texture) { - if (!options.resolution) { - options.resolution = getResolutionOfUrl(source); - } - texture = new Texture(new BaseTexture(source, options)); - texture.baseTexture.cacheId = cacheId; - BaseTexture.addToCache(texture.baseTexture, cacheId); - Texture.addToCache(texture, cacheId); - } - // lets assume its a base texture! - return texture; - }; - /** - * Useful for loading textures via URLs. Use instead of `Texture.from` because - * it does a better job of handling failed URLs more effectively. This also ignores - * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. - * @param {string} url The remote URL to load. - * @param {object} [options] Optional options to include - * @return {Promise} A Promise that resolves to a Texture. - */ - Texture.fromURL = function (url, options) { - var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); - var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); - var resource = texture.baseTexture.resource; - // The texture was already loaded - if (texture.baseTexture.valid) { - return Promise.resolve(texture); - } - // Manually load the texture, this should allow users to handle load errors - return resource.load().then(function () { return Promise.resolve(texture); }); - }; - /** - * Create a new Texture with a BufferResource from a Float32Array. - * RGBA values are floats from 0 to 1. - * @static - * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data - * is provided, a new Float32Array is created. - * @param {number} width - Width of the resource - * @param {number} height - Height of the resource - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.Texture} The resulting new BaseTexture - */ - Texture.fromBuffer = function (buffer, width, height, options) { - return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); - }; - /** - * Create a texture from a source and add to the cache. - * - * @static - * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. - * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readable name for the texture cache. If no name is - * specified, only `imageUrl` will be used as the cache ID. - * @return {PIXI.Texture} Output texture - */ - Texture.fromLoader = function (source, imageUrl, name) { - var resource = new ImageResource(source); - resource.url = imageUrl; - var baseTexture = new BaseTexture(resource, { - scaleMode: settings.SCALE_MODE, - resolution: getResolutionOfUrl(imageUrl), - }); - var texture = new Texture(baseTexture); - // No name, use imageUrl instead - if (!name) { - name = imageUrl; - } - // lets also add the frame to pixi's global cache for 'fromLoader' function - BaseTexture.addToCache(texture.baseTexture, name); - Texture.addToCache(texture, name); - // also add references by url if they are different. - if (name !== imageUrl) { - BaseTexture.addToCache(texture.baseTexture, imageUrl); - Texture.addToCache(texture, imageUrl); - } - return texture; - }; - /** - * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. - * - * @static - * @param {PIXI.Texture} texture - The Texture to add to the cache. - * @param {string} id - The id that the Texture will be stored against. - */ - Texture.addToCache = function (texture, id) { - if (id) { - if (texture.textureCacheIds.indexOf(id) === -1) { - texture.textureCacheIds.push(id); - } - if (TextureCache[id]) { - // eslint-disable-next-line no-console - console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); - } - TextureCache[id] = texture; - } - }; - /** - * Remove a Texture from the global TextureCache. - * - * @static - * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself - * @return {PIXI.Texture|null} The Texture that was removed - */ - Texture.removeFromCache = function (texture) { - if (typeof texture === 'string') { - var textureFromCache = TextureCache[texture]; - if (textureFromCache) { - var index = textureFromCache.textureCacheIds.indexOf(texture); - if (index > -1) { - textureFromCache.textureCacheIds.splice(index, 1); - } - delete TextureCache[texture]; - return textureFromCache; - } - } - else if (texture && texture.textureCacheIds) { - for (var i = 0; i < texture.textureCacheIds.length; ++i) { - // Check that texture matches the one being passed in before deleting it from the cache. - if (TextureCache[texture.textureCacheIds[i]] === texture) { - delete TextureCache[texture.textureCacheIds[i]]; - } - } - texture.textureCacheIds.length = 0; - return texture; - } - return null; - }; - Object.defineProperty(Texture.prototype, "resolution", { - /** - * Returns resolution of baseTexture - * - * @member {number} - * @readonly - */ - get: function () { - return this.baseTexture.resolution; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "frame", { - /** - * The frame specifies the region of the base texture that this texture uses. - * Please call `updateUvs()` after you change coordinates of `frame` manually. - * - * @member {PIXI.Rectangle} - */ - get: function () { - return this._frame; - }, - set: function (frame) { - this._frame = frame; - this.noFrame = false; - var x = frame.x, y = frame.y, width = frame.width, height = frame.height; - var xNotFit = x + width > this.baseTexture.width; - var yNotFit = y + height > this.baseTexture.height; - if (xNotFit || yNotFit) { - var relationship = xNotFit && yNotFit ? 'and' : 'or'; - var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; - var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; - throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' - + (errorX + " " + relationship + " " + errorY)); - } - this.valid = width && height && this.baseTexture.valid; - if (!this.trim && !this.rotate) { - this.orig = frame; - } - if (this.valid) { - this.updateUvs(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "rotate", { - /** - * Indicates whether the texture is rotated inside the atlas - * set to 2 to compensate for texture packer rotation - * set to 6 to compensate for spine packer rotation - * can be used to rotate or mirror sprites - * See {@link PIXI.groupD8} for explanation - * - * @member {number} - */ - get: function () { - return this._rotate; - }, - set: function (rotate) { - this._rotate = rotate; - if (this.valid) { - this.updateUvs(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "width", { - /** - * The width of the Texture in pixels. - * - * @member {number} - */ - get: function () { - return this.orig.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "height", { - /** - * The height of the Texture in pixels. - * - * @member {number} - */ - get: function () { - return this.orig.height; - }, - enumerable: false, - configurable: true - }); - /** - * Utility function for BaseTexture|Texture cast - */ - Texture.prototype.castToBaseTexture = function () { - return this.baseTexture; - }; - return Texture; - }(eventemitter3)); - function createWhiteTexture() { - var canvas = document.createElement('canvas'); - canvas.width = 16; - canvas.height = 16; - var context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 0, 16, 16); - return new Texture(new BaseTexture(new CanvasResource(canvas))); - } - function removeAllHandlers(tex) { - tex.destroy = function _emptyDestroy() { }; - tex.on = function _emptyOn() { }; - tex.once = function _emptyOnce() { }; - tex.emit = function _emptyEmit() { }; - } - /** - * An empty texture, used often to not have to create multiple empty textures. - * Can not be destroyed. - * - * @static - * @constant - * @member {PIXI.Texture} - */ - Texture.EMPTY = new Texture(new BaseTexture()); - removeAllHandlers(Texture.EMPTY); - removeAllHandlers(Texture.EMPTY.baseTexture); - /** - * A white texture of 16x16 size, used for graphics and other things - * Can not be destroyed. - * - * @static - * @constant - * @member {PIXI.Texture} - */ - Texture.WHITE = createWhiteTexture(); - removeAllHandlers(Texture.WHITE); - removeAllHandlers(Texture.WHITE.baseTexture); - - /** - * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. - * - * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded - * otherwise black rectangles will be drawn instead. - * - * __Hint-2__: The actual memory allocation will happen on first render. - * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. - * - * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: - * - * ```js - * let renderer = PIXI.autoDetectRenderer(); - * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); - * let sprite = PIXI.Sprite.from("spinObj_01.png"); - * - * sprite.position.x = 800/2; - * sprite.position.y = 600/2; - * sprite.anchor.x = 0.5; - * sprite.anchor.y = 0.5; - * - * renderer.render(sprite, renderTexture); - * ``` - * - * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 - * you can clear the transform - * - * ```js - * - * sprite.setTransform() - * - * let renderTexture = new PIXI.RenderTexture.create(100, 100); - * - * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture - * ``` - * - * @class - * @extends PIXI.Texture - * @memberof PIXI - */ - var RenderTexture = /** @class */ (function (_super) { - __extends$2(RenderTexture, _super); - /** - * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses - * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show - */ - function RenderTexture(baseRenderTexture, frame) { - var _this = this; - // support for legacy.. - var _legacyRenderer = null; - if (!(baseRenderTexture instanceof BaseRenderTexture)) { - /* eslint-disable prefer-rest-params, no-console */ - var width = arguments[1]; - var height = arguments[2]; - var scaleMode = arguments[3]; - var resolution = arguments[4]; - // we have an old render texture.. - console.warn("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly."); - _legacyRenderer = arguments[0]; - /* eslint-enable prefer-rest-params, no-console */ - frame = null; - baseRenderTexture = new BaseRenderTexture({ - width: width, - height: height, - scaleMode: scaleMode, - resolution: resolution, - }); - } - /** - * The base texture object that this texture uses - * - * @member {PIXI.BaseTexture} - */ - _this = _super.call(this, baseRenderTexture, frame) || this; - _this.legacyRenderer = _legacyRenderer; - /** - * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. - * - * @member {boolean} - */ - _this.valid = true; - /** - * Stores `sourceFrame` when this texture is inside current filter stack. - * You can read it inside filters. - * - * @readonly - * @member {PIXI.Rectangle} - */ - _this.filterFrame = null; - /** - * The key for pooled texture of FilterSystem - * @protected - * @member {string} - */ - _this.filterPoolKey = null; - _this.updateUvs(); - return _this; - } - Object.defineProperty(RenderTexture.prototype, "framebuffer", { - /** - * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. - * @member {PIXI.Framebuffer} - * @readonly - */ - get: function () { - return this.baseTexture.framebuffer; - }, - enumerable: false, - configurable: true - }); - /** - * Resizes the RenderTexture. - * - * @param {number} width - The width to resize to. - * @param {number} height - The height to resize to. - * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well? - */ - RenderTexture.prototype.resize = function (width, height, resizeBaseTexture) { - if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } - width = Math.ceil(width); - height = Math.ceil(height); - // TODO - could be not required.. - this.valid = (width > 0 && height > 0); - this._frame.width = this.orig.width = width; - this._frame.height = this.orig.height = height; - if (resizeBaseTexture) { - this.baseTexture.resize(width, height); - } - this.updateUvs(); - }; - /** - * Changes the resolution of baseTexture, but does not change framebuffer size. - * - * @param {number} resolution - The new resolution to apply to RenderTexture - */ - RenderTexture.prototype.setResolution = function (resolution) { - var baseTexture = this.baseTexture; - if (baseTexture.resolution === resolution) { - return; - } - baseTexture.setResolution(resolution); - this.resize(baseTexture.width, baseTexture.height, false); - }; - /** - * A short hand way of creating a render texture. - * - * @param {object} [options] - Options - * @param {number} [options.width=100] - The width of the render texture - * @param {number} [options.height=100] - The height of the render texture - * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated - * @return {PIXI.RenderTexture} The new render texture - */ - RenderTexture.create = function (options) { - // fallback, old-style: create(width, height, scaleMode, resolution) - if (typeof options === 'number') { - /* eslint-disable prefer-rest-params */ - options = { - width: options, - height: arguments[1], - scaleMode: arguments[2], - resolution: arguments[3], - }; - /* eslint-enable prefer-rest-params */ - } - return new RenderTexture(new BaseRenderTexture(options)); - }; - return RenderTexture; - }(Texture)); - - /** - * Experimental! - * - * Texture pool, used by FilterSystem and plugins - * Stores collection of temporary pow2 or screen-sized renderTextures - * - * If you use custom RenderTexturePool for your filters, you can use methods - * `getFilterTexture` and `returnFilterTexture` same as in - * - * @class - * @memberof PIXI - */ - var RenderTexturePool = /** @class */ (function () { - /** - * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor - * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. - */ - function RenderTexturePool(textureOptions) { - this.texturePool = {}; - this.textureOptions = textureOptions || {}; - /** - * Allow renderTextures of the same size as screen, not just pow2 - * - * Automatically sets to true after `setScreenSize` - * - * @member {boolean} - * @default false - */ - this.enableFullScreen = false; - this._pixelsWidth = 0; - this._pixelsHeight = 0; - } - /** - * creates of texture with params that were specified in pool constructor - * - * @param {number} realWidth - width of texture in pixels - * @param {number} realHeight - height of texture in pixels - * @returns {RenderTexture} - */ - RenderTexturePool.prototype.createTexture = function (realWidth, realHeight) { - var baseRenderTexture = new BaseRenderTexture(Object.assign({ - width: realWidth, - height: realHeight, - resolution: 1, - }, this.textureOptions)); - return new RenderTexture(baseRenderTexture); - }; - /** - * Gets a Power-of-Two render texture or fullScreen texture - * - * @protected - * @param {number} minWidth - The minimum width of the render texture in real pixels. - * @param {number} minHeight - The minimum height of the render texture in real pixels. - * @param {number} [resolution=1] - The resolution of the render texture. - * @return {PIXI.RenderTexture} The new render texture. - */ - RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution) { - if (resolution === void 0) { resolution = 1; } - var key = RenderTexturePool.SCREEN_KEY; - minWidth *= resolution; - minHeight *= resolution; - if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { - minWidth = nextPow2(minWidth); - minHeight = nextPow2(minHeight); - key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF); - } - if (!this.texturePool[key]) { - this.texturePool[key] = []; - } - var renderTexture = this.texturePool[key].pop(); - if (!renderTexture) { - renderTexture = this.createTexture(minWidth, minHeight); - } - renderTexture.filterPoolKey = key; - renderTexture.setResolution(resolution); - return renderTexture; - }; - /** - * Gets extra texture of the same size as input renderTexture - * - * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` - * - * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied - * @param {number} [resolution] - override resolution of the renderTexture - * It overrides, it does not multiply - * @returns {PIXI.RenderTexture} - */ - RenderTexturePool.prototype.getFilterTexture = function (input, resolution) { - var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution); - filterTexture.filterFrame = input.filterFrame; - return filterTexture; - }; - /** - * Place a render texture back into the pool. - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnTexture = function (renderTexture) { - var key = renderTexture.filterPoolKey; - renderTexture.filterFrame = null; - this.texturePool[key].push(renderTexture); - }; - /** - * Alias for returnTexture, to be compliant with FilterSystem interface - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { - this.returnTexture(renderTexture); - }; - /** - * Clears the pool - * - * @param {boolean} [destroyTextures=true] - destroy all stored textures - */ - RenderTexturePool.prototype.clear = function (destroyTextures) { - destroyTextures = destroyTextures !== false; - if (destroyTextures) { - for (var i in this.texturePool) { - var textures = this.texturePool[i]; - if (textures) { - for (var j = 0; j < textures.length; j++) { - textures[j].destroy(true); - } - } - } - } - this.texturePool = {}; - }; - /** - * If screen size was changed, drops all screen-sized textures, - * sets new screen size, sets `enableFullScreen` to true - * - * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` - * - * @param {PIXI.ISize} size - Initial size of screen - */ - RenderTexturePool.prototype.setScreenSize = function (size) { - if (size.width === this._pixelsWidth - && size.height === this._pixelsHeight) { - return; - } - var screenKey = RenderTexturePool.SCREEN_KEY; - var textures = this.texturePool[screenKey]; - this.enableFullScreen = size.width > 0 && size.height > 0; - if (textures) { - for (var j = 0; j < textures.length; j++) { - textures[j].destroy(true); - } - } - this.texturePool[screenKey] = []; - this._pixelsWidth = size.width; - this._pixelsHeight = size.height; - }; - /** - * Key that is used to store fullscreen renderTextures in a pool - * - * @static - * @const {string} - */ - RenderTexturePool.SCREEN_KEY = 'screen'; - return RenderTexturePool; - }()); - - /* eslint-disable max-len */ - /** - * Holds the information for a single attribute structure required to render geometry. - * - * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc. - * - * @class - * @memberof PIXI - */ - var Attribute = /** @class */ (function () { - /** - * @param {string} buffer - the id of the buffer that this attribute will look for - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) - * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data) - */ - function Attribute(buffer, size, normalized, type, stride, start, instance) { - if (size === void 0) { size = 0; } - if (normalized === void 0) { normalized = false; } - if (type === void 0) { type = 5126; } - this.buffer = buffer; - this.size = size; - this.normalized = normalized; - this.type = type; - this.stride = stride; - this.start = start; - this.instance = instance; - } - /** - * Destroys the Attribute. - */ - Attribute.prototype.destroy = function () { - this.buffer = null; - }; - /** - * Helper function that creates an Attribute based on the information provided - * - * @static - * @param {string} buffer - the id of the buffer that this attribute will look for - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) - * - * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided - */ - Attribute.from = function (buffer, size, normalized, type, stride) { - return new Attribute(buffer, size, normalized, type, stride); - }; - return Attribute; - }()); - - var UID = 0; - /** - * A wrapper for data so that it can be used and uploaded by WebGL - * - * @class - * @memberof PIXI - */ - var Buffer = /** @class */ (function () { - /** - * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer. - * @param {boolean} [_static=true] - `true` for static buffer - * @param {boolean} [index=false] - `true` for index buffer - */ - function Buffer(data, _static, index) { - if (_static === void 0) { _static = true; } - if (index === void 0) { index = false; } - /** - * The data in the buffer, as a typed array - * - * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView} - */ - this.data = (data || new Float32Array(1)); - /** - * A map of renderer IDs to webgl buffer - * - * @private - * @member {object} - */ - this._glBuffers = {}; - this._updateID = 0; - this.index = index; - this.static = _static; - this.id = UID++; - this.disposeRunner = new Runner('disposeBuffer'); - } - // TODO could explore flagging only a partial upload? - /** - * flags this buffer as requiring an upload to the GPU - * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer. - */ - Buffer.prototype.update = function (data) { - this.data = data || this.data; - this._updateID++; - }; - /** - * disposes WebGL resources that are connected to this geometry - */ - Buffer.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys the buffer - */ - Buffer.prototype.destroy = function () { - this.dispose(); - this.data = null; - }; - /** - * Helper function that creates a buffer based on an array or TypedArray - * - * @static - * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. - * @return {PIXI.Buffer} A new Buffer based on the data provided. - */ - Buffer.from = function (data) { - if (data instanceof Array) { - data = new Float32Array(data); - } - return new Buffer(data); - }; - return Buffer; - }()); - - function getBufferType$1(array) { - if (array.BYTES_PER_ELEMENT === 4) { - if (array instanceof Float32Array) { - return 'Float32Array'; - } - else if (array instanceof Uint32Array) { - return 'Uint32Array'; - } - return 'Int32Array'; - } - else if (array.BYTES_PER_ELEMENT === 2) { - if (array instanceof Uint16Array) { - return 'Uint16Array'; - } - } - else if (array.BYTES_PER_ELEMENT === 1) { - if (array instanceof Uint8Array) { - return 'Uint8Array'; - } - } - // TODO map out the rest of the array elements! - return null; - } - - /* eslint-disable object-shorthand */ - var map$1 = { - Float32Array: Float32Array, - Uint32Array: Uint32Array, - Int32Array: Int32Array, - Uint8Array: Uint8Array, - }; - function interleaveTypedArrays$1(arrays, sizes) { - var outSize = 0; - var stride = 0; - var views = {}; - for (var i = 0; i < arrays.length; i++) { - stride += sizes[i]; - outSize += arrays[i].length; - } - var buffer = new ArrayBuffer(outSize * 4); - var out = null; - var littleOffset = 0; - for (var i = 0; i < arrays.length; i++) { - var size = sizes[i]; - var array = arrays[i]; - var type = getBufferType$1(array); - if (!views[type]) { - views[type] = new map$1[type](buffer); - } - out = views[type]; - for (var j = 0; j < array.length; j++) { - var indexStart = ((j / size | 0) * stride) + littleOffset; - var index = j % size; - out[indexStart + index] = array[j]; - } - littleOffset += size; - } - return new Float32Array(buffer); - } - - var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; - var UID$1 = 0; - /* eslint-disable object-shorthand */ - var map$1$1 = { - Float32Array: Float32Array, - Uint32Array: Uint32Array, - Int32Array: Int32Array, - Uint8Array: Uint8Array, - Uint16Array: Uint16Array, - }; - /* eslint-disable max-len */ - /** - * The Geometry represents a model. It consists of two components: - * - GeometryStyle - The structure of the model such as the attributes layout - * - GeometryData - the data of the model - this consists of buffers. - * This can include anything from positions, uvs, normals, colors etc. - * - * Geometry can be defined without passing in a style or data if required (thats how I prefer!) - * - * ```js - * let geometry = new PIXI.Geometry(); - * - * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); - * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) - * geometry.addIndex([0,1,2,1,3,2]) - * - * ``` - * @class - * @memberof PIXI - */ - var Geometry = /** @class */ (function () { - /** - * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional. - * @param {object} [attributes] - of the geometry, optional structure of the attributes layout - */ - function Geometry(buffers, attributes) { - if (buffers === void 0) { buffers = []; } - if (attributes === void 0) { attributes = {}; } - this.buffers = buffers; - this.indexBuffer = null; - this.attributes = attributes; - /** - * A map of renderer IDs to webgl VAOs - * - * @protected - * @type {object} - */ - this.glVertexArrayObjects = {}; - this.id = UID$1++; - this.instanced = false; - /** - * Number of instances in this geometry, pass it to `GeometrySystem.draw()` - * @member {number} - * @default 1 - */ - this.instanceCount = 1; - this.disposeRunner = new Runner('disposeGeometry'); - /** - * Count of existing (not destroyed) meshes that reference this geometry - * @member {number} - */ - this.refCount = 0; - } - /** - * - * Adds an attribute to the geometry - * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! - * - * @param {String} id - the name of the attribute (matching up to a shader) - * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available - * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data) - * @param {Number} [start] - How far into the array to start reading values (used for interleaving data) - * @param {boolean} [instance=false] - Instancing flag - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { - if (size === void 0) { size = 0; } - if (normalized === void 0) { normalized = false; } - if (instance === void 0) { instance = false; } - if (!buffer) { - throw new Error('You must pass a buffer when creating an attribute'); - } - // check if this is a buffer! - if (!(buffer instanceof Buffer)) { - // its an array! - if (buffer instanceof Array) { - buffer = new Float32Array(buffer); - } - buffer = new Buffer(buffer); - } - var ids = id.split('|'); - if (ids.length > 1) { - for (var i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalized, type); - } - return this; - } - var bufferIndex = this.buffers.indexOf(buffer); - if (bufferIndex === -1) { - this.buffers.push(buffer); - bufferIndex = this.buffers.length - 1; - } - this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); - // assuming that if there is instanced data then this will be drawn with instancing! - this.instanced = this.instanced || instance; - return this; - }; - /** - * returns the requested attribute - * - * @param {String} id - the name of the attribute required - * @return {PIXI.Attribute} the attribute requested. - */ - Geometry.prototype.getAttribute = function (id) { - return this.attributes[id]; - }; - /** - * returns the requested buffer - * - * @param {String} id - the name of the buffer required - * @return {PIXI.Buffer} the buffer requested. - */ - Geometry.prototype.getBuffer = function (id) { - return this.buffers[this.getAttribute(id).buffer]; - }; - /** - * - * Adds an index buffer to the geometry - * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. - * - * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addIndex = function (buffer) { - if (!(buffer instanceof Buffer)) { - // its an array! - if (buffer instanceof Array) { - buffer = new Uint16Array(buffer); - } - buffer = new Buffer(buffer); - } - buffer.index = true; - this.indexBuffer = buffer; - if (this.buffers.indexOf(buffer) === -1) { - this.buffers.push(buffer); - } - return this; - }; - /** - * returns the index buffer - * - * @return {PIXI.Buffer} the index buffer. - */ - Geometry.prototype.getIndex = function () { - return this.indexBuffer; - }; - /** - * this function modifies the structure so that all current attributes become interleaved into a single buffer - * This can be useful if your model remains static as it offers a little performance boost - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.interleave = function () { - // a simple check to see if buffers are already interleaved.. - if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) - { return this; } - // assume already that no buffers are interleaved - var arrays = []; - var sizes = []; - var interleavedBuffer = new Buffer(); - var i; - for (i in this.attributes) { - var attribute = this.attributes[i]; - var buffer = this.buffers[attribute.buffer]; - arrays.push(buffer.data); - sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4); - attribute.buffer = 0; - } - interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); - for (i = 0; i < this.buffers.length; i++) { - if (this.buffers[i] !== this.indexBuffer) { - this.buffers[i].destroy(); - } - } - this.buffers = [interleavedBuffer]; - if (this.indexBuffer) { - this.buffers.push(this.indexBuffer); - } - return this; - }; - Geometry.prototype.getSize = function () { - for (var i in this.attributes) { - var attribute = this.attributes[i]; - var buffer = this.buffers[attribute.buffer]; - return buffer.data.length / ((attribute.stride / 4) || attribute.size); - } - return 0; - }; - /** - * disposes WebGL resources that are connected to this geometry - */ - Geometry.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys the geometry. - */ - Geometry.prototype.destroy = function () { - this.dispose(); - this.buffers = null; - this.indexBuffer = null; - this.attributes = null; - }; - /** - * returns a clone of the geometry - * - * @returns {PIXI.Geometry} a new clone of this geometry - */ - Geometry.prototype.clone = function () { - var geometry = new Geometry(); - for (var i = 0; i < this.buffers.length; i++) { - geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); - } - for (var i in this.attributes) { - var attrib = this.attributes[i]; - geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); - } - if (this.indexBuffer) { - geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; - geometry.indexBuffer.index = true; - } - return geometry; - }; - /** - * merges an array of geometries into a new single one - * geometry attribute styles must match for this operation to work - * - * @param {PIXI.Geometry[]} geometries - array of geometries to merge - * @returns {PIXI.Geometry} shiny new geometry! - */ - Geometry.merge = function (geometries) { - // todo add a geometry check! - // also a size check.. cant be too big!] - var geometryOut = new Geometry(); - var arrays = []; - var sizes = []; - var offsets = []; - var geometry; - // pass one.. get sizes.. - for (var i = 0; i < geometries.length; i++) { - geometry = geometries[i]; - for (var j = 0; j < geometry.buffers.length; j++) { - sizes[j] = sizes[j] || 0; - sizes[j] += geometry.buffers[j].data.length; - offsets[j] = 0; - } - } - // build the correct size arrays.. - for (var i = 0; i < geometry.buffers.length; i++) { - // TODO types! - arrays[i] = new map$1$1[getBufferType$1(geometry.buffers[i].data)](sizes[i]); - geometryOut.buffers[i] = new Buffer(arrays[i]); - } - // pass to set data.. - for (var i = 0; i < geometries.length; i++) { - geometry = geometries[i]; - for (var j = 0; j < geometry.buffers.length; j++) { - arrays[j].set(geometry.buffers[j].data, offsets[j]); - offsets[j] += geometry.buffers[j].data.length; - } - } - geometryOut.attributes = geometry.attributes; - if (geometry.indexBuffer) { - geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; - geometryOut.indexBuffer.index = true; - var offset = 0; - var stride = 0; - var offset2 = 0; - var bufferIndexToCount = 0; - // get a buffer - for (var i = 0; i < geometry.buffers.length; i++) { - if (geometry.buffers[i] !== geometry.indexBuffer) { - bufferIndexToCount = i; - break; - } - } - // figure out the stride of one buffer.. - for (var i in geometry.attributes) { - var attribute = geometry.attributes[i]; - if ((attribute.buffer | 0) === bufferIndexToCount) { - stride += ((attribute.size * byteSizeMap[attribute.type]) / 4); - } - } - // time to off set all indexes.. - for (var i = 0; i < geometries.length; i++) { - var indexBufferData = geometries[i].indexBuffer.data; - for (var j = 0; j < indexBufferData.length; j++) { - geometryOut.indexBuffer.data[j + offset2] += offset; - } - offset += geometry.buffers[bufferIndexToCount].data.length / (stride); - offset2 += indexBufferData.length; - } - } - return geometryOut; - }; - return Geometry; - }()); - - /** - * Helper class to create a quad - * - * @class - * @memberof PIXI - */ - var Quad = /** @class */ (function (_super) { - __extends$2(Quad, _super); - function Quad() { - var _this = _super.call(this) || this; - _this.addAttribute('aVertexPosition', new Float32Array([ - 0, 0, - 1, 0, - 1, 1, - 0, 1 ])) - .addIndex([0, 1, 3, 2]); - return _this; - } - return Quad; - }(Geometry)); - - /** - * Helper class to create a quad with uvs like in v4 - * - * @class - * @memberof PIXI - * @extends PIXI.Geometry - */ - var QuadUv = /** @class */ (function (_super) { - __extends$2(QuadUv, _super); - function QuadUv() { - var _this = _super.call(this) || this; - /** - * An array of vertices - * - * @member {Float32Array} - */ - _this.vertices = new Float32Array([ - -1, -1, - 1, -1, - 1, 1, - -1, 1 ]); - /** - * The Uvs of the quad - * - * @member {Float32Array} - */ - _this.uvs = new Float32Array([ - 0, 0, - 1, 0, - 1, 1, - 0, 1 ]); - _this.vertexBuffer = new Buffer(_this.vertices); - _this.uvBuffer = new Buffer(_this.uvs); - _this.addAttribute('aVertexPosition', _this.vertexBuffer) - .addAttribute('aTextureCoord', _this.uvBuffer) - .addIndex([0, 1, 2, 0, 2, 3]); - return _this; - } - /** - * Maps two Rectangle to the quad. - * - * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle - * @param {PIXI.Rectangle} destinationFrame - the second rectangle - * @return {PIXI.Quad} Returns itself. - */ - QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { - var x = 0; // destinationFrame.x / targetTextureFrame.width; - var y = 0; // destinationFrame.y / targetTextureFrame.height; - this.uvs[0] = x; - this.uvs[1] = y; - this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); - this.uvs[3] = y; - this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); - this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); - this.uvs[6] = x; - this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); - x = destinationFrame.x; - y = destinationFrame.y; - this.vertices[0] = x; - this.vertices[1] = y; - this.vertices[2] = x + destinationFrame.width; - this.vertices[3] = y; - this.vertices[4] = x + destinationFrame.width; - this.vertices[5] = y + destinationFrame.height; - this.vertices[6] = x; - this.vertices[7] = y + destinationFrame.height; - this.invalidate(); - return this; - }; - /** - * legacy upload method, just marks buffers dirty - * @returns {PIXI.QuadUv} Returns itself. - */ - QuadUv.prototype.invalidate = function () { - this.vertexBuffer._updateID++; - this.uvBuffer._updateID++; - return this; - }; - return QuadUv; - }(Geometry)); - - var UID$2 = 0; - /** - * Uniform group holds uniform map and some ID's for work - * - * @class - * @memberof PIXI - */ - var UniformGroup = /** @class */ (function () { - /** - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - * @param {boolean} [_static] - Uniforms wont be changed after creation - */ - function UniformGroup(uniforms, _static) { - /** - * uniform values - * @member {object} - * @readonly - */ - this.uniforms = uniforms; - /** - * Its a group and not a single uniforms - * @member {boolean} - * @readonly - * @default true - */ - this.group = true; - // lets generate this when the shader ? - this.syncUniforms = {}; - /** - * dirty version - * @protected - * @member {number} - */ - this.dirtyId = 0; - /** - * unique id - * @protected - * @member {number} - */ - this.id = UID$2++; - /** - * Uniforms wont be changed after creation - * @member {boolean} - */ - this.static = !!_static; - } - UniformGroup.prototype.update = function () { - this.dirtyId++; - }; - UniformGroup.prototype.add = function (name, uniforms, _static) { - this.uniforms[name] = new UniformGroup(uniforms, _static); - }; - UniformGroup.from = function (uniforms, _static) { - return new UniformGroup(uniforms, _static); - }; - return UniformGroup; - }()); - - /** - * System plugin to the renderer to manage filter states. - * - * @class - * @private - */ - var FilterState = /** @class */ (function () { - function FilterState() { - this.renderTexture = null; - /** - * Target of the filters - * We store for case when custom filter wants to know the element it was applied on - * @member {PIXI.DisplayObject} - * @private - */ - this.target = null; - /** - * Compatibility with PixiJS v4 filters - * @member {boolean} - * @default false - * @private - */ - this.legacy = false; - /** - * Resolution of filters - * @member {number} - * @default 1 - * @private - */ - this.resolution = 1; - // next three fields are created only for root - // re-assigned for everything else - /** - * Source frame - * @member {PIXI.Rectangle} - * @private - */ - this.sourceFrame = new Rectangle(); - /** - * Destination frame - * @member {PIXI.Rectangle} - * @private - */ - this.destinationFrame = new Rectangle(); - /** - * Collection of filters - * @member {PIXI.Filter[]} - * @private - */ - this.filters = []; - } - /** - * clears the state - * @private - */ - FilterState.prototype.clear = function () { - this.target = null; - this.filters = null; - this.renderTexture = null; - }; - return FilterState; - }()); - - /** - * System plugin to the renderer to manage the filters. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var FilterSystem = /** @class */ (function (_super) { - __extends$2(FilterSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function FilterSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * List of filters for the FilterSystem - * @member {Object[]} - * @readonly - */ - _this.defaultFilterStack = [{}]; - /** - * stores a bunch of PO2 textures used for filtering - * @member {Object} - */ - _this.texturePool = new RenderTexturePool(); - _this.texturePool.setScreenSize(renderer.view); - /** - * a pool for storing filter states, save us creating new ones each tick - * @member {Object[]} - */ - _this.statePool = []; - /** - * A very simple geometry used when drawing a filter effect to the screen - * @member {PIXI.Quad} - */ - _this.quad = new Quad(); - /** - * Quad UVs - * @member {PIXI.QuadUv} - */ - _this.quadUv = new QuadUv(); - /** - * Temporary rect for maths - * @type {PIXI.Rectangle} - */ - _this.tempRect = new Rectangle(); - /** - * Active state - * @member {object} - */ - _this.activeState = {}; - /** - * This uniform group is attached to filter uniforms when used - * @member {PIXI.UniformGroup} - * @property {PIXI.Rectangle} outputFrame - * @property {Float32Array} inputSize - * @property {Float32Array} inputPixel - * @property {Float32Array} inputClamp - * @property {Number} resolution - * @property {Float32Array} filterArea - * @property {Fload32Array} filterClamp - */ - _this.globalUniforms = new UniformGroup({ - outputFrame: _this.tempRect, - inputSize: new Float32Array(4), - inputPixel: new Float32Array(4), - inputClamp: new Float32Array(4), - resolution: 1, - // legacy variables - filterArea: new Float32Array(4), - filterClamp: new Float32Array(4), - }, true); - /** - * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES} - * @member {boolean} - */ - _this.forceClear = false; - /** - * Old padding behavior is to use the max amount instead of sum padding. - * Use this flag if you need the old behavior. - * @member {boolean} - * @default false - */ - _this.useMaxPadding = false; - return _this; - } - /** - * Adds a new filter to the System. - * - * @param {PIXI.DisplayObject} target - The target of the filter to render. - * @param {PIXI.Filter[]} filters - The filters to apply. - */ - FilterSystem.prototype.push = function (target, filters) { - var renderer = this.renderer; - var filterStack = this.defaultFilterStack; - var state = this.statePool.pop() || new FilterState(); - var resolution = filters[0].resolution; - var padding = filters[0].padding; - var autoFit = filters[0].autoFit; - var legacy = filters[0].legacy; - for (var i = 1; i < filters.length; i++) { - var filter = filters[i]; - // lets use the lowest resolution.. - resolution = Math.min(resolution, filter.resolution); - // figure out the padding required for filters - padding = this.useMaxPadding - // old behavior: use largest amount of padding! - ? Math.max(padding, filter.padding) - // new behavior: sum the padding - : padding + filter.padding; - // only auto fit if all filters are autofit - autoFit = autoFit && filter.autoFit; - legacy = legacy || filter.legacy; - } - if (filterStack.length === 1) { - this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current; - } - filterStack.push(state); - state.resolution = resolution; - state.legacy = legacy; - state.target = target; - state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); - state.sourceFrame.pad(padding); - if (autoFit) { - state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame); - } - // round to whole number based on resolution - state.sourceFrame.ceil(resolution); - state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution); - state.filters = filters; - state.destinationFrame.width = state.renderTexture.width; - state.destinationFrame.height = state.renderTexture.height; - var destinationFrame = this.tempRect; - destinationFrame.width = state.sourceFrame.width; - destinationFrame.height = state.sourceFrame.height; - state.renderTexture.filterFrame = state.sourceFrame; - renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame); - renderer.renderTexture.clear(); - }; - /** - * Pops off the filter and applies it. - * - */ - FilterSystem.prototype.pop = function () { - var filterStack = this.defaultFilterStack; - var state = filterStack.pop(); - var filters = state.filters; - this.activeState = state; - var globalUniforms = this.globalUniforms.uniforms; - globalUniforms.outputFrame = state.sourceFrame; - globalUniforms.resolution = state.resolution; - var inputSize = globalUniforms.inputSize; - var inputPixel = globalUniforms.inputPixel; - var inputClamp = globalUniforms.inputClamp; - inputSize[0] = state.destinationFrame.width; - inputSize[1] = state.destinationFrame.height; - inputSize[2] = 1.0 / inputSize[0]; - inputSize[3] = 1.0 / inputSize[1]; - inputPixel[0] = inputSize[0] * state.resolution; - inputPixel[1] = inputSize[1] * state.resolution; - inputPixel[2] = 1.0 / inputPixel[0]; - inputPixel[3] = 1.0 / inputPixel[1]; - inputClamp[0] = 0.5 * inputPixel[2]; - inputClamp[1] = 0.5 * inputPixel[3]; - inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); - inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); - // only update the rect if its legacy.. - if (state.legacy) { - var filterArea = globalUniforms.filterArea; - filterArea[0] = state.destinationFrame.width; - filterArea[1] = state.destinationFrame.height; - filterArea[2] = state.sourceFrame.x; - filterArea[3] = state.sourceFrame.y; - globalUniforms.filterClamp = globalUniforms.inputClamp; - } - this.globalUniforms.update(); - var lastState = filterStack[filterStack.length - 1]; - if (state.renderTexture.framebuffer.multisample > 1) { - this.renderer.framebuffer.blit(); - } - if (filters.length === 1) { - filters[0].apply(this, state.renderTexture, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(state.renderTexture); - } - else { - var flip = state.renderTexture; - var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); - flop.filterFrame = flip.filterFrame; - var i = 0; - for (i = 0; i < filters.length - 1; ++i) { - filters[i].apply(this, flip, flop, exports.CLEAR_MODES.CLEAR, state); - var t = flip; - flip = flop; - flop = t; - } - filters[i].apply(this, flip, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(flip); - this.returnFilterTexture(flop); - } - state.clear(); - this.statePool.push(state); - }; - /** - * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. - * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack - * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} - */ - FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { - if (clearMode === void 0) { clearMode = exports.CLEAR_MODES.CLEAR; } - if (filterTexture && filterTexture.filterFrame) { - var destinationFrame = this.tempRect; - destinationFrame.width = filterTexture.filterFrame.width; - destinationFrame.height = filterTexture.filterFrame.height; - this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame); - } - else { - this.renderer.renderTexture.bind(filterTexture); - } - // TODO: remove in next major version - if (typeof clearMode === 'boolean') { - clearMode = clearMode ? exports.CLEAR_MODES.CLEAR : exports.CLEAR_MODES.BLEND; - // get deprecation function from utils - deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option'); - } - if (clearMode === exports.CLEAR_MODES.CLEAR - || (clearMode === exports.CLEAR_MODES.BLIT && this.forceClear)) { - this.renderer.renderTexture.clear(); - } - }; - /** - * Draws a filter. - * - * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it - */ - FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { - var renderer = this.renderer; - this.bindAndClear(output, clearMode); - // set the uniforms.. - filter.uniforms.uSampler = input; - filter.uniforms.filterGlobals = this.globalUniforms; - // TODO make it so that the order of this does not matter.. - // because it does at the moment cos of global uniforms. - // they need to get resynced - renderer.state.set(filter.state); - renderer.shader.bind(filter); - if (filter.legacy) { - this.quadUv.map(input._frame, input.filterFrame); - renderer.geometry.bind(this.quadUv); - renderer.geometry.draw(exports.DRAW_MODES.TRIANGLES); - } - else { - renderer.geometry.bind(this.quad); - renderer.geometry.draw(exports.DRAW_MODES.TRIANGLE_STRIP); - } - }; - /** - * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. - * - * Use `outputMatrix * vTextureCoord` in the shader. - * - * @param {PIXI.Matrix} outputMatrix - The matrix to output to. - * @param {PIXI.Sprite} sprite - The sprite to map to. - * @return {PIXI.Matrix} The mapped matrix. - */ - FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var orig = sprite._texture.orig; - var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); - var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX); - worldTransform.invert(); - mappedMatrix.prepend(worldTransform); - mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); - mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); - return mappedMatrix; - }; - /** - * Destroys this Filter System. - */ - FilterSystem.prototype.destroy = function () { - // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem - this.texturePool.clear(false); - }; - /** - * Gets a Power-of-Two render texture or fullScreen texture - * - * @protected - * @param {number} minWidth - The minimum width of the render texture in real pixels. - * @param {number} minHeight - The minimum height of the render texture in real pixels. - * @param {number} [resolution=1] - The resolution of the render texture. - * @return {PIXI.RenderTexture} The new render texture. - */ - FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution) { - if (resolution === void 0) { resolution = 1; } - return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution); - }; - /** - * Gets extra render texture to use inside current filter - * To be compliant with older filters, you can use params in any order - * - * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied - * @param {number} [resolution] - override resolution of the renderTexture - * @returns {PIXI.RenderTexture} - */ - FilterSystem.prototype.getFilterTexture = function (input, resolution) { - if (typeof input === 'number') { - var swap = input; - input = resolution; - resolution = swap; - } - input = input || this.activeState.renderTexture; - var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution); - filterTexture.filterFrame = input.filterFrame; - return filterTexture; - }; - /** - * Frees a render texture back into the pool. - * - * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free - */ - FilterSystem.prototype.returnFilterTexture = function (renderTexture) { - this.texturePool.returnTexture(renderTexture); - }; - /** - * Empties the texture pool. - */ - FilterSystem.prototype.emptyPool = function () { - this.texturePool.clear(true); - }; - /** - * calls `texturePool.resize()`, affects fullScreen renderTextures - */ - FilterSystem.prototype.resize = function () { - this.texturePool.setScreenSize(this.renderer.view); - }; - return FilterSystem; - }(System)); - - /** - * Base for a common object renderer that can be used as a - * system renderer plugin. - * - * @class - * @extends PIXI.System - * @memberof PIXI - */ - var ObjectRenderer = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. - */ - function ObjectRenderer(renderer) { - /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} - */ - this.renderer = renderer; - } - /** - * Stub method that should be used to empty the current - * batch by rendering objects now. - */ - ObjectRenderer.prototype.flush = function () { - // flush! - }; - /** - * Generic destruction method that frees all resources. This - * should be called by subclasses. - */ - ObjectRenderer.prototype.destroy = function () { - this.renderer = null; - }; - /** - * Stub method that initializes any state required before - * rendering starts. It is different from the `prerender` - * signal, which occurs every frame, in that it is called - * whenever an object requests _this_ renderer specifically. - */ - ObjectRenderer.prototype.start = function () { - // set the shader.. - }; - /** - * Stops the renderer. It should free up any state and - * become dormant. - */ - ObjectRenderer.prototype.stop = function () { - this.flush(); - }; - /** - * Keeps the object to render. It doesn't have to be - * rendered immediately. - * - * @param {PIXI.DisplayObject} object - The object to render. - */ - ObjectRenderer.prototype.render = function (_object) { - // render the object - }; - return ObjectRenderer; - }()); - - /** - * System plugin to the renderer to manage batching. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var BatchSystem = /** @class */ (function (_super) { - __extends$2(BatchSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function BatchSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * An empty renderer. - * - * @member {PIXI.ObjectRenderer} - */ - _this.emptyRenderer = new ObjectRenderer(renderer); - /** - * The currently active ObjectRenderer. - * - * @member {PIXI.ObjectRenderer} - */ - _this.currentRenderer = _this.emptyRenderer; - return _this; - } - /** - * Changes the current renderer to the one given in parameter - * - * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use. - */ - BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { - if (this.currentRenderer === objectRenderer) { - return; - } - this.currentRenderer.stop(); - this.currentRenderer = objectRenderer; - this.currentRenderer.start(); - }; - /** - * This should be called if you wish to do some custom rendering - * It will basically render anything that may be batched up such as sprites - */ - BatchSystem.prototype.flush = function () { - this.setObjectRenderer(this.emptyRenderer); - }; - /** - * Reset the system to an empty renderer - */ - BatchSystem.prototype.reset = function () { - this.setObjectRenderer(this.emptyRenderer); - }; - /** - * Handy function for batch renderers: copies bound textures in first maxTextures locations to array - * sets actual _batchLocation for them - * - * @param {PIXI.BaseTexture[]} - arr copy destination - * @param {number} maxTextures - number of copied elements - */ - BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { - var boundTextures = this.renderer.texture.boundTextures; - for (var i = maxTextures - 1; i >= 0; --i) { - arr[i] = boundTextures[i] || null; - if (arr[i]) { - arr[i]._batchLocation = i; - } - } - }; - /** - * Assigns batch locations to textures in array based on boundTextures state. - * All textures in texArray should have `_batchEnabled = _batchId`, - * and their count should be less than `maxTextures`. - * - * @param {PIXI.BatchTextureArray} texArray - textures to bound - * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures - * @param {number} batchId - marker for _batchEnabled param of textures in texArray - * @param {number} maxTextures - number of texture locations to manipulate - */ - BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { - var elements = texArray.elements, ids = texArray.ids, count = texArray.count; - var j = 0; - for (var i = 0; i < count; i++) { - var tex = elements[i]; - var loc = tex._batchLocation; - if (loc >= 0 && loc < maxTextures - && boundTextures[loc] === tex) { - ids[i] = loc; - continue; - } - while (j < maxTextures) { - var bound = boundTextures[j]; - if (bound && bound._batchEnabled === batchId - && bound._batchLocation === j) { - j++; - continue; - } - ids[i] = j; - tex._batchLocation = j; - boundTextures[j] = tex; - break; - } - } - }; - return BatchSystem; - }(System)); - - var CONTEXT_UID_COUNTER = 0; - /** - * System plugin to the renderer to manage the context. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ContextSystem = /** @class */ (function (_super) { - __extends$2(ContextSystem, _super); - /* eslint-enable camelcase */ - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ContextSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Either 1 or 2 to reflect the WebGL version being used - * @member {number} - * @readonly - */ - _this.webGLVersion = 1; - /** - * Extensions being used - * @member {object} - * @readonly - * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension - * @property {OES_texture_float} floatTexture - WebGL v1 extension - * @property {WEBGL_lose_context} loseContext - WebGL v1 extension - * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension - * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension - */ - _this.extensions = {}; - /** - * Features supported by current context - * @member {object} - * @private - * @readonly - * @property {boolean} uint32Indices - Supports of 32-bit indices buffer - */ - _this.supports = { - uint32Indices: false, - }; - // Bind functions - _this.handleContextLost = _this.handleContextLost.bind(_this); - _this.handleContextRestored = _this.handleContextRestored.bind(_this); - renderer.view.addEventListener('webglcontextlost', _this.handleContextLost, false); - renderer.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false); - return _this; - } - Object.defineProperty(ContextSystem.prototype, "isLost", { - /** - * `true` if the context is lost - * @member {boolean} - * @readonly - */ - get: function () { - return (!this.gl || this.gl.isContextLost()); - }, - enumerable: false, - configurable: true - }); - /** - * Handle the context change event - * @param {WebGLRenderingContext} gl - new webgl context - */ - ContextSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; - // restore a context if it was previously lost - if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) { - gl.getExtension('WEBGL_lose_context').restoreContext(); - } - }; - /** - * Initialize the context - * - * @protected - * @param {WebGLRenderingContext} gl - WebGL context - */ - ContextSystem.prototype.initFromContext = function (gl) { - this.gl = gl; - this.validateContext(gl); - this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; - this.renderer.runners.contextChange.emit(gl); - }; - /** - * Initialize from context options - * - * @protected - * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext - * @param {object} options - context attributes - */ - ContextSystem.prototype.initFromOptions = function (options) { - var gl = this.createContext(this.renderer.view, options); - this.initFromContext(gl); - }; - /** - * Helper class to create a WebGL Context - * - * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from - * @param options {object} An options object that gets passed in to the canvas element containing the context attributes - * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext - * @return {WebGLRenderingContext} the WebGL context - */ - ContextSystem.prototype.createContext = function (canvas, options) { - var gl; - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { - gl = canvas.getContext('webgl2', options); - } - if (gl) { - this.webGLVersion = 2; - } - else { - this.webGLVersion = 1; - gl = canvas.getContext('webgl', options) - || canvas.getContext('experimental-webgl', options); - if (!gl) { - // fail, not able to get a context - throw new Error('This browser does not support WebGL. Try using the canvas renderer'); - } - } - this.gl = gl; - this.getExtensions(); - return this.gl; - }; - /** - * Auto-populate the extensions - * - * @protected - */ - ContextSystem.prototype.getExtensions = function () { - // time to set up default extensions that Pixi uses. - var gl = this.gl; - if (this.webGLVersion === 1) { - Object.assign(this.extensions, { - drawBuffers: gl.getExtension('WEBGL_draw_buffers'), - depthTexture: gl.getExtension('WEBGL_depth_texture'), - loseContext: gl.getExtension('WEBGL_lose_context'), - vertexArrayObject: gl.getExtension('OES_vertex_array_object') - || gl.getExtension('MOZ_OES_vertex_array_object') - || gl.getExtension('WEBKIT_OES_vertex_array_object'), - anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), - uint32ElementIndex: gl.getExtension('OES_element_index_uint'), - // Floats and half-floats - floatTexture: gl.getExtension('OES_texture_float'), - floatTextureLinear: gl.getExtension('OES_texture_float_linear'), - textureHalfFloat: gl.getExtension('OES_texture_half_float'), - textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), - }); - } - else if (this.webGLVersion === 2) { - Object.assign(this.extensions, { - anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), - // Floats and half-floats - colorBufferFloat: gl.getExtension('EXT_color_buffer_float'), - floatTextureLinear: gl.getExtension('OES_texture_float_linear'), - }); - } - }; - /** - * Handles a lost webgl context - * - * @protected - * @param {WebGLContextEvent} event - The context lost event. - */ - ContextSystem.prototype.handleContextLost = function (event) { - event.preventDefault(); - }; - /** - * Handles a restored webgl context - * - * @protected - */ - ContextSystem.prototype.handleContextRestored = function () { - this.renderer.runners.contextChange.emit(this.gl); - }; - ContextSystem.prototype.destroy = function () { - var view = this.renderer.view; - // remove listeners - view.removeEventListener('webglcontextlost', this.handleContextLost); - view.removeEventListener('webglcontextrestored', this.handleContextRestored); - this.gl.useProgram(null); - if (this.extensions.loseContext) { - this.extensions.loseContext.loseContext(); - } - }; - /** - * Handle the post-render runner event - * - * @protected - */ - ContextSystem.prototype.postrender = function () { - if (this.renderer.renderingToScreen) { - this.gl.flush(); - } - }; - /** - * Validate context - * - * @protected - * @param {WebGLRenderingContext} gl - Render context - */ - ContextSystem.prototype.validateContext = function (gl) { - var attributes = gl.getContextAttributes(); - var isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext; - if (isWebGl2) { - this.webGLVersion = 2; - } - // this is going to be fairly simple for now.. but at least we have room to grow! - if (!attributes.stencil) { - /* eslint-disable max-len, no-console */ - console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); - /* eslint-enable max-len, no-console */ - } - var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); - this.supports.uint32Indices = hasuint32; - if (!hasuint32) { - /* eslint-disable max-len, no-console */ - console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); - /* eslint-enable max-len, no-console */ - } - }; - return ContextSystem; - }(System)); - - /** - * Internal framebuffer for WebGL context - * @class - * @memberof PIXI - */ - var GLFramebuffer = /** @class */ (function () { - function GLFramebuffer(framebuffer) { - /** - * The WebGL framebuffer - * @member {WebGLFramebuffer} - */ - this.framebuffer = framebuffer; - /** - * stencil+depth , usually costs 32bits per pixel - * @member {WebGLRenderbuffer} - */ - this.stencil = null; - /** - * latest known version of framebuffer - * @member {number} - * @protected - */ - this.dirtyId = 0; - /** - * latest known version of framebuffer format - * @member {number} - * @protected - */ - this.dirtyFormat = 0; - /** - * latest known version of framebuffer size - * @member {number} - * @protected - */ - this.dirtySize = 0; - /** - * Detected AA samples number - * @member {PIXI.MSAA_QUALITY} - */ - this.multisample = exports.MSAA_QUALITY.NONE; - /** - * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info - * @member {WebGLRenderbuffer} - */ - this.msaaBuffer = null; - /** - * In case we use MSAA, this is actual framebuffer that has colorTextures[0] - * The contents of that framebuffer are read when we use that renderTexture in sprites - * @member {PIXI.Framebuffer} - */ - this.blitFramebuffer = null; - } - return GLFramebuffer; - }()); - - var tempRectangle = new Rectangle(); - /** - * System plugin to the renderer to manage framebuffers. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var FramebufferSystem = /** @class */ (function (_super) { - __extends$2(FramebufferSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function FramebufferSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * A list of managed framebuffers - * @member {PIXI.Framebuffer[]} - * @readonly - */ - _this.managedFramebuffers = []; - /** - * Framebuffer value that shows that we don't know what is bound - * @member {Framebuffer} - * @readonly - */ - _this.unknownFramebuffer = new Framebuffer(10, 10); - _this.msaaSamples = null; - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - FramebufferSystem.prototype.contextChange = function () { - var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - this.current = this.unknownFramebuffer; - this.viewport = new Rectangle(); - this.hasMRT = true; - this.writeDepthTexture = true; - this.disposeAll(true); - // webgl2 - if (this.renderer.context.webGLVersion === 1) { - // webgl 1! - var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; - var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - nativeDrawBuffersExtension_1 = null; - nativeDepthTextureExtension = null; - } - if (nativeDrawBuffersExtension_1) { - gl.drawBuffers = function (activeTextures) { - return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); - }; - } - else { - this.hasMRT = false; - gl.drawBuffers = function () { - // empty - }; - } - if (!nativeDepthTextureExtension) { - this.writeDepthTexture = false; - } - } - else { - // WebGL2 - // cache possible MSAA samples - this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); - } - }; - /** - * Bind a framebuffer - * - * @param {PIXI.Framebuffer} framebuffer - * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size - */ - FramebufferSystem.prototype.bind = function (framebuffer, frame) { - var gl = this.gl; - if (framebuffer) { - // TODO caching layer! - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); - if (this.current !== framebuffer) { - this.current = framebuffer; - gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - } - // make sure all textures are unbound.. - // now check for updates... - if (fbo.dirtyId !== framebuffer.dirtyId) { - fbo.dirtyId = framebuffer.dirtyId; - if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { - fbo.dirtyFormat = framebuffer.dirtyFormat; - this.updateFramebuffer(framebuffer); - } - else if (fbo.dirtySize !== framebuffer.dirtySize) { - fbo.dirtySize = framebuffer.dirtySize; - this.resizeFramebuffer(framebuffer); - } - } - for (var i = 0; i < framebuffer.colorTextures.length; i++) { - var tex = framebuffer.colorTextures[i]; - this.renderer.texture.unbind(tex.parentTextureArray || tex); - } - if (framebuffer.depthTexture) { - this.renderer.texture.unbind(framebuffer.depthTexture); - } - if (frame) { - this.setViewport(frame.x, frame.y, frame.width, frame.height); - } - else { - this.setViewport(0, 0, framebuffer.width, framebuffer.height); - } - } - else { - if (this.current) { - this.current = null; - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - } - if (frame) { - this.setViewport(frame.x, frame.y, frame.width, frame.height); - } - else { - this.setViewport(0, 0, this.renderer.width, this.renderer.height); - } - } - }; - /** - * Set the WebGLRenderingContext's viewport. - * - * @param {Number} x - X position of viewport - * @param {Number} y - Y position of viewport - * @param {Number} width - Width of viewport - * @param {Number} height - Height of viewport - */ - FramebufferSystem.prototype.setViewport = function (x, y, width, height) { - var v = this.viewport; - if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { - v.x = x; - v.y = y; - v.width = width; - v.height = height; - this.gl.viewport(x, y, width, height); - } - }; - Object.defineProperty(FramebufferSystem.prototype, "size", { - /** - * Get the size of the current width and height. Returns object with `width` and `height` values. - * - * @member {object} - * @readonly - */ - get: function () { - if (this.current) { - // TODO store temp - return { x: 0, y: 0, width: this.current.width, height: this.current.height }; - } - return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; - }, - enumerable: false, - configurable: true - }); - /** - * Clear the color of the context - * - * @param {Number} r - Red value from 0 to 1 - * @param {Number} g - Green value from 0 to 1 - * @param {Number} b - Blue value from 0 to 1 - * @param {Number} a - Alpha value from 0 to 1 - * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks - * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. - */ - FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { - if (mask === void 0) { mask = exports.BUFFER_BITS.COLOR | exports.BUFFER_BITS.DEPTH; } - var gl = this.gl; - // TODO clear color can be set only one right? - gl.clearColor(r, g, b, a); - gl.clear(mask); - }; - /** - * Initialize framebuffer for this context - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - * @returns {PIXI.GLFramebuffer} created GLFramebuffer - */ - FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = new GLFramebuffer(gl.createFramebuffer()); - fbo.multisample = this.detectSamples(framebuffer.multisample); - framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; - this.managedFramebuffers.push(framebuffer); - framebuffer.disposeRunner.add(this); - return fbo; - }; - /** - * Resize the framebuffer - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - */ - FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - if (fbo.stencil) { - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); - } - var colorTextures = framebuffer.colorTextures; - for (var i = 0; i < colorTextures.length; i++) { - this.renderer.texture.bind(colorTextures[i], 0); - } - if (framebuffer.depthTexture) { - this.renderer.texture.bind(framebuffer.depthTexture, 0); - } - }; - /** - * Update the framebuffer - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - */ - FramebufferSystem.prototype.updateFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - // bind the color texture - var colorTextures = framebuffer.colorTextures; - var count = colorTextures.length; - if (!gl.drawBuffers) { - count = Math.min(count, 1); - } - if (fbo.multisample > 1) { - fbo.msaaBuffer = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); - gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); - } - var activeTextures = []; - for (var i = 0; i < count; i++) { - if (i === 0 && fbo.multisample > 1) { - continue; - } - var texture = framebuffer.colorTextures[i]; - var parentTexture = texture.parentTextureArray || texture; - this.renderer.texture.bind(parentTexture, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, 0); - activeTextures.push(gl.COLOR_ATTACHMENT0 + i); - } - if (activeTextures.length > 1) { - gl.drawBuffers(activeTextures); - } - if (framebuffer.depthTexture) { - var writeDepthTexture = this.writeDepthTexture; - if (writeDepthTexture) { - var depthTexture = framebuffer.depthTexture; - this.renderer.texture.bind(depthTexture, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, 0); - } - } - if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) { - fbo.stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); - // TODO.. this is depth AND stencil? - if (!framebuffer.depthTexture) { // you can't have both, so one should take priority if enabled - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); - } - } - }; - /** - * Detects number of samples that is not more than a param but as close to it as possible - * - * @param {PIXI.MSAA_QUALITY} samples - number of samples - * @returns {PIXI.MSAA_QUALITY} - recommended number of samples - */ - FramebufferSystem.prototype.detectSamples = function (samples) { - var msaaSamples = this.msaaSamples; - var res = exports.MSAA_QUALITY.NONE; - if (samples <= 1 || msaaSamples === null) { - return res; - } - for (var i = 0; i < msaaSamples.length; i++) { - if (msaaSamples[i] <= samples) { - res = msaaSamples[i]; - break; - } - } - if (res === 1) { - res = exports.MSAA_QUALITY.NONE; - } - return res; - }; - /** - * Only works with WebGL2 - * - * blits framebuffer to another of the same or bigger size - * after that target framebuffer is bound - * - * Fails with WebGL warning if blits multisample framebuffer to different size - * - * @param {PIXI.Framebuffer} [framebuffer] - by default it blits "into itself", from renderBuffer to texture. - * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels - * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels - */ - FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { - var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; - if (renderer.context.webGLVersion !== 2) { - return; - } - if (!current) { - return; - } - var fbo = current.glFramebuffers[CONTEXT_UID]; - if (!fbo) { - return; - } - if (!framebuffer) { - if (fbo.multisample <= 1) { - return; - } - if (!fbo.blitFramebuffer) { - fbo.blitFramebuffer = new Framebuffer(current.width, current.height); - fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]); - } - framebuffer = fbo.blitFramebuffer; - framebuffer.width = current.width; - framebuffer.height = current.height; - } - if (!sourcePixels) { - sourcePixels = tempRectangle; - sourcePixels.width = current.width; - sourcePixels.height = current.height; - } - if (!destPixels) { - destPixels = sourcePixels; - } - var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; - this.bind(framebuffer); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); - gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); - }; - /** - * Disposes framebuffer - * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of - * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls - */ - FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - var gl = this.gl; - if (!fbo) { - return; - } - delete framebuffer.glFramebuffers[this.CONTEXT_UID]; - var index = this.managedFramebuffers.indexOf(framebuffer); - if (index >= 0) { - this.managedFramebuffers.splice(index, 1); - } - framebuffer.disposeRunner.remove(this); - if (!contextLost) { - gl.deleteFramebuffer(fbo.framebuffer); - if (fbo.stencil) { - gl.deleteRenderbuffer(fbo.stencil); - } - } - }; - /** - * Disposes all framebuffers, but not textures bound to them - * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls - */ - FramebufferSystem.prototype.disposeAll = function (contextLost) { - var list = this.managedFramebuffers; - this.managedFramebuffers = []; - for (var i = 0; i < list.length; i++) { - this.disposeFramebuffer(list[i], contextLost); - } - }; - /** - * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. - * Used by MaskSystem, when its time to use stencil mask for Graphics element. - * - * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. - * - * @private - */ - FramebufferSystem.prototype.forceStencil = function () { - var framebuffer = this.current; - if (!framebuffer) { - return; - } - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - if (!fbo || fbo.stencil) { - return; - } - framebuffer.enableStencil(); - var w = framebuffer.width; - var h = framebuffer.height; - var gl = this.gl; - var stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); - fbo.stencil = stencil; - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); - }; - /** - * resets framebuffer stored state, binds screen framebuffer - * - * should be called before renderTexture reset() - */ - FramebufferSystem.prototype.reset = function () { - this.current = this.unknownFramebuffer; - this.viewport = new Rectangle(); - }; - return FramebufferSystem; - }(System)); - - var GLBuffer = /** @class */ (function () { - function GLBuffer(buffer) { - this.buffer = buffer || null; - this.updateID = -1; - this.byteLength = -1; - this.refCount = 0; - } - return GLBuffer; - }()); - - var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; - /** - * System plugin to the renderer to manage geometry. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var GeometrySystem = /** @class */ (function (_super) { - __extends$2(GeometrySystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function GeometrySystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this._activeGeometry = null; - _this._activeVao = null; - /** - * `true` if we has `*_vertex_array_object` extension - * @member {boolean} - * @readonly - */ - _this.hasVao = true; - /** - * `true` if has `ANGLE_instanced_arrays` extension - * @member {boolean} - * @readonly - */ - _this.hasInstance = true; - /** - * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced` - * @member {boolean} - * @readonly - */ - _this.canUseUInt32ElementIndex = false; - /** - * Cache for all geometries by id, used in case renderer gets destroyed or for profiling - * @member {object} - * @readonly - */ - _this.managedGeometries = {}; - /** - * Cache for all buffers by id, used in case renderer gets destroyed or for profiling - * @member {object} - * @readonly - */ - _this.managedBuffers = {}; - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - GeometrySystem.prototype.contextChange = function () { - this.disposeAll(true); - var gl = this.gl = this.renderer.gl; - var context = this.renderer.context; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - // webgl2 - if (context.webGLVersion !== 2) { - // webgl 1! - var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - nativeVaoExtension_1 = null; - } - if (nativeVaoExtension_1) { - gl.createVertexArray = function () { - return nativeVaoExtension_1.createVertexArrayOES(); - }; - gl.bindVertexArray = function (vao) { - return nativeVaoExtension_1.bindVertexArrayOES(vao); - }; - gl.deleteVertexArray = function (vao) { - return nativeVaoExtension_1.deleteVertexArrayOES(vao); - }; - } - else { - this.hasVao = false; - gl.createVertexArray = function () { - return null; - }; - gl.bindVertexArray = function () { - return null; - }; - gl.deleteVertexArray = function () { - return null; - }; - } - } - if (context.webGLVersion !== 2) { - var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); - if (instanceExt_1) { - gl.vertexAttribDivisor = function (a, b) { - return instanceExt_1.vertexAttribDivisorANGLE(a, b); - }; - gl.drawElementsInstanced = function (a, b, c, d, e) { - return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); - }; - gl.drawArraysInstanced = function (a, b, c, d) { - return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); - }; - } - else { - this.hasInstance = false; - } - } - this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; - }; - /** - * Binds geometry so that is can be drawn. Creating a Vao if required - * - * @param {PIXI.Geometry} geometry - instance of geometry to bind - * @param {PIXI.Shader} [shader] - instance of shader to use vao for - */ - GeometrySystem.prototype.bind = function (geometry, shader) { - shader = shader || this.renderer.shader.shader; - var gl = this.gl; - // not sure the best way to address this.. - // currently different shaders require different VAOs for the same geometry - // Still mulling over the best way to solve this one.. - // will likely need to modify the shader attribute locations at run time! - var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var incRefCount = false; - if (!vaos) { - this.managedGeometries[geometry.id] = geometry; - geometry.disposeRunner.add(this); - geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; - incRefCount = true; - } - var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount); - this._activeGeometry = geometry; - if (this._activeVao !== vao) { - this._activeVao = vao; - if (this.hasVao) { - gl.bindVertexArray(vao); - } - else { - this.activateVao(geometry, shader.program); - } - } - // TODO - optimise later! - // don't need to loop through if nothing changed! - // maybe look to add an 'autoupdate' to geometry? - this.updateBuffers(); - }; - /** - * Reset and unbind any active VAO and geometry - */ - GeometrySystem.prototype.reset = function () { - this.unbind(); - }; - /** - * Update buffers - * @protected - */ - GeometrySystem.prototype.updateBuffers = function () { - var geometry = this._activeGeometry; - var gl = this.gl; - for (var i = 0; i < geometry.buffers.length; i++) { - var buffer = geometry.buffers[i]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; - if (buffer._updateID !== glBuffer.updateID) { - glBuffer.updateID = buffer._updateID; - // TODO can cache this on buffer! maybe added a getter / setter? - var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER; - // TODO this could change if the VAO changes... - // need to come up with a better way to cache.. - // if (this.boundBuffers[type] !== glBuffer) - // { - // this.boundBuffers[type] = glBuffer; - gl.bindBuffer(type, glBuffer.buffer); - // } - this._boundBuffer = glBuffer; - if (glBuffer.byteLength >= buffer.data.byteLength) { - // offset is always zero for now! - gl.bufferSubData(type, 0, buffer.data); - } - else { - var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; - glBuffer.byteLength = buffer.data.byteLength; - gl.bufferData(type, buffer.data, drawType); - } - } - } - }; - /** - * Check compability between a geometry and a program - * @protected - * @param {PIXI.Geometry} geometry - Geometry instance - * @param {PIXI.Program} program - Program instance - */ - GeometrySystem.prototype.checkCompatibility = function (geometry, program) { - // geometry must have at least all the attributes that the shader requires. - var geometryAttributes = geometry.attributes; - var shaderAttributes = program.attributeData; - for (var j in shaderAttributes) { - if (!geometryAttributes[j]) { - throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); - } - } - }; - /** - * Takes a geometry and program and generates a unique signature for them. - * - * @param {PIXI.Geometry} geometry - to get signature from - * @param {PIXI.Program} program - to test geometry against - * @returns {String} Unique signature of the geometry and program - * @protected - */ - GeometrySystem.prototype.getSignature = function (geometry, program) { - var attribs = geometry.attributes; - var shaderAttributes = program.attributeData; - var strings = ['g', geometry.id]; - for (var i in attribs) { - if (shaderAttributes[i]) { - strings.push(i); - } - } - return strings.join('-'); - }; - /** - * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. - * If vao is created, it is bound automatically. - * - * @protected - * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for - * @param {PIXI.Program} program - Instance of program - * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers - */ - GeometrySystem.prototype.initGeometryVao = function (geometry, program, incRefCount) { - if (incRefCount === void 0) { incRefCount = true; } - this.checkCompatibility(geometry, program); - var gl = this.gl; - var CONTEXT_UID = this.CONTEXT_UID; - var signature = this.getSignature(geometry, program); - var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var vao = vaoObjectHash[signature]; - if (vao) { - // this will give us easy access to the vao - vaoObjectHash[program.id] = vao; - return vao; - } - var buffers = geometry.buffers; - var attributes = geometry.attributes; - var tempStride = {}; - var tempStart = {}; - for (var j in buffers) { - tempStride[j] = 0; - tempStart[j] = 0; - } - for (var j in attributes) { - if (!attributes[j].size && program.attributeData[j]) { - attributes[j].size = program.attributeData[j].size; - } - else if (!attributes[j].size) { - console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line - } - tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type]; - } - for (var j in attributes) { - var attribute = attributes[j]; - var attribSize = attribute.size; - if (attribute.stride === undefined) { - if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) { - attribute.stride = 0; - } - else { - attribute.stride = tempStride[attribute.buffer]; - } - } - if (attribute.start === undefined) { - attribute.start = tempStart[attribute.buffer]; - tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type]; - } - } - vao = gl.createVertexArray(); - gl.bindVertexArray(vao); - // first update - and create the buffers! - // only create a gl buffer if it actually gets - for (var i = 0; i < buffers.length; i++) { - var buffer = buffers[i]; - if (!buffer._glBuffers[CONTEXT_UID]) { - buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); - this.managedBuffers[buffer.id] = buffer; - buffer.disposeRunner.add(this); - } - if (incRefCount) { - buffer._glBuffers[CONTEXT_UID].refCount++; - } - } - // TODO - maybe make this a data object? - // lets wait to see if we need to first! - this.activateVao(geometry, program); - this._activeVao = vao; - // add it to the cache! - vaoObjectHash[program.id] = vao; - vaoObjectHash[signature] = vao; - return vao; - }; - /** - * Disposes buffer - * @param {PIXI.Buffer} buffer - buffer with data - * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray - */ - GeometrySystem.prototype.disposeBuffer = function (buffer, contextLost) { - if (!this.managedBuffers[buffer.id]) { - return; - } - delete this.managedBuffers[buffer.id]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; - var gl = this.gl; - buffer.disposeRunner.remove(this); - if (!glBuffer) { - return; - } - if (!contextLost) { - gl.deleteBuffer(glBuffer.buffer); - } - delete buffer._glBuffers[this.CONTEXT_UID]; - }; - /** - * Disposes geometry - * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed - * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray - */ - GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { - if (!this.managedGeometries[geometry.id]) { - return; - } - delete this.managedGeometries[geometry.id]; - var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var gl = this.gl; - var buffers = geometry.buffers; - geometry.disposeRunner.remove(this); - if (!vaos) { - return; - } - for (var i = 0; i < buffers.length; i++) { - var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; - buf.refCount--; - if (buf.refCount === 0 && !contextLost) { - this.disposeBuffer(buffers[i], contextLost); - } - } - if (!contextLost) { - for (var vaoId in vaos) { - // delete only signatures, everything else are copies - if (vaoId[0] === 'g') { - var vao = vaos[vaoId]; - if (this._activeVao === vao) { - this.unbind(); - } - gl.deleteVertexArray(vao); - } - } - } - delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; - }; - /** - * dispose all WebGL resources of all managed geometries and buffers - * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls - */ - GeometrySystem.prototype.disposeAll = function (contextLost) { - var all = Object.keys(this.managedGeometries); - for (var i = 0; i < all.length; i++) { - this.disposeGeometry(this.managedGeometries[all[i]], contextLost); - } - all = Object.keys(this.managedBuffers); - for (var i = 0; i < all.length; i++) { - this.disposeBuffer(this.managedBuffers[all[i]], contextLost); - } - }; - /** - * Activate vertex array object - * - * @protected - * @param {PIXI.Geometry} geometry - Geometry instance - * @param {PIXI.Program} program - Shader program instance - */ - GeometrySystem.prototype.activateVao = function (geometry, program) { - var gl = this.gl; - var CONTEXT_UID = this.CONTEXT_UID; - var buffers = geometry.buffers; - var attributes = geometry.attributes; - if (geometry.indexBuffer) { - // first update the index buffer if we have one.. - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer); - } - var lastBuffer = null; - // add a new one! - for (var j in attributes) { - var attribute = attributes[j]; - var buffer = buffers[attribute.buffer]; - var glBuffer = buffer._glBuffers[CONTEXT_UID]; - if (program.attributeData[j]) { - if (lastBuffer !== glBuffer) { - gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer); - lastBuffer = glBuffer; - } - var location = program.attributeData[j].location; - // TODO introduce state again - // we can optimise this for older devices that have no VAOs - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); - if (attribute.instance) { - // TODO calculate instance count based of this... - if (this.hasInstance) { - gl.vertexAttribDivisor(location, 1); - } - else { - throw new Error('geometry error, GPU Instancing is not supported on this device'); - } - } - } - } - }; - /** - * Draw the geometry - * - * @param {Number} type - the type primitive to render - * @param {Number} [size] - the number of elements to be rendered - * @param {Number} [start] - Starting index - * @param {Number} [instanceCount] - the number of instances of the set of elements to execute - */ - GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { - var gl = this.gl; - var geometry = this._activeGeometry; - // TODO.. this should not change so maybe cache the function? - if (geometry.indexBuffer) { - var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; - var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; - if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { - if (geometry.instanced) { - /* eslint-disable max-len */ - gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); - /* eslint-enable max-len */ - } - else { - /* eslint-disable max-len */ - gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); - /* eslint-enable max-len */ - } - } - else { - console.warn('unsupported index buffer type: uint32'); - } - } - else if (geometry.instanced) { - // TODO need a better way to calculate size.. - gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); - } - else { - gl.drawArrays(type, start, size || geometry.getSize()); - } - return this; - }; - /** - * Unbind/reset everything - * @protected - */ - GeometrySystem.prototype.unbind = function () { - this.gl.bindVertexArray(null); - this._activeVao = null; - this._activeGeometry = null; - }; - return GeometrySystem; - }(System)); - - /** - * Component for masked elements - * - * Holds mask mode and temporary data about current mask - * - * @class - * @memberof PIXI - */ - var MaskData = /** @class */ (function () { - /** - * Create MaskData - * - * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask - */ - function MaskData(maskObject) { - if (maskObject === void 0) { maskObject = null; } - /** - * Mask type - * @member {PIXI.MASK_TYPES} - */ - this.type = exports.MASK_TYPES.NONE; - /** - * Whether we know the mask type beforehand - * @member {boolean} - * @default true - */ - this.autoDetect = true; - /** - * Which element we use to mask - * @member {PIXI.DisplayObject} - */ - this.maskObject = maskObject || null; - /** - * Whether it belongs to MaskSystem pool - * @member {boolean} - */ - this.pooled = false; - /** - * Indicator of the type - * @member {boolean} - */ - this.isMaskData = true; - /** - * Stencil counter above the mask in stack - * @member {number} - * @private - */ - this._stencilCounter = 0; - /** - * Scissor counter above the mask in stack - * @member {number} - * @private - */ - this._scissorCounter = 0; - /** - * Scissor operation above the mask in stack. - * Null if _scissorCounter is zero, rectangle instance if positive. - * @member {PIXI.Rectangle} - */ - this._scissorRect = null; - /** - * Targeted element. Temporary variable set by MaskSystem - * @member {PIXI.DisplayObject} - * @private - */ - this._target = null; - } - /** - * resets the mask data after popMask() - */ - MaskData.prototype.reset = function () { - if (this.pooled) { - this.maskObject = null; - this.type = exports.MASK_TYPES.NONE; - this.autoDetect = true; - } - this._target = null; - }; - /** - * copies counters from maskData above, called from pushMask() - * @param {PIXI.MaskData|null} maskAbove - */ - MaskData.prototype.copyCountersOrReset = function (maskAbove) { - if (maskAbove) { - this._stencilCounter = maskAbove._stencilCounter; - this._scissorCounter = maskAbove._scissorCounter; - this._scissorRect = maskAbove._scissorRect; - } - else { - this._stencilCounter = 0; - this._scissorCounter = 0; - this._scissorRect = null; - } - }; - return MaskData; - }()); - - /** - * @private - * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} - * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER - * @param src {string} The vertex shader source as an array of strings. - * @return {WebGLShader} the shader - */ - function compileShader(gl, type, src) { - var shader = gl.createShader(type); - gl.shaderSource(shader, src); - gl.compileShader(shader); - return shader; - } - /** - * @method compileProgram - * @private - * @memberof PIXI.shader - * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} - * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. - * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. - * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations - * @return {WebGLProgram} the shader program - */ - function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) { - var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc); - var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc); - var program = gl.createProgram(); - gl.attachShader(program, glVertShader); - gl.attachShader(program, glFragShader); - // optionally, set the attributes manually for the program rather than letting WebGL decide.. - if (attributeLocations) { - for (var i in attributeLocations) { - gl.bindAttribLocation(program, attributeLocations[i], i); - } - } - gl.linkProgram(program); - // if linking fails, then log and cleanup - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) { - console.warn(vertexSrc); - console.error(gl.getShaderInfoLog(glVertShader)); - } - if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) { - console.warn(fragmentSrc); - console.error(gl.getShaderInfoLog(glFragShader)); - } - console.error('Pixi.js Error: Could not initialize shader.'); - console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); - console.error('gl.getError()', gl.getError()); - // if there is a program info log, log it - if (gl.getProgramInfoLog(program) !== '') { - console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); - } - gl.deleteProgram(program); - program = null; - } - // clean up some shaders - gl.deleteShader(glVertShader); - gl.deleteShader(glFragShader); - return program; - } - - function booleanArray(size) { - var array = new Array(size); - for (var i = 0; i < array.length; i++) { - array[i] = false; - } - return array; - } - /** - * @method defaultValue - * @memberof PIXI.shader - * @param type {String} Type of value - * @param size {Number} - * @private - */ - function defaultValue(type, size) { - switch (type) { - case 'float': - return 0; - case 'vec2': - return new Float32Array(2 * size); - case 'vec3': - return new Float32Array(3 * size); - case 'vec4': - return new Float32Array(4 * size); - case 'int': - case 'sampler2D': - case 'sampler2DArray': - return 0; - case 'ivec2': - return new Int32Array(2 * size); - case 'ivec3': - return new Int32Array(3 * size); - case 'ivec4': - return new Int32Array(4 * size); - case 'bool': - return false; - case 'bvec2': - return booleanArray(2 * size); - case 'bvec3': - return booleanArray(3 * size); - case 'bvec4': - return booleanArray(4 * size); - case 'mat2': - return new Float32Array([1, 0, - 0, 1]); - case 'mat3': - return new Float32Array([1, 0, 0, - 0, 1, 0, - 0, 0, 1]); - case 'mat4': - return new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]); - } - return null; - } - - var unknownContext = {}; - var context = unknownContext; - /** - * returns a little WebGL context to use for program inspection. - * - * @static - * @private - * @returns {WebGLRenderingContext} a gl context to test with - */ - function getTestContext() { - if (context === unknownContext || (context && context.isContextLost())) { - var canvas = document.createElement('canvas'); - var gl = void 0; - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { - gl = canvas.getContext('webgl2', {}); - } - if (!gl) { - gl = canvas.getContext('webgl', {}) - || canvas.getContext('experimental-webgl', {}); - if (!gl) { - // fail, not able to get a context - gl = null; - } - else { - // for shader testing.. - gl.getExtension('WEBGL_draw_buffers'); - } - } - context = gl; - } - return context; - } - - var maxFragmentPrecision; - function getMaxFragmentPrecision() { - if (!maxFragmentPrecision) { - maxFragmentPrecision = exports.PRECISION.MEDIUM; - var gl = getTestContext(); - if (gl) { - if (gl.getShaderPrecisionFormat) { - var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); - maxFragmentPrecision = shaderFragment.precision ? exports.PRECISION.HIGH : exports.PRECISION.MEDIUM; - } - } - } - return maxFragmentPrecision; - } - - /** - * Sets the float precision on the shader, ensuring the device supports the request precision. - * If the precision is already present, it just ensures that the device is able to handle it. - * - * @private - * @param {string} src - The shader source - * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. - * @param {string} maxSupportedPrecision - The maximum precision the shader supports. - * - * @return {string} modified shader source - */ - function setPrecision(src, requestedPrecision, maxSupportedPrecision) { - if (src.substring(0, 9) !== 'precision') { - // no precision supplied, so PixiJS will add the requested level. - var precision = requestedPrecision; - // If highp is requested but not supported, downgrade precision to a level all devices support. - if (requestedPrecision === exports.PRECISION.HIGH && maxSupportedPrecision !== exports.PRECISION.HIGH) { - precision = exports.PRECISION.MEDIUM; - } - return "precision " + precision + " float;\n" + src; - } - else if (maxSupportedPrecision !== exports.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { - // precision was supplied, but at a level this device does not support, so downgrading to mediump. - return src.replace('precision highp', 'precision mediump'); - } - return src; - } - - var GLSL_TO_SIZE = { - float: 1, - vec2: 2, - vec3: 3, - vec4: 4, - int: 1, - ivec2: 2, - ivec3: 3, - ivec4: 4, - bool: 1, - bvec2: 2, - bvec3: 3, - bvec4: 4, - mat2: 4, - mat3: 9, - mat4: 16, - sampler2D: 1, - }; - /** - * @private - * @method mapSize - * @memberof PIXI.shader - * @param type {String} - * @return {Number} - */ - function mapSize(type) { - return GLSL_TO_SIZE[type]; - } - - var GL_TABLE = null; - var GL_TO_GLSL_TYPES = { - FLOAT: 'float', - FLOAT_VEC2: 'vec2', - FLOAT_VEC3: 'vec3', - FLOAT_VEC4: 'vec4', - INT: 'int', - INT_VEC2: 'ivec2', - INT_VEC3: 'ivec3', - INT_VEC4: 'ivec4', - BOOL: 'bool', - BOOL_VEC2: 'bvec2', - BOOL_VEC3: 'bvec3', - BOOL_VEC4: 'bvec4', - FLOAT_MAT2: 'mat2', - FLOAT_MAT3: 'mat3', - FLOAT_MAT4: 'mat4', - SAMPLER_2D: 'sampler2D', - INT_SAMPLER_2D: 'sampler2D', - UNSIGNED_INT_SAMPLER_2D: 'sampler2D', - SAMPLER_CUBE: 'samplerCube', - INT_SAMPLER_CUBE: 'samplerCube', - UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', - SAMPLER_2D_ARRAY: 'sampler2DArray', - INT_SAMPLER_2D_ARRAY: 'sampler2DArray', - UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', - }; - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function mapType(gl, type) { - if (!GL_TABLE) { - var typeNames = Object.keys(GL_TO_GLSL_TYPES); - GL_TABLE = {}; - for (var i = 0; i < typeNames.length; ++i) { - var tn = typeNames[i]; - GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; - } - } - return GL_TABLE[type]; - } - - /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - // Parsers, each one of these will take a look at the type of shader property and uniform. - // if they pass the test function then the code function is called that returns a the shader upload code for that uniform. - // Shader upload code is automagically generated with these parsers. - // If no parser is valid then the default upload functions are used. - // exposing Parsers means that custom upload logic can be added to pixi's shaders. - // A good example would be a pixi rectangle can be directly set on a uniform. - // If the shader sees it it knows how to upload the rectangle structure as a vec4 - // format is as follows: - // - // { - // test: (data, uniform) => {} <--- test is this code should be used for this uniform - // code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform - // } - var uniformParsers = [ - // a float cache layer - { - test: function (data) { - return data.type === 'float' && data.size === 1; - }, - code: function (name) { - return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; - }, - }, - // handling samplers - { - test: function (data) { - // eslint-disable-next-line max-len - return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray; - }, - code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, - }, - // uploading pixi matrix object to mat3 - { - test: function (data, uniform) { - return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined; - }, - code: function (name) { - // TODO and some smart caching dirty ids here! - return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; - }, - }, - // uploading a pixi point as a vec2 with caching layer - { - test: function (data, uniform) { - return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; - }, - }, - // caching layer for a vec2 - { - test: function (data) { - return data.type === 'vec2' && data.size === 1; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; - }, - }, - // upload a pixi rectangle as a vec4 with caching layer - { - test: function (data, uniform) { - return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; - }, - }, - // a caching layer for vec4 uploading - { - test: function (data) { - return data.type === 'vec4' && data.size === 1; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; - }, - } ]; - - // cv = CachedValue - // v = value - // ud = uniformData - // uv = uniformValue - // l = location - var GLSL_TO_SINGLE_SETTERS_CACHED = { - float: "\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }", - vec2: "\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }", - vec3: "\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", - vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])', - int: 'gl.uniform1i(location, v)', - ivec2: 'gl.uniform2i(location, v[0], v[1])', - ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - bool: 'gl.uniform1i(location, v)', - bvec2: 'gl.uniform2i(location, v[0], v[1])', - bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - mat2: 'gl.uniformMatrix2fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat4: 'gl.uniformMatrix4fv(location, false, v)', - sampler2D: 'gl.uniform1i(location, v)', - samplerCube: 'gl.uniform1i(location, v)', - sampler2DArray: 'gl.uniform1i(location, v)', - }; - var GLSL_TO_ARRAY_SETTERS = { - float: "gl.uniform1fv(location, v)", - vec2: "gl.uniform2fv(location, v)", - vec3: "gl.uniform3fv(location, v)", - vec4: 'gl.uniform4fv(location, v)', - mat4: 'gl.uniformMatrix4fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat2: 'gl.uniformMatrix2fv(location, false, v)', - int: 'gl.uniform1iv(location, v)', - ivec2: 'gl.uniform2iv(location, v)', - ivec3: 'gl.uniform3iv(location, v)', - ivec4: 'gl.uniform4iv(location, v)', - bool: 'gl.uniform1iv(location, v)', - bvec2: 'gl.uniform2iv(location, v)', - bvec3: 'gl.uniform3iv(location, v)', - bvec4: 'gl.uniform4iv(location, v)', - sampler2D: 'gl.uniform1iv(location, v)', - samplerCube: 'gl.uniform1iv(location, v)', - sampler2DArray: 'gl.uniform1iv(location, v)', - }; - function generateUniformsSync(group, uniformData) { - var funcFragments = ["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "]; - for (var i in group.uniforms) { - var data = uniformData[i]; - if (!data) { - if (group.uniforms[i].group) { - funcFragments.push("\n renderer.shader.syncUniformGroup(uv[\"" + i + "\"], syncData);\n "); - } - continue; - } - var uniform = group.uniforms[i]; - var parsed = false; - for (var j = 0; j < uniformParsers.length; j++) { - if (uniformParsers[j].test(data, uniform)) { - funcFragments.push(uniformParsers[j].code(i, uniform)); - parsed = true; - break; - } - } - if (!parsed) { - var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; - var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); - funcFragments.push("\n cv = ud[\"" + i + "\"].value;\n v = uv[\"" + i + "\"];\n " + template + ";"); - } - } - /** - * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly - * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used - * no matter which group is being used - * - */ - // eslint-disable-next-line no-new-func - return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); - } - - var fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}' ].join('\n'); - function generateIfTestSrc(maxIfs) { - var src = ''; - for (var i = 0; i < maxIfs; ++i) { - if (i > 0) { - src += '\nelse '; - } - if (i < maxIfs - 1) { - src += "if(test == " + i + ".0){}"; - } - } - return src; - } - function checkMaxIfStatementsInShader(maxIfs, gl) { - if (maxIfs === 0) { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - var shader = gl.createShader(gl.FRAGMENT_SHADER); - while (true) // eslint-disable-line no-constant-condition - { - var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { - maxIfs = (maxIfs / 2) | 0; - } - else { - // valid! - break; - } - } - return maxIfs; - } - - // Cache the result to prevent running this over and over - var unsafeEval; - /** - * Not all platforms allow to generate function code (e.g., `new Function`). - * this provides the platform-level detection. - * - * @private - * @returns {boolean} - */ - function unsafeEvalSupported() { - if (typeof unsafeEval === 'boolean') { - return unsafeEval; - } - try { - /* eslint-disable no-new-func */ - var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); - /* eslint-enable no-new-func */ - unsafeEval = func({ a: 'b' }, 'a', 'b') === true; - } - catch (e) { - unsafeEval = false; - } - return unsafeEval; - } - - var defaultFragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; - - var defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; - - var UID$3 = 0; - var nameCache = {}; - /** - * Helper class to create a shader program. - * - * @class - * @memberof PIXI - */ - var Program = /** @class */ (function () { - /** - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {string} [name] - Name for shader - */ - function Program(vertexSrc, fragmentSrc, name) { - if (name === void 0) { name = 'pixi-shader'; } - this.id = UID$3++; - /** - * The vertex shader. - * - * @member {string} - */ - this.vertexSrc = vertexSrc || Program.defaultVertexSrc; - /** - * The fragment shader. - * - * @member {string} - */ - this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; - this.vertexSrc = this.vertexSrc.trim(); - this.fragmentSrc = this.fragmentSrc.trim(); - if (this.vertexSrc.substring(0, 8) !== '#version') { - name = name.replace(/\s+/g, '-'); - if (nameCache[name]) { - nameCache[name]++; - name += "-" + nameCache[name]; - } - else { - nameCache[name] = 1; - } - this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; - this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; - this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, exports.PRECISION.HIGH); - this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); - } - // currently this does not extract structs only default types - this.extractData(this.vertexSrc, this.fragmentSrc); - // this is where we store shader references.. - this.glPrograms = {}; - this.syncUniforms = null; - } - /** - * Extracts the data for a buy creating a small test program - * or reading the src directly. - * @protected - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - */ - Program.prototype.extractData = function (vertexSrc, fragmentSrc) { - var gl = getTestContext(); - if (gl) { - var program = compileProgram(gl, vertexSrc, fragmentSrc); - this.attributeData = this.getAttributeData(program, gl); - this.uniformData = this.getUniformData(program, gl); - gl.deleteProgram(program); - } - else { - this.uniformData = {}; - this.attributeData = {}; - } - }; - /** - * returns the attribute data from the program - * @private - * - * @param {WebGLProgram} [program] - the WebGL program - * @param {WebGLRenderingContext} [gl] - the WebGL context - * - * @returns {object} the attribute data for this program - */ - Program.prototype.getAttributeData = function (program, gl) { - var attributes = {}; - var attributesArray = []; - var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (var i = 0; i < totalAttributes; i++) { - var attribData = gl.getActiveAttrib(program, i); - var type = mapType(gl, attribData.type); - /*eslint-disable */ - var data = { - type: type, - name: attribData.name, - size: mapSize(type), - location: 0, - }; - /* eslint-enable */ - attributes[attribData.name] = data; - attributesArray.push(data); - } - attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow - for (var i = 0; i < attributesArray.length; i++) { - attributesArray[i].location = i; - } - return attributes; - }; - /** - * returns the uniform data from the program - * @private - * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the WebGL context - * - * @returns {object} the uniform data for this program - */ - Program.prototype.getUniformData = function (program, gl) { - var uniforms = {}; - var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - // TODO expose this as a prop? - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - for (var i = 0; i < totalUniforms; i++) { - var uniformData = gl.getActiveUniform(program, i); - var name = uniformData.name.replace(/\[.*?\]$/, ''); - var isArray = uniformData.name.match(/\[.*?\]$/); - var type = mapType(gl, uniformData.type); - /*eslint-disable */ - uniforms[name] = { - type: type, - size: uniformData.size, - isArray: isArray, - value: defaultValue(type, uniformData.size), - }; - /* eslint-enable */ - } - return uniforms; - }; - Object.defineProperty(Program, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @constant - * @member {string} - */ - get: function () { - return defaultVertex; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Program, "defaultFragmentSrc", { - /** - * The default fragment shader source - * - * @static - * @constant - * @member {string} - */ - get: function () { - return defaultFragment; - }, - enumerable: false, - configurable: true - }); - /** - * A short hand function to create a program based of a vertex and fragment shader - * this method will also check to see if there is a cached program. - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {string} [name=pixi-shader] - Name for shader - * - * @returns {PIXI.Program} an shiny new Pixi shader! - */ - Program.from = function (vertexSrc, fragmentSrc, name) { - var key = vertexSrc + fragmentSrc; - var program = ProgramCache[key]; - if (!program) { - ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); - } - return program; - }; - return Program; - }()); - - /** - * A helper class for shaders - * - * @class - * @memberof PIXI - */ - var Shader = /** @class */ (function () { - /** - * @param {PIXI.Program} [program] - The program the shader will use. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - */ - function Shader(program, uniforms) { - /** - * Program that the shader uses - * - * @member {PIXI.Program} - */ - this.program = program; - // lets see whats been passed in - // uniforms should be converted to a uniform group - if (uniforms) { - if (uniforms instanceof UniformGroup) { - this.uniformGroup = uniforms; - } - else { - this.uniformGroup = new UniformGroup(uniforms); - } - } - else { - this.uniformGroup = new UniformGroup({}); - } - // time to build some getters and setters! - // I guess down the line this could sort of generate an instruction list rather than use dirty ids? - // does the trick for now though! - for (var i in program.uniformData) { - if (this.uniformGroup.uniforms[i] instanceof Array) { - this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]); - } - } - } - // TODO move to shader system.. - Shader.prototype.checkUniformExists = function (name, group) { - if (group.uniforms[name]) { - return true; - } - for (var i in group.uniforms) { - var uniform = group.uniforms[i]; - if (uniform.group) { - if (this.checkUniformExists(name, uniform)) { - return true; - } - } - } - return false; - }; - Shader.prototype.destroy = function () { - // usage count on programs? - // remove if not used! - this.uniformGroup = null; - }; - Object.defineProperty(Shader.prototype, "uniforms", { - /** - * Shader uniform values, shortcut for `uniformGroup.uniforms` - * @readonly - * @member {object} - */ - get: function () { - return this.uniformGroup.uniforms; - }, - enumerable: false, - configurable: true - }); - /** - * A short hand function to create a shader based of a vertex and fragment shader - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - * - * @returns {PIXI.Shader} an shiny new Pixi shader! - */ - Shader.from = function (vertexSrc, fragmentSrc, uniforms) { - var program = Program.from(vertexSrc, fragmentSrc); - return new Shader(program, uniforms); - }; - return Shader; - }()); - - /* eslint-disable max-len */ - var BLEND = 0; - var OFFSET = 1; - var CULLING = 2; - var DEPTH_TEST = 3; - var WINDING = 4; - /** - * This is a WebGL state, and is is passed The WebGL StateManager. - * - * Each mesh rendered may require WebGL to be in a different state. - * For example you may want different blend mode or to enable polygon offsets - * - * @class - * @memberof PIXI - */ - var State = /** @class */ (function () { - function State() { - this.data = 0; - this.blendMode = exports.BLEND_MODES.NORMAL; - this.polygonOffset = 0; - this.blend = true; - // this.depthTest = true; - } - Object.defineProperty(State.prototype, "blend", { - /** - * Activates blending of the computed fragment color values - * - * @member {boolean} - */ - get: function () { - return !!(this.data & (1 << BLEND)); - }, - set: function (value) { - if (!!(this.data & (1 << BLEND)) !== value) { - this.data ^= (1 << BLEND); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "offsets", { - /** - * Activates adding an offset to depth values of polygon's fragments - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << OFFSET)); - }, - set: function (value) { - if (!!(this.data & (1 << OFFSET)) !== value) { - this.data ^= (1 << OFFSET); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "culling", { - /** - * Activates culling of polygons. - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << CULLING)); - }, - set: function (value) { - if (!!(this.data & (1 << CULLING)) !== value) { - this.data ^= (1 << CULLING); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "depthTest", { - /** - * Activates depth comparisons and updates to the depth buffer. - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << DEPTH_TEST)); - }, - set: function (value) { - if (!!(this.data & (1 << DEPTH_TEST)) !== value) { - this.data ^= (1 << DEPTH_TEST); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "clockwiseFrontFace", { - /** - * Specifies whether or not front or back-facing polygons can be culled. - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << WINDING)); - }, - set: function (value) { - if (!!(this.data & (1 << WINDING)) !== value) { - this.data ^= (1 << WINDING); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "blendMode", { - /** - * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * Setting this mode to anything other than NO_BLEND will automatically switch blending on. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - get: function () { - return this._blendMode; - }, - set: function (value) { - this.blend = (value !== exports.BLEND_MODES.NONE); - this._blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "polygonOffset", { - /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. - * - * @member {number} - * @default 0 - */ - get: function () { - return this._polygonOffset; - }, - set: function (value) { - this.offsets = !!value; - this._polygonOffset = value; - }, - enumerable: false, - configurable: true - }); - State.for2d = function () { - var state = new State(); - state.depthTest = false; - state.blend = true; - return state; - }; - return State; - }()); - - var defaultVertex$1 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; - - var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; - - /** - * Filter is a special type of WebGL shader that is applied to the screen. - * - * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the - * {@link PIXI.filters.BlurFilter BlurFilter}. - * - * ### Usage - * Filters can be applied to any DisplayObject or Container. - * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, - * then filter renders it to the screen. - * Multiple filters can be added to the `filters` array property and stacked on each other. - * - * ``` - * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); - * const container = new PIXI.Container(); - * container.filters = [filter]; - * ``` - * - * ### Previous Version Differences - * - * In PixiJS **v3**, a filter was always applied to _whole screen_. - * - * In PixiJS **v4**, a filter can be applied _only part of the screen_. - * Developers had to create a set of uniforms to deal with coordinates. - * - * In PixiJS **v5** combines _both approaches_. - * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, - * bringing those extra uniforms into account. - * - * Also be aware that we have changed default vertex shader, please consult - * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. - * - * ### Built-in Uniforms - * - * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, - * and `projectionMatrix` uniform maps it to the gl viewport. - * - * **uSampler** - * - * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all Framebuffers in PixiJS, both input and output are - * premultiplied by alpha._ - * - * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. - * Use it to sample the input. - * - * ``` - * const fragment = ` - * varying vec2 vTextureCoord; - * uniform sampler2D uSampler; - * void main(void) - * { - * gl_FragColor = texture2D(uSampler, vTextureCoord); - * } - * `; - * - * const myFilter = new PIXI.Filter(null, fragment); - * ``` - * - * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. - * - * **outputFrame** - * - * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. - * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, - * `(0, 0, outputFrame.width, outputFrame.height)`, - * - * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. - * To calculate vertex position in screen space using normalized (0-1) space: - * - * ``` - * vec4 filterVertexPosition( void ) - * { - * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; - * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); - * } - * ``` - * - * **inputSize** - * - * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary framebuffer that holds input. - * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. - * - * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. - * - * To calculate input normalized coordinate, you have to map it to filter normalized space. - * Multiply by `outputFrame.zw` to get input coordinate. - * Divide by `inputSize.xy` to get input normalized coordinate. - * - * ``` - * vec2 filterTextureCoord( void ) - * { - * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy - * } - * ``` - * **resolution** - * - * The `resolution` is the ratio of screen (CSS) pixels to real pixels. - * - * **inputPixel** - * - * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` - * `inputPixel.zw` is inverted `inputPixel.xy`. - * - * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. - * - * **inputClamp** - * - * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. - * For displacements, coordinates has to be clamped. - * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer - * `inputClamp.zw` is bottom-right pixel center. - * - * ``` - * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw)) - * ``` - * OR - * ``` - * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) - * ``` - * - * ### Additional Information - * - * Complete documentation on Filter usage is located in the - * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. - * - * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded - * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. - * - * @class - * @memberof PIXI - * @extends PIXI.Shader - */ - var Filter = /** @class */ (function (_super) { - __extends$2(Filter, _super); - /** - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - */ - function Filter(vertexSrc, fragmentSrc, uniforms) { - var _this = this; - var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); - _this = _super.call(this, program, uniforms) || this; - /** - * The padding of the filter. Some filters require extra space to breath such as a blur. - * Increasing this will add extra width and height to the bounds of the object that the - * filter is applied to. - * - * @member {number} - */ - _this.padding = 0; - /** - * The resolution of the filter. Setting this to be lower will lower the quality but - * increase the performance of the filter. - * - * @member {number} - */ - _this.resolution = settings.FILTER_RESOLUTION; - /** - * If enabled is true the filter is applied, if false it will not. - * - * @member {boolean} - */ - _this.enabled = true; - /** - * If enabled, PixiJS will fit the filter area into boundaries for better performance. - * Switch it off if it does not work for specific shader. - * - * @member {boolean} - */ - _this.autoFit = true; - /** - * Legacy filters use position and uvs from attributes - * @member {boolean} - * @readonly - */ - _this.legacy = !!_this.program.attributeData.aTextureCoord; - /** - * The WebGL state the filter requires to render - * @member {PIXI.State} - */ - _this.state = new State(); - return _this; - } - /** - * Applies the filter - * - * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. - * @param {object} [currentState] - It's current state of filter. - * There are some useful properties in the currentState : - * target, filters, sourceFrame, destinationFrame, renderTarget, resolution - */ - Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { - // do as you please! - filterManager.applyFilter(this, input, output, clearMode); - // or just do a regular render.. - }; - Object.defineProperty(Filter.prototype, "blendMode", { - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - get: function () { - return this.state.blendMode; - }, - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Filter, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultVertex$1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Filter, "defaultFragmentSrc", { - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultFragment$1; - }, - enumerable: false, - configurable: true - }); - return Filter; - }(Shader)); - - var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; - - var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; - - var tempMat = new Matrix(); - /** - * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * - * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. - * - * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. - * If you want to add support for texture region of certain feature or filter, that's what you're looking for. - * - * Takes track of Texture changes through `_lastTextureID` private field. - * Use `update()` method call to track it from outside. - * - * @see PIXI.Texture - * @see PIXI.Mesh - * @see PIXI.TilingSprite - * @class - * @memberof PIXI - */ - var TextureMatrix = /** @class */ (function () { - /** - * - * @param {PIXI.Texture} texture - observed texture - * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. - * @constructor - */ - function TextureMatrix(texture, clampMargin) { - this._texture = texture; - /** - * Matrix operation that converts texture region coords to texture coords - * @member {PIXI.Matrix} - * @readonly - */ - this.mapCoord = new Matrix(); - /** - * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampFrame = new Float32Array(4); - /** - * Normalized clamp offset. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampOffset = new Float32Array(2); - /** - * Tracks Texture frame changes - * @member {number} - * @protected - */ - this._textureID = -1; - /** - * Tracks Texture frame changes - * @member {number} - * @protected - */ - this._updateID = 0; - /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders - * - * @default 0 - * @member {number} - */ - this.clampOffset = 0; - /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} - */ - this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; - /** - * If texture size is the same as baseTexture - * @member {boolean} - * @default false - * @readonly - */ - this.isSimple = false; - } - Object.defineProperty(TextureMatrix.prototype, "texture", { - /** - * texture property - * @member {PIXI.Texture} - */ - get: function () { - return this._texture; - }, - set: function (value) { - this._texture = value; - this._textureID = -1; - }, - enumerable: false, - configurable: true - }); - /** - * Multiplies uvs array to transform - * @param {Float32Array} uvs - mesh uvs - * @param {Float32Array} [out=uvs] output - * @returns {Float32Array} output - */ - TextureMatrix.prototype.multiplyUvs = function (uvs, out) { - if (out === undefined) { - out = uvs; - } - var mat = this.mapCoord; - for (var i = 0; i < uvs.length; i += 2) { - var x = uvs[i]; - var y = uvs[i + 1]; - out[i] = (x * mat.a) + (y * mat.c) + mat.tx; - out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; - } - return out; - }; - /** - * updates matrices if texture was changed - * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case - * @returns {boolean} whether or not it was updated - */ - TextureMatrix.prototype.update = function (forceUpdate) { - var tex = this._texture; - if (!tex || !tex.valid) { - return false; - } - if (!forceUpdate - && this._textureID === tex._updateID) { - return false; - } - this._textureID = tex._updateID; - this._updateID++; - var uvs = tex._uvs; - this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); - var orig = tex.orig; - var trim = tex.trim; - if (trim) { - tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); - this.mapCoord.append(tempMat); - } - var texBase = tex.baseTexture; - var frame = this.uClampFrame; - var margin = this.clampMargin / texBase.resolution; - var offset = this.clampOffset; - frame[0] = (tex._frame.x + margin + offset) / texBase.width; - frame[1] = (tex._frame.y + margin + offset) / texBase.height; - frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; - frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; - this.uClampOffset[0] = offset / texBase.realWidth; - this.uClampOffset[1] = offset / texBase.realHeight; - this.isSimple = tex._frame.width === texBase.width - && tex._frame.height === texBase.height - && tex.rotate === 0; - return true; - }; - return TextureMatrix; - }()); - - /** - * This handles a Sprite acting as a mask, as opposed to a Graphic. - * - * WebGL only. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI - */ - var SpriteMaskFilter = /** @class */ (function (_super) { - __extends$2(SpriteMaskFilter, _super); - /** - * @param {PIXI.Sprite} sprite - the target sprite - */ - function SpriteMaskFilter(sprite) { - var _this = this; - var maskMatrix = new Matrix(); - _this = _super.call(this, vertex, fragment) || this; - sprite.renderable = false; - /** - * Sprite mask - * @member {PIXI.Sprite} - */ - _this.maskSprite = sprite; - /** - * Mask matrix - * @member {PIXI.Matrix} - */ - _this.maskMatrix = maskMatrix; - return _this; - } - /** - * Applies the filter - * - * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. - */ - SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { - var maskSprite = this.maskSprite; - var tex = maskSprite._texture; - if (!tex.valid) { - return; - } - if (!tex.uvMatrix) { - // margin = 0.0, let it bleed a bit, shader code becomes easier - // assuming that atlas textures were made with 1-pixel padding - tex.uvMatrix = new TextureMatrix(tex, 0.0); - } - tex.uvMatrix.update(); - this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; - this.uniforms.mask = tex; - // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` - this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) - .prepend(tex.uvMatrix.mapCoord); - this.uniforms.alpha = maskSprite.worldAlpha; - this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; - filterManager.applyFilter(this, input, output, clearMode); - }; - return SpriteMaskFilter; - }(Filter)); - - /** - * System plugin to the renderer to manage masks. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var MaskSystem = /** @class */ (function (_super) { - __extends$2(MaskSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function MaskSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Enable scissor - * @member {boolean} - * @readonly - */ - _this.enableScissor = false; - /** - * Pool of used sprite mask filters - * @member {PIXI.SpriteMaskFilter[]} - * @readonly - */ - _this.alphaMaskPool = []; - /** - * Pool of mask data - * @member {PIXI.MaskData[]} - * @readonly - */ - _this.maskDataPool = []; - _this.maskStack = []; - /** - * Current index of alpha mask pool - * @member {number} - * @default 0 - * @readonly - */ - _this.alphaMaskIndex = 0; - return _this; - } - /** - * Changes the mask stack that is used by this System. - * - * @param {PIXI.MaskData[]} maskStack - The mask stack - */ - MaskSystem.prototype.setMaskStack = function (maskStack) { - this.maskStack = maskStack; - this.renderer.scissor.setMaskStack(maskStack); - this.renderer.stencil.setMaskStack(maskStack); - }; - /** - * Applies the Mask and adds it to the current filter stack. - * Renderer batch must be flushed beforehand. - * - * @param {PIXI.DisplayObject} target - Display Object to push the mask to - * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data. - */ - MaskSystem.prototype.push = function (target, maskDataOrTarget) { - var maskData = maskDataOrTarget; - if (!maskData.isMaskData) { - var d = this.maskDataPool.pop() || new MaskData(); - d.pooled = true; - d.maskObject = maskDataOrTarget; - maskData = d; - } - if (maskData.autoDetect) { - this.detect(maskData); - } - maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]); - maskData._target = target; - switch (maskData.type) { - case exports.MASK_TYPES.SCISSOR: - this.maskStack.push(maskData); - this.renderer.scissor.push(maskData); - break; - case exports.MASK_TYPES.STENCIL: - this.maskStack.push(maskData); - this.renderer.stencil.push(maskData); - break; - case exports.MASK_TYPES.SPRITE: - maskData.copyCountersOrReset(null); - this.pushSpriteMask(maskData); - this.maskStack.push(maskData); - break; - default: - break; - } - }; - /** - * Removes the last mask from the mask stack and doesn't return it. - * Renderer batch must be flushed beforehand. - * - * @param {PIXI.DisplayObject} target - Display Object to pop the mask from - */ - MaskSystem.prototype.pop = function (target) { - var maskData = this.maskStack.pop(); - if (!maskData || maskData._target !== target) { - // TODO: add an assert when we have it - return; - } - switch (maskData.type) { - case exports.MASK_TYPES.SCISSOR: - this.renderer.scissor.pop(); - break; - case exports.MASK_TYPES.STENCIL: - this.renderer.stencil.pop(maskData.maskObject); - break; - case exports.MASK_TYPES.SPRITE: - this.popSpriteMask(); - break; - default: - break; - } - maskData.reset(); - if (maskData.pooled) { - this.maskDataPool.push(maskData); - } - }; - /** - * Sets type of MaskData based on its maskObject - * @param {PIXI.MaskData} maskData - */ - MaskSystem.prototype.detect = function (maskData) { - var maskObject = maskData.maskObject; - if (maskObject.isSprite) { - maskData.type = exports.MASK_TYPES.SPRITE; - return; - } - maskData.type = exports.MASK_TYPES.STENCIL; - // detect scissor in graphics - if (this.enableScissor - && maskObject.isFastRect - && maskObject.isFastRect()) { - var matrix = maskObject.worldTransform; - // TODO: move the check to the matrix itself - // we are checking that its orthogonal and x rotation is 0 90 180 or 270 - var rotX = Math.atan2(matrix.b, matrix.a); - var rotXY = Math.atan2(matrix.d, matrix.c); - // use the nearest degree to 0.01 - rotX = Math.round(rotX * (180 / Math.PI) * 100); - rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX; - rotX = ((rotX % 9000) + 9000) % 9000; - rotXY = ((rotXY % 18000) + 18000) % 18000; - if (rotX === 0 && rotXY === 9000) { - maskData.type = exports.MASK_TYPES.SCISSOR; - } - } - }; - /** - * Applies the Mask and adds it to the current filter stack. - * - * @param {PIXI.MaskData} maskData - Sprite to be used as the mask - */ - MaskSystem.prototype.pushSpriteMask = function (maskData) { - var maskObject = maskData.maskObject; - var target = maskData._target; - var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; - if (!alphaMaskFilter) { - alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)]; - } - alphaMaskFilter[0].resolution = this.renderer.resolution; - alphaMaskFilter[0].maskSprite = maskObject; - var stashFilterArea = target.filterArea; - target.filterArea = maskObject.getBounds(true); - this.renderer.filter.push(target, alphaMaskFilter); - target.filterArea = stashFilterArea; - this.alphaMaskIndex++; - }; - /** - * Removes the last filter from the filter stack and doesn't return it. - */ - MaskSystem.prototype.popSpriteMask = function () { - this.renderer.filter.pop(); - this.alphaMaskIndex--; - }; - return MaskSystem; - }(System)); - - /** - * System plugin to the renderer to manage masks of certain type - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var AbstractMaskSystem = /** @class */ (function (_super) { - __extends$2(AbstractMaskSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function AbstractMaskSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * The mask stack - * @member {PIXI.MaskData[]} - */ - _this.maskStack = []; - /** - * Constant for gl.enable - * @member {number} - * @private - */ - _this.glConst = 0; - return _this; - } - /** - * gets count of masks of certain type - * @returns {number} - */ - AbstractMaskSystem.prototype.getStackLength = function () { - return this.maskStack.length; - }; - /** - * Changes the mask stack that is used by this System. - * - * @param {PIXI.MaskData[]} maskStack - The mask stack - */ - AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { - var gl = this.renderer.gl; - var curStackLen = this.getStackLength(); - this.maskStack = maskStack; - var newStackLen = this.getStackLength(); - if (newStackLen !== curStackLen) { - if (newStackLen === 0) { - gl.disable(this.glConst); - } - else { - gl.enable(this.glConst); - this._useCurrent(); - } - } - }; - /** - * Setup renderer to use the current mask data. - * @private - */ - AbstractMaskSystem.prototype._useCurrent = function () { - // OVERWRITE; - }; - /** - * Destroys the mask stack. - * - */ - AbstractMaskSystem.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.maskStack = null; - }; - return AbstractMaskSystem; - }(System)); - - /** - * System plugin to the renderer to manage scissor rects (used for masks). - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ScissorSystem = /** @class */ (function (_super) { - __extends$2(ScissorSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ScissorSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.glConst = WebGLRenderingContext.SCISSOR_TEST; - return _this; - } - ScissorSystem.prototype.getStackLength = function () { - var maskData = this.maskStack[this.maskStack.length - 1]; - if (maskData) { - return maskData._scissorCounter; - } - return 0; - }; - /** - * Applies the Mask and adds it to the current stencil stack. @alvin - * - * @param {PIXI.MaskData} maskData - The mask data - */ - ScissorSystem.prototype.push = function (maskData) { - var maskObject = maskData.maskObject; - maskObject.renderable = true; - var prevData = maskData._scissorRect; - var bounds = maskObject.getBounds(true); - var gl = this.renderer.gl; - maskObject.renderable = false; - if (prevData) { - bounds.fit(prevData); - } - else { - gl.enable(gl.SCISSOR_TEST); - } - maskData._scissorCounter++; - maskData._scissorRect = bounds; - this._useCurrent(); - }; - /** - * Pops scissor mask. MaskData is already removed from stack - */ - ScissorSystem.prototype.pop = function () { - var gl = this.renderer.gl; - if (this.getStackLength() > 0) { - this._useCurrent(); - } - else { - gl.disable(gl.SCISSOR_TEST); - } - }; - /** - * Setup renderer to use the current scissor data. - * @private - */ - ScissorSystem.prototype._useCurrent = function () { - var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; - var rt = this.renderer.renderTexture.current; - var _a = this.renderer.projection, transform = _a.transform, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var resolution = rt ? rt.resolution : this.renderer.resolution; - var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x; - var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y; - var width = rect.width * resolution; - var height = rect.height * resolution; - if (transform) { - x += transform.tx * resolution; - y += transform.ty * resolution; - } - if (!rt) { - // flipY. In future we'll have it over renderTextures as an option - y = this.renderer.height - height - y; - } - this.renderer.gl.scissor(x, y, width, height); - }; - return ScissorSystem; - }(AbstractMaskSystem)); - - /** - * System plugin to the renderer to manage stencils (used for masks). - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var StencilSystem = /** @class */ (function (_super) { - __extends$2(StencilSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function StencilSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.glConst = WebGLRenderingContext.STENCIL_TEST; - return _this; - } - StencilSystem.prototype.getStackLength = function () { - var maskData = this.maskStack[this.maskStack.length - 1]; - if (maskData) { - return maskData._stencilCounter; - } - return 0; - }; - /** - * Applies the Mask and adds it to the current stencil stack. - * - * @param {PIXI.MaskData} maskData - The mask data - */ - StencilSystem.prototype.push = function (maskData) { - var maskObject = maskData.maskObject; - var gl = this.renderer.gl; - var prevMaskCount = maskData._stencilCounter; - if (prevMaskCount === 0) { - // force use stencil texture in current framebuffer - this.renderer.framebuffer.forceStencil(); - gl.enable(gl.STENCIL_TEST); - } - maskData._stencilCounter++; - // Increment the reference stencil value where the new mask overlaps with the old ones. - gl.colorMask(false, false, false, false); - gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask()); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); - maskObject.renderable = true; - maskObject.render(this.renderer); - this.renderer.batch.flush(); - maskObject.renderable = false; - this._useCurrent(); - }; - /** - * Pops stencil mask. MaskData is already removed from stack - * - * @param {PIXI.DisplayObject} maskObject - object of popped mask data - */ - StencilSystem.prototype.pop = function (maskObject) { - var gl = this.renderer.gl; - if (this.getStackLength() === 0) { - // the stack is empty! - gl.disable(gl.STENCIL_TEST); - gl.clear(gl.STENCIL_BUFFER_BIT); - gl.clearStencil(0); - } - else { - // Decrement the reference stencil value where the popped mask overlaps with the other ones - gl.colorMask(false, false, false, false); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); - maskObject.renderable = true; - maskObject.render(this.renderer); - this.renderer.batch.flush(); - maskObject.renderable = false; - this._useCurrent(); - } - }; - /** - * Setup renderer to use the current stencil data. - * @private - */ - StencilSystem.prototype._useCurrent = function () { - var gl = this.renderer.gl; - gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask()); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - }; - /** - * Fill 1s equal to the number of acitve stencil masks. - * @private - * @return {number} The bitwise mask. - */ - StencilSystem.prototype._getBitwiseMask = function () { - return (1 << this.getStackLength()) - 1; - }; - return StencilSystem; - }(AbstractMaskSystem)); - - /** - * System plugin to the renderer to manage the projection matrix. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ProjectionSystem = /** @class */ (function (_super) { - __extends$2(ProjectionSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ProjectionSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.destinationFrame = null; - /** - * Source frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.sourceFrame = null; - /** - * Default destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.defaultFrame = null; - /** - * Project matrix - * @member {PIXI.Matrix} - * @readonly - */ - _this.projectionMatrix = new Matrix(); - /** - * A transform that will be appended to the projection matrix - * if null, nothing will be applied - * @member {PIXI.Matrix} - */ - _this.transform = null; - return _this; - } - /** - * Updates the projection matrix based on a projection frame (which is a rectangle). - * - * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this. - * - * @param {PIXI.Rectangle} destinationFrame - The destination frame. - * @param {PIXI.Rectangle} sourceFrame - The source frame. - * @param {Number} resolution - Resolution - * @param {boolean} root - If is root - */ - ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { - this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; - this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; - // Calculate object-space to clip-space projection - this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); - if (this.transform) { - this.projectionMatrix.append(this.transform); - } - var renderer = this.renderer; - renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; - renderer.globalUniforms.update(); - // this will work for now - // but would be sweet to stick and even on the global uniforms.. - if (renderer.shader.shader) { - renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); - } - }; - /** - * Updates the projection matrix based on a projection frame (which is a rectangle) - * - * @param {PIXI.Rectangle} destinationFrame - The destination frame. - * @param {PIXI.Rectangle} sourceFrame - The source frame. - * @param {Number} resolution - Resolution - * @param {boolean} root - If is root - */ - ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { - var pm = this.projectionMatrix; - var sign = !root ? 1 : -1; - pm.identity(); - pm.a = (1 / sourceFrame.width * 2); - pm.d = sign * (1 / sourceFrame.height * 2); - pm.tx = -1 - (sourceFrame.x * pm.a); - pm.ty = -sign - (sourceFrame.y * pm.d); - }; - /** - * Sets the transform of the active render target to the given matrix - * - * @param {PIXI.Matrix} matrix - The transformation matrix - */ - ProjectionSystem.prototype.setTransform = function (_matrix) { - // this._activeRenderTarget.transform = matrix; - }; - return ProjectionSystem; - }(System)); - - // Temporary rectangle for assigned sourceFrame or destinationFrame - var tempRect = new Rectangle(); - // Temporary rectangle for renderTexture destinationFrame - var tempRect2 = new Rectangle(); - // Temporary rectangle for passing the framebuffer viewport - var viewportFrame = new Rectangle(); - /** - * System plugin to the renderer to manage render textures. - * - * Should be added after FramebufferSystem - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var RenderTextureSystem = /** @class */ (function (_super) { - __extends$2(RenderTextureSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function RenderTextureSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * The clear background color as rgba - * @member {number[]} - */ - _this.clearColor = renderer._backgroundColorRgba; - // TODO move this property somewhere else! - /** - * List of masks for the StencilSystem - * @member {PIXI.Graphics[]} - * @readonly - */ - _this.defaultMaskStack = []; - // empty render texture? - /** - * Render texture - * @member {PIXI.RenderTexture} - * @readonly - */ - _this.current = null; - /** - * Source frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.sourceFrame = new Rectangle(); - /** - * Destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.destinationFrame = new Rectangle(); - return _this; - } - /** - * Bind the current render texture - * - * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen - * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture - * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame - */ - RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { - if (renderTexture === void 0) { renderTexture = null; } - var renderer = this.renderer; - this.current = renderTexture; - var baseTexture; - var framebuffer; - var resolution; - if (renderTexture) { - baseTexture = renderTexture.baseTexture; - resolution = baseTexture.resolution; - if (!sourceFrame) { - tempRect.width = renderTexture.frame.width; - tempRect.height = renderTexture.frame.height; - sourceFrame = tempRect; - } - if (!destinationFrame) { - tempRect2.x = renderTexture.frame.x; - tempRect2.y = renderTexture.frame.y; - tempRect2.width = sourceFrame.width; - tempRect2.height = sourceFrame.height; - destinationFrame = tempRect2; - } - framebuffer = baseTexture.framebuffer; - } - else { - resolution = renderer.resolution; - if (!sourceFrame) { - tempRect.width = renderer.screen.width; - tempRect.height = renderer.screen.height; - sourceFrame = tempRect; - } - if (!destinationFrame) { - destinationFrame = tempRect; - destinationFrame.width = sourceFrame.width; - destinationFrame.height = sourceFrame.height; - } - } - viewportFrame.x = destinationFrame.x * resolution; - viewportFrame.y = destinationFrame.y * resolution; - viewportFrame.width = destinationFrame.width * resolution; - viewportFrame.height = destinationFrame.height * resolution; - this.renderer.framebuffer.bind(framebuffer, viewportFrame); - this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); - if (renderTexture) { - this.renderer.mask.setMaskStack(baseTexture.maskStack); - } - else { - this.renderer.mask.setMaskStack(this.defaultMaskStack); - } - this.sourceFrame.copyFrom(sourceFrame); - this.destinationFrame.copyFrom(destinationFrame); - }; - /** - * Erases the render texture and fills the drawing area with a colour - * - * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor - * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks - * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. - * @return {PIXI.Renderer} Returns itself. - */ - RenderTextureSystem.prototype.clear = function (clearColor, mask) { - if (this.current) { - clearColor = clearColor || this.current.baseTexture.clearColor; - } - else { - clearColor = clearColor || this.clearColor; - } - this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); - }; - RenderTextureSystem.prototype.resize = function () { - // resize the root only! - this.bind(null); - }; - /** - * Resets renderTexture state - */ - RenderTextureSystem.prototype.reset = function () { - this.bind(null); - }; - return RenderTextureSystem; - }(System)); - - var IGLUniformData = /** @class */ (function () { - function IGLUniformData() { - } - return IGLUniformData; - }()); - /** - * Helper class to create a WebGL Program - * - * @class - * @memberof PIXI - */ - var GLProgram = /** @class */ (function () { - /** - * Makes a new Pixi program - * - * @param program {WebGLProgram} webgl program - * @param uniformData {Object} uniforms - */ - function GLProgram(program, uniformData) { - /** - * The shader program - * - * @member {WebGLProgram} - */ - this.program = program; - /** - * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing unneeded GPU commands - * @member {Object} - */ - this.uniformData = uniformData; - /** - * uniformGroups holds the various upload functions for the shader. Each uniform group - * and program have a unique upload function generated. - * @member {Object} - */ - this.uniformGroups = {}; - } - /** - * Destroys this program - */ - GLProgram.prototype.destroy = function () { - this.uniformData = null; - this.uniformGroups = null; - this.program = null; - }; - return GLProgram; - }()); - - var UID$4 = 0; - // defualt sync data so we don't create a new one each time! - var defaultSyncData = { textureCount: 0 }; - /** - * System plugin to the renderer to manage shaders. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var ShaderSystem = /** @class */ (function (_super) { - __extends$2(ShaderSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ShaderSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.destroyed = false; - // Validation check that this environment support `new Function` - _this.systemCheck(); - /** - * The current WebGL rendering context - * - * @member {WebGLRenderingContext} - */ - _this.gl = null; - _this.shader = null; - _this.program = null; - /** - * Cache to holds the generated functions. Stored against UniformObjects unique signature - * @type {Object} - * @private - */ - _this.cache = {}; - _this.id = UID$4++; - return _this; - } - /** - * Overrideable function by `@pixi/unsafe-eval` to silence - * throwing an error if platform doesn't support unsafe-evals. - * - * @private - */ - ShaderSystem.prototype.systemCheck = function () { - if (!unsafeEvalSupported()) { - throw new Error('Current environment does not allow unsafe-eval, ' - + 'please use @pixi/unsafe-eval module to enable support.'); - } - }; - ShaderSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.reset(); - }; - /** - * Changes the current shader to the one given in parameter - * - * @param {PIXI.Shader} shader - the new shader - * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms. - * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. - */ - ShaderSystem.prototype.bind = function (shader, dontSync) { - shader.uniforms.globals = this.renderer.globalUniforms; - var program = shader.program; - var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader); - this.shader = shader; - // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. - if (this.program !== program) { - this.program = program; - this.gl.useProgram(glProgram.program); - } - if (!dontSync) { - defaultSyncData.textureCount = 0; - this.syncUniformGroup(shader.uniformGroup, defaultSyncData); - } - return glProgram; - }; - /** - * Uploads the uniforms values to the currently bound shader. - * - * @param {object} uniforms - the uniforms values that be applied to the current shader - */ - ShaderSystem.prototype.setUniforms = function (uniforms) { - var shader = this.shader.program; - var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; - shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); - }; - /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - /** - * - * syncs uniforms on the group - * @param {*} group - the uniform group to sync - * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions - */ - ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { - var glProgram = this.getglProgram(); - if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) { - glProgram.uniformGroups[group.id] = group.dirtyId; - this.syncUniforms(group, glProgram, syncData); - } - }; - /** - * Overrideable by the @pixi/unsafe-eval package to use static - * syncUnforms instead. - * - * @private - */ - ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { - var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); - syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); - }; - /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ - ShaderSystem.prototype.createSyncGroups = function (group) { - var id = this.getSignature(group, this.shader.program.uniformData); - if (!this.cache[id]) { - this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); - } - group.syncUniforms[this.shader.program.id] = this.cache[id]; - return group.syncUniforms[this.shader.program.id]; - }; - /** - * Takes a uniform group and data and generates a unique signature for them. - * - * @param {PIXI.UniformGroup} group - the uniform group to get signature of - * @param {Object} uniformData - uniform information generated by the shader - * @returns {String} Unique signature of the uniform group - * @private - */ - ShaderSystem.prototype.getSignature = function (group, uniformData) { - var uniforms = group.uniforms; - var strings = []; - for (var i in uniforms) { - strings.push(i); - if (uniformData[i]) { - strings.push(uniformData[i].type); - } - } - return strings.join('-'); - }; - /** - * Returns the underlying GLShade rof the currently bound shader. - * This can be handy for when you to have a little more control over the setting of your uniforms. - * - * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context - */ - ShaderSystem.prototype.getglProgram = function () { - if (this.shader) { - return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; - } - return null; - }; - /** - * Generates a glProgram version of the Shader provided. - * - * @private - * @param {PIXI.Shader} shader - the shader that the glProgram will be based on. - * @return {PIXI.GLProgram} A shiny new glProgram! - */ - ShaderSystem.prototype.generateShader = function (shader) { - var gl = this.gl; - var program = shader.program; - var attribMap = {}; - for (var i in program.attributeData) { - attribMap[i] = program.attributeData[i].location; - } - var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap); - var uniformData = {}; - for (var i in program.uniformData) { - var data = program.uniformData[i]; - uniformData[i] = { - location: gl.getUniformLocation(shaderProgram, i), - value: defaultValue(data.type, data.size), - }; - } - var glProgram = new GLProgram(shaderProgram, uniformData); - program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; - return glProgram; - }; - /** - * Resets ShaderSystem state, does not affect WebGL state - */ - ShaderSystem.prototype.reset = function () { - this.program = null; - this.shader = null; - }; - /** - * Destroys this System and removes all its textures - */ - ShaderSystem.prototype.destroy = function () { - // TODO implement destroy method for ShaderSystem - this.destroyed = true; - }; - return ShaderSystem; - }(System)); - - /** - * Maps gl blend combinations to WebGL. - * - * @memberof PIXI - * @function mapWebGLBlendModesToPixi - * @private - * @param {WebGLRenderingContext} gl - The rendering context. - * @param {number[][]} [array=[]] - The array to output into. - * @return {number[][]} Mapped modes. - */ - function mapWebGLBlendModesToPixi(gl, array) { - if (array === void 0) { array = []; } - // TODO - premultiply alpha would be different. - // add a boolean for that! - array[exports.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; - array[exports.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.NONE] = [0, 0]; - // not-premultiplied blend modes - array[exports.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; - array[exports.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - // composite operations - array[exports.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; - array[exports.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; - array[exports.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; - array[exports.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; - array[exports.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; - array[exports.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; - // SUBTRACT from flash - array[exports.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; - return array; - } - - var BLEND$1 = 0; - var OFFSET$1 = 1; - var CULLING$1 = 2; - var DEPTH_TEST$1 = 3; - var WINDING$1 = 4; - /** - * System plugin to the renderer to manage WebGL state machines. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var StateSystem = /** @class */ (function (_super) { - __extends$2(StateSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function StateSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * GL context - * @member {WebGLRenderingContext} - * @readonly - */ - _this.gl = null; - /** - * State ID - * @member {number} - * @readonly - */ - _this.stateId = 0; - /** - * Polygon offset - * @member {number} - * @readonly - */ - _this.polygonOffset = 0; - /** - * Blend mode - * @member {number} - * @default PIXI.BLEND_MODES.NONE - * @readonly - */ - _this.blendMode = exports.BLEND_MODES.NONE; - /** - * Whether current blend equation is different - * @member {boolean} - * @protected - */ - _this._blendEq = false; - /** - * Collection of calls - * @member {function[]} - * @readonly - */ - _this.map = []; - // map functions for when we set state.. - _this.map[BLEND$1] = _this.setBlend; - _this.map[OFFSET$1] = _this.setOffset; - _this.map[CULLING$1] = _this.setCullFace; - _this.map[DEPTH_TEST$1] = _this.setDepthTest; - _this.map[WINDING$1] = _this.setFrontFace; - /** - * Collection of check calls - * @member {function[]} - * @readonly - */ - _this.checks = []; - /** - * Default WebGL State - * @member {PIXI.State} - * @readonly - */ - _this.defaultState = new State(); - _this.defaultState.blend = true; - return _this; - } - StateSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.blendModes = mapWebGLBlendModesToPixi(gl); - this.set(this.defaultState); - this.reset(); - }; - /** - * Sets the current state - * - * @param {*} state - The state to set. - */ - StateSystem.prototype.set = function (state) { - state = state || this.defaultState; - // TODO maybe to an object check? ( this.state === state )? - if (this.stateId !== state.data) { - var diff = this.stateId ^ state.data; - var i = 0; - // order from least to most common - while (diff) { - if (diff & 1) { - // state change! - this.map[i].call(this, !!(state.data & (1 << i))); - } - diff = diff >> 1; - i++; - } - this.stateId = state.data; - } - // based on the above settings we check for specific modes.. - // for example if blend is active we check and set the blend modes - // or of polygon offset is active we check the poly depth. - for (var i = 0; i < this.checks.length; i++) { - this.checks[i](this, state); - } - }; - /** - * Sets the state, when previous state is unknown - * - * @param {*} state - The state to set - */ - StateSystem.prototype.forceState = function (state) { - state = state || this.defaultState; - for (var i = 0; i < this.map.length; i++) { - this.map[i].call(this, !!(state.data & (1 << i))); - } - for (var i = 0; i < this.checks.length; i++) { - this.checks[i](this, state); - } - this.stateId = state.data; - }; - /** - * Enables or disabled blending. - * - * @param {boolean} value - Turn on or off webgl blending. - */ - StateSystem.prototype.setBlend = function (value) { - this.updateCheck(StateSystem.checkBlendMode, value); - this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); - }; - /** - * Enables or disable polygon offset fill - * - * @param {boolean} value - Turn on or off webgl polygon offset testing. - */ - StateSystem.prototype.setOffset = function (value) { - this.updateCheck(StateSystem.checkPolygonOffset, value); - this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); - }; - /** - * Sets whether to enable or disable depth test. - * - * @param {boolean} value - Turn on or off webgl depth testing. - */ - StateSystem.prototype.setDepthTest = function (value) { - this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); - }; - /** - * Sets whether to enable or disable cull face. - * - * @param {boolean} value - Turn on or off webgl cull face. - */ - StateSystem.prototype.setCullFace = function (value) { - this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); - }; - /** - * Sets the gl front face. - * - * @param {boolean} value - true is clockwise and false is counter-clockwise - */ - StateSystem.prototype.setFrontFace = function (value) { - this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); - }; - /** - * Sets the blend mode. - * - * @param {number} value - The blend mode to set to. - */ - StateSystem.prototype.setBlendMode = function (value) { - if (value === this.blendMode) { - return; - } - this.blendMode = value; - var mode = this.blendModes[value]; - var gl = this.gl; - if (mode.length === 2) { - gl.blendFunc(mode[0], mode[1]); - } - else { - gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); - } - if (mode.length === 6) { - this._blendEq = true; - gl.blendEquationSeparate(mode[4], mode[5]); - } - else if (this._blendEq) { - this._blendEq = false; - gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); - } - }; - /** - * Sets the polygon offset. - * - * @param {number} value - the polygon offset - * @param {number} scale - the polygon offset scale - */ - StateSystem.prototype.setPolygonOffset = function (value, scale) { - this.gl.polygonOffset(value, scale); - }; - // used - /** - * Resets all the logic and disables the vaos - */ - StateSystem.prototype.reset = function () { - this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); - this.forceState(this.defaultState); - this._blendEq = true; - this.blendMode = -1; - this.setBlendMode(0); - }; - /** - * checks to see which updates should be checked based on which settings have been activated. - * For example, if blend is enabled then we should check the blend modes each time the state is changed - * or if polygon fill is activated then we need to check if the polygon offset changes. - * The idea is that we only check what we have too. - * - * @param {Function} func - the checking function to add or remove - * @param {boolean} value - should the check function be added or removed. - */ - StateSystem.prototype.updateCheck = function (func, value) { - var index = this.checks.indexOf(func); - if (value && index === -1) { - this.checks.push(func); - } - else if (!value && index !== -1) { - this.checks.splice(index, 1); - } - }; - /** - * A private little wrapper function that we call to check the blend mode. - * - * @static - * @private - * @param {PIXI.StateSystem} System - the System to perform the state check on - * @param {PIXI.State} state - the state that the blendMode will pulled from - */ - StateSystem.checkBlendMode = function (system, state) { - system.setBlendMode(state.blendMode); - }; - /** - * A private little wrapper function that we call to check the polygon offset. - * - * @static - * @private - * @param {PIXI.StateSystem} System - the System to perform the state check on - * @param {PIXI.State} state - the state that the blendMode will pulled from - */ - StateSystem.checkPolygonOffset = function (system, state) { - system.setPolygonOffset(1, state.polygonOffset); - }; - return StateSystem; - }(System)); - - /** - * System plugin to the renderer to manage texture garbage collection on the GPU, - * ensuring that it does not get clogged up with textures that are no longer being used. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var TextureGCSystem = /** @class */ (function (_super) { - __extends$2(TextureGCSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function TextureGCSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Count - * @member {number} - * @readonly - */ - _this.count = 0; - /** - * Check count - * @member {number} - * @readonly - */ - _this.checkCount = 0; - /** - * Maximum idle time, in seconds - * @member {number} - * @see PIXI.settings.GC_MAX_IDLE - */ - _this.maxIdle = settings.GC_MAX_IDLE; - /** - * Maximum number of item to check - * @member {number} - * @see PIXI.settings.GC_MAX_CHECK_COUNT - */ - _this.checkCountMax = settings.GC_MAX_CHECK_COUNT; - /** - * Current garabage collection mode - * @member {PIXI.GC_MODES} - * @see PIXI.settings.GC_MODE - */ - _this.mode = settings.GC_MODE; - return _this; - } - /** - * Checks to see when the last time a texture was used - * if the texture has not been used for a specified amount of time it will be removed from the GPU - */ - TextureGCSystem.prototype.postrender = function () { - if (!this.renderer.renderingToScreen) { - return; - } - this.count++; - if (this.mode === exports.GC_MODES.MANUAL) { - return; - } - this.checkCount++; - if (this.checkCount > this.checkCountMax) { - this.checkCount = 0; - this.run(); - } - }; - /** - * Checks to see when the last time a texture was used - * if the texture has not been used for a specified amount of time it will be removed from the GPU - */ - TextureGCSystem.prototype.run = function () { - var tm = this.renderer.texture; - var managedTextures = tm.managedTextures; - var wasRemoved = false; - for (var i = 0; i < managedTextures.length; i++) { - var texture = managedTextures[i]; - // only supports non generated textures at the moment! - if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { - tm.destroyTexture(texture, true); - managedTextures[i] = null; - wasRemoved = true; - } - } - if (wasRemoved) { - var j = 0; - for (var i = 0; i < managedTextures.length; i++) { - if (managedTextures[i] !== null) { - managedTextures[j++] = managedTextures[i]; - } - } - managedTextures.length = j; - } - }; - /** - * Removes all the textures within the specified displayObject and its children from the GPU - * - * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. - */ - TextureGCSystem.prototype.unload = function (displayObject) { - var tm = this.renderer.texture; - var texture = displayObject._texture; - // only destroy non generated textures - if (texture && !texture.framebuffer) { - tm.destroyTexture(texture); - } - for (var i = displayObject.children.length - 1; i >= 0; i--) { - this.unload(displayObject.children[i]); - } - }; - return TextureGCSystem; - }(System)); - - /** - * Internal texture for WebGL context - * @class - * @memberof PIXI - */ - var GLTexture = /** @class */ (function () { - function GLTexture(texture) { - /** - * The WebGL texture - * @member {WebGLTexture} - */ - this.texture = texture; - /** - * Width of texture that was used in texImage2D - * @member {number} - */ - this.width = -1; - /** - * Height of texture that was used in texImage2D - * @member {number} - */ - this.height = -1; - /** - * Texture contents dirty flag - * @member {number} - */ - this.dirtyId = -1; - /** - * Texture style dirty flag - * @member {number} - */ - this.dirtyStyleId = -1; - /** - * Whether mip levels has to be generated - * @member {boolean} - */ - this.mipmap = false; - /** - * WrapMode copied from baseTexture - * @member {number} - */ - this.wrapMode = 33071; - /** - * Type copied from baseTexture - * @member {number} - */ - this.type = 6408; - /** - * Type copied from baseTexture - * @member {number} - */ - this.internalFormat = 5121; - } - return GLTexture; - }()); - - /** - * System plugin to the renderer to manage textures. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var TextureSystem = /** @class */ (function (_super) { - __extends$2(TextureSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function TextureSystem(renderer) { - var _this = _super.call(this, renderer) || this; - // TODO set to max textures... - /** - * Bound textures - * @member {PIXI.BaseTexture[]} - * @readonly - */ - _this.boundTextures = []; - /** - * Current location - * @member {number} - * @readonly - */ - _this.currentLocation = -1; - /** - * List of managed textures - * @member {PIXI.BaseTexture[]} - * @readonly - */ - _this.managedTextures = []; - /** - * Did someone temper with textures state? We'll overwrite them when we need to unbind something. - * @member {boolean} - * @private - */ - _this._unknownBoundTextures = false; - /** - * BaseTexture value that shows that we don't know what is bound - * @member {PIXI.BaseTexture} - * @readonly - */ - _this.unknownTexture = new BaseTexture(); - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - TextureSystem.prototype.contextChange = function () { - var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - this.webGLVersion = this.renderer.context.webGLVersion; - var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - this.boundTextures.length = maxTextures; - for (var i = 0; i < maxTextures; i++) { - this.boundTextures[i] = null; - } - // TODO move this.. to a nice make empty textures class.. - this.emptyTextures = {}; - var emptyTexture2D = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); - this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; - this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); - for (var i = 0; i < 6; i++) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); - } - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - for (var i = 0; i < this.boundTextures.length; i++) { - this.bind(null, i); - } - }; - /** - * Bind a texture to a specific location - * - * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` - * - * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind - * @param {number} [location=0] - Location to bind at - */ - TextureSystem.prototype.bind = function (texture, location) { - if (location === void 0) { location = 0; } - var gl = this.gl; - if (texture) { - texture = texture.castToBaseTexture(); - if (!texture || texture.parentTextureArray) { - // cannot bind partial texture - // TODO: report a warning - return; - } - if (texture.valid) { - texture.touched = this.renderer.textureGC.count; - var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); - if (this.boundTextures[location] !== texture) { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - gl.bindTexture(texture.target, glTexture.texture); - } - if (glTexture.dirtyId !== texture.dirtyId) { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - this.updateTexture(texture); - } - this.boundTextures[location] = texture; - } - } - else { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); - this.boundTextures[location] = null; - } - }; - /** - * Resets texture location and bound textures - * - * Actual `bind(null, i)` calls will be performed at next `unbind()` call - */ - TextureSystem.prototype.reset = function () { - this._unknownBoundTextures = true; - this.currentLocation = -1; - for (var i = 0; i < this.boundTextures.length; i++) { - this.boundTextures[i] = this.unknownTexture; - } - }; - /** - * Unbind a texture - * @param {PIXI.BaseTexture} texture - Texture to bind - */ - TextureSystem.prototype.unbind = function (texture) { - var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; - if (this._unknownBoundTextures) { - this._unknownBoundTextures = false; - // someone changed webGL state, - // we have to be sure that our texture does not appear in multi-texture renderer samplers - for (var i = 0; i < boundTextures.length; i++) { - if (boundTextures[i] === this.unknownTexture) { - this.bind(null, i); - } - } - } - for (var i = 0; i < boundTextures.length; i++) { - if (boundTextures[i] === texture) { - if (this.currentLocation !== i) { - gl.activeTexture(gl.TEXTURE0 + i); - this.currentLocation = i; - } - gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); - boundTextures[i] = null; - } - } - }; - /** - * Initialize a texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to initialize - */ - TextureSystem.prototype.initTexture = function (texture) { - var glTexture = new GLTexture(this.gl.createTexture()); - // guarantee an update.. - glTexture.dirtyId = -1; - texture._glTextures[this.CONTEXT_UID] = glTexture; - this.managedTextures.push(texture); - texture.on('dispose', this.destroyTexture, this); - return glTexture; - }; - TextureSystem.prototype.initTextureType = function (texture, glTexture) { - glTexture.internalFormat = texture.format; - glTexture.type = texture.type; - if (this.webGLVersion !== 2) { - return; - } - var gl = this.renderer.gl; - if (texture.type === gl.FLOAT - && texture.format === gl.RGBA) { - glTexture.internalFormat = gl.RGBA32F; - } - // that's WebGL1 HALF_FLOAT_OES - // we have to convert it to WebGL HALF_FLOAT - if (texture.type === exports.TYPES.HALF_FLOAT) { - glTexture.type = gl.HALF_FLOAT; - } - if (glTexture.type === gl.HALF_FLOAT - && texture.format === gl.RGBA) { - glTexture.internalFormat = gl.RGBA16F; - } - }; - /** - * Update a texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to initialize - */ - TextureSystem.prototype.updateTexture = function (texture) { - var glTexture = texture._glTextures[this.CONTEXT_UID]; - if (!glTexture) { - return; - } - var renderer = this.renderer; - this.initTextureType(texture, glTexture); - if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { ; } - else { - // default, renderTexture-like logic - var width = texture.realWidth; - var height = texture.realHeight; - var gl = renderer.gl; - if (glTexture.width !== width - || glTexture.height !== height - || glTexture.dirtyId < 0) { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); - } - } - // lets only update what changes.. - if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { - this.updateTextureStyle(texture); - } - glTexture.dirtyId = texture.dirtyId; - }; - /** - * Deletes the texture from WebGL - * - * @private - * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy - * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager. - */ - TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { - var gl = this.gl; - texture = texture.castToBaseTexture(); - if (texture._glTextures[this.CONTEXT_UID]) { - this.unbind(texture); - gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); - texture.off('dispose', this.destroyTexture, this); - delete texture._glTextures[this.CONTEXT_UID]; - if (!skipRemove) { - var i = this.managedTextures.indexOf(texture); - if (i !== -1) { - removeItems(this.managedTextures, i, 1); - } - } - } - }; - /** - * Update texture style such as mipmap flag - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to update - */ - TextureSystem.prototype.updateTextureStyle = function (texture) { - var glTexture = texture._glTextures[this.CONTEXT_UID]; - if (!glTexture) { - return; - } - if ((texture.mipmap === exports.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { - glTexture.mipmap = false; - } - else { - glTexture.mipmap = texture.mipmap >= 1; - } - if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { - glTexture.wrapMode = exports.WRAP_MODES.CLAMP; - } - else { - glTexture.wrapMode = texture.wrapMode; - } - if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) { ; } - else { - this.setStyle(texture, glTexture); - } - glTexture.dirtyStyleId = texture.dirtyStyleId; - }; - /** - * Set style for texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to update - * @param {PIXI.GLTexture} glTexture - */ - TextureSystem.prototype.setStyle = function (texture, glTexture) { - var gl = this.gl; - if (glTexture.mipmap) { - gl.generateMipmap(texture.target); - } - gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); - gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); - if (glTexture.mipmap) { - /* eslint-disable max-len */ - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); - /* eslint-disable max-len */ - var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; - if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === exports.SCALE_MODES.LINEAR) { - var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); - gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); - } - } - else { - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); - } - gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); - }; - return TextureSystem; - }(System)); - - /** - * Systems are individual components to the Renderer pipeline. - * @namespace PIXI.systems - */ - - var systems = ({ - FilterSystem: FilterSystem, - BatchSystem: BatchSystem, - ContextSystem: ContextSystem, - FramebufferSystem: FramebufferSystem, - GeometrySystem: GeometrySystem, - MaskSystem: MaskSystem, - ScissorSystem: ScissorSystem, - StencilSystem: StencilSystem, - ProjectionSystem: ProjectionSystem, - RenderTextureSystem: RenderTextureSystem, - ShaderSystem: ShaderSystem, - StateSystem: StateSystem, - TextureGCSystem: TextureGCSystem, - TextureSystem: TextureSystem - }); - - var tempMatrix = new Matrix(); - /** - * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} - * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. - * - * @abstract - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var AbstractRenderer = /** @class */ (function (_super) { - __extends$2(AbstractRenderer, _super); - /** - * @param {string} system - The name of the system this renderer is for. - * @param {object} [options] - The optional renderer parameters. - * @param {number} [options.width=800] - The width of the screen. - * @param {number} [options.height=600] - The height of the screen. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The - * resolution of the renderer retina would be 2. - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, - * enable this if you need to call toDataUrl on the WebGL context. - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - */ - function AbstractRenderer(type, options) { - if (type === void 0) { type = exports.RENDERER_TYPE.UNKNOWN; } - var _this = _super.call(this) || this; - // Add the default render options - options = Object.assign({}, settings.RENDER_OPTIONS, options); - // Deprecation notice for renderer roundPixels option - if (options.roundPixels) { - settings.ROUND_PIXELS = options.roundPixels; - deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2); - } - /** - * The supplied constructor options. - * - * @member {Object} - * @readOnly - */ - _this.options = options; - /** - * The type of the renderer. - * - * @member {number} - * @default PIXI.RENDERER_TYPE.UNKNOWN - * @see PIXI.RENDERER_TYPE - */ - _this.type = type; - /** - * Measurements of the screen. (0, 0, screenWidth, screenHeight). - * - * Its safe to use as filterArea or hitArea for the whole stage. - * - * @member {PIXI.Rectangle} - */ - _this.screen = new Rectangle(0, 0, options.width, options.height); - /** - * The canvas element that everything is drawn to. - * - * @member {HTMLCanvasElement} - */ - _this.view = options.view || document.createElement('canvas'); - /** - * The resolution / device pixel ratio of the renderer. - * - * @member {number} - * @default 1 - */ - _this.resolution = options.resolution || settings.RESOLUTION; - /** - * Whether the render view is transparent. - * - * @member {boolean} - */ - _this.transparent = options.transparent; - /** - * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. - * - * @member {boolean} - */ - _this.autoDensity = options.autoDensity || options.autoResize || false; - // autoResize is deprecated, provides fallback support - /** - * The value of the preserveDrawingBuffer flag affects whether or not the contents of - * the stencil buffer is retained after rendering. - * - * @member {boolean} - */ - _this.preserveDrawingBuffer = options.preserveDrawingBuffer; - /** - * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. - * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every - * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect - * to clear the canvas every frame. Disable this by setting this to false. For example, if - * your game has a canvas filling background image you often don't need this set. - * - * @member {boolean} - * @default - */ - _this.clearBeforeRender = options.clearBeforeRender; - /** - * The background color as a number. - * - * @member {number} - * @protected - */ - _this._backgroundColor = 0x000000; - /** - * The background color as an [R, G, B] array. - * - * @member {number[]} - * @protected - */ - _this._backgroundColorRgba = [0, 0, 0, 0]; - /** - * The background color as a string. - * - * @member {string} - * @protected - */ - _this._backgroundColorString = '#000000'; - _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter - /** - * The last root object that the renderer tried to render. - * - * @member {PIXI.DisplayObject} - * @protected - */ - _this._lastObjectRendered = null; - /** - * Collection of plugins. - * @readonly - * @member {object} - */ - _this.plugins = {}; - return _this; - } - /** - * Initialize the plugins. - * - * @protected - * @param {object} staticMap - The dictionary of statically saved plugins. - */ - AbstractRenderer.prototype.initPlugins = function (staticMap) { - for (var o in staticMap) { - this.plugins[o] = new (staticMap[o])(this); - } - }; - Object.defineProperty(AbstractRenderer.prototype, "width", { - /** - * Same as view.width, actual number of pixels in the canvas by horizontal. - * - * @member {number} - * @readonly - * @default 800 - */ - get: function () { - return this.view.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbstractRenderer.prototype, "height", { - /** - * Same as view.height, actual number of pixels in the canvas by vertical. - * - * @member {number} - * @readonly - * @default 600 - */ - get: function () { - return this.view.height; - }, - enumerable: false, - configurable: true - }); - /** - * Resizes the screen and canvas to the specified width and height. - * Canvas dimensions are multiplied by resolution. - * - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - AbstractRenderer.prototype.resize = function (screenWidth, screenHeight) { - this.screen.width = screenWidth; - this.screen.height = screenHeight; - this.view.width = screenWidth * this.resolution; - this.view.height = screenHeight * this.resolution; - if (this.autoDensity) { - this.view.style.width = screenWidth + "px"; - this.view.style.height = screenHeight + "px"; - } - /** - * Fired after view has been resized. - * - * @event PIXI.Renderer#resize - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - this.emit('resize', screenWidth, screenHeight); - }; - /** - * Useful function that returns a texture of the display object that can then be used to create sprites - * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. - * - * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from. - * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture. - * @param {number} resolution - The resolution / device pixel ratio of the texture being generated. - * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, - * if no region is specified, defaults to the local bounds of the displayObject. - * @return {PIXI.RenderTexture} A texture of the graphics object. - */ - AbstractRenderer.prototype.generateTexture = function (displayObject, scaleMode, resolution, region) { - region = region || displayObject.getLocalBounds(null, true); - // minimum texture size is 1x1, 0x0 will throw an error - if (region.width === 0) - { region.width = 1; } - if (region.height === 0) - { region.height = 1; } - var renderTexture = RenderTexture.create({ - width: region.width | 0, - height: region.height | 0, - scaleMode: scaleMode, - resolution: resolution, - }); - tempMatrix.tx = -region.x; - tempMatrix.ty = -region.y; - this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent); - return renderTexture; - }; - /** - * Removes everything from the renderer and optionally removes the Canvas DOM element. - * - * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. - */ - AbstractRenderer.prototype.destroy = function (removeView) { - for (var o in this.plugins) { - this.plugins[o].destroy(); - this.plugins[o] = null; - } - if (removeView && this.view.parentNode) { - this.view.parentNode.removeChild(this.view); - } - var thisAny = this; - // null-ing all objects, that's a tradition! - thisAny.plugins = null; - thisAny.type = exports.RENDERER_TYPE.UNKNOWN; - thisAny.view = null; - thisAny.screen = null; - thisAny._tempDisplayObjectParent = null; - thisAny.options = null; - this._backgroundColorRgba = null; - this._backgroundColorString = null; - this._lastObjectRendered = null; - }; - Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { - /** - * The background color to fill if not transparent - * - * @member {number} - */ - get: function () { - return this._backgroundColor; - }, - set: function (value) { - this._backgroundColor = value; - this._backgroundColorString = hex2string(value); - hex2rgb(value, this._backgroundColorRgba); - }, - enumerable: false, - configurable: true - }); - return AbstractRenderer; - }(eventemitter3)); - - /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. - * - * This renderer should be used for browsers that support WebGL. - * - * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything! - * - * @class - * @memberof PIXI - * @extends PIXI.AbstractRenderer - */ - var Renderer = /** @class */ (function (_super) { - __extends$2(Renderer, _super); - /** - * @param {object} [options] - The optional renderer parameters. - * @param {number} [options.width=800] - The width of the screen. - * @param {number} [options.height=600] - The height of the screen. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA - * antialiasing is used. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. - * The resolution of the renderer retina would be 2. - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear - * the canvas or not before the new render pass. If you wish to set this to false, you *must* set - * preserveDrawingBuffer to `true`. - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, - * enable this if you need to call toDataUrl on the WebGL context. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" - * for devices with dual graphics card. - * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it. - * @public - */ - function Renderer(options) { - var _this = _super.call(this, exports.RENDERER_TYPE.WEBGL, options) || this; - // the options will have been modified here in the super constructor with pixi's default settings.. - options = _this.options; - /** - * WebGL context, set by the contextSystem (this.context) - * - * @readonly - * @member {WebGLRenderingContext} - */ - _this.gl = null; - _this.CONTEXT_UID = 0; - // TODO legacy! - /** - * Internal signal instances of **runner**, these - * are assigned to each system created. - * @see PIXI.Runner - * @name PIXI.Renderer#runners - * @private - * @type {object} - * @readonly - * @property {PIXI.Runner} destroy - Destroy runner - * @property {PIXI.Runner} contextChange - Context change runner - * @property {PIXI.Runner} reset - Reset runner - * @property {PIXI.Runner} update - Update runner - * @property {PIXI.Runner} postrender - Post-render runner - * @property {PIXI.Runner} prerender - Pre-render runner - * @property {PIXI.Runner} resize - Resize runner - */ - _this.runners = { - destroy: new Runner('destroy'), - contextChange: new Runner('contextChange'), - reset: new Runner('reset'), - update: new Runner('update'), - postrender: new Runner('postrender'), - prerender: new Runner('prerender'), - resize: new Runner('resize'), - }; - /** - * Global uniforms - * @member {PIXI.UniformGroup} - */ - _this.globalUniforms = new UniformGroup({ - projectionMatrix: new Matrix(), - }, true); - /** - * Mask system instance - * @member {PIXI.systems.MaskSystem} mask - * @memberof PIXI.Renderer# - * @readonly - */ - _this.addSystem(MaskSystem, 'mask') - /** - * Context system instance - * @member {PIXI.systems.ContextSystem} context - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ContextSystem, 'context') - /** - * State system instance - * @member {PIXI.systems.StateSystem} state - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(StateSystem, 'state') - /** - * Shader system instance - * @member {PIXI.systems.ShaderSystem} shader - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ShaderSystem, 'shader') - /** - * Texture system instance - * @member {PIXI.systems.TextureSystem} texture - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(TextureSystem, 'texture') - /** - * Geometry system instance - * @member {PIXI.systems.GeometrySystem} geometry - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(GeometrySystem, 'geometry') - /** - * Framebuffer system instance - * @member {PIXI.systems.FramebufferSystem} framebuffer - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(FramebufferSystem, 'framebuffer') - /** - * Scissor system instance - * @member {PIXI.systems.ScissorSystem} scissor - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ScissorSystem, 'scissor') - /** - * Stencil system instance - * @member {PIXI.systems.StencilSystem} stencil - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(StencilSystem, 'stencil') - /** - * Projection system instance - * @member {PIXI.systems.ProjectionSystem} projection - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ProjectionSystem, 'projection') - /** - * Texture garbage collector system instance - * @member {PIXI.systems.TextureGCSystem} textureGC - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(TextureGCSystem, 'textureGC') - /** - * Filter system instance - * @member {PIXI.systems.FilterSystem} filter - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(FilterSystem, 'filter') - /** - * RenderTexture system instance - * @member {PIXI.systems.RenderTextureSystem} renderTexture - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(RenderTextureSystem, 'renderTexture') - /** - * Batch system instance - * @member {PIXI.systems.BatchSystem} batch - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(BatchSystem, 'batch'); - _this.initPlugins(Renderer.__plugins); - /** - * The options passed in to create a new WebGL context. - */ - if (options.context) { - _this.context.initFromContext(options.context); - } - else { - _this.context.initFromOptions({ - alpha: !!_this.transparent, - antialias: options.antialias, - premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied', - stencil: true, - preserveDrawingBuffer: options.preserveDrawingBuffer, - powerPreference: _this.options.powerPreference, - }); - } - /** - * Flag if we are rendering to the screen vs renderTexture - * @member {boolean} - * @readonly - * @default true - */ - _this.renderingToScreen = true; - sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); - _this.resize(_this.options.width, _this.options.height); - return _this; - } - /** - * Create renderer if WebGL is available. Overrideable - * by the **@pixi/canvas-renderer** package to allow fallback. - * throws error if WebGL is not available. - * @static - * @private - */ - Renderer.create = function (options) { - if (isWebGLSupported()) { - return new Renderer(options); - } - throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); - }; - /** - * Add a new system to the renderer. - * @param {Function} ClassRef - Class reference - * @param {string} [name] - Property name for system, if not specified - * will use a static `name` property on the class itself. This - * name will be assigned as s property on the Renderer so make - * sure it doesn't collide with properties on Renderer. - * @return {PIXI.Renderer} Return instance of renderer - */ - Renderer.prototype.addSystem = function (ClassRef, name) { - if (!name) { - name = ClassRef.name; - } - var system = new ClassRef(this); - if (this[name]) { - throw new Error("Whoops! The name \"" + name + "\" is already in use"); - } - this[name] = system; - for (var i in this.runners) { - this.runners[i].add(system); - } - /** - * Fired after rendering finishes. - * - * @event PIXI.Renderer#postrender - */ - /** - * Fired before rendering starts. - * - * @event PIXI.Renderer#prerender - */ - /** - * Fired when the WebGL context is set. - * - * @event PIXI.Renderer#context - * @param {WebGLRenderingContext} gl - WebGL context. - */ - return this; - }; - /** - * Renders the object to its WebGL view - * - * @param {PIXI.DisplayObject} displayObject - The object to be rendered. - * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to. - * @param {boolean} [clear=true] - Should the canvas be cleared before the new render. - * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering. - * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass? - */ - Renderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { - // can be handy to know! - this.renderingToScreen = !renderTexture; - this.runners.prerender.emit(); - this.emit('prerender'); - // apply a transform at a GPU level - this.projection.transform = transform; - // no point rendering if our context has been blown up! - if (this.context.isLost) { - return; - } - if (!renderTexture) { - this._lastObjectRendered = displayObject; - } - if (!skipUpdateTransform) { - // update the scene graph - var cacheParent = displayObject.enableTempParent(); - displayObject.updateTransform(); - displayObject.disableTempParent(cacheParent); - // displayObject.hitArea = //TODO add a temp hit area - } - this.renderTexture.bind(renderTexture); - this.batch.currentRenderer.start(); - if (clear !== undefined ? clear : this.clearBeforeRender) { - this.renderTexture.clear(); - } - displayObject.render(this); - // apply transform.. - this.batch.currentRenderer.flush(); - if (renderTexture) { - renderTexture.baseTexture.update(); - } - this.runners.postrender.emit(); - // reset transform after render - this.projection.transform = null; - this.emit('postrender'); - }; - /** - * Resizes the WebGL view to the specified width and height. - * - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - Renderer.prototype.resize = function (screenWidth, screenHeight) { - _super.prototype.resize.call(this, screenWidth, screenHeight); - this.runners.resize.emit(screenWidth, screenHeight); - }; - /** - * Resets the WebGL state so you can render things however you fancy! - * - * @return {PIXI.Renderer} Returns itself. - */ - Renderer.prototype.reset = function () { - this.runners.reset.emit(); - return this; - }; - /** - * Clear the frame buffer - */ - Renderer.prototype.clear = function () { - this.renderTexture.bind(); - this.renderTexture.clear(); - }; - /** - * Removes everything from the renderer (event listeners, spritebatch, etc...) - * - * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. - * See: https://github.com/pixijs/pixi.js/issues/2233 - */ - Renderer.prototype.destroy = function (removeView) { - this.runners.destroy.emit(); - for (var r in this.runners) { - this.runners[r].destroy(); - } - // call base destroy - _super.prototype.destroy.call(this, removeView); - // TODO nullify all the managers.. - this.gl = null; - }; - /** - * Adds a plugin to the renderer. - * - * @method - * @param {string} pluginName - The name of the plugin. - * @param {Function} ctor - The constructor function or class for the plugin. - */ - Renderer.registerPlugin = function (pluginName, ctor) { - Renderer.__plugins = Renderer.__plugins || {}; - Renderer.__plugins[pluginName] = ctor; - }; - return Renderer; - }(AbstractRenderer)); - - /** - * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by - * the browser then this function will return a canvas renderer - * - * @memberof PIXI - * @function autoDetectRenderer - * @param {object} [options] - The optional renderer parameters - * @param {number} [options.width=800] - the width of the renderers view - * @param {number} [options.height=600] - the height of the renderers view - * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional - * @param {boolean} [options.transparent=false] - If the render view is transparent, default false - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1 - * @param {boolean} [options.antialias=false] - sets antialias - * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you - * need to call toDataUrl on the webgl context - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2 - * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this - * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise - * it is ignored. - * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" - * for devices with dual graphics card **webgl only** - * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer - */ - function autoDetectRenderer(options) { - return Renderer.create(options); - } - - var _default = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; - - var defaultFilter = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; - - /** - * Used by the batcher to draw batches. - * Each one of these contains all information required to draw a bound geometry. - * - * @class - * @memberof PIXI - */ - var BatchDrawCall = /** @class */ (function () { - function BatchDrawCall() { - this.texArray = null; - this.blend = 0; - this.type = exports.DRAW_MODES.TRIANGLES; - this.start = 0; - this.size = 0; - /** - * data for uniforms or custom webgl state - * @member {object} - */ - this.data = null; - } - return BatchDrawCall; - }()); - - /** - * Used by the batcher to build texture batches. - * Holds list of textures and their respective locations. - * - * @class - * @memberof PIXI - */ - var BatchTextureArray = /** @class */ (function () { - function BatchTextureArray() { - /** - * inside textures array - * @member {PIXI.BaseTexture[]} - */ - this.elements = []; - /** - * Respective locations for textures - * @member {number[]} - */ - this.ids = []; - /** - * number of filled elements - * @member {number} - */ - this.count = 0; - } - BatchTextureArray.prototype.clear = function () { - for (var i = 0; i < this.count; i++) { - this.elements[i] = null; - } - this.count = 0; - }; - return BatchTextureArray; - }()); - - /** - * Flexible wrapper around `ArrayBuffer` that also provides - * typed array views on demand. - * - * @class - * @memberof PIXI - */ - var ViewableBuffer = /** @class */ (function () { - /** - * @param {number} size - The size of the buffer in bytes. - */ - function ViewableBuffer(size) { - /** - * Underlying `ArrayBuffer` that holds all the data - * and is of capacity `size`. - * - * @member {ArrayBuffer} - */ - this.rawBinaryData = new ArrayBuffer(size); - /** - * View on the raw binary data as a `Uint32Array`. - * - * @member {Uint32Array} - */ - this.uint32View = new Uint32Array(this.rawBinaryData); - /** - * View on the raw binary data as a `Float32Array`. - * - * @member {Float32Array} - */ - this.float32View = new Float32Array(this.rawBinaryData); - } - Object.defineProperty(ViewableBuffer.prototype, "int8View", { - /** - * View on the raw binary data as a `Int8Array`. - * - * @member {Int8Array} - */ - get: function () { - if (!this._int8View) { - this._int8View = new Int8Array(this.rawBinaryData); - } - return this._int8View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "uint8View", { - /** - * View on the raw binary data as a `Uint8Array`. - * - * @member {Uint8Array} - */ - get: function () { - if (!this._uint8View) { - this._uint8View = new Uint8Array(this.rawBinaryData); - } - return this._uint8View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "int16View", { - /** - * View on the raw binary data as a `Int16Array`. - * - * @member {Int16Array} - */ - get: function () { - if (!this._int16View) { - this._int16View = new Int16Array(this.rawBinaryData); - } - return this._int16View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "uint16View", { - /** - * View on the raw binary data as a `Uint16Array`. - * - * @member {Uint16Array} - */ - get: function () { - if (!this._uint16View) { - this._uint16View = new Uint16Array(this.rawBinaryData); - } - return this._uint16View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "int32View", { - /** - * View on the raw binary data as a `Int32Array`. - * - * @member {Int32Array} - */ - get: function () { - if (!this._int32View) { - this._int32View = new Int32Array(this.rawBinaryData); - } - return this._int32View; - }, - enumerable: false, - configurable: true - }); - /** - * Returns the view of the given type. - * - * @param {string} type - One of `int8`, `uint8`, `int16`, - * `uint16`, `int32`, `uint32`, and `float32`. - * @return {object} typed array of given type - */ - ViewableBuffer.prototype.view = function (type) { - return this[type + "View"]; - }; - /** - * Destroys all buffer references. Do not use after calling - * this. - */ - ViewableBuffer.prototype.destroy = function () { - this.rawBinaryData = null; - this._int8View = null; - this._uint8View = null; - this._int16View = null; - this._uint16View = null; - this._int32View = null; - this.uint32View = null; - this.float32View = null; - }; - ViewableBuffer.sizeOf = function (type) { - switch (type) { - case 'int8': - case 'uint8': - return 1; - case 'int16': - case 'uint16': - return 2; - case 'int32': - case 'uint32': - case 'float32': - return 4; - default: - throw new Error(type + " isn't a valid view type"); - } - }; - return ViewableBuffer; - }()); - - /** - * Renderer dedicated to drawing and batching sprites. - * - * This is the default batch renderer. It buffers objects - * with texture-based geometries and renders them in - * batches. It uploads multiple textures to the GPU to - * reduce to the number of draw calls. - * - * @class - * @protected - * @memberof PIXI - * @extends PIXI.ObjectRenderer - */ - var AbstractBatchRenderer = /** @class */ (function (_super) { - __extends$2(AbstractBatchRenderer, _super); - /** - * This will hook onto the renderer's `contextChange` - * and `prerender` signals. - * - * @param {PIXI.Renderer} renderer - The renderer this works for. - */ - function AbstractBatchRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * This is used to generate a shader that can - * color each vertex based on a `aTextureId` - * attribute that points to an texture in `uSampler`. - * - * This enables the objects with different textures - * to be drawn in the same draw call. - * - * You can customize your shader by creating your - * custom shader generator. - * - * @member {PIXI.BatchShaderGenerator} - * @protected - */ - _this.shaderGenerator = null; - /** - * The class that represents the geometry of objects - * that are going to be batched with this. - * - * @member {object} - * @default PIXI.BatchGeometry - * @protected - */ - _this.geometryClass = null; - /** - * Size of data being buffered per vertex in the - * attribute buffers (in floats). By default, the - * batch-renderer plugin uses 6: - * - * | aVertexPosition | 2 | - * |-----------------|---| - * | aTextureCoords | 2 | - * | aColor | 1 | - * | aTextureId | 1 | - * - * @member {number} - * @readonly - */ - _this.vertexSize = null; - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - /** - * The number of bufferable objects before a flush - * occurs automatically. - * - * @member {number} - * @default settings.SPRITE_BATCH_SIZE * 4 - */ - _this.size = settings.SPRITE_BATCH_SIZE * 4; - /** - * Total count of all vertices used by the currently - * buffered objects. - * - * @member {number} - * @private - */ - _this._vertexCount = 0; - /** - * Total count of all indices used by the currently - * buffered objects. - * - * @member {number} - * @private - */ - _this._indexCount = 0; - /** - * Buffer of objects that are yet to be rendered. - * - * @member {PIXI.DisplayObject[]} - * @private - */ - _this._bufferedElements = []; - /** - * Data for texture batch builder, helps to save a bit of CPU on a pass. - * @type {PIXI.BaseTexture[]} - * @private - */ - _this._bufferedTextures = []; - /** - * Number of elements that are buffered and are - * waiting to be flushed. - * - * @member {number} - * @private - */ - _this._bufferSize = 0; - /** - * This shader is generated by `this.shaderGenerator`. - * - * It is generated specifically to handle the required - * number of textures being batched together. - * - * @member {PIXI.Shader} - * @protected - */ - _this._shader = null; - /** - * Pool of `this.geometryClass` geometry objects - * that store buffers. They are used to pass data - * to the shader on each draw call. - * - * These are never re-allocated again, unless a - * context change occurs; however, the pool may - * be expanded if required. - * - * @member {PIXI.Geometry[]} - * @private - * @see PIXI.AbstractBatchRenderer.contextChange - */ - _this._packedGeometries = []; - /** - * Size of `this._packedGeometries`. It can be expanded - * if more than `this._packedGeometryPoolSize` flushes - * occur in a single frame. - * - * @member {number} - * @private - */ - _this._packedGeometryPoolSize = 2; - /** - * A flush may occur multiple times in a single - * frame. On iOS devices or when - * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the - * batch renderer does not upload data to the same - * `WebGLBuffer` for performance reasons. - * - * This is the index into `packedGeometries` that points to - * geometry holding the most recent buffers. - * - * @member {number} - * @private - */ - _this._flushId = 0; - /** - * Pool of `ViewableBuffer` objects that are sorted in - * order of increasing size. The flush method uses - * the buffer with the least size above the amount - * it requires. These are used for passing attributes. - * - * The first buffer has a size of 8; each subsequent - * buffer has double capacity of its previous. - * - * @member {PIXI.ViewableBuffer[]} - * @private - * @see PIXI.AbstractBatchRenderer#getAttributeBuffer - */ - _this._aBuffers = {}; - /** - * Pool of `Uint16Array` objects that are sorted in - * order of increasing size. The flush method uses - * the buffer with the least size above the amount - * it requires. These are used for passing indices. - * - * The first buffer has a size of 12; each subsequent - * buffer has double capacity of its previous. - * - * @member {Uint16Array[]} - * @private - * @see PIXI.AbstractBatchRenderer#getIndexBuffer - */ - _this._iBuffers = {}; - /** - * Maximum number of textures that can be uploaded to - * the GPU under the current context. It is initialized - * properly in `this.contextChange`. - * - * @member {number} - * @see PIXI.AbstractBatchRenderer#contextChange - * @readonly - */ - _this.MAX_TEXTURES = 1; - _this.renderer.on('prerender', _this.onPrerender, _this); - renderer.runners.contextChange.add(_this); - _this._dcIndex = 0; - _this._aIndex = 0; - _this._iIndex = 0; - _this._attributeBuffer = null; - _this._indexBuffer = null; - _this._tempBoundTextures = []; - return _this; - } - /** - * Handles the `contextChange` signal. - * - * It calculates `this.MAX_TEXTURES` and allocating the - * packed-geometry object pool. - */ - AbstractBatchRenderer.prototype.contextChange = function () { - var gl = this.renderer.gl; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - this.MAX_TEXTURES = 1; - } - else { - // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); - // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); - } - this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); - // we use the second shader as the first one depending on your browser - // may omit aTextureId as it is not used by the shader so is optimized out. - for (var i = 0; i < this._packedGeometryPoolSize; i++) { - /* eslint-disable max-len */ - this._packedGeometries[i] = new (this.geometryClass)(); - } - this.initFlushBuffers(); - }; - /** - * Makes sure that static and dynamic flush pooled objects have correct dimensions - */ - AbstractBatchRenderer.prototype.initFlushBuffers = function () { - var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; - // max draw calls - var MAX_SPRITES = this.size / 4; - // max texture arrays - var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; - while (_drawCallPool.length < MAX_SPRITES) { - _drawCallPool.push(new BatchDrawCall()); - } - while (_textureArrayPool.length < MAX_TA) { - _textureArrayPool.push(new BatchTextureArray()); - } - for (var i = 0; i < this.MAX_TEXTURES; i++) { - this._tempBoundTextures[i] = null; - } - }; - /** - * Handles the `prerender` signal. - * - * It ensures that flushes start from the first geometry - * object again. - */ - AbstractBatchRenderer.prototype.onPrerender = function () { - this._flushId = 0; - }; - /** - * Buffers the "batchable" object. It need not be rendered - * immediately. - * - * @param {PIXI.DisplayObject} element - the element to render when - * using this renderer - */ - AbstractBatchRenderer.prototype.render = function (element) { - if (!element._texture.valid) { - return; - } - if (this._vertexCount + (element.vertexData.length / 2) > this.size) { - this.flush(); - } - this._vertexCount += element.vertexData.length / 2; - this._indexCount += element.indices.length; - this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; - this._bufferedElements[this._bufferSize++] = element; - }; - AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { - var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; - var textureArrays = AbstractBatchRenderer._textureArrayPool; - var batch = this.renderer.batch; - var boundTextures = this._tempBoundTextures; - var touch = this.renderer.textureGC.count; - var TICK = ++BaseTexture._globalBatch; - var countTexArrays = 0; - var texArray = textureArrays[0]; - var start = 0; - batch.copyBoundTextures(boundTextures, MAX_TEXTURES); - for (var i = 0; i < this._bufferSize; ++i) { - var tex = textures[i]; - textures[i] = null; - if (tex._batchEnabled === TICK) { - continue; - } - if (texArray.count >= MAX_TEXTURES) { - batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); - this.buildDrawCalls(texArray, start, i); - start = i; - texArray = textureArrays[++countTexArrays]; - ++TICK; - } - tex._batchEnabled = TICK; - tex.touched = touch; - texArray.elements[texArray.count++] = tex; - } - if (texArray.count > 0) { - batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); - this.buildDrawCalls(texArray, start, this._bufferSize); - ++countTexArrays; - ++TICK; - } - // Clean-up - for (var i = 0; i < boundTextures.length; i++) { - boundTextures[i] = null; - } - BaseTexture._globalBatch = TICK; - }; - /** - * Populating drawcalls for rendering - * - * @param {PIXI.BatchTextureArray} texArray - * @param {number} start - * @param {number} finish - */ - AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { - var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; - var drawCalls = AbstractBatchRenderer._drawCallPool; - var dcIndex = this._dcIndex; - var aIndex = this._aIndex; - var iIndex = this._iIndex; - var drawCall = drawCalls[dcIndex]; - drawCall.start = this._iIndex; - drawCall.texArray = texArray; - for (var i = start; i < finish; ++i) { - var sprite = elements[i]; - var tex = sprite._texture.baseTexture; - var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; - elements[i] = null; - if (start < i && drawCall.blend !== spriteBlendMode) { - drawCall.size = iIndex - drawCall.start; - start = i; - drawCall = drawCalls[++dcIndex]; - drawCall.texArray = texArray; - drawCall.start = iIndex; - } - this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); - aIndex += sprite.vertexData.length / 2 * vertexSize; - iIndex += sprite.indices.length; - drawCall.blend = spriteBlendMode; - } - if (start < finish) { - drawCall.size = iIndex - drawCall.start; - ++dcIndex; - } - this._dcIndex = dcIndex; - this._aIndex = aIndex; - this._iIndex = iIndex; - }; - /** - * Bind textures for current rendering - * - * @param {PIXI.BatchTextureArray} texArray - */ - AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { - var textureSystem = this.renderer.texture; - for (var j = 0; j < texArray.count; j++) { - textureSystem.bind(texArray.elements[j], texArray.ids[j]); - texArray.elements[j] = null; - } - texArray.count = 0; - }; - AbstractBatchRenderer.prototype.updateGeometry = function () { - var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; - if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't - like uploads to the same buffer in a single frame. */ - if (this._packedGeometryPoolSize <= this._flushId) { - this._packedGeometryPoolSize++; - packedGeometries[this._flushId] = new (this.geometryClass)(); - } - packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); - packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.bind(packedGeometries[this._flushId]); - this.renderer.geometry.updateBuffers(); - this._flushId++; - } - else { - // lets use the faster option, always use buffer number 0 - packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); - packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.updateBuffers(); - } - }; - AbstractBatchRenderer.prototype.drawBatches = function () { - var dcCount = this._dcIndex; - var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; - var drawCalls = AbstractBatchRenderer._drawCallPool; - var curTexArray = null; - // Upload textures and do the draw calls - for (var i = 0; i < dcCount; i++) { - var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; - if (curTexArray !== texArray) { - curTexArray = texArray; - this.bindAndClearTexArray(texArray); - } - this.state.blendMode = blend; - stateSystem.set(this.state); - gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); - } - }; - /** - * Renders the content _now_ and empties the current batch. - */ - AbstractBatchRenderer.prototype.flush = function () { - if (this._vertexCount === 0) { - return; - } - this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); - this._indexBuffer = this.getIndexBuffer(this._indexCount); - this._aIndex = 0; - this._iIndex = 0; - this._dcIndex = 0; - this.buildTexturesAndDrawCalls(); - this.updateGeometry(); - this.drawBatches(); - // reset elements buffer for the next flush - this._bufferSize = 0; - this._vertexCount = 0; - this._indexCount = 0; - }; - /** - * Starts a new sprite batch. - */ - AbstractBatchRenderer.prototype.start = function () { - this.renderer.state.set(this.state); - this.renderer.shader.bind(this._shader); - if (settings.CAN_UPLOAD_SAME_BUFFER) { - // bind buffer #0, we don't need others - this.renderer.geometry.bind(this._packedGeometries[this._flushId]); - } - }; - /** - * Stops and flushes the current batch. - */ - AbstractBatchRenderer.prototype.stop = function () { - this.flush(); - }; - /** - * Destroys this `AbstractBatchRenderer`. It cannot be used again. - */ - AbstractBatchRenderer.prototype.destroy = function () { - for (var i = 0; i < this._packedGeometryPoolSize; i++) { - if (this._packedGeometries[i]) { - this._packedGeometries[i].destroy(); - } - } - this.renderer.off('prerender', this.onPrerender, this); - this._aBuffers = null; - this._iBuffers = null; - this._packedGeometries = null; - this._attributeBuffer = null; - this._indexBuffer = null; - if (this._shader) { - this._shader.destroy(); - this._shader = null; - } - _super.prototype.destroy.call(this); - }; - /** - * Fetches an attribute buffer from `this._aBuffers` that - * can hold atleast `size` floats. - * - * @param {number} size - minimum capacity required - * @return {ViewableBuffer} - buffer than can hold atleast `size` floats - * @private - */ - AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { - // 8 vertices is enough for 2 quads - var roundedP2 = nextPow2(Math.ceil(size / 8)); - var roundedSizeIndex = log2(roundedP2); - var roundedSize = roundedP2 * 8; - if (this._aBuffers.length <= roundedSizeIndex) { - this._iBuffers.length = roundedSizeIndex + 1; - } - var buffer = this._aBuffers[roundedSize]; - if (!buffer) { - this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); - } - return buffer; - }; - /** - * Fetches an index buffer from `this._iBuffers` that can - * have at least `size` capacity. - * - * @param {number} size - minimum required capacity - * @return {Uint16Array} - buffer that can fit `size` - * indices. - * @private - */ - AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { - // 12 indices is enough for 2 quads - var roundedP2 = nextPow2(Math.ceil(size / 12)); - var roundedSizeIndex = log2(roundedP2); - var roundedSize = roundedP2 * 12; - if (this._iBuffers.length <= roundedSizeIndex) { - this._iBuffers.length = roundedSizeIndex + 1; - } - var buffer = this._iBuffers[roundedSizeIndex]; - if (!buffer) { - this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); - } - return buffer; - }; - /** - * Takes the four batching parameters of `element`, interleaves - * and pushes them into the batching attribute/index buffers given. - * - * It uses these properties: `vertexData` `uvs`, `textureId` and - * `indicies`. It also uses the "tint" of the base-texture, if - * present. - * - * @param {PIXI.Sprite} element - element being rendered - * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer. - * @param {Uint16Array} indexBuffer - index buffer - * @param {number} aIndex - number of floats already in the attribute buffer - * @param {number} iIndex - number of indices already in `indexBuffer` - */ - AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { - var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; - var packedVertices = aIndex / this.vertexSize; - var uvs = element.uvs; - var indicies = element.indices; - var vertexData = element.vertexData; - var textureId = element._texture.baseTexture._batchLocation; - var alpha = Math.min(element.worldAlpha, 1.0); - var argb = (alpha < 1.0 - && element._texture.baseTexture.alphaMode) - ? premultiplyTint(element._tintRGB, alpha) - : element._tintRGB + (alpha * 255 << 24); - // lets not worry about tint! for now.. - for (var i = 0; i < vertexData.length; i += 2) { - float32View[aIndex++] = vertexData[i]; - float32View[aIndex++] = vertexData[i + 1]; - float32View[aIndex++] = uvs[i]; - float32View[aIndex++] = uvs[i + 1]; - uint32View[aIndex++] = argb; - float32View[aIndex++] = textureId; - } - for (var i = 0; i < indicies.length; i++) { - indexBuffer[iIndex++] = packedVertices + indicies[i]; - } - }; - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchDrawCall[]} - */ - AbstractBatchRenderer._drawCallPool = []; - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchTextureArray[]} - */ - AbstractBatchRenderer._textureArrayPool = []; - return AbstractBatchRenderer; - }(ObjectRenderer)); - - /** - * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer - * - * @class - * @memberof PIXI - */ - var BatchShaderGenerator = /** @class */ (function () { - /** - * @param {string} vertexSrc - Vertex shader - * @param {string} fragTemplate - Fragment shader template - */ - function BatchShaderGenerator(vertexSrc, fragTemplate) { - /** - * Reference to the vertex shader source. - * - * @member {string} - */ - this.vertexSrc = vertexSrc; - /** - * Reference to the fragement shader template. Must contain "%count%" and "%forloop%". - * - * @member {string} - */ - this.fragTemplate = fragTemplate; - this.programCache = {}; - this.defaultGroupCache = {}; - if (fragTemplate.indexOf('%count%') < 0) { - throw new Error('Fragment template must contain "%count%".'); - } - if (fragTemplate.indexOf('%forloop%') < 0) { - throw new Error('Fragment template must contain "%forloop%".'); - } - } - BatchShaderGenerator.prototype.generateShader = function (maxTextures) { - if (!this.programCache[maxTextures]) { - var sampleValues = new Int32Array(maxTextures); - for (var i = 0; i < maxTextures; i++) { - sampleValues[i] = i; - } - this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); - var fragmentSrc = this.fragTemplate; - fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); - fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); - this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); - } - var uniforms = { - tint: new Float32Array([1, 1, 1, 1]), - translationMatrix: new Matrix(), - default: this.defaultGroupCache[maxTextures], - }; - return new Shader(this.programCache[maxTextures], uniforms); - }; - BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { - var src = ''; - src += '\n'; - src += '\n'; - for (var i = 0; i < maxTextures; i++) { - if (i > 0) { - src += '\nelse '; - } - if (i < maxTextures - 1) { - src += "if(vTextureId < " + i + ".5)"; - } - src += '\n{'; - src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; - src += '\n}'; - } - src += '\n'; - src += '\n'; - return src; - }; - return BatchShaderGenerator; - }()); - - /** - * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). - * - * @class - * @memberof PIXI - */ - var BatchGeometry = /** @class */ (function (_super) { - __extends$2(BatchGeometry, _super); - /** - * @param {boolean} [_static=false] - Optimization flag, where `false` - * is updated every frame, `true` doesn't change frame-to-frame. - */ - function BatchGeometry(_static) { - if (_static === void 0) { _static = false; } - var _this = _super.call(this) || this; - /** - * Buffer used for position, color, texture IDs - * - * @member {PIXI.Buffer} - * @protected - */ - _this._buffer = new Buffer(null, _static, false); - /** - * Index buffer data - * - * @member {PIXI.Buffer} - * @protected - */ - _this._indexBuffer = new Buffer(null, _static, true); - _this.addAttribute('aVertexPosition', _this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', _this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aColor', _this._buffer, 4, true, exports.TYPES.UNSIGNED_BYTE) - .addAttribute('aTextureId', _this._buffer, 1, true, exports.TYPES.FLOAT) - .addIndex(_this._indexBuffer); - return _this; - } - return BatchGeometry; - }(Geometry)); - - var defaultVertex$2 = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; - - var defaultFragment$2 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; - - /** - * @class - * @memberof PIXI - * @hideconstructor - */ - var BatchPluginFactory = /** @class */ (function () { - function BatchPluginFactory() { - } - /** - * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way - * to extend BatchRenderer with all the necessary pieces. - * @example - * const fragment = ` - * varying vec2 vTextureCoord; - * varying vec4 vColor; - * varying float vTextureId; - * uniform sampler2D uSamplers[%count%]; - * - * void main(void){ - * vec4 color; - * %forloop% - * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); - * } - * `; - * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); - * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer); - * const sprite = new PIXI.Sprite(); - * sprite.pluginName = 'invert'; - * - * @static - * @param {object} [options] - * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source - * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template - * @param {number} [options.vertexSize=6] - Vertex size - * @param {object} [options.geometryClass=PIXI.BatchGeometry] - * @return {*} New batch renderer plugin - */ - BatchPluginFactory.create = function (options) { - var _a = Object.assign({ - vertex: defaultVertex$2, - fragment: defaultFragment$2, - geometryClass: BatchGeometry, - vertexSize: 6, - }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; - return /** @class */ (function (_super) { - __extends$2(BatchPlugin, _super); - function BatchPlugin(renderer) { - var _this = _super.call(this, renderer) || this; - _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); - _this.geometryClass = geometryClass; - _this.vertexSize = vertexSize; - return _this; - } - return BatchPlugin; - }(AbstractBatchRenderer)); - }; - Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultVertex$2; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultFragment$2; - }, - enumerable: false, - configurable: true - }); - return BatchPluginFactory; - }()); - // Setup the default BatchRenderer plugin, this is what - // we'll actually export at the root level - var BatchRenderer = BatchPluginFactory.create(); - - /*! - * @pixi/app - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/app is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Convenience class to create a new PIXI application. - * - * This class automatically creates the renderer, ticker and root container. - * - * @example - * // Create the application - * const app = new PIXI.Application(); - * - * // Add the view to the DOM - * document.body.appendChild(app.view); - * - * // ex, add display objects - * app.stage.addChild(PIXI.Sprite.from('something.png')); - * - * @class - * @memberof PIXI - */ - var Application = /** @class */ (function () { - /** - * @param {object} [options] - The optional renderer parameters. - * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. - * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set - * options.sharedTicker to true in case that it is already started. Stop it by your own. - * @param {number} [options.width=800] - The width of the renderers view. - * @param {number} [options.height=600] - The height of the renderers view. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you - * need to call toDataUrl on the WebGL context. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2. - * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this - * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise - * it is ignored. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" - * for devices with dual graphics card. **(WebGL only)**. - * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker. - * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker. - * The system ticker will always run before both the shared ticker and the app ticker. - * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader. - * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to. - */ - function Application(options) { - var _this = this; - // The default options - options = Object.assign({ - forceCanvas: false, - }, options); - /** - * WebGL renderer if available, otherwise CanvasRenderer. - * @member {PIXI.Renderer|PIXI.CanvasRenderer} - */ - this.renderer = autoDetectRenderer(options); - /** - * The root display container that's rendered. - * @member {PIXI.Container} - */ - this.stage = new Container(); - // install plugins here - Application._plugins.forEach(function (plugin) { - plugin.init.call(_this, options); - }); - } - /** - * Register a middleware plugin for the application - * @static - * @param {PIXI.Application.Plugin} plugin - Plugin being installed - */ - Application.registerPlugin = function (plugin) { - Application._plugins.push(plugin); - }; - /** - * Render the current stage. - */ - Application.prototype.render = function () { - // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject - // This can be fixed when CanvasRenderer is converted. - this.renderer.render(this.stage); - }; - Object.defineProperty(Application.prototype, "view", { - /** - * Reference to the renderer's canvas element. - * @member {HTMLCanvasElement} - * @readonly - */ - get: function () { - return this.renderer.view; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Application.prototype, "screen", { - /** - * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. - * @member {PIXI.Rectangle} - * @readonly - */ - get: function () { - return this.renderer.screen; - }, - enumerable: false, - configurable: true - }); - /** - * Destroy and don't use after this. - * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM. - * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy - * method called as well. 'stageOptions' will be passed on to those calls. - * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the texture of the child sprite - * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the base texture of the child sprite - */ - Application.prototype.destroy = function (removeView, stageOptions) { - var _this = this; - // Destroy plugins in the opposite order - // which they were constructed - var plugins = Application._plugins.slice(0); - plugins.reverse(); - plugins.forEach(function (plugin) { - plugin.destroy.call(_this); - }); - this.stage.destroy(stageOptions); - this.stage = null; - this.renderer.destroy(removeView); - this.renderer = null; - }; - return Application; - }()); - /** - * @memberof PIXI.Application - * @typedef {object} Plugin - * @property {function} init - Called when Application is constructed, scoped to Application instance. - * Passes in `options` as the only argument, which are Application constructor options. - * @property {function} destroy - Called when destroying Application, scoped to Application instance - */ - /** - * Collection of installed plugins. - * @static - * @private - * @type {PIXI.Application.Plugin[]} - */ - Application._plugins = []; - - /** - * Middleware for for Application's resize functionality - * @private - * @class - */ - var ResizePlugin = /** @class */ (function () { - function ResizePlugin() { - } - /** - * Initialize the plugin with scope of application instance - * @static - * @private - * @param {object} [options] - See application options - */ - ResizePlugin.init = function (options) { - var _this = this; - /** - * The HTML element or window to automatically resize the - * renderer's view element to match width and height. - * @type {Window|HTMLElement} - * @name resizeTo - * @memberof PIXI.Application# - */ - Object.defineProperty(this, 'resizeTo', { - set: function (dom) { - window.removeEventListener('resize', this.queueResize); - this._resizeTo = dom; - if (dom) { - window.addEventListener('resize', this.queueResize); - this.resize(); - } - }, - get: function () { - return this._resizeTo; - }, - }); - /** - * Resize is throttled, so it's - * safe to call this multiple times per frame and it'll - * only be called once. - * @method PIXI.Application#queueResize - */ - this.queueResize = function () { - if (!_this._resizeTo) { - return; - } - _this.cancelResize(); - // // Throttle resize events per raf - _this._resizeId = requestAnimationFrame(function () { return _this.resize(); }); - }; - /** - * Cancel the resize queue. - * @method PIXI.Application#cancelResize - * @private - */ - this.cancelResize = function () { - if (_this._resizeId) { - cancelAnimationFrame(_this._resizeId); - _this._resizeId = null; - } - }; - /** - * Execute an immediate resize on the renderer, this is not - * throttled and can be expensive to call many times in a row. - * Will resize only if `resizeTo` property is set. - * @method PIXI.Application#resize - */ - this.resize = function () { - if (!_this._resizeTo) { - return; - } - // clear queue resize - _this.cancelResize(); - var width; - var height; - // Resize to the window - if (_this._resizeTo === window) { - width = window.innerWidth; - height = window.innerHeight; - } - // Resize to other HTML entities - else { - var _a = _this._resizeTo, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight; - width = clientWidth; - height = clientHeight; - } - _this.renderer.resize(width, height); - }; - // On resize - this._resizeId = null; - this._resizeTo = null; - this.resizeTo = options.resizeTo || null; - }; - /** - * Clean up the ticker, scoped to application - * @static - * @private - */ - ResizePlugin.destroy = function () { - this.cancelResize(); - this.cancelResize = null; - this.queueResize = null; - this.resizeTo = null; - this.resize = null; - }; - return ResizePlugin; - }()); - - Application.registerPlugin(ResizePlugin); - - /*! - * @pixi/extract - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/extract is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var TEMP_RECT = new Rectangle(); - var BYTES_PER_PIXEL = 4; - /** - * This class provides renderer-specific plugins for exporting content from a renderer. - * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels). - * - * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. - * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. - * @example - * // Create a new app (will auto-add extract plugin to renderer) - * const app = new PIXI.Application(); - * - * // Draw a red circle - * const graphics = new PIXI.Graphics() - * .beginFill(0xFF0000) - * .drawCircle(0, 0, 50); - * - * // Render the graphics as an HTMLImageElement - * const image = app.renderer.plugins.extract.image(graphics); - * document.body.appendChild(image); - * @class - * @memberof PIXI - */ - var Extract = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer - */ - function Extract(renderer) { - this.renderer = renderer; - /** - * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture - * - * @member {PIXI.Extract} extract - * @memberof PIXI.Renderer# - * @see PIXI.Extract - */ - renderer.extract = this; - } - /** - * Will return a HTML Image of the target - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {HTMLImageElement} HTML Image of the target - */ - Extract.prototype.image = function (target, format, quality) { - var image = new Image(); - image.src = this.base64(target, format, quality); - return image; - }; - /** - * Will return a a base64 encoded string of this target. It works by calling - * `Extract.getCanvas` and then running toDataURL on that. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {string} A base64 encoded string of the texture. - */ - Extract.prototype.base64 = function (target, format, quality) { - return this.canvas(target).toDataURL(format, quality); - }; - /** - * Creates a Canvas element, renders this target to it and then returns it. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ - Extract.prototype.canvas = function (target) { - var renderer = this.renderer; - var resolution; - var frame; - var flipY = false; - var renderTexture; - var generated = false; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = this.renderer.generateTexture(target); - generated = true; - } - } - if (renderTexture) { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - flipY = false; - renderer.renderTexture.bind(renderTexture); - } - else { - resolution = this.renderer.resolution; - flipY = true; - frame = TEMP_RECT; - frame.width = this.renderer.width; - frame.height = this.renderer.height; - renderer.renderTexture.bind(null); - } - var width = Math.floor((frame.width * resolution) + 1e-4); - var height = Math.floor((frame.height * resolution) + 1e-4); - var canvasBuffer = new CanvasRenderTarget(width, height, 1); - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - // read pixels to the array - var gl = renderer.gl; - gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); - // add the pixels to the canvas - var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); - Extract.arrayPostDivide(webglPixels, canvasData.data); - canvasBuffer.context.putImageData(canvasData, 0, 0); - // pulling pixels - if (flipY) { - var target_1 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1); - target_1.context.scale(1, -1); - // we can't render to itself because we should be empty before render. - target_1.context.drawImage(canvasBuffer.canvas, 0, -height); - canvasBuffer.destroy(); - canvasBuffer = target_1; - } - if (generated) { - renderTexture.destroy(true); - } - // send the canvas back.. - return canvasBuffer.canvas; - }; - /** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA - * order, with integer values between 0 and 255 (included). - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture - */ - Extract.prototype.pixels = function (target) { - var renderer = this.renderer; - var resolution; - var frame; - var renderTexture; - var generated = false; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = this.renderer.generateTexture(target); - generated = true; - } - } - if (renderTexture) { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - // bind the buffer - renderer.renderTexture.bind(renderTexture); - } - else { - resolution = renderer.resolution; - frame = TEMP_RECT; - frame.width = renderer.width; - frame.height = renderer.height; - renderer.renderTexture.bind(null); - } - var width = frame.width * resolution; - var height = frame.height * resolution; - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - // read pixels to the array - var gl = renderer.gl; - gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); - if (generated) { - renderTexture.destroy(true); - } - Extract.arrayPostDivide(webglPixels, webglPixels); - return webglPixels; - }; - /** - * Destroys the extract - * - */ - Extract.prototype.destroy = function () { - this.renderer.extract = null; - this.renderer = null; - }; - /** - * Takes premultiplied pixel data and produces regular pixel data - * - * @private - * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data - * @param out {number[] | Uint8Array | Uint8ClampedArray} output array - */ - Extract.arrayPostDivide = function (pixels, out) { - for (var i = 0; i < pixels.length; i += 4) { - var alpha = out[i + 3] = pixels[i + 3]; - if (alpha !== 0) { - out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0)); - out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0)); - out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0)); - } - else { - out[i] = pixels[i]; - out[i + 1] = pixels[i + 1]; - out[i + 2] = pixels[i + 2]; - } - } - }; - return Extract; - }()); - - 'use strict'; - - function parseURI (str, opts) { - if (!str) { return undefined } - - opts = opts || {}; - - var o = { - key: [ - 'source', - 'protocol', - 'authority', - 'userInfo', - 'user', - 'password', - 'host', - 'port', - 'relative', - 'path', - 'directory', - 'file', - 'query', - 'anchor' - ], - q: { - name: 'queryKey', - parser: /(?:^|&)([^&=]*)=?([^&]*)/g - }, - parser: { - strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, - loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ - } - }; - - var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); - var uri = {}; - var i = 14; - - while (i--) { uri[o.key[i]] = m[i] || ''; } - - uri[o.q.name] = {}; - uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { - if ($1) { uri[o.q.name][$1] = $2; } - }); - - return uri - } - - var parseUri = parseURI; - - var miniSignals = createCommonjsModule(function (module, exports) { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; })(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - - var MiniSignalBinding = (function () { - function MiniSignalBinding(fn, once, thisArg) { - if (once === undefined) { once = false; } - - _classCallCheck(this, MiniSignalBinding); - - this._fn = fn; - this._once = once; - this._thisArg = thisArg; - this._next = this._prev = this._owner = null; - } - - _createClass(MiniSignalBinding, [{ - key: 'detach', - value: function detach() { - if (this._owner === null) { return false; } - this._owner.detach(this); - return true; - } - }]); - - return MiniSignalBinding; - })(); - - function _addMiniSignalBinding(self, node) { - if (!self._head) { - self._head = node; - self._tail = node; - } else { - self._tail._next = node; - node._prev = self._tail; - self._tail = node; - } - - node._owner = self; - - return node; - } - - var MiniSignal = (function () { - function MiniSignal() { - _classCallCheck(this, MiniSignal); - - this._head = this._tail = undefined; - } - - _createClass(MiniSignal, [{ - key: 'handlers', - value: function handlers() { - var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var node = this._head; - - if (exists) { return !!node; } - - var ee = []; - - while (node) { - ee.push(node); - node = node._next; - } - - return ee; - } - }, { - key: 'has', - value: function has(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); - } - - return node._owner === this; - } - }, { - key: 'dispatch', - value: function dispatch() { - var arguments$1 = arguments; - - var node = this._head; - - if (!node) { return false; } - - while (node) { - if (node._once) { this.detach(node); } - node._fn.apply(node._thisArg, arguments$1); - node = node._next; - } - - return true; - } - }, { - key: 'add', - value: function add(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#add(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); - } - }, { - key: 'once', - value: function once(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#once(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); - } - }, { - key: 'detach', - value: function detach(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); - } - if (node._owner !== this) { return this; } - - if (node._prev) { node._prev._next = node._next; } - if (node._next) { node._next._prev = node._prev; } - - if (node === this._head) { - this._head = node._next; - if (node._next === null) { - this._tail = null; - } - } else if (node === this._tail) { - this._tail = node._prev; - this._tail._next = null; - } - - node._owner = null; - return this; - } - }, { - key: 'detachAll', - value: function detachAll() { - var node = this._head; - if (!node) { return this; } - - this._head = this._tail = null; - - while (node) { - node._owner = null; - node = node._next; - } - return this; - } - }]); - - return MiniSignal; - })(); - - MiniSignal.MiniSignalBinding = MiniSignalBinding; - - exports['default'] = MiniSignal; - module.exports = exports['default']; - }); - - var Signal = unwrapExports(miniSignals); - - /*! - * resource-loader - v3.0.1 - * https://github.com/pixijs/pixi-sound - * Compiled Tue, 02 Jul 2019 14:06:18 UTC - * - * resource-loader is licensed under the MIT license. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Smaller version of the async library constructs. - * - * @namespace async - */ - - /** - * Noop function - * - * @ignore - * @function - * @memberof async - */ - function _noop() {} - /* empty */ - - /** - * Iterates an array in series. - * - * @memberof async - * @function eachSeries - * @param {Array.<*>} array - Array to iterate. - * @param {function} iterator - Function to call for each element. - * @param {function} callback - Function to call when done, or on error. - * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. - */ - - - function eachSeries(array, iterator, callback, deferNext) { - var i = 0; - var len = array.length; - - (function next(err) { - if (err || i === len) { - if (callback) { - callback(err); - } - - return; - } - - if (deferNext) { - setTimeout(function () { - iterator(array[i++], next); - }, 1); - } else { - iterator(array[i++], next); - } - })(); - } - /** - * Ensures a function is only called once. - * - * @ignore - * @memberof async - * @param {function} fn - The function to wrap. - * @return {function} The wrapping function. - */ - - function onlyOnce(fn) { - return function onceWrapper() { - if (fn === null) { - throw new Error('Callback was already called.'); - } - - var callFn = fn; - fn = null; - callFn.apply(this, arguments); - }; - } - /** - * Async queue implementation, - * - * @memberof async - * @function queue - * @param {function} worker - The worker function to call for each task. - * @param {number} concurrency - How many workers to run in parrallel. - * @return {*} The async queue object. - */ - - - function queue(worker, concurrency) { - if (concurrency == null) { - // eslint-disable-line no-eq-null,eqeqeq - concurrency = 1; - } else if (concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - - var workers = 0; - var q = { - _tasks: [], - concurrency: concurrency, - saturated: _noop, - unsaturated: _noop, - buffer: concurrency / 4, - empty: _noop, - drain: _noop, - error: _noop, - started: false, - paused: false, - push: function push(data, callback) { - _insert(data, false, callback); - }, - kill: function kill() { - workers = 0; - q.drain = _noop; - q.started = false; - q._tasks = []; - }, - unshift: function unshift(data, callback) { - _insert(data, true, callback); - }, - process: function process() { - while (!q.paused && workers < q.concurrency && q._tasks.length) { - var task = q._tasks.shift(); - - if (q._tasks.length === 0) { - q.empty(); - } - - workers += 1; - - if (workers === q.concurrency) { - q.saturated(); - } - - worker(task.data, onlyOnce(_next(task))); - } - }, - length: function length() { - return q._tasks.length; - }, - running: function running() { - return workers; - }, - idle: function idle() { - return q._tasks.length + workers === 0; - }, - pause: function pause() { - if (q.paused === true) { - return; - } - - q.paused = true; - }, - resume: function resume() { - if (q.paused === false) { - return; - } - - q.paused = false; // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - - for (var w = 1; w <= q.concurrency; w++) { - q.process(); - } - } - }; - - function _insert(data, insertAtFront, callback) { - if (callback != null && typeof callback !== 'function') { - // eslint-disable-line no-eq-null,eqeqeq - throw new Error('task callback must be a function'); - } - - q.started = true; - - if (data == null && q.idle()) { - // eslint-disable-line no-eq-null,eqeqeq - // call drain immediately if there are no tasks - setTimeout(function () { - return q.drain(); - }, 1); - return; - } - - var item = { - data: data, - callback: typeof callback === 'function' ? callback : _noop - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - setTimeout(function () { - return q.process(); - }, 1); - } - - function _next(task) { - return function next() { - workers -= 1; - task.callback.apply(task, arguments); - - if (arguments[0] != null) { - // eslint-disable-line no-eq-null,eqeqeq - q.error(arguments[0], task.data); - } - - if (workers <= q.concurrency - q.buffer) { - q.unsaturated(); - } - - if (q.idle()) { - q.drain(); - } - - q.process(); - }; - } - - return q; - } - - var async = ({ - eachSeries: eachSeries, - queue: queue - }); - - // a simple in-memory cache for resources - var cache = {}; - /** - * A simple in-memory cache for resource. - * - * @memberof middleware - * @function caching - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.caching); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function caching(resource, next) { - var _this = this; - - // if cached, then set data and complete the resource - if (cache[resource.url]) { - resource.data = cache[resource.url]; - resource.complete(); // marks resource load complete and stops processing before middlewares - } // if not cached, wait for complete and store it in the cache. - else { - resource.onComplete.once(function () { - return cache[_this.url] = _this.data; - }); - } - - next(); - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) { descriptor.writable = true; } - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } - if (staticProps) { _defineProperties(Constructor, staticProps); } - return Constructor; - } - - var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); - var tempAnchor$1 = null; // some status constants - - var STATUS_NONE = 0; - var STATUS_OK = 200; - var STATUS_EMPTY = 204; - var STATUS_IE_BUG_EMPTY = 1223; - var STATUS_TYPE_OK = 2; // noop - - function _noop$1() {} - /* empty */ - - /** - * Manages the state and loading of a resource and all child resources. - * - * @class - */ - - - var Resource$1 = - /*#__PURE__*/ - function () { - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. - */ - Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { - setExtMap(Resource._loadTypeMap, extname, loadType); - } - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. - */ - ; - - Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { - setExtMap(Resource._xhrTypeMap, extname, xhrType); - } - /** - * @param {string} name - The name of the resource to load. - * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass - * an array of sources. - * @param {object} [options] - The options for the load. - * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. - */ - ; - - function Resource(name, url, options) { - if (typeof name !== 'string' || typeof url !== 'string') { - throw new Error('Both name and url are required for constructing a resource.'); - } - - options = options || {}; - /** - * The state flags of this resource. - * - * @private - * @member {number} - */ - - this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work. - - this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); - /** - * The name of this resource. - * - * @readonly - * @member {string} - */ - - - this.name = name; - /** - * The url used to load this resource. - * - * @readonly - * @member {string} - */ - - this.url = url; - /** - * The extension used to load this resource. - * - * @readonly - * @member {string} - */ - - this.extension = this._getExtension(); - /** - * The data that was loaded by the resource. - * - * @member {any} - */ - - this.data = null; - /** - * Is this request cross-origin? If unset, determined automatically. - * - * @member {string} - */ - - this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; - /** - * A timeout in milliseconds for the load. If the load takes longer than this time - * it is cancelled and the load is considered a failure. If this value is set to `0` - * then there is no explicit timeout. - * - * @member {number} - */ - - this.timeout = options.timeout || 0; - /** - * The method of loading to use for this resource. - * - * @member {Resource.LOAD_TYPE} - */ - - this.loadType = options.loadType || this._determineLoadType(); - /** - * The type used to load the resource via XHR. If unset, determined automatically. - * - * @member {string} - */ - - this.xhrType = options.xhrType; - /** - * Extra info for middleware, and controlling specifics about how the resource loads. - * - * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. - * Meaning it will modify it as it sees fit. - * - * @member {Resource.IMetadata} - */ - - this.metadata = options.metadata || {}; - /** - * The error that occurred while loading (if any). - * - * @readonly - * @member {Error} - */ - - this.error = null; - /** - * The XHR object that was used to load this resource. This is only set - * when `loadType` is `Resource.LOAD_TYPE.XHR`. - * - * @readonly - * @member {XMLHttpRequest} - */ - - this.xhr = null; - /** - * The child resources this resource owns. - * - * @readonly - * @member {Resource[]} - */ - - this.children = []; - /** - * The resource type. - * - * @readonly - * @member {Resource.TYPE} - */ - - this.type = Resource.TYPE.UNKNOWN; - /** - * The progress chunk owned by this resource. - * - * @readonly - * @member {number} - */ - - this.progressChunk = 0; - /** - * The `dequeue` method that will be used a storage place for the async queue dequeue method - * used privately by the loader. - * - * @private - * @member {function} - */ - - this._dequeue = _noop$1; - /** - * Used a storage place for the on load binding used privately by the loader. - * - * @private - * @member {function} - */ - - this._onLoadBinding = null; - /** - * The timer for element loads to check if they timeout. - * - * @private - * @member {number} - */ - - this._elementTimer = 0; - /** - * The `complete` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundComplete = this.complete.bind(this); - /** - * The `_onError` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnError = this._onError.bind(this); - /** - * The `_onProgress` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnProgress = this._onProgress.bind(this); - /** - * The `_onTimeout` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks - - this._boundXhrOnError = this._xhrOnError.bind(this); - this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); - this._boundXhrOnAbort = this._xhrOnAbort.bind(this); - this._boundXhrOnLoad = this._xhrOnLoad.bind(this); - /** - * Dispatched when the resource beings to load. - * - * The callback looks like {@link Resource.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched each time progress of this resource load updates. - * Not all resources types and loader systems can support this event - * so sometimes it may not be available. If the resource - * is being loaded on a modern browser, using XHR, and the remote server - * properly sets Content-Length headers, then this will be available. - * - * The callback looks like {@link Resource.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once this resource has loaded, if there was an error it will - * be in the `error` property. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); - /** - * Dispatched after this resource has had all the *after* middleware run on it. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onAfterMiddleware = new Signal(); - } - /** - * When the resource starts to load. - * - * @memberof Resource - * @callback OnStartSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * When the resource reports loading progress. - * - * @memberof Resource - * @callback OnProgressSignal - * @param {Resource} resource - The resource that the event happened on. - * @param {number} percentage - The progress of the load in the range [0, 1]. - */ - - /** - * When the resource finishes loading. - * - * @memberof Resource - * @callback OnCompleteSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * @memberof Resource - * @typedef {object} IMetadata - * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The - * element to use for loading, instead of creating one. - * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This - * is useful if you want to pass in a `loadElement` that you already added load sources to. - * @property {string|string[]} [mimeType] - The mime type to use for the source element - * of a video/audio elment. If the urls are an array, you can pass this as an array as well - * where each index is the mime type to use for the corresponding url index. - */ - - /** - * Stores whether or not this url is a data url. - * - * @readonly - * @member {boolean} - */ - - - var _proto = Resource.prototype; - - /** - * Marks the resource as complete. - * - */ - _proto.complete = function complete() { - this._clearEvents(); - - this._finish(); - } - /** - * Aborts the loading of this resource, with an optional message. - * - * @param {string} message - The message to use for the error - */ - ; - - _proto.abort = function abort(message) { - // abort can be called multiple times, ignore subsequent calls. - if (this.error) { - return; - } // store error - - - this.error = new Error(message); // clear events before calling aborts - - this._clearEvents(); // abort the actual loading - - - if (this.xhr) { - this.xhr.abort(); - } else if (this.xdr) { - this.xdr.abort(); - } else if (this.data) { - // single source - if (this.data.src) { - this.data.src = Resource.EMPTY_GIF; - } // multi-source - else { - while (this.data.firstChild) { - this.data.removeChild(this.data.firstChild); - } - } - } // done now. - - - this._finish(); - } - /** - * Kicks off loading of this resource. This method is asynchronous. - * - * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. - */ - ; - - _proto.load = function load(cb) { - var _this = this; - - if (this.isLoading) { - return; - } - - if (this.isComplete) { - if (cb) { - setTimeout(function () { - return cb(_this); - }, 1); - } - - return; - } else if (cb) { - this.onComplete.once(cb); - } - - this._setFlag(Resource.STATUS_FLAGS.LOADING, true); - - this.onStart.dispatch(this); // if unset, determine the value - - if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { - this.crossOrigin = this._determineCrossOrigin(this.url); - } - - switch (this.loadType) { - case Resource.LOAD_TYPE.IMAGE: - this.type = Resource.TYPE.IMAGE; - - this._loadElement('image'); - - break; - - case Resource.LOAD_TYPE.AUDIO: - this.type = Resource.TYPE.AUDIO; - - this._loadSourceElement('audio'); - - break; - - case Resource.LOAD_TYPE.VIDEO: - this.type = Resource.TYPE.VIDEO; - - this._loadSourceElement('video'); - - break; - - case Resource.LOAD_TYPE.XHR: - /* falls through */ - - default: - if (useXdr && this.crossOrigin) { - this._loadXdr(); - } else { - this._loadXhr(); - } - - break; - } - } - /** - * Checks if the flag is set. - * - * @private - * @param {number} flag - The flag to check. - * @return {boolean} True if the flag is set. - */ - ; - - _proto._hasFlag = function _hasFlag(flag) { - return (this._flags & flag) !== 0; - } - /** - * (Un)Sets the flag. - * - * @private - * @param {number} flag - The flag to (un)set. - * @param {boolean} value - Whether to set or (un)set the flag. - */ - ; - - _proto._setFlag = function _setFlag(flag, value) { - this._flags = value ? this._flags | flag : this._flags & ~flag; - } - /** - * Clears all the events from the underlying loading source. - * - * @private - */ - ; - - _proto._clearEvents = function _clearEvents() { - clearTimeout(this._elementTimer); - - if (this.data && this.data.removeEventListener) { - this.data.removeEventListener('error', this._boundOnError, false); - this.data.removeEventListener('load', this._boundComplete, false); - this.data.removeEventListener('progress', this._boundOnProgress, false); - this.data.removeEventListener('canplaythrough', this._boundComplete, false); - } - - if (this.xhr) { - if (this.xhr.removeEventListener) { - this.xhr.removeEventListener('error', this._boundXhrOnError, false); - this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); - this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); - this.xhr.removeEventListener('progress', this._boundOnProgress, false); - this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); - } else { - this.xhr.onerror = null; - this.xhr.ontimeout = null; - this.xhr.onprogress = null; - this.xhr.onload = null; - } - } - } - /** - * Finalizes the load. - * - * @private - */ - ; - - _proto._finish = function _finish() { - if (this.isComplete) { - throw new Error('Complete called again for an already completed resource.'); - } - - this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); - - this._setFlag(Resource.STATUS_FLAGS.LOADING, false); - - this.onComplete.dispatch(this); - } - /** - * Loads this resources using an element that has a single source, - * like an HTMLImageElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadElement = function _loadElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'image' && typeof window.Image !== 'undefined') { - this.data = new Image(); - } else { - this.data = document.createElement(type); - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - this.data.src = this.url; - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an element that has multiple sources, - * like an HTMLAudioElement or HTMLVideoElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadSourceElement = function _loadSourceElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'audio' && typeof window.Audio !== 'undefined') { - this.data = new Audio(); - } else { - this.data = document.createElement(type); - } - - if (this.data === null) { - this.abort("Unsupported element: " + type); - return; - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') - if (navigator.isCocoonJS) { - this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; - } else if (Array.isArray(this.url)) { - var mimeTypes = this.metadata.mimeType; - - for (var i = 0; i < this.url.length; ++i) { - this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); - } - } else { - var _mimeTypes = this.metadata.mimeType; - this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); - } - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - this.data.addEventListener('canplaythrough', this._boundComplete, false); - this.data.load(); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an XMLHttpRequest. - * - * @private - */ - ; - - _proto._loadXhr = function _loadXhr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url - - xhr.open('GET', this.url, true); - xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers - // *cough* safari *cough* can't deal with it. - - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; - } else { - xhr.responseType = this.xhrType; - } - - xhr.addEventListener('error', this._boundXhrOnError, false); - xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); - xhr.addEventListener('abort', this._boundXhrOnAbort, false); - xhr.addEventListener('progress', this._boundOnProgress, false); - xhr.addEventListener('load', this._boundXhrOnLoad, false); - xhr.send(); - } - /** - * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). - * - * @private - */ - ; - - _proto._loadXdr = function _loadXdr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef - // XDomainRequest has a few quirks. Occasionally it will abort requests - // A way to avoid this is to make sure ALL callbacks are set even if not used - // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 - - xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 - - xdr.onerror = this._boundXhrOnError; - xdr.ontimeout = this._boundXhrOnTimeout; - xdr.onprogress = this._boundOnProgress; - xdr.onload = this._boundXhrOnLoad; - xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an - // issue with the interface where some requests are lost if multiple - // XDomainRequests are being sent at the same time. - // Some info here: https://github.com/photonstorm/phaser/issues/1248 - - setTimeout(function () { - return xdr.send(); - }, 1); - } - /** - * Creates a source used in loading via an element. - * - * @private - * @param {string} type - The element type (video or audio). - * @param {string} url - The source URL to load from. - * @param {string} [mime] - The mime type of the video - * @return {HTMLSourceElement} The source element. - */ - ; - - _proto._createSource = function _createSource(type, url, mime) { - if (!mime) { - mime = type + "/" + this._getExtension(url); - } - - var source = document.createElement('source'); - source.src = url; - source.type = mime; - return source; - } - /** - * Called if a load errors out. - * - * @param {Event} event - The error event from the element that emits it. - * @private - */ - ; - - _proto._onError = function _onError(event) { - this.abort("Failed to load element using: " + event.target.nodeName); - } - /** - * Called if a load progress event fires for an element or xhr/xdr. - * - * @private - * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. - */ - ; - - _proto._onProgress = function _onProgress(event) { - if (event && event.lengthComputable) { - this.onProgress.dispatch(this, event.loaded / event.total); - } - } - /** - * Called if a timeout event fires for an element. - * - * @private - */ - ; - - _proto._onTimeout = function _onTimeout() { - this.abort("Load timed out."); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnError = function _xhrOnError() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnTimeout = function _xhrOnTimeout() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request timed out."); - } - /** - * Called if an abort event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnAbort = function _xhrOnAbort() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request was aborted by the user."); - } - /** - * Called when data successfully loads from an xhr/xdr request. - * - * @private - * @param {XMLHttpRequestLoadEvent|Event} event - Load event - */ - ; - - _proto._xhrOnLoad = function _xhrOnLoad() { - var xhr = this.xhr; - var text = ''; - var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. - // responseText is accessible only if responseType is '' or 'text' and on older browsers - - if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { - text = xhr.responseText; - } // status can be 0 when using the `file://` protocol so we also check if a response is set. - // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. - - - if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { - status = STATUS_OK; - } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - else if (status === STATUS_IE_BUG_EMPTY) { - status = STATUS_EMPTY; - } - - var statusType = status / 100 | 0; - - if (statusType === STATUS_TYPE_OK) { - // if text, just return it - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { - this.data = text; - this.type = Resource.TYPE.TEXT; - } // if json, parse into json object - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { - try { - this.data = JSON.parse(text); - this.type = Resource.TYPE.JSON; - } catch (e) { - this.abort("Error trying to parse loaded json: " + e); - return; - } - } // if xml, parse into an xml document or div element - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - try { - if (window.DOMParser) { - var domparser = new DOMParser(); - this.data = domparser.parseFromString(text, 'text/xml'); - } else { - var div = document.createElement('div'); - div.innerHTML = text; - this.data = div; - } - - this.type = Resource.TYPE.XML; - } catch (e) { - this.abort("Error trying to parse loaded xml: " + e); - return; - } - } // other types just return the response - else { - this.data = xhr.response || text; - } - } else { - this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); - return; - } - - this.complete(); - } - /** - * Sets the `crossOrigin` property for this resource based on if the url - * for this resource is cross-origin. If crossOrigin was manually set, this - * function does nothing. - * - * @private - * @param {string} url - The url to test. - * @param {object} [loc=window.location] - The location object to test against. - * @return {string} The crossOrigin value to use (or empty string for none). - */ - ; - - _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) { - // data: and javascript: urls are considered same-origin - if (url.indexOf('data:') === 0) { - return ''; - } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special - // origin designed not to match window.location.origin, and will always require - // crossOrigin requests regardless of whether the location matches. - - - if (window.origin !== window.location.origin) { - return 'anonymous'; - } // default is window.location - - - loc = loc || window.location; - - if (!tempAnchor$1) { - tempAnchor$1 = document.createElement('a'); - } // let the browser determine the full href for the url of this resource and then - // parse with the node url lib, we can't use the properties of the anchor element - // because they don't work in IE9 :( - - - tempAnchor$1.href = url; - url = parseUri(tempAnchor$1.href, { - strictMode: true - }); - var samePort = !url.port && loc.port === '' || url.port === loc.port; - var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin - - if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { - return 'anonymous'; - } - - return ''; - } - /** - * Determines the responseType of an XHR request based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. - */ - ; - - _proto._determineXhrType = function _determineXhrType() { - return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; - } - /** - * Determines the loadType of a resource based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.LOAD_TYPE} The loadType to use. - */ - ; - - _proto._determineLoadType = function _determineLoadType() { - return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; - } - /** - * Extracts the extension (sans '.') of the file being loaded by the resource. - * - * @private - * @return {string} The extension. - */ - ; - - _proto._getExtension = function _getExtension() { - var url = this.url; - var ext = ''; - - if (this.isDataUrl) { - var slashIndex = url.indexOf('/'); - ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); - } else { - var queryStart = url.indexOf('?'); - var hashStart = url.indexOf('#'); - var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); - url = url.substring(0, index); - ext = url.substring(url.lastIndexOf('.') + 1); - } - - return ext.toLowerCase(); - } - /** - * Determines the mime type of an XHR request based on the responseType of - * resource being loaded. - * - * @private - * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. - * @return {string} The mime type to use. - */ - ; - - _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) { - switch (type) { - case Resource.XHR_RESPONSE_TYPE.BUFFER: - return 'application/octet-binary'; - - case Resource.XHR_RESPONSE_TYPE.BLOB: - return 'application/blob'; - - case Resource.XHR_RESPONSE_TYPE.DOCUMENT: - return 'application/xml'; - - case Resource.XHR_RESPONSE_TYPE.JSON: - return 'application/json'; - - case Resource.XHR_RESPONSE_TYPE.DEFAULT: - case Resource.XHR_RESPONSE_TYPE.TEXT: - /* falls through */ - - default: - return 'text/plain'; - } - }; - - _createClass(Resource, [{ - key: "isDataUrl", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); - } - /** - * Describes if this resource has finished loading. Is true when the resource has completely - * loaded. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isComplete", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); - } - /** - * Describes if this resource is currently loading. Is true when the resource starts loading, - * and is false again when complete. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isLoading", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.LOADING); - } - }]); - - return Resource; - }(); - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - - Resource$1.STATUS_FLAGS = { - NONE: 0, - DATA_URL: 1 << 0, - COMPLETE: 1 << 1, - LOADING: 1 << 2 - }; - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.TYPE = { - UNKNOWN: 0, - JSON: 1, - XML: 2, - IMAGE: 3, - AUDIO: 4, - VIDEO: 5, - TEXT: 6 - }; - /** - * The types of loading a resource can use. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.LOAD_TYPE = { - /** Uses XMLHttpRequest to load the resource. */ - XHR: 1, - - /** Uses an `Image` object to load the resource. */ - IMAGE: 2, - - /** Uses an `Audio` object to load the resource. */ - AUDIO: 3, - - /** Uses a `Video` object to load the resource. */ - VIDEO: 4 - }; - /** - * The XHR ready states, used internally. - * - * @static - * @readonly - * @enum {string} - */ - - Resource$1.XHR_RESPONSE_TYPE = { - /** string */ - DEFAULT: 'text', - - /** ArrayBuffer */ - BUFFER: 'arraybuffer', - - /** Blob */ - BLOB: 'blob', - - /** Document */ - DOCUMENT: 'document', - - /** Object */ - JSON: 'json', - - /** String */ - TEXT: 'text' - }; - Resource$1._loadTypeMap = { - // images - gif: Resource$1.LOAD_TYPE.IMAGE, - png: Resource$1.LOAD_TYPE.IMAGE, - bmp: Resource$1.LOAD_TYPE.IMAGE, - jpg: Resource$1.LOAD_TYPE.IMAGE, - jpeg: Resource$1.LOAD_TYPE.IMAGE, - tif: Resource$1.LOAD_TYPE.IMAGE, - tiff: Resource$1.LOAD_TYPE.IMAGE, - webp: Resource$1.LOAD_TYPE.IMAGE, - tga: Resource$1.LOAD_TYPE.IMAGE, - svg: Resource$1.LOAD_TYPE.IMAGE, - 'svg+xml': Resource$1.LOAD_TYPE.IMAGE, - // for SVG data urls - // audio - mp3: Resource$1.LOAD_TYPE.AUDIO, - ogg: Resource$1.LOAD_TYPE.AUDIO, - wav: Resource$1.LOAD_TYPE.AUDIO, - // videos - mp4: Resource$1.LOAD_TYPE.VIDEO, - webm: Resource$1.LOAD_TYPE.VIDEO - }; - Resource$1._xhrTypeMap = { - // xml - xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. - // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, - // this should probably be fine. - tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // images - gif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - png: Resource$1.XHR_RESPONSE_TYPE.BLOB, - bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB, - webp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tga: Resource$1.XHR_RESPONSE_TYPE.BLOB, - // json - json: Resource$1.XHR_RESPONSE_TYPE.JSON, - // text - text: Resource$1.XHR_RESPONSE_TYPE.TEXT, - txt: Resource$1.XHR_RESPONSE_TYPE.TEXT, - // fonts - ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER, - otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER - }; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif - - Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; - /** - * Quick helper to set a value on one of the extension maps. Ensures there is no - * dot at the start of the extension. - * - * @ignore - * @param {object} map - The map to set on. - * @param {string} extname - The extension (or key) to set. - * @param {number} val - The value to set. - */ - - function setExtMap(map, extname, val) { - if (extname && extname.indexOf('.') === 0) { - extname = extname.substring(1); - } - - if (!extname) { - return; - } - - map[extname] = val; - } - /** - * Quick helper to get string xhr type. - * - * @ignore - * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. - * @return {string} The type. - */ - - - function reqType(xhr) { - return xhr.toString().replace('object ', ''); - } - - var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - /** - * Encodes binary into base64. - * - * @function encodeBinary - * @param {string} input The input data to encode. - * @returns {string} The encoded base64 string - */ - - function encodeBinary(input) { - var output = ''; - var inx = 0; - - while (inx < input.length) { - // Fill byte buffer array - var bytebuffer = [0, 0, 0]; - var encodedCharIndexes = [0, 0, 0, 0]; - - for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { - if (inx < input.length) { - // throw away high-order byte, as documented at: - // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data - bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; - } else { - bytebuffer[jnx] = 0; - } - } // Get each encoded character, 6 bits at a time - // index 1: first 6 bits - - - encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) - - encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) - - encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3) - - encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly - - var paddingBytes = inx - (input.length - 1); - - switch (paddingBytes) { - case 2: - // Set last 2 characters to padding char - encodedCharIndexes[3] = 64; - encodedCharIndexes[2] = 64; - break; - - case 1: - // Set last character to padding char - encodedCharIndexes[3] = 64; - break; - - default: - break; - // No padding - proceed - } // Now we will grab each appropriate character out of our keystring - // based on our index array and append it to the output string - - - for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { - output += _keyStr.charAt(encodedCharIndexes[_jnx]); - } - } - - return output; - } - - var Url$1 = window.URL || window.webkitURL; - /** - * A middleware for transforming XHR loaded Blobs into more useful objects - * - * @memberof middleware - * @function parsing - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.parsing); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function parsing(resource, next) { - if (!resource.data) { - next(); - return; - } // if this was an XHR load of a blob - - - if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) { - // if there is no blob support we probably got a binary string back - if (!window.Blob || typeof resource.data === 'string') { - var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url - - if (type && type.indexOf('image') === 0) { - resource.data = new Image(); - resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); - resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback - - resource.data.onload = function () { - resource.data.onload = null; - next(); - }; // next will be called on load - - - return; - } - } // if content type says this is an image, then we should transform the blob into an Image object - else if (resource.data.type.indexOf('image') === 0) { - var src = Url$1.createObjectURL(resource.data); - resource.blob = resource.data; - resource.data = new Image(); - resource.data.src = src; - resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads - // TODO: Is this correct? Will the image be invalid after revoking? - - resource.data.onload = function () { - Url$1.revokeObjectURL(src); - resource.data.onload = null; - next(); - }; // next will be called on load. - - - return; - } - } - - next(); - } - - /** - * @namespace middleware - */ - - var index$1 = ({ - caching: caching, - parsing: parsing - }); - - var MAX_PROGRESS = 100; - var rgxExtractUrlHash = /(#[\w-]+)?$/; - /** - * Manages the state and loading of multiple resources to load. - * - * @class - */ - - var Loader = - /*#__PURE__*/ - function () { - /** - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - function Loader(baseUrl, concurrency) { - var _this = this; - - if (baseUrl === void 0) { - baseUrl = ''; - } - - if (concurrency === void 0) { - concurrency = 10; - } - - /** - * The base url for all resources loaded by this loader. - * - * @member {string} - */ - this.baseUrl = baseUrl; - /** - * The progress percent of the loader going through the queue. - * - * @member {number} - * @default 0 - */ - - this.progress = 0; - /** - * Loading state of the loader, true if it is currently loading resources. - * - * @member {boolean} - * @default false - */ - - this.loading = false; - /** - * A querystring to append to every URL added to the loader. - * - * This should be a valid query string *without* the question-mark (`?`). The loader will - * also *not* escape values for you. Make sure to escape your parameters with - * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. - * - * @example - * const loader = new Loader(); - * - * loader.defaultQueryString = 'user=me&password=secret'; - * - * // This will request 'image.png?user=me&password=secret' - * loader.add('image.png').load(); - * - * loader.reset(); - * - * // This will request 'image.png?v=1&user=me&password=secret' - * loader.add('iamge.png?v=1').load(); - * - * @member {string} - * @default '' - */ - - this.defaultQueryString = ''; - /** - * The middleware to run before loading each resource. - * - * @private - * @member {function[]} - */ - - this._beforeMiddleware = []; - /** - * The middleware to run after loading each resource. - * - * @private - * @member {function[]} - */ - - this._afterMiddleware = []; - /** - * The tracks the resources we are currently completing parsing for. - * - * @private - * @member {Resource[]} - */ - - this._resourcesParsing = []; - /** - * The `_loadResource` function bound with this object context. - * - * @private - * @member {function} - * @param {Resource} r - The resource to load - * @param {Function} d - The dequeue function - * @return {undefined} - */ - - this._boundLoadResource = function (r, d) { - return _this._loadResource(r, d); - }; - /** - * The resources waiting to be loaded. - * - * @private - * @member {Resource[]} - */ - - - this._queue = queue(this._boundLoadResource, concurrency); - - this._queue.pause(); - /** - * All the resources for this loader keyed by name. - * - * @member {object} - */ - - - this.resources = {}; - /** - * Dispatched once per loaded or errored resource. - * - * The callback looks like {@link Loader.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once per errored resource. - * - * The callback looks like {@link Loader.OnErrorSignal}. - * - * @member {Signal} - */ - - this.onError = new Signal(); - /** - * Dispatched once per loaded resource. - * - * The callback looks like {@link Loader.OnLoadSignal}. - * - * @member {Signal} - */ - - this.onLoad = new Signal(); - /** - * Dispatched when the loader begins to process the queue. - * - * The callback looks like {@link Loader.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched when the queued resources all load. - * - * The callback looks like {@link Loader.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); // Add default before middleware - - for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { - this.pre(Loader._defaultBeforeMiddleware[i]); - } // Add default after middleware - - - for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { - this.use(Loader._defaultAfterMiddleware[_i]); - } - } - /** - * When the progress changes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnProgressSignal - * @param {Loader} loader - The loader the progress is advancing on. - * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. - */ - - /** - * When an error occurrs the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnErrorSignal - * @param {Loader} loader - The loader the error happened in. - * @param {Resource} resource - The resource that caused the error. - */ - - /** - * When a load completes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnLoadSignal - * @param {Loader} loader - The loader that laoded the resource. - * @param {Resource} resource - The resource that has completed loading. - */ - - /** - * When the loader starts loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnStartSignal - * @param {Loader} loader - The loader that has started loading resources. - */ - - /** - * When the loader completes loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnCompleteSignal - * @param {Loader} loader - The loader that has finished loading resources. - */ - - /** - * Options for a call to `.add()`. - * - * @see Loader#add - * - * @typedef {object} IAddOptions - * @property {string} [name] - The name of the resource to load, if not passed the url is used. - * @property {string} [key] - Alias for `name`. - * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. - * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. - * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`. - * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. - */ - - /* eslint-disable require-jsdoc,valid-jsdoc */ - - /** - * Adds a resource (or multiple resources) to the loader queue. - * - * This function can take a wide variety of different parameters. The only thing that is always - * required the url to load. All the following will work: - * - * ```js - * loader - * // normal param syntax - * .add('key', 'http://...', function () {}) - * .add('http://...', function () {}) - * .add('http://...') - * - * // object syntax - * .add({ - * name: 'key2', - * url: 'http://...' - * }, function () {}) - * .add({ - * url: 'http://...' - * }, function () {}) - * .add({ - * name: 'key3', - * url: 'http://...' - * onComplete: function () {} - * }) - * .add({ - * url: 'https://...', - * onComplete: function () {}, - * crossOrigin: true - * }) - * - * // you can also pass an array of objects or urls or both - * .add([ - * { name: 'key4', url: 'http://...', onComplete: function () {} }, - * { url: 'http://...', onComplete: function () {} }, - * 'http://...' - * ]) - * - * // and you can use both params and options - * .add('key', 'http://...', { crossOrigin: true }, function () {}) - * .add('http://...', { crossOrigin: true }, function () {}); - * ``` - * - * @function - * @variation 1 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 2 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 3 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 4 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 5 - * @param {IAddOptions} options - The options for the load. This object must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 6 - * @param {Array} resources - An array of resources to load, where each is - * either an object with the options or a string url. If you pass an object, it must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - - var _proto = Loader.prototype; - - _proto.add = function add(name, url, options, cb) { - // special case of an array of objects or urls - if (Array.isArray(name)) { - for (var i = 0; i < name.length; ++i) { - this.add(name[i]); - } - - return this; - } // if an object is passed instead of params - - - if (typeof name === 'object') { - cb = url || name.callback || name.onComplete; - options = name; - url = name.url; - name = name.name || name.key || name.url; - } // case where no name is passed shift all args over by one. - - - if (typeof url !== 'string') { - cb = options; - options = url; - url = name; - } // now that we shifted make sure we have a proper url. - - - if (typeof url !== 'string') { - throw new Error('No url passed to add resource to loader.'); - } // options are optional so people might pass a function and no options - - - if (typeof options === 'function') { - cb = options; - options = null; - } // if loading already you can only add resources that have a parent. - - - if (this.loading && (!options || !options.parentResource)) { - throw new Error('Cannot add resources while the loader is running.'); - } // check if resource already exists. - - - if (this.resources[name]) { - throw new Error("Resource named \"" + name + "\" already exists."); - } // add base url if this isn't an absolute url - - - url = this._prepareUrl(url); // create the store the resource - - this.resources[name] = new Resource$1(name, url, options); - - if (typeof cb === 'function') { - this.resources[name].onAfterMiddleware.once(cb); - } // if actively loading, make sure to adjust progress chunks for that parent and its children - - - if (this.loading) { - var parent = options.parentResource; - var incompleteChildren = []; - - for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { - if (!parent.children[_i2].isComplete) { - incompleteChildren.push(parent.children[_i2]); - } - } - - var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent - - var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child - - parent.children.push(this.resources[name]); - parent.progressChunk = eachChunk; - - for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { - incompleteChildren[_i3].progressChunk = eachChunk; - } - - this.resources[name].progressChunk = eachChunk; - } // add the resource to the queue - - - this._queue.push(this.resources[name]); - - return this; - } - /* eslint-enable require-jsdoc,valid-jsdoc */ - - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; - - _proto.pre = function pre(fn) { - this._beforeMiddleware.push(fn); - - return this; - } - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; - - _proto.use = function use(fn) { - this._afterMiddleware.push(fn); - - return this; - } - /** - * Resets the queue of the loader to prepare for a new load. - * - * @return {this} Returns itself. - */ - ; - - _proto.reset = function reset() { - this.progress = 0; - this.loading = false; - - this._queue.kill(); - - this._queue.pause(); // abort all resource loads - - - for (var k in this.resources) { - var res = this.resources[k]; - - if (res._onLoadBinding) { - res._onLoadBinding.detach(); - } - - if (res.isLoading) { - res.abort(); - } - } - - this.resources = {}; - return this; - } - /** - * Starts loading the queued resources. - * - * @param {function} [cb] - Optional callback that will be bound to the `complete` event. - * @return {this} Returns itself. - */ - ; - - _proto.load = function load(cb) { - // register complete callback if they pass one - if (typeof cb === 'function') { - this.onComplete.once(cb); - } // if the queue has already started we are done here - - - if (this.loading) { - return this; - } - - if (this._queue.idle()) { - this._onStart(); - - this._onComplete(); - } else { - // distribute progress chunks - var numTasks = this._queue._tasks.length; - var chunk = MAX_PROGRESS / numTasks; - - for (var i = 0; i < this._queue._tasks.length; ++i) { - this._queue._tasks[i].data.progressChunk = chunk; - } // notify we are starting - - - this._onStart(); // start loading - - - this._queue.resume(); - } - - return this; - } - /** - * The number of resources to load concurrently. - * - * @member {number} - * @default 10 - */ - ; - - /** - * Prepares a url for usage based on the configuration of this object - * - * @private - * @param {string} url - The url to prepare. - * @return {string} The prepared url. - */ - _proto._prepareUrl = function _prepareUrl(url) { - var parsedUrl = parseUri(url, { - strictMode: true - }); - var result; // absolute url, just use it as is. - - if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { - result = url; - } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween - else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { - result = this.baseUrl + "/" + url; - } else { - result = this.baseUrl + url; - } // if we need to add a default querystring, there is a bit more work - - - if (this.defaultQueryString) { - var hash = rgxExtractUrlHash.exec(result)[0]; - result = result.substr(0, result.length - hash.length); - - if (result.indexOf('?') !== -1) { - result += "&" + this.defaultQueryString; - } else { - result += "?" + this.defaultQueryString; - } - - result += hash; - } - - return result; - } - /** - * Loads a single resource. - * - * @private - * @param {Resource} resource - The resource to load. - * @param {function} dequeue - The function to call when we need to dequeue this item. - */ - ; - - _proto._loadResource = function _loadResource(resource, dequeue) { - var _this2 = this; - - resource._dequeue = dequeue; // run before middleware - - eachSeries(this._beforeMiddleware, function (fn, next) { - fn.call(_this2, resource, function () { - // if the before middleware marks the resource as complete, - // break and don't process any more before middleware - next(resource.isComplete ? {} : null); - }); - }, function () { - if (resource.isComplete) { - _this2._onLoad(resource); - } else { - resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); - resource.load(); - } - }, true); - } - /** - * Called once loading has started. - * - * @private - */ - ; - - _proto._onStart = function _onStart() { - this.progress = 0; - this.loading = true; - this.onStart.dispatch(this); - } - /** - * Called once each resource has loaded. - * - * @private - */ - ; - - _proto._onComplete = function _onComplete() { - this.progress = MAX_PROGRESS; - this.loading = false; - this.onComplete.dispatch(this, this.resources); - } - /** - * Called each time a resources is loaded. - * - * @private - * @param {Resource} resource - The resource that was loaded - */ - ; - - _proto._onLoad = function _onLoad(resource) { - var _this3 = this; - - resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed - - this._resourcesParsing.push(resource); - - resource._dequeue(); // run all the after middleware for this resource - - - eachSeries(this._afterMiddleware, function (fn, next) { - fn.call(_this3, resource, next); - }, function () { - resource.onAfterMiddleware.dispatch(resource); - _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); - - _this3.onProgress.dispatch(_this3, resource); - - if (resource.error) { - _this3.onError.dispatch(resource.error, _this3, resource); - } else { - _this3.onLoad.dispatch(_this3, resource); - } - - _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check - - - if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { - _this3._onComplete(); - } - }, true); - }; - - _createClass(Loader, [{ - key: "concurrency", - get: function get() { - return this._queue.concurrency; - } // eslint-disable-next-line require-jsdoc - , - set: function set(concurrency) { - this._queue.concurrency = concurrency; - } - }]); - - return Loader; - }(); - /** - * A default array of middleware to run before loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - - Loader._defaultBeforeMiddleware = []; - /** - * A default array of middleware to run after loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - Loader._defaultAfterMiddleware = []; - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - Loader.pre = function LoaderPreStatic(fn) { - Loader._defaultBeforeMiddleware.push(fn); - - return Loader; - }; - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - - Loader.use = function LoaderUseStatic(fn) { - Loader._defaultAfterMiddleware.push(fn); - - return Loader; - }; - - /*! - * @pixi/loaders - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/loaders is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Reference to **{@link https://github.com/englercj/resource-loader - * resource-loader}**'s Resource class. - * @see http://englercj.github.io/resource-loader/Resource.html - * @class LoaderResource - * @memberof PIXI - */ - var LoaderResource = Resource$1; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$3 = function(d, b) { - extendStatics$3 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$3(d, b); - }; - - function __extends$3(d, b) { - extendStatics$3(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Loader plugin for handling Texture resources. - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var TextureLoader = /** @class */ (function () { - function TextureLoader() { - } - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - TextureLoader.use = function (resource, next) { - // create a new texture if the data is an Image object - if (resource.data && resource.type === Resource$1.TYPE.IMAGE) { - resource.texture = Texture.fromLoader(resource.data, resource.url, resource.name); - } - next(); - }; - return TextureLoader; - }()); - - /** - * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader - * - * ```js - * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. - * //or - * const loader = new PIXI.Loader(); // you can also create your own if you want - * - * const sprites = {}; - * - * // Chainable `add` to enqueue a resource - * loader.add('bunny', 'data/bunny.png') - * .add('spaceship', 'assets/spritesheet.json'); - * loader.add('scoreFont', 'assets/score.fnt'); - * - * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. - * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). - * loader.pre(cachingMiddleware); - * - * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. - * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). - * loader.use(parsingMiddleware); - * - * // The `load` method loads the queue of resources, and calls the passed in callback called once all - * // resources have loaded. - * loader.load((loader, resources) => { - * // resources is an object where the key is the name of the resource loaded and the value is the resource object. - * // They have a couple default properties: - * // - `url`: The URL that the resource was loaded from - * // - `error`: The error that happened when trying to load (if any) - * // - `data`: The raw data that was loaded - * // also may contain other properties based on the middleware that runs. - * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); - * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); - * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); - * }); - * - * // throughout the process multiple signals can be dispatched. - * loader.onProgress.add(() => {}); // called once per loaded/errored file - * loader.onError.add(() => {}); // called once per errored file - * loader.onLoad.add(() => {}); // called once per loaded file - * loader.onComplete.add(() => {}); // called once when the queued resources all load. - * ``` - * - * @see https://github.com/englercj/resource-loader - * - * @class Loader - * @memberof PIXI - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - var Loader$1 = /** @class */ (function (_super) { - __extends$3(Loader, _super); - function Loader(baseUrl, concurrency) { - var _this = _super.call(this, baseUrl, concurrency) || this; - for (var i = 0; i < Loader._plugins.length; ++i) { - var plugin = Loader._plugins[i]; - var pre = plugin.pre, use = plugin.use; - if (pre) { - _this.pre(pre); - } - if (use) { - _this.use(use); - } - } - /** - * If this loader cannot be destroyed. - * @member {boolean} - * @default false - * @private - */ - _this._protected = false; - return _this; - } - /** - * Destroy the loader, removes references. - * @memberof PIXI.Loader# - * @method destroy - * @public - */ - Loader.prototype.destroy = function () { - if (!this._protected) { - this.reset(); - } - }; - Object.defineProperty(Loader, "shared", { - /** - * A premade instance of the loader that can be used to load resources. - * @name shared - * @type {PIXI.Loader} - * @static - * @memberof PIXI.Loader - */ - get: function () { - var shared = Loader._shared; - if (!shared) { - shared = new Loader(); - shared._protected = true; - Loader._shared = shared; - } - return shared; - }, - enumerable: false, - configurable: true - }); - /** - * Adds a Loader plugin for the global shared loader and all - * new Loader instances created. - * - * @static - * @method registerPlugin - * @memberof PIXI.Loader - * @param {PIXI.ILoaderPlugin} plugin - The plugin to add - * @return {PIXI.Loader} Reference to PIXI.Loader for chaining - */ - Loader.registerPlugin = function (plugin) { - Loader._plugins.push(plugin); - if (plugin.add) { - plugin.add(); - } - return Loader; - }; - /** - * Collection of all installed `use` middleware for Loader. - * - * @static - * @member {Array} _plugins - * @memberof PIXI.Loader - * @private - */ - Loader._plugins = []; - return Loader; - }(Loader)); - // parse any blob into more usable objects (e.g. Image) - Loader$1.registerPlugin({ use: index$1.parsing }); - // parse any Image objects into textures - Loader$1.registerPlugin(TextureLoader); - /** - * Plugin to be installed for handling specific Loader resources. - * - * @memberof PIXI - * @typedef {object} ILoaderPlugin - * @property {function} [add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the - * arguments for this are `(resource, next)` - * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the - * arguments for this are `(resource, next)` - */ - /** - * @memberof PIXI.Loader - * @typedef {object} ICallbackID - */ - /** - * @memberof PIXI.Loader - * @typedef {function} ISignalCallback - * @param {function} callback - Callback function - * @param {object} [context] - Context - * @returns {ICallbackID} - CallbackID - */ - /** - * @memberof PIXI.Loader - * @typedef {function} ISignalDetach - * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods - */ - /** - * @memberof PIXI.Loader - * @typedef ILoaderSignal - * @property {ISignalCallback} add - Register callback - * @property {ISignalCallback} once - Register oneshot callback - * @property {ISignalDetach} detach - Detach specific callback by ID - */ - /** - * @memberof PIXI.Loader - * @callback loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched when the loader begins to loading process. - * @member {PIXI.Loader.ILoaderSignal} onStart - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per loaded or errored resource. - * @member {PIXI.Loader.ILoaderSignal} onProgress - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per errored resource. - * @member {PIXI.Loader.ILoaderSignal} onError - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per loaded resource. - * @member {PIXI.Loader.ILoaderSignal} onLoad - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched when completely loaded all resources. - * @member {PIXI.Loader.ILoaderSignal} onComplete - */ - - /** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {AppLoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(AppLoaderPlugin); - * @class - * @memberof PIXI - */ - var AppLoaderPlugin = /** @class */ (function () { - function AppLoaderPlugin() { - } - /** - * Called on application constructor - * @param {object} options - * @private - */ - AppLoaderPlugin.init = function (options) { - options = Object.assign({ - sharedLoader: false, - }, options); - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); - }; - /** - * Called when application destroyed - * @private - */ - AppLoaderPlugin.destroy = function () { - if (this.loader) { - this.loader.destroy(); - this.loader = null; - } - }; - return AppLoaderPlugin; - }()); - - /*! - * @pixi/particles - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/particles is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$4 = function(d, b) { - extendStatics$4 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$4(d, b); - }; - - function __extends$4(d, b) { - extendStatics$4(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. - * - * The tradeoff of the ParticleContainer is that most advanced functionality will not work. - * ParticleContainer implements the basic object transform (position, scale, rotation) - * and some advanced functionality like tint (as of v4.5.6). - * - * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. - * - * It's extremely easy to use: - * ```js - * let container = new ParticleContainer(); - * - * for (let i = 0; i < 100; ++i) - * { - * let sprite = PIXI.Sprite.from("myImage.png"); - * container.addChild(sprite); - * } - * ``` - * - * And here you have a hundred sprites that will be rendered at the speed of light. - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var ParticleContainer = /** @class */ (function (_super) { - __extends$4(ParticleContainer, _super); - /** - * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container. - * Affects size of allocated buffers. - * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied. - * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied. - * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`. - * @param {boolean} [properties.position=true] - When true, position be uploaded and applied. - * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied. - * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied. - * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied. - * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead. - * @param {boolean} [autoResize=false] - If true, container allocates more batches in case - * there are more than `maxSize` particles. - */ - function ParticleContainer(maxSize, properties, batchSize, autoResize) { - if (maxSize === void 0) { maxSize = 1500; } - if (batchSize === void 0) { batchSize = 16384; } - if (autoResize === void 0) { autoResize = false; } - var _this = _super.call(this) || this; - // Making sure the batch size is valid - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - var maxBatchSize = 16384; - if (batchSize > maxBatchSize) { - batchSize = maxBatchSize; - } - /** - * Set properties to be dynamic (true) / static (false) - * - * @member {boolean[]} - * @private - */ - _this._properties = [false, true, false, false, false]; - /** - * @member {number} - * @private - */ - _this._maxSize = maxSize; - /** - * @member {number} - * @private - */ - _this._batchSize = batchSize; - /** - * @member {Array} - * @private - */ - _this._buffers = null; - /** - * for every batch stores _updateID corresponding to the last change in that batch - * @member {number[]} - * @private - */ - _this._bufferUpdateIDs = []; - /** - * when child inserted, removed or changes position this number goes up - * @member {number[]} - * @private - */ - _this._updateID = 0; - /** - * @member {boolean} - * - */ - _this.interactiveChildren = false; - /** - * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` - * to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - _this.blendMode = exports.BLEND_MODES.NORMAL; - /** - * If true, container allocates more batches in case there are more than `maxSize` particles. - * @member {boolean} - * @default false - */ - _this.autoResize = autoResize; - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * Default to true here as performance is usually the priority for particles. - * - * @member {boolean} - * @default true - */ - _this.roundPixels = true; - /** - * The texture used to render the children. - * - * @readonly - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = null; - _this.setProperties(properties); - /** - * The tint applied to the container. - * This is a hex value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 0xFFFFFF - */ - _this._tint = 0; - _this.tintRgb = new Float32Array(4); - _this.tint = 0xFFFFFF; - return _this; - } - /** - * Sets the private properties array to dynamic / static based on the passed properties object - * - * @param {object} properties - The properties to be uploaded - */ - ParticleContainer.prototype.setProperties = function (properties) { - if (properties) { - this._properties[0] = 'vertices' in properties || 'scale' in properties - ? !!properties.vertices || !!properties.scale : this._properties[0]; - this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; - this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; - this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; - this._properties[4] = 'tint' in properties || 'alpha' in properties - ? !!properties.tint || !!properties.alpha : this._properties[4]; - } - }; - /** - * Updates the object transform for rendering - * - * @private - */ - ParticleContainer.prototype.updateTransform = function () { - // TODO don't need to! - this.displayObjectUpdateTransform(); - }; - Object.defineProperty(ParticleContainer.prototype, "tint", { - /** - * The tint applied to the container. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - hex2rgb(value, this.tintRgb); - }, - enumerable: false, - configurable: true - }); - /** - * Renders the container using the WebGL renderer - * - * @private - * @param {PIXI.Renderer} renderer - The webgl renderer - */ - ParticleContainer.prototype.render = function (renderer) { - var _this = this; - if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { - return; - } - if (!this.baseTexture) { - this.baseTexture = this.children[0]._texture.baseTexture; - if (!this.baseTexture.valid) { - this.baseTexture.once('update', function () { return _this.onChildrenChange(0); }); - } - } - renderer.batch.setObjectRenderer(renderer.plugins.particle); - renderer.plugins.particle.render(this); - }; - /** - * Set the flag that static data should be updated to true - * - * @private - * @param {number} smallestChildIndex - The smallest child index - */ - ParticleContainer.prototype.onChildrenChange = function (smallestChildIndex) { - var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); - while (this._bufferUpdateIDs.length < bufferIndex) { - this._bufferUpdateIDs.push(0); - } - this._bufferUpdateIDs[bufferIndex] = ++this._updateID; - }; - ParticleContainer.prototype.dispose = function () { - if (this._buffers) { - for (var i = 0; i < this._buffers.length; ++i) { - this._buffers[i].destroy(); - } - this._buffers = null; - } - }; - /** - * Destroys the container - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their - * destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - ParticleContainer.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.dispose(); - this._properties = null; - this._buffers = null; - this._bufferUpdateIDs = null; - }; - return ParticleContainer; - }(Container)); - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that - * they now share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleBuffer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java - */ - /** - * The particle buffer manages the static and dynamic buffers for a particle container. - * - * @class - * @private - * @memberof PIXI - */ - var ParticleBuffer = /** @class */ (function () { - /** - * @private - * @param {object} properties - The properties to upload. - * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. - * @param {number} size - The size of the batch. - */ - function ParticleBuffer(properties, dynamicPropertyFlags, size) { - this.geometry = new Geometry(); - this.indexBuffer = null; - /** - * The number of particles the buffer can hold - * - * @private - * @member {number} - */ - this.size = size; - /** - * A list of the properties that are dynamic. - * - * @private - * @member {object[]} - */ - this.dynamicProperties = []; - /** - * A list of the properties that are static. - * - * @private - * @member {object[]} - */ - this.staticProperties = []; - for (var i = 0; i < properties.length; ++i) { - var property = properties[i]; - // Make copy of properties object so that when we edit the offset it doesn't - // change all other instances of the object literal - property = { - attributeName: property.attributeName, - size: property.size, - uploadFunction: property.uploadFunction, - type: property.type || exports.TYPES.FLOAT, - offset: property.offset, - }; - if (dynamicPropertyFlags[i]) { - this.dynamicProperties.push(property); - } - else { - this.staticProperties.push(property); - } - } - this.staticStride = 0; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - this.dynamicStride = 0; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - this._updateID = 0; - this.initBuffers(); - } - /** - * Sets up the renderer context and necessary buffers. - * - * @private - */ - ParticleBuffer.prototype.initBuffers = function () { - var geometry = this.geometry; - var dynamicOffset = 0; - /** - * Holds the indices of the geometry (quads) to draw - * - * @member {Uint16Array} - * @private - */ - this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); - geometry.addIndex(this.indexBuffer); - this.dynamicStride = 0; - for (var i = 0; i < this.dynamicProperties.length; ++i) { - var property = this.dynamicProperties[i]; - property.offset = dynamicOffset; - dynamicOffset += property.size; - this.dynamicStride += property.size; - } - var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); - this.dynamicData = new Float32Array(dynBuffer); - this.dynamicDataUint32 = new Uint32Array(dynBuffer); - this.dynamicBuffer = new Buffer(this.dynamicData, false, false); - // static // - var staticOffset = 0; - this.staticStride = 0; - for (var i = 0; i < this.staticProperties.length; ++i) { - var property = this.staticProperties[i]; - property.offset = staticOffset; - staticOffset += property.size; - this.staticStride += property.size; - } - var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); - this.staticData = new Float32Array(statBuffer); - this.staticDataUint32 = new Uint32Array(statBuffer); - this.staticBuffer = new Buffer(this.staticData, true, false); - for (var i = 0; i < this.dynamicProperties.length; ++i) { - var property = this.dynamicProperties[i]; - geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4); - } - for (var i = 0; i < this.staticProperties.length; ++i) { - var property = this.staticProperties[i]; - geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4); - } - }; - /** - * Uploads the dynamic properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadDynamic = function (children, startIndex, amount) { - for (var i = 0; i < this.dynamicProperties.length; i++) { - var property = this.dynamicProperties[i]; - property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset); - } - this.dynamicBuffer._updateID++; - }; - /** - * Uploads the static properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadStatic = function (children, startIndex, amount) { - for (var i = 0; i < this.staticProperties.length; i++) { - var property = this.staticProperties[i]; - property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset); - } - this.staticBuffer._updateID++; - }; - /** - * Destroys the ParticleBuffer. - * - * @private - */ - ParticleBuffer.prototype.destroy = function () { - this.indexBuffer = null; - this.dynamicProperties = null; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - this.staticProperties = null; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - // all buffers are destroyed inside geometry - this.geometry.destroy(); - }; - return ParticleBuffer; - }()); - - var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; - - var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now - * share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleRenderer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java - */ - /** - * Renderer for Particles that is designer for speed over feature set. - * - * @class - * @memberof PIXI - */ - var ParticleRenderer = /** @class */ (function (_super) { - __extends$4(ParticleRenderer, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for. - */ - function ParticleRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - // and max number of element in the index buffer is 16384 * 6 = 98304 - // Creating a full index buffer, overhead is 98304 * 2 = 196Ko - // let numIndices = 98304; - /** - * The default shader that is used if a sprite doesn't have a more specific one. - * - * @member {PIXI.Shader} - */ - _this.shader = null; - _this.properties = null; - _this.tempMatrix = new Matrix(); - _this.properties = [ - // verticesData - { - attributeName: 'aVertexPosition', - size: 2, - uploadFunction: _this.uploadVertices, - offset: 0, - }, - // positionData - { - attributeName: 'aPositionCoord', - size: 2, - uploadFunction: _this.uploadPosition, - offset: 0, - }, - // rotationData - { - attributeName: 'aRotation', - size: 1, - uploadFunction: _this.uploadRotation, - offset: 0, - }, - // uvsData - { - attributeName: 'aTextureCoord', - size: 2, - uploadFunction: _this.uploadUvs, - offset: 0, - }, - // tintData - { - attributeName: 'aColor', - size: 1, - type: exports.TYPES.UNSIGNED_BYTE, - uploadFunction: _this.uploadTint, - offset: 0, - } ]; - _this.shader = Shader.from(vertex$1, fragment$1, {}); - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - return _this; - } - /** - * Renders the particle container object. - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - */ - ParticleRenderer.prototype.render = function (container) { - var children = container.children; - var maxSize = container._maxSize; - var batchSize = container._batchSize; - var renderer = this.renderer; - var totalChildren = children.length; - if (totalChildren === 0) { - return; - } - else if (totalChildren > maxSize && !container.autoResize) { - totalChildren = maxSize; - } - var buffers = container._buffers; - if (!buffers) { - buffers = container._buffers = this.generateBuffers(container); - } - var baseTexture = children[0]._texture.baseTexture; - // if the uvs have not updated then no point rendering just yet! - this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); - renderer.state.set(this.state); - var gl = renderer.gl; - var m = container.worldTransform.copyTo(this.tempMatrix); - m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); - this.shader.uniforms.translationMatrix = m.toArray(true); - this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); - this.shader.uniforms.uSampler = baseTexture; - this.renderer.shader.bind(this.shader); - var updateStatic = false; - // now lets upload and render the buffers.. - for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) { - var amount = (totalChildren - i); - if (amount > batchSize) { - amount = batchSize; - } - if (j >= buffers.length) { - buffers.push(this._generateOneMoreBuffer(container)); - } - var buffer = buffers[j]; - // we always upload the dynamic - buffer.uploadDynamic(children, i, amount); - var bid = container._bufferUpdateIDs[j] || 0; - updateStatic = updateStatic || (buffer._updateID < bid); - // we only upload the static content when we have to! - if (updateStatic) { - buffer._updateID = container._updateID; - buffer.uploadStatic(children, i, amount); - } - // bind the buffer - renderer.geometry.bind(buffer.geometry); - gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); - } - }; - /** - * Creates one particle buffer for each child in the container we want to render and updates internal properties - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer[]} The buffers - * @private - */ - ParticleRenderer.prototype.generateBuffers = function (container) { - var buffers = []; - var size = container._maxSize; - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - for (var i = 0; i < size; i += batchSize) { - buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); - } - return buffers; - }; - /** - * Creates one more particle buffer, because container has autoResize feature - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer} generated buffer - * @private - */ - ParticleRenderer.prototype._generateOneMoreBuffer = function (container) { - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); - }; - /** - * Uploads the vertices. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their vertices uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset) { - var w0 = 0; - var w1 = 0; - var h0 = 0; - var h1 = 0; - for (var i = 0; i < amount; ++i) { - var sprite = children[startIndex + i]; - var texture = sprite._texture; - var sx = sprite.scale.x; - var sy = sprite.scale.y; - var trim = texture.trim; - var orig = texture.orig; - if (trim) { - // if the sprite is trimmed and is not a tilingsprite then we need to add the - // extra space before transforming the sprite coords.. - w1 = trim.x - (sprite.anchor.x * orig.width); - w0 = w1 + trim.width; - h1 = trim.y - (sprite.anchor.y * orig.height); - h0 = h1 + trim.height; - } - else { - w0 = (orig.width) * (1 - sprite.anchor.x); - w1 = (orig.width) * -sprite.anchor.x; - h0 = orig.height * (1 - sprite.anchor.y); - h1 = orig.height * -sprite.anchor.y; - } - array[offset] = w1 * sx; - array[offset + 1] = h1 * sy; - array[offset + stride] = w0 * sx; - array[offset + stride + 1] = h1 * sy; - array[offset + (stride * 2)] = w0 * sx; - array[offset + (stride * 2) + 1] = h0 * sy; - array[offset + (stride * 3)] = w1 * sx; - array[offset + (stride * 3) + 1] = h0 * sy; - offset += stride * 4; - } - }; - /** - * Uploads the position. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their positions uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadPosition = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; i++) { - var spritePosition = children[startIndex + i].position; - array[offset] = spritePosition.x; - array[offset + 1] = spritePosition.y; - array[offset + stride] = spritePosition.x; - array[offset + stride + 1] = spritePosition.y; - array[offset + (stride * 2)] = spritePosition.x; - array[offset + (stride * 2) + 1] = spritePosition.y; - array[offset + (stride * 3)] = spritePosition.x; - array[offset + (stride * 3) + 1] = spritePosition.y; - offset += stride * 4; - } - }; - /** - * Uploads the rotation. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadRotation = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; i++) { - var spriteRotation = children[startIndex + i].rotation; - array[offset] = spriteRotation; - array[offset + stride] = spriteRotation; - array[offset + (stride * 2)] = spriteRotation; - array[offset + (stride * 3)] = spriteRotation; - offset += stride * 4; - } - }; - /** - * Uploads the Uvs - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadUvs = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; ++i) { - var textureUvs = children[startIndex + i]._texture._uvs; - if (textureUvs) { - array[offset] = textureUvs.x0; - array[offset + 1] = textureUvs.y0; - array[offset + stride] = textureUvs.x1; - array[offset + stride + 1] = textureUvs.y1; - array[offset + (stride * 2)] = textureUvs.x2; - array[offset + (stride * 2) + 1] = textureUvs.y2; - array[offset + (stride * 3)] = textureUvs.x3; - array[offset + (stride * 3) + 1] = textureUvs.y3; - offset += stride * 4; - } - else { - // TODO you know this can be easier! - array[offset] = 0; - array[offset + 1] = 0; - array[offset + stride] = 0; - array[offset + stride + 1] = 0; - array[offset + (stride * 2)] = 0; - array[offset + (stride * 2) + 1] = 0; - array[offset + (stride * 3)] = 0; - array[offset + (stride * 3) + 1] = 0; - offset += stride * 4; - } - } - }; - /** - * Uploads the tint. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadTint = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; ++i) { - var sprite = children[startIndex + i]; - var premultiplied = sprite._texture.baseTexture.alphaMode > 0; - var alpha = sprite.alpha; - // we dont call extra function if alpha is 1.0, that's faster - var argb = alpha < 1.0 && premultiplied - ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); - array[offset] = argb; - array[offset + stride] = argb; - array[offset + (stride * 2)] = argb; - array[offset + (stride * 3)] = argb; - offset += stride * 4; - } - }; - /** - * Destroys the ParticleRenderer. - */ - ParticleRenderer.prototype.destroy = function () { - _super.prototype.destroy.call(this); - if (this.shader) { - this.shader.destroy(); - this.shader = null; - } - this.tempMatrix = null; - }; - return ParticleRenderer; - }(ObjectRenderer)); - - /*! - * @pixi/graphics - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/graphics is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Supported line joints in `PIXI.LineStyle` for graphics. - * - * @see PIXI.Graphics#lineStyle - * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator - * - * @name LINE_JOIN - * @memberof PIXI - * @static - * @enum {string} - * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet - * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn - * @property {string} ROUND - 'round': add an arc at the joint - */ - - (function (LINE_JOIN) { - LINE_JOIN["MITER"] = "miter"; - LINE_JOIN["BEVEL"] = "bevel"; - LINE_JOIN["ROUND"] = "round"; - })(exports.LINE_JOIN || (exports.LINE_JOIN = {})); - /** - * Support line caps in `PIXI.LineStyle` for graphics. - * - * @see PIXI.Graphics#lineStyle - * - * @name LINE_CAP - * @memberof PIXI - * @static - * @enum {string} - * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges) - * @property {string} ROUND - 'round': add semicircle at ends - * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end) - */ - - (function (LINE_CAP) { - LINE_CAP["BUTT"] = "butt"; - LINE_CAP["ROUND"] = "round"; - LINE_CAP["SQUARE"] = "square"; - })(exports.LINE_CAP || (exports.LINE_CAP = {})); - /** - * Graphics curves resolution settings. If `adaptive` flag is set to `true`, - * the resolution is calculated based on the curve's length to ensure better visual quality. - * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`. - * - * @static - * @constant - * @memberof PIXI - * @name GRAPHICS_CURVES - * @type {object} - * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive - * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored) - * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored) - * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored) - */ - var GRAPHICS_CURVES = { - adaptive: true, - maxLength: 10, - minSegments: 8, - maxSegments: 2048, - epsilon: 0.0001, - _segmentsCount: function (length, defaultSegments) { - if (defaultSegments === void 0) { defaultSegments = 20; } - if (!this.adaptive || !length || isNaN(length)) { - return defaultSegments; - } - var result = Math.ceil(length / this.maxLength); - if (result < this.minSegments) { - result = this.minSegments; - } - else if (result > this.maxSegments) { - result = this.maxSegments; - } - return result; - }, - }; - - /** - * Fill style object for Graphics. - * - * @class - * @memberof PIXI - */ - var FillStyle = /** @class */ (function () { - function FillStyle() { - /** - * The hex color value used when coloring the Graphics object. - * - * @member {number} - * @default 0xFFFFFF - */ - this.color = 0xFFFFFF; - /** - * The alpha value used when filling the Graphics object. - * - * @member {number} - * @default 1 - */ - this.alpha = 1.0; - /** - * The texture to be used for the fill. - * - * @member {PIXI.Texture} - * @default 0 - */ - this.texture = Texture.WHITE; - /** - * The transform aplpied to the texture. - * - * @member {PIXI.Matrix} - * @default null - */ - this.matrix = null; - /** - * If the current fill is visible. - * - * @member {boolean} - * @default false - */ - this.visible = false; - this.reset(); - } - /** - * Clones the object - * - * @return {PIXI.FillStyle} - */ - FillStyle.prototype.clone = function () { - var obj = new FillStyle(); - obj.color = this.color; - obj.alpha = this.alpha; - obj.texture = this.texture; - obj.matrix = this.matrix; - obj.visible = this.visible; - return obj; - }; - /** - * Reset - */ - FillStyle.prototype.reset = function () { - this.color = 0xFFFFFF; - this.alpha = 1; - this.texture = Texture.WHITE; - this.matrix = null; - this.visible = false; - }; - /** - * Destroy and don't use after this - */ - FillStyle.prototype.destroy = function () { - this.texture = null; - this.matrix = null; - }; - return FillStyle; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$5 = function(d, b) { - extendStatics$5 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$5(d, b); - }; - - function __extends$5(d, b) { - extendStatics$5(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Builds a polygon to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildPoly = { - build: function (graphicsData) { - graphicsData.points = graphicsData.shape.points.slice(); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var holes = graphicsData.holes; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - if (points.length >= 6) { - var holeArray = []; - // Process holes.. - for (var i = 0; i < holes.length; i++) { - var hole = holes[i]; - holeArray.push(points.length / 2); - points = points.concat(hole.points); - } - // sort color - var triangles = earcut_1(points, holeArray, 2); - if (!triangles) { - return; - } - var vertPos = verts.length / 2; - for (var i = 0; i < triangles.length; i += 3) { - indices.push(triangles[i] + vertPos); - indices.push(triangles[i + 1] + vertPos); - indices.push(triangles[i + 2] + vertPos); - } - for (var i = 0; i < points.length; i++) { - verts.push(points[i]); - } - } - }, - }; - - // for type only - /** - * Builds a circle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildCircle = { - build: function (graphicsData) { - // need to convert points to a nice regular data - var circleData = graphicsData.shape; - var points = graphicsData.points; - var x = circleData.x; - var y = circleData.y; - var width; - var height; - points.length = 0; - // TODO - bit hacky?? - if (graphicsData.type === exports.SHAPES.CIRC) { - width = circleData.radius; - height = circleData.radius; - } - else { - var ellipseData = graphicsData.shape; - width = ellipseData.width; - height = ellipseData.height; - } - if (width === 0 || height === 0) { - return; - } - var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius)) - || Math.floor(15 * Math.sqrt(width + height)); - totalSegs /= 2.3; - var seg = (Math.PI * 2) / totalSegs; - for (var i = 0; i < totalSegs - 0.5; i++) { - points.push(x + (Math.sin(-seg * i) * width), y + (Math.cos(-seg * i) * height)); - } - points.push(points[0], points[1]); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var vertPos = verts.length / 2; - var center = vertPos; - var circle = (graphicsData.shape); - var matrix = graphicsData.matrix; - var x = circle.x; - var y = circle.y; - // Push center (special point) - verts.push(graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x, graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y); - for (var i = 0; i < points.length; i += 2) { - verts.push(points[i], points[i + 1]); - // add some uvs - indices.push(vertPos++, center, vertPos); - } - }, - }; - - /** - * Builds a rectangle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildRectangle = { - build: function (graphicsData) { - // --- // - // need to convert points to a nice regular data - // - var rectData = graphicsData.shape; - var x = rectData.x; - var y = rectData.y; - var width = rectData.width; - var height = rectData.height; - var points = graphicsData.points; - points.length = 0; - points.push(x, y, x + width, y, x + width, y + height, x, y + height); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var vertPos = verts.length / 2; - verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]); - graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3); - }, - }; - - /** - * Calculate a single point for a quadratic bezier curve. - * Utility function used by quadraticBezierCurve. - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} n1 - first number - * @param {number} n2 - second number - * @param {number} perc - percentage - * @return {number} the result - * - */ - function getPt(n1, n2, perc) { - var diff = n2 - n1; - return n1 + (diff * perc); - } - /** - * Calculate the points for a quadratic bezier curve. (helper function..) - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} fromX - Origin point x - * @param {number} fromY - Origin point x - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created. - * @return {number[]} an array of points - */ - function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) { - if (out === void 0) { out = []; } - var n = 20; - var points = out; - var xa = 0; - var ya = 0; - var xb = 0; - var yb = 0; - var x = 0; - var y = 0; - for (var i = 0, j = 0; i <= n; ++i) { - j = i / n; - // The Green Line - xa = getPt(fromX, cpX, j); - ya = getPt(fromY, cpY, j); - xb = getPt(cpX, toX, j); - yb = getPt(cpY, toY, j); - // The Black Dot - x = getPt(xa, xb, j); - y = getPt(ya, yb, j); - points.push(x, y); - } - return points; - } - /** - * Builds a rounded rectangle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildRoundedRectangle = { - build: function (graphicsData) { - var rrectData = graphicsData.shape; - var points = graphicsData.points; - var x = rrectData.x; - var y = rrectData.y; - var width = rrectData.width; - var height = rrectData.height; - // Don't allow negative radius or greater than half the smallest width - var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2)); - points.length = 0; - // No radius, do a simple rectangle - if (!radius) { - points.push(x, y, x + width, y, x + width, y + height, x, y + height); - } - else { - quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points); - quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points); - quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points); - quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points); - } - // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. - // TODO - fix this properly, this is not very elegant.. but it works for now. - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var vecPos = verts.length / 2; - var triangles = earcut_1(points, null, 2); - for (var i = 0, j = triangles.length; i < j; i += 3) { - indices.push(triangles[i] + vecPos); - // indices.push(triangles[i] + vecPos); - indices.push(triangles[i + 1] + vecPos); - // indices.push(triangles[i + 2] + vecPos); - indices.push(triangles[i + 2] + vecPos); - } - for (var i = 0, j = points.length; i < j; i++) { - verts.push(points[i], points[++i]); - } - }, - }; - - /** - * Buffers vertices to draw a square cap. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} x - X-coord of end point - * @param {number} y - Y-coord of end point - * @param {number} nx - X-coord of line normal pointing inside - * @param {number} ny - Y-coord of line normal pointing inside - * @param {Array} verts - vertex buffer - * @returns {} - */ - function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) { - var ix = x - (nx * innerWeight); - var iy = y - (ny * innerWeight); - var ox = x + (nx * outerWeight); - var oy = y + (ny * outerWeight); - /* Rotate nx,ny for extension vector */ - var exx; - var eyy; - if (clockwise) { - exx = ny; - eyy = -nx; - } - else { - exx = -ny; - eyy = nx; - } - /* [i|0]x,y extended at cap */ - var eix = ix + exx; - var eiy = iy + eyy; - var eox = ox + exx; - var eoy = oy + eyy; - /* Square itself must be inserted clockwise*/ - verts.push(eix, eiy); - verts.push(eox, eoy); - return 2; - } - /** - * Buffers vertices to draw an arc at the line joint or cap. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} cx - X-coord of center - * @param {number} cy - Y-coord of center - * @param {number} sx - X-coord of arc start - * @param {number} sy - Y-coord of arc start - * @param {number} ex - X-coord of arc end - * @param {number} ey - Y-coord of arc end - * @param {Array} verts - buffer of vertices - * @param {boolean} clockwise - orientation of vertices - * @returns {number} - no. of vertices pushed - */ - function round(cx, cy, sx, sy, ex, ey, verts, clockwise) { - var cx2p0x = sx - cx; - var cy2p0y = sy - cy; - var angle0 = Math.atan2(cx2p0x, cy2p0y); - var angle1 = Math.atan2(ex - cx, ey - cy); - if (clockwise && angle0 < angle1) { - angle0 += Math.PI * 2; - } - else if (!clockwise && angle0 > angle1) { - angle1 += Math.PI * 2; - } - var startAngle = angle0; - var angleDiff = angle1 - angle0; - var absAngleDiff = Math.abs(angleDiff); - /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND) - { - const r1x = cx - nxtPx; - const r1y = cy - nxtPy; - - if (r1x === 0) - { - if (r1y > 0) - { - angleDiff = -angleDiff; - } - } - else if (r1x >= -GRAPHICS_CURVES.epsilon) - { - angleDiff = -angleDiff; - } - }*/ - var radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y)); - var segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1; - var angleInc = angleDiff / segCount; - startAngle += angleInc; - if (clockwise) { - verts.push(cx, cy); - verts.push(sx, sy); - for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { - verts.push(cx, cy); - verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); - } - verts.push(cx, cy); - verts.push(ex, ey); - } - else { - verts.push(sx, sy); - verts.push(cx, cy); - for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { - verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); - verts.push(cx, cy); - } - verts.push(ex, ey); - verts.push(cx, cy); - } - return segCount * 2; - } - /** - * Builds a line to draw using the polygon method. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildNonNativeLine(graphicsData, graphicsGeometry) { - var shape = graphicsData.shape; - var points = graphicsData.points || shape.points.slice(); - var eps = graphicsGeometry.closePointEps; - if (points.length === 0) { - return; - } - // if the line width is an odd number add 0.5 to align to a whole pixel - // commenting this out fixes #711 and #1620 - // if (graphicsData.lineWidth%2) - // { - // for (i = 0; i < points.length; i++) - // { - // points[i] += 0.5; - // } - // } - var style = graphicsData.lineStyle; - // get first and last point.. figure out the middle! - var firstPoint = new Point(points[0], points[1]); - var lastPoint = new Point(points[points.length - 2], points[points.length - 1]); - var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; - var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps - && Math.abs(firstPoint.y - lastPoint.y) < eps; - // if the first point is the last point - gonna have issues :) - if (closedShape) { - // need to clone as we are going to slightly modify the shape.. - points = points.slice(); - if (closedPath) { - points.pop(); - points.pop(); - lastPoint.set(points[points.length - 2], points[points.length - 1]); - } - var midPointX = (firstPoint.x + lastPoint.x) * 0.5; - var midPointY = (lastPoint.y + firstPoint.y) * 0.5; - points.unshift(midPointX, midPointY); - points.push(midPointX, midPointY); - } - var verts = graphicsGeometry.points; - var length = points.length / 2; - var indexCount = points.length; - var indexStart = verts.length / 2; - // Max. inner and outer width - var width = style.width / 2; - var widthSquared = width * width; - var miterLimitSquared = style.miterLimit * style.miterLimit; - /* Line segments of interest where (x1,y1) forms the corner. */ - var x0 = points[0]; - var y0 = points[1]; - var x1 = points[2]; - var y1 = points[3]; - var x2 = 0; - var y2 = 0; - /* perp[?](x|y) = the line normal with magnitude lineWidth. */ - var perpx = -(y0 - y1); - var perpy = x0 - x1; - var perp1x = 0; - var perp1y = 0; - var dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - var ratio = style.alignment; // 0.5; - var innerWeight = (1 - ratio) * 2; - var outerWeight = ratio * 2; - if (!closedShape) { - if (style.cap === exports.LINE_CAP.ROUND) { - indexCount += round(x0 - (perpx * (innerWeight - outerWeight) * 0.5), y0 - (perpy * (innerWeight - outerWeight) * 0.5), x0 - (perpx * innerWeight), y0 - (perpy * innerWeight), x0 + (perpx * outerWeight), y0 + (perpy * outerWeight), verts, true) + 2; - } - else if (style.cap === exports.LINE_CAP.SQUARE) { - indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts); - } - } - // Push first point (below & above vertices) - verts.push(x0 - (perpx * innerWeight), y0 - (perpy * innerWeight)); - verts.push(x0 + (perpx * outerWeight), y0 + (perpy * outerWeight)); - for (var i = 1; i < length - 1; ++i) { - x0 = points[(i - 1) * 2]; - y0 = points[((i - 1) * 2) + 1]; - x1 = points[i * 2]; - y1 = points[(i * 2) + 1]; - x2 = points[(i + 1) * 2]; - y2 = points[((i + 1) * 2) + 1]; - perpx = -(y0 - y1); - perpy = x0 - x1; - dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - perp1x = -(y1 - y2); - perp1y = x1 - x2; - dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y)); - perp1x /= dist; - perp1y /= dist; - perp1x *= width; - perp1y *= width; - /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */ - var dx0 = x1 - x0; - var dy0 = y0 - y1; - var dx1 = x1 - x2; - var dy1 = y2 - y1; - /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ - var cross = (dy0 * dx1) - (dy1 * dx0); - var clockwise = (cross < 0); - /* Going nearly straight? */ - if (Math.abs(cross) < 0.1) { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - continue; - } - /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */ - var c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0)); - var c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2)); - var px = ((dx0 * c2) - (dx1 * c1)) / cross; - var py = ((dy1 * c1) - (dy0 * c2)) / cross; - var pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1)); - /* Inner miter point */ - var imx = x1 + ((px - x1) * innerWeight); - var imy = y1 + ((py - y1) * innerWeight); - /* Outer miter point */ - var omx = x1 - ((px - x1) * outerWeight); - var omy = y1 - ((py - y1) * outerWeight); - /* Is the inside miter point too far away, creating a spike? */ - var smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1)); - var insideWeight = clockwise ? innerWeight : outerWeight; - var smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared); - var insideMiterOk = pdist <= smallerInsideDiagonalSq; - if (insideMiterOk) { - if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { - if (clockwise) /* rotating at inner angle */ { - verts.push(imx, imy); // inner miter point - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex - verts.push(imx, imy); // inner miter point - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex - } - else /* rotating at outer angle */ { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex - verts.push(omx, omy); // outer miter point - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's outer vertex - verts.push(omx, omy); // outer miter point - } - indexCount += 2; - } - else if (style.join === exports.LINE_JOIN.ROUND) { - if (clockwise) /* arc is outside */ { - verts.push(imx, imy); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 4; - verts.push(imx, imy); - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); - } - else /* arc is inside */ { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(omx, omy); - indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 4; - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); - verts.push(omx, omy); - } - } - else { - verts.push(imx, imy); - verts.push(omx, omy); - } - } - else // inside miter is NOT ok - { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex - if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { ; } - else if (style.join === exports.LINE_JOIN.ROUND) { - if (clockwise) /* arc is outside */ { - indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 2; - } - else /* arc is inside */ { - indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 2; - } - } - else { - if (clockwise) { - verts.push(omx, omy); // inner miter point - verts.push(omx, omy); // inner miter point - } - else { - verts.push(imx, imy); // outer miter point - verts.push(imx, imy); // outer miter point - } - indexCount += 2; - } - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex - indexCount += 2; - } - } - x0 = points[(length - 2) * 2]; - y0 = points[((length - 2) * 2) + 1]; - x1 = points[(length - 1) * 2]; - y1 = points[((length - 1) * 2) + 1]; - perpx = -(y0 - y1); - perpy = x0 - x1; - dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - if (!closedShape) { - if (style.cap === exports.LINE_CAP.ROUND) { - indexCount += round(x1 - (perpx * (innerWeight - outerWeight) * 0.5), y1 - (perpy * (innerWeight - outerWeight) * 0.5), x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), verts, false) + 2; - } - else if (style.cap === exports.LINE_CAP.SQUARE) { - indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts); - } - } - var indices = graphicsGeometry.indices; - var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon; - // indices.push(indexStart); - for (var i = indexStart; i < indexCount + indexStart - 2; ++i) { - x0 = verts[(i * 2)]; - y0 = verts[(i * 2) + 1]; - x1 = verts[(i + 1) * 2]; - y1 = verts[((i + 1) * 2) + 1]; - x2 = verts[(i + 2) * 2]; - y2 = verts[((i + 2) * 2) + 1]; - /* Skip zero area triangles */ - if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2) { - continue; - } - indices.push(i, i + 1, i + 2); - } - } - /** - * Builds a line to draw using the gl.drawArrays(gl.LINES) method - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildNativeLine(graphicsData, graphicsGeometry) { - var i = 0; - var shape = graphicsData.shape; - var points = graphicsData.points || shape.points; - var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; - if (points.length === 0) - { return; } - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var length = points.length / 2; - var startIndex = verts.length / 2; - var currentIndex = startIndex; - verts.push(points[0], points[1]); - for (i = 1; i < length; i++) { - verts.push(points[i * 2], points[(i * 2) + 1]); - indices.push(currentIndex, currentIndex + 1); - currentIndex++; - } - if (closedShape) { - indices.push(currentIndex, startIndex); - } - } - /** - * Builds a line to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildLine(graphicsData, graphicsGeometry) { - if (graphicsData.lineStyle.native) { - buildNativeLine(graphicsData, graphicsGeometry); - } - else { - buildNonNativeLine(graphicsData, graphicsGeometry); - } - } - - /** - * Draw a star shape with an arbitrary number of points. - * - * @class - * @extends PIXI.Polygon - * @memberof PIXI.graphicsUtils - * @param {number} x - Center X position of the star - * @param {number} y - Center Y position of the star - * @param {number} points - The number of points of the star, must be > 1 - * @param {number} radius - The outer radius of the star - * @param {number} [innerRadius] - The inner radius between points, default half `radius` - * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - var Star = /** @class */ (function (_super) { - __extends$5(Star, _super); - function Star(x, y, points, radius, innerRadius, rotation) { - if (rotation === void 0) { rotation = 0; } - var _this = this; - innerRadius = innerRadius || radius / 2; - var startAngle = (-1 * Math.PI / 2) + rotation; - var len = points * 2; - var delta = PI_2 / len; - var polygon = []; - for (var i = 0; i < len; i++) { - var r = i % 2 ? innerRadius : radius; - var angle = (i * delta) + startAngle; - polygon.push(x + (r * Math.cos(angle)), y + (r * Math.sin(angle))); - } - _this = _super.call(this, polygon) || this; - return _this; - } - return Star; - }(Polygon)); - - /** - * Utilities for arc curves - * @class - * @private - */ - var ArcUtils = /** @class */ (function () { - function ArcUtils() { - } - /** - * The arcTo() method creates an arc/curve between two tangents on the canvas. - * - * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! - * - * @private - * @param {number} x1 - The x-coordinate of the beginning of the arc - * @param {number} y1 - The y-coordinate of the beginning of the arc - * @param {number} x2 - The x-coordinate of the end of the arc - * @param {number} y2 - The y-coordinate of the end of the arc - * @param {number} radius - The radius of the arc - * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`. - */ - ArcUtils.curveTo = function (x1, y1, x2, y2, radius, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - var a1 = fromY - y1; - var b1 = fromX - x1; - var a2 = y2 - y1; - var b2 = x2 - x1; - var mm = Math.abs((a1 * b2) - (b1 * a2)); - if (mm < 1.0e-8 || radius === 0) { - if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) { - points.push(x1, y1); - } - return null; - } - var dd = (a1 * a1) + (b1 * b1); - var cc = (a2 * a2) + (b2 * b2); - var tt = (a1 * a2) + (b1 * b2); - var k1 = radius * Math.sqrt(dd) / mm; - var k2 = radius * Math.sqrt(cc) / mm; - var j1 = k1 * tt / dd; - var j2 = k2 * tt / cc; - var cx = (k1 * b2) + (k2 * b1); - var cy = (k1 * a2) + (k2 * a1); - var px = b1 * (k2 + j1); - var py = a1 * (k2 + j1); - var qx = b2 * (k1 + j2); - var qy = a2 * (k1 + j2); - var startAngle = Math.atan2(py - cy, px - cx); - var endAngle = Math.atan2(qy - cy, qx - cx); - return { - cx: (cx + x1), - cy: (cy + y1), - radius: radius, - startAngle: startAngle, - endAngle: endAngle, - anticlockwise: (b1 * a2 > b2 * a1), - }; - }; - /* eslint-disable max-len */ - /** - * The arc method creates an arc/curve (used to create circles, or parts of circles). - * - * @private - * @param {number} startX - Start x location of arc - * @param {number} startY - Start y location of arc - * @param {number} cx - The x-coordinate of the center of the circle - * @param {number} cy - The y-coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position - * of the arc's circle) - * @param {number} endAngle - The ending angle, in radians - * @param {boolean} anticlockwise - Specifies whether the drawing should be - * counter-clockwise or clockwise. False is default, and indicates clockwise, while true - * indicates counter-clockwise. - * @param {number[]} points - Collection of points to add to - */ - ArcUtils.arc = function (_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) { - var sweep = endAngle - startAngle; - var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / PI_2) * 40); - var theta = (sweep) / (n * 2); - var theta2 = theta * 2; - var cTheta = Math.cos(theta); - var sTheta = Math.sin(theta); - var segMinus = n - 1; - var remainder = (segMinus % 1) / segMinus; - for (var i = 0; i <= segMinus; ++i) { - var real = i + (remainder * i); - var angle = ((theta) + startAngle + (theta2 * real)); - var c = Math.cos(angle); - var s = -Math.sin(angle); - points.push((((cTheta * c) + (sTheta * s)) * radius) + cx, (((cTheta * -s) + (sTheta * c)) * radius) + cy); - } - }; - return ArcUtils; - }()); - - /** - * Utilities for bezier curves - * @class - * @private - */ - var BezierUtils = /** @class */ (function () { - function BezierUtils() { - } - /** - * Calculate length of bezier curve. - * Analytical solution is impossible, since it involves an integral that does not integrate in general. - * Therefore numerical solution is used. - * - * @private - * @param {number} fromX - Starting point x - * @param {number} fromY - Starting point y - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {number} Length of bezier curve - */ - BezierUtils.curveLength = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) { - var n = 10; - var result = 0.0; - var t = 0.0; - var t2 = 0.0; - var t3 = 0.0; - var nt = 0.0; - var nt2 = 0.0; - var nt3 = 0.0; - var x = 0.0; - var y = 0.0; - var dx = 0.0; - var dy = 0.0; - var prevX = fromX; - var prevY = fromY; - for (var i = 1; i <= n; ++i) { - t = i / n; - t2 = t * t; - t3 = t2 * t; - nt = (1.0 - t); - nt2 = nt * nt; - nt3 = nt2 * nt; - x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX); - y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY); - dx = prevX - x; - dy = prevY - y; - prevX = x; - prevY = y; - result += Math.sqrt((dx * dx) + (dy * dy)); - } - return result; - }; - /** - * Calculate the points for a bezier curve and then draws it. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Path array to push points into - */ - BezierUtils.curveTo = function (cpX, cpY, cpX2, cpY2, toX, toY, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - points.length -= 2; - var n = GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)); - var dt = 0; - var dt2 = 0; - var dt3 = 0; - var t2 = 0; - var t3 = 0; - points.push(fromX, fromY); - for (var i = 1, j = 0; i <= n; ++i) { - j = i / n; - dt = (1 - j); - dt2 = dt * dt; - dt3 = dt2 * dt; - t2 = j * j; - t3 = t2 * j; - points.push((dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)); - } - }; - return BezierUtils; - }()); - - /** - * Utilities for quadratic curves - * @class - * @private - */ - var QuadraticUtils = /** @class */ (function () { - function QuadraticUtils() { - } - /** - * Calculate length of quadratic curve - * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/} - * for the detailed explanation of math behind this. - * - * @private - * @param {number} fromX - x-coordinate of curve start point - * @param {number} fromY - y-coordinate of curve start point - * @param {number} cpX - x-coordinate of curve control point - * @param {number} cpY - y-coordinate of curve control point - * @param {number} toX - x-coordinate of curve end point - * @param {number} toY - y-coordinate of curve end point - * @return {number} Length of quadratic curve - */ - QuadraticUtils.curveLength = function (fromX, fromY, cpX, cpY, toX, toY) { - var ax = fromX - (2.0 * cpX) + toX; - var ay = fromY - (2.0 * cpY) + toY; - var bx = (2.0 * cpX) - (2.0 * fromX); - var by = (2.0 * cpY) - (2.0 * fromY); - var a = 4.0 * ((ax * ax) + (ay * ay)); - var b = 4.0 * ((ax * bx) + (ay * by)); - var c = (bx * bx) + (by * by); - var s = 2.0 * Math.sqrt(a + b + c); - var a2 = Math.sqrt(a); - var a32 = 2.0 * a * a2; - var c2 = 2.0 * Math.sqrt(c); - var ba = b / a2; - return ((a32 * s) - + (a2 * b * (s - c2)) - + (((4.0 * c * a) - (b * b)) - * Math.log(((2.0 * a2) + ba + s) / (ba + c2)))) / (4.0 * a32); - }; - /** - * Calculate the points for a quadratic bezier curve and then draws it. - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * @private - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Points to add segments to. - */ - QuadraticUtils.curveTo = function (cpX, cpY, toX, toY, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)); - var xa = 0; - var ya = 0; - for (var i = 1; i <= n; ++i) { - var j = i / n; - xa = fromX + ((cpX - fromX) * j); - ya = fromY + ((cpY - fromY) * j); - points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), ya + (((cpY + ((toY - cpY) * j)) - ya) * j)); - } - }; - return QuadraticUtils; - }()); - - /** - * A structure to hold interim batch objects for Graphics. - * @class - * @memberof PIXI.graphicsUtils - */ - var BatchPart = /** @class */ (function () { - function BatchPart() { - this.reset(); - } - /** - * Begin batch part - * - * @param {PIXI.FillStyle | PIXI.LineStyle} style - * @param {number} startIndex - * @param {number} attribStart - */ - BatchPart.prototype.begin = function (style, startIndex, attribStart) { - this.reset(); - this.style = style; - this.start = startIndex; - this.attribStart = attribStart; - }; - /** - * End batch part - * - * @param {number} endIndex - * @param {number} endAttrib - */ - BatchPart.prototype.end = function (endIndex, endAttrib) { - this.attribSize = endAttrib - this.attribStart; - this.size = endIndex - this.start; - }; - BatchPart.prototype.reset = function () { - this.style = null; - this.size = 0; - this.start = 0; - this.attribStart = 0; - this.attribSize = 0; - }; - return BatchPart; - }()); - - /** - * Generalized convenience utilities for Graphics. - * - * @namespace graphicsUtils - * @memberof PIXI - */ - var _a; - /** - * Map of fill commands for each shape type. - * - * @memberof PIXI.graphicsUtils - * @member {Object} FILL_COMMANDS - */ - var FILL_COMMANDS = (_a = {}, - _a[exports.SHAPES.POLY] = buildPoly, - _a[exports.SHAPES.CIRC] = buildCircle, - _a[exports.SHAPES.ELIP] = buildCircle, - _a[exports.SHAPES.RECT] = buildRectangle, - _a[exports.SHAPES.RREC] = buildRoundedRectangle, - _a); - /** - * Batch pool, stores unused batches for preventing allocations. - * - * @memberof PIXI.graphicsUtils - * @member {Array} BATCH_POOL - */ - var BATCH_POOL = []; - /** - * Draw call pool, stores unused draw calls for preventing allocations. - * - * @memberof PIXI.graphicsUtils - * @member {Array} DRAW_CALL_POOL - */ - var DRAW_CALL_POOL = []; - - var index$2 = ({ - buildPoly: buildPoly, - buildCircle: buildCircle, - buildRectangle: buildRectangle, - buildRoundedRectangle: buildRoundedRectangle, - FILL_COMMANDS: FILL_COMMANDS, - BATCH_POOL: BATCH_POOL, - DRAW_CALL_POOL: DRAW_CALL_POOL, - buildLine: buildLine, - Star: Star, - ArcUtils: ArcUtils, - BezierUtils: BezierUtils, - QuadraticUtils: QuadraticUtils, - BatchPart: BatchPart - }); - - /** - * A class to contain data useful for Graphics objects - * - * @class - * @memberof PIXI - */ - var GraphicsData = /** @class */ (function () { - /** - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw - * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw - * @param {PIXI.Matrix} [matrix] - Transform matrix - */ - function GraphicsData(shape, fillStyle, lineStyle, matrix) { - if (fillStyle === void 0) { fillStyle = null; } - if (lineStyle === void 0) { lineStyle = null; } - if (matrix === void 0) { matrix = null; } - /** - * The shape object to draw. - * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} - */ - this.shape = shape; - /** - * The style of the line. - * @member {PIXI.LineStyle} - */ - this.lineStyle = lineStyle; - /** - * The style of the fill. - * @member {PIXI.FillStyle} - */ - this.fillStyle = fillStyle; - /** - * The transform matrix. - * @member {PIXI.Matrix} - */ - this.matrix = matrix; - /** - * The type of the shape, see the Const.Shapes file for all the existing types, - * @member {number} - */ - this.type = shape.type; - /** - * The collection of points. - * @member {number[]} - */ - this.points = []; - /** - * The collection of holes. - * @member {PIXI.GraphicsData[]} - */ - this.holes = []; - } - /** - * Creates a new GraphicsData object with the same values as this one. - * - * @return {PIXI.GraphicsData} Cloned GraphicsData object - */ - GraphicsData.prototype.clone = function () { - return new GraphicsData(this.shape, this.fillStyle, this.lineStyle, this.matrix); - }; - /** - * Destroys the Graphics data. - * - */ - GraphicsData.prototype.destroy = function () { - this.shape = null; - this.holes.length = 0; - this.holes = null; - this.points.length = 0; - this.points = null; - this.lineStyle = null; - this.fillStyle = null; - }; - return GraphicsData; - }()); - - var tmpPoint = new Point(); - var tmpBounds = new Bounds(); - /** - * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. - * - * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. - * - * @class - * @extends PIXI.BatchGeometry - * @memberof PIXI - */ - var GraphicsGeometry = /** @class */ (function (_super) { - __extends$5(GraphicsGeometry, _super); - function GraphicsGeometry() { - var _this = _super.call(this) || this; - _this.uvsFloat32 = null; - _this.indicesUint16 = null; - /** - * An array of points to draw, 2 numbers per point - * - * @member {number[]} - * @protected - */ - _this.points = []; - /** - * The collection of colors - * - * @member {number[]} - * @protected - */ - _this.colors = []; - /** - * The UVs collection - * - * @member {number[]} - * @protected - */ - _this.uvs = []; - /** - * The indices of the vertices - * - * @member {number[]} - * @protected - */ - _this.indices = []; - /** - * Reference to the texture IDs. - * - * @member {number[]} - * @protected - */ - _this.textureIds = []; - /** - * The collection of drawn shapes. - * - * @member {PIXI.GraphicsData[]} - * @protected - */ - _this.graphicsData = []; - /** - * Used to detect if the graphics object has changed. - * - * @member {number} - * @protected - */ - _this.dirty = 0; - /** - * Batches need to regenerated if the geometry is updated. - * - * @member {number} - * @protected - */ - _this.batchDirty = -1; - /** - * Used to check if the cache is dirty. - * - * @member {number} - * @protected - */ - _this.cacheDirty = -1; - /** - * Used to detect if we cleared the graphicsData. - * - * @member {number} - * @default 0 - * @protected - */ - _this.clearDirty = 0; - /** - * List of current draw calls drived from the batches. - * - * @member {object[]} - * @protected - */ - _this.drawCalls = []; - /** - * Intermediate abstract format sent to batch system. - * Can be converted to drawCalls or to batchable objects. - * - * @member {PIXI.graphicsUtils.BatchPart[]} - * @protected - */ - _this.batches = []; - /** - * Index of the last batched shape in the stack of calls. - * - * @member {number} - * @protected - */ - _this.shapeIndex = 0; - /** - * Cached bounds. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._bounds = new Bounds(); - /** - * The bounds dirty flag. - * - * @member {number} - * @protected - */ - _this.boundsDirty = -1; - /** - * Padding to add to the bounds. - * - * @member {number} - * @default 0 - */ - _this.boundsPadding = 0; - _this.batchable = false; - _this.indicesUint16 = null; - _this.uvsFloat32 = null; - /** - * Minimal distance between points that are considered different. - * Affects line tesselation. - * - * @member {number} - */ - _this.closePointEps = 1e-4; - return _this; - } - Object.defineProperty(GraphicsGeometry.prototype, "bounds", { - /** - * Get the current bounds of the graphic geometry. - * - * @member {PIXI.Bounds} - * @readonly - */ - get: function () { - if (this.boundsDirty !== this.dirty) { - this.boundsDirty = this.dirty; - this.calculateBounds(); - } - return this._bounds; - }, - enumerable: false, - configurable: true - }); - /** - * Call if you changed graphicsData manually. - * Empties all batch buffers. - */ - GraphicsGeometry.prototype.invalidate = function () { - this.boundsDirty = -1; - this.dirty++; - this.batchDirty++; - this.shapeIndex = 0; - this.points.length = 0; - this.colors.length = 0; - this.uvs.length = 0; - this.indices.length = 0; - this.textureIds.length = 0; - for (var i = 0; i < this.drawCalls.length; i++) { - this.drawCalls[i].texArray.clear(); - DRAW_CALL_POOL.push(this.drawCalls[i]); - } - this.drawCalls.length = 0; - for (var i = 0; i < this.batches.length; i++) { - var batchPart = this.batches[i]; - batchPart.reset(); - BATCH_POOL.push(batchPart); - } - this.batches.length = 0; - }; - /** - * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. - * - * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls - */ - GraphicsGeometry.prototype.clear = function () { - if (this.graphicsData.length > 0) { - this.invalidate(); - this.clearDirty++; - this.graphicsData.length = 0; - } - return this; - }; - /** - * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. - * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. - * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. - */ - GraphicsGeometry.prototype.drawShape = function (shape, fillStyle, lineStyle, matrix) { - if (fillStyle === void 0) { fillStyle = null; } - if (lineStyle === void 0) { lineStyle = null; } - if (matrix === void 0) { matrix = null; } - var data = new GraphicsData(shape, fillStyle, lineStyle, matrix); - this.graphicsData.push(data); - this.dirty++; - return this; - }; - /** - * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. - */ - GraphicsGeometry.prototype.drawHole = function (shape, matrix) { - if (matrix === void 0) { matrix = null; } - if (!this.graphicsData.length) { - return null; - } - var data = new GraphicsData(shape, null, null, matrix); - var lastShape = this.graphicsData[this.graphicsData.length - 1]; - data.lineStyle = lastShape.lineStyle; - lastShape.holes.push(data); - this.dirty++; - return this; - }; - /** - * Destroys the GraphicsGeometry object. - * - */ - GraphicsGeometry.prototype.destroy = function () { - _super.prototype.destroy.call(this); - // destroy each of the GraphicsData objects - for (var i = 0; i < this.graphicsData.length; ++i) { - this.graphicsData[i].destroy(); - } - this.points.length = 0; - this.points = null; - this.colors.length = 0; - this.colors = null; - this.uvs.length = 0; - this.uvs = null; - this.indices.length = 0; - this.indices = null; - this.indexBuffer.destroy(); - this.indexBuffer = null; - this.graphicsData.length = 0; - this.graphicsData = null; - this.drawCalls.length = 0; - this.drawCalls = null; - this.batches.length = 0; - this.batches = null; - this._bounds = null; - }; - /** - * Check to see if a point is contained within this geometry. - * - * @param {PIXI.IPointData} point - Point to check if it's contained. - * @return {Boolean} `true` if the point is contained within geometry. - */ - GraphicsGeometry.prototype.containsPoint = function (point) { - var graphicsData = this.graphicsData; - for (var i = 0; i < graphicsData.length; ++i) { - var data = graphicsData[i]; - if (!data.fillStyle.visible) { - continue; - } - // only deal with fills.. - if (data.shape) { - if (data.matrix) { - data.matrix.applyInverse(point, tmpPoint); - } - else { - tmpPoint.copyFrom(point); - } - if (data.shape.contains(tmpPoint.x, tmpPoint.y)) { - var hitHole = false; - if (data.holes) { - for (var i_1 = 0; i_1 < data.holes.length; i_1++) { - var hole = data.holes[i_1]; - if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) { - hitHole = true; - break; - } - } - } - if (!hitHole) { - return true; - } - } - } - } - return false; - }; - /** - * Generates intermediate batch data. Either gets converted to drawCalls - * or used to convert to batch objects directly by the Graphics object. - * - * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices - */ - GraphicsGeometry.prototype.updateBatches = function (allow32Indices) { - if (!this.graphicsData.length) { - this.batchable = true; - return; - } - if (!this.validateBatching()) { - return; - } - this.cacheDirty = this.dirty; - var uvs = this.uvs; - var graphicsData = this.graphicsData; - var batchPart = null; - var currentStyle = null; - if (this.batches.length > 0) { - batchPart = this.batches[this.batches.length - 1]; - currentStyle = batchPart.style; - } - for (var i = this.shapeIndex; i < graphicsData.length; i++) { - this.shapeIndex++; - var data = graphicsData[i]; - var fillStyle = data.fillStyle; - var lineStyle = data.lineStyle; - var command = FILL_COMMANDS[data.type]; - // build out the shapes points.. - command.build(data); - if (data.matrix) { - this.transformPoints(data.points, data.matrix); - } - for (var j = 0; j < 2; j++) { - var style = (j === 0) ? fillStyle : lineStyle; - if (!style.visible) - { continue; } - var nextTexture = style.texture.baseTexture; - var index_1 = this.indices.length; - var attribIndex = this.points.length / 2; - nextTexture.wrapMode = exports.WRAP_MODES.REPEAT; - if (j === 0) { - this.processFill(data); - } - else { - this.processLine(data); - } - var size = (this.points.length / 2) - attribIndex; - if (size === 0) - { continue; } - // close batch if style is different - if (batchPart && !this._compareStyles(currentStyle, style)) { - batchPart.end(index_1, attribIndex); - batchPart = null; - } - // spawn new batch if its first batch or previous was closed - if (!batchPart) { - batchPart = BATCH_POOL.pop() || new BatchPart(); - batchPart.begin(style, index_1, attribIndex); - this.batches.push(batchPart); - currentStyle = style; - } - this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix); - } - } - var index = this.indices.length; - var attrib = this.points.length / 2; - if (batchPart) { - batchPart.end(index, attrib); - } - if (this.batches.length === 0) { - // there are no visible styles in GraphicsData - // its possible that someone wants Graphics just for the bounds - this.batchable = true; - return; - } - // prevent allocation when length is same as buffer - if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) { - this.indicesUint16.set(this.indices); - } - else { - var need32 = attrib > 0xffff && allow32Indices; - this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices); - } - // TODO make this a const.. - this.batchable = this.isBatchable(); - if (this.batchable) { - this.packBatches(); - } - else { - this.buildDrawCalls(); - } - }; - /** - * Affinity check - * - * @param {PIXI.FillStyle | PIXI.LineStyle} styleA - * @param {PIXI.FillStyle | PIXI.LineStyle} styleB - */ - GraphicsGeometry.prototype._compareStyles = function (styleA, styleB) { - if (!styleA || !styleB) { - return false; - } - if (styleA.texture.baseTexture !== styleB.texture.baseTexture) { - return false; - } - if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) { - return false; - } - if (!!styleA.native !== !!styleB.native) { - return false; - } - return true; - }; - /** - * Test geometry for batching process. - * - * @protected - */ - GraphicsGeometry.prototype.validateBatching = function () { - if (this.dirty === this.cacheDirty || !this.graphicsData.length) { - return false; - } - for (var i = 0, l = this.graphicsData.length; i < l; i++) { - var data = this.graphicsData[i]; - var fill = data.fillStyle; - var line = data.lineStyle; - if (fill && !fill.texture.baseTexture.valid) - { return false; } - if (line && !line.texture.baseTexture.valid) - { return false; } - } - return true; - }; - /** - * Offset the indices so that it works with the batcher. - * - * @protected - */ - GraphicsGeometry.prototype.packBatches = function () { - this.batchDirty++; - this.uvsFloat32 = new Float32Array(this.uvs); - var batches = this.batches; - for (var i = 0, l = batches.length; i < l; i++) { - var batch = batches[i]; - for (var j = 0; j < batch.size; j++) { - var index = batch.start + j; - this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart; - } - } - }; - /** - * Checks to see if this graphics geometry can be batched. - * Currently it needs to be small enough and not contain any native lines. - * - * @protected - */ - GraphicsGeometry.prototype.isBatchable = function () { - // prevent heavy mesh batching - if (this.points.length > 0xffff * 2) { - return false; - } - var batches = this.batches; - for (var i = 0; i < batches.length; i++) { - if (batches[i].style.native) { - return false; - } - } - return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2); - }; - /** - * Converts intermediate batches data to drawCalls. - * - * @protected - */ - GraphicsGeometry.prototype.buildDrawCalls = function () { - var TICK = ++BaseTexture._globalBatch; - for (var i = 0; i < this.drawCalls.length; i++) { - this.drawCalls[i].texArray.clear(); - DRAW_CALL_POOL.push(this.drawCalls[i]); - } - this.drawCalls.length = 0; - var colors = this.colors; - var textureIds = this.textureIds; - var currentGroup = DRAW_CALL_POOL.pop(); - if (!currentGroup) { - currentGroup = new BatchDrawCall(); - currentGroup.texArray = new BatchTextureArray(); - } - currentGroup.texArray.count = 0; - currentGroup.start = 0; - currentGroup.size = 0; - currentGroup.type = exports.DRAW_MODES.TRIANGLES; - var textureCount = 0; - var currentTexture = null; - var textureId = 0; - var native = false; - var drawMode = exports.DRAW_MODES.TRIANGLES; - var index = 0; - this.drawCalls.push(currentGroup); - // TODO - this can be simplified - for (var i = 0; i < this.batches.length; i++) { - var data = this.batches[i]; - // TODO add some full on MAX_TEXTURE CODE.. - var MAX_TEXTURES = 8; - // Forced cast for checking `native` without errors - var style = data.style; - var nextTexture = style.texture.baseTexture; - if (native !== !!style.native) { - native = !!style.native; - drawMode = native ? exports.DRAW_MODES.LINES : exports.DRAW_MODES.TRIANGLES; - // force the batch to break! - currentTexture = null; - textureCount = MAX_TEXTURES; - TICK++; - } - if (currentTexture !== nextTexture) { - currentTexture = nextTexture; - if (nextTexture._batchEnabled !== TICK) { - if (textureCount === MAX_TEXTURES) { - TICK++; - textureCount = 0; - if (currentGroup.size > 0) { - currentGroup = DRAW_CALL_POOL.pop(); - if (!currentGroup) { - currentGroup = new BatchDrawCall(); - currentGroup.texArray = new BatchTextureArray(); - } - this.drawCalls.push(currentGroup); - } - currentGroup.start = index; - currentGroup.size = 0; - currentGroup.texArray.count = 0; - currentGroup.type = drawMode; - } - // TODO add this to the render part.. - // Hack! Because texture has protected `touched` - nextTexture.touched = 1; // touch; - nextTexture._batchEnabled = TICK; - nextTexture._batchLocation = textureCount; - nextTexture.wrapMode = 10497; - currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture; - textureCount++; - } - } - currentGroup.size += data.size; - index += data.size; - textureId = nextTexture._batchLocation; - this.addColors(colors, style.color, style.alpha, data.attribSize); - this.addTextureIds(textureIds, textureId, data.attribSize); - } - BaseTexture._globalBatch = TICK; - // upload.. - // merge for now! - this.packAttributes(); - }; - /** - * Packs attributes to single buffer. - * - * @protected - */ - GraphicsGeometry.prototype.packAttributes = function () { - var verts = this.points; - var uvs = this.uvs; - var colors = this.colors; - var textureIds = this.textureIds; - // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes - var glPoints = new ArrayBuffer(verts.length * 3 * 4); - var f32 = new Float32Array(glPoints); - var u32 = new Uint32Array(glPoints); - var p = 0; - for (var i = 0; i < verts.length / 2; i++) { - f32[p++] = verts[i * 2]; - f32[p++] = verts[(i * 2) + 1]; - f32[p++] = uvs[i * 2]; - f32[p++] = uvs[(i * 2) + 1]; - u32[p++] = colors[i]; - f32[p++] = textureIds[i]; - } - this._buffer.update(glPoints); - this._indexBuffer.update(this.indicesUint16); - }; - /** - * Process fill part of Graphics. - * - * @param {PIXI.GraphicsData} data - * @protected - */ - GraphicsGeometry.prototype.processFill = function (data) { - if (data.holes.length) { - this.processHoles(data.holes); - buildPoly.triangulate(data, this); - } - else { - var command = FILL_COMMANDS[data.type]; - command.triangulate(data, this); - } - }; - /** - * Process line part of Graphics. - * - * @param {PIXI.GraphicsData} data - * @protected - */ - GraphicsGeometry.prototype.processLine = function (data) { - buildLine(data, this); - for (var i = 0; i < data.holes.length; i++) { - buildLine(data.holes[i], this); - } - }; - /** - * Process the holes data. - * - * @param {PIXI.GraphicsData[]} holes - Holes to render - * @protected - */ - GraphicsGeometry.prototype.processHoles = function (holes) { - for (var i = 0; i < holes.length; i++) { - var hole = holes[i]; - var command = FILL_COMMANDS[hole.type]; - command.build(hole); - if (hole.matrix) { - this.transformPoints(hole.points, hole.matrix); - } - } - }; - /** - * Update the local bounds of the object. Expensive to use performance-wise. - * - * @protected - */ - GraphicsGeometry.prototype.calculateBounds = function () { - var bounds = this._bounds; - var sequenceBounds = tmpBounds; - var curMatrix = Matrix.IDENTITY; - this._bounds.clear(); - sequenceBounds.clear(); - for (var i = 0; i < this.graphicsData.length; i++) { - var data = this.graphicsData[i]; - var shape = data.shape; - var type = data.type; - var lineStyle = data.lineStyle; - var nextMatrix = data.matrix || Matrix.IDENTITY; - var lineWidth = 0.0; - if (lineStyle && lineStyle.visible) { - var alignment = lineStyle.alignment; - lineWidth = lineStyle.width; - if (type === exports.SHAPES.POLY) { - lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment)); - } - else { - lineWidth = lineWidth * Math.max(0, alignment); - } - } - if (curMatrix !== nextMatrix) { - if (!sequenceBounds.isEmpty()) { - bounds.addBoundsMatrix(sequenceBounds, curMatrix); - sequenceBounds.clear(); - } - curMatrix = nextMatrix; - } - if (type === exports.SHAPES.RECT || type === exports.SHAPES.RREC) { - var rect = shape; - sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, lineWidth, lineWidth); - } - else if (type === exports.SHAPES.CIRC) { - var circle = shape; - sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y, circle.radius + lineWidth, circle.radius + lineWidth); - } - else if (type === exports.SHAPES.ELIP) { - var ellipse = shape; - sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y, ellipse.width + lineWidth, ellipse.height + lineWidth); - } - else { - var poly = shape; - // adding directly to the bounds - bounds.addVerticesMatrix(curMatrix, poly.points, 0, poly.points.length, lineWidth, lineWidth); - } - } - if (!sequenceBounds.isEmpty()) { - bounds.addBoundsMatrix(sequenceBounds, curMatrix); - } - bounds.pad(this.boundsPadding, this.boundsPadding); - }; - /** - * Transform points using matrix. - * - * @protected - * @param {number[]} points - Points to transform - * @param {PIXI.Matrix} matrix - Transform matrix - */ - GraphicsGeometry.prototype.transformPoints = function (points, matrix) { - for (var i = 0; i < points.length / 2; i++) { - var x = points[(i * 2)]; - var y = points[(i * 2) + 1]; - points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx; - points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty; - } - }; - /** - * Add colors. - * - * @protected - * @param {number[]} colors - List of colors to add to - * @param {number} color - Color to add - * @param {number} alpha - Alpha to use - * @param {number} size - Number of colors to add - */ - GraphicsGeometry.prototype.addColors = function (colors, color, alpha, size) { - // TODO use the premultiply bits Ivan added - var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16); - var rgba = premultiplyTint(rgb, alpha); - while (size-- > 0) { - colors.push(rgba); - } - }; - /** - * Add texture id that the shader/fragment wants to use. - * - * @protected - * @param {number[]} textureIds - * @param {number} id - * @param {number} size - */ - GraphicsGeometry.prototype.addTextureIds = function (textureIds, id, size) { - while (size-- > 0) { - textureIds.push(id); - } - }; - /** - * Generates the UVs for a shape. - * - * @protected - * @param {number[]} verts - Vertices - * @param {number[]} uvs - UVs - * @param {PIXI.Texture} texture - Reference to Texture - * @param {number} start - Index buffer start index. - * @param {number} size - The size/length for index buffer. - * @param {PIXI.Matrix} [matrix] - Optional transform for all points. - */ - GraphicsGeometry.prototype.addUvs = function (verts, uvs, texture, start, size, matrix) { - if (matrix === void 0) { matrix = null; } - var index = 0; - var uvsStart = uvs.length; - var frame = texture.frame; - while (index < size) { - var x = verts[(start + index) * 2]; - var y = verts[((start + index) * 2) + 1]; - if (matrix) { - var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx; - y = (matrix.b * x) + (matrix.d * y) + matrix.ty; - x = nx; - } - index++; - uvs.push(x / frame.width, y / frame.height); - } - var baseTexture = texture.baseTexture; - if (frame.width < baseTexture.width - || frame.height < baseTexture.height) { - this.adjustUvs(uvs, texture, uvsStart, size); - } - }; - /** - * Modify uvs array according to position of texture region - * Does not work with rotated or trimmed textures - * - * @param {number[]} uvs - array - * @param {PIXI.Texture} texture - region - * @param {number} start - starting index for uvs - * @param {number} size - how many points to adjust - */ - GraphicsGeometry.prototype.adjustUvs = function (uvs, texture, start, size) { - var baseTexture = texture.baseTexture; - var eps = 1e-6; - var finish = start + (size * 2); - var frame = texture.frame; - var scaleX = frame.width / baseTexture.width; - var scaleY = frame.height / baseTexture.height; - var offsetX = frame.x / frame.width; - var offsetY = frame.y / frame.height; - var minX = Math.floor(uvs[start] + eps); - var minY = Math.floor(uvs[start + 1] + eps); - for (var i = start + 2; i < finish; i += 2) { - minX = Math.min(minX, Math.floor(uvs[i] + eps)); - minY = Math.min(minY, Math.floor(uvs[i + 1] + eps)); - } - offsetX -= minX; - offsetY -= minY; - for (var i = start; i < finish; i += 2) { - uvs[i] = (uvs[i] + offsetX) * scaleX; - uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY; - } - }; - /** - * The maximum number of points to consider an object "batchable", - * able to be batched by the renderer's batch system. - * - * @memberof PIXI.GraphicsGeometry - * @static - * @member {number} BATCHABLE_SIZE - * @default 100 - */ - GraphicsGeometry.BATCHABLE_SIZE = 100; - return GraphicsGeometry; - }(BatchGeometry)); - - /** - * Represents the line style for Graphics. - * @memberof PIXI - * @class - * @extends PIXI.FillStyle - */ - var LineStyle = /** @class */ (function (_super) { - __extends$5(LineStyle, _super); - function LineStyle() { - var _this = _super !== null && _super.apply(this, arguments) || this; - /** - * The width (thickness) of any lines drawn. - * - * @member {number} - * @default 0 - */ - _this.width = 0; - /** - * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). - * - * @member {number} - * @default 0.5 - */ - _this.alignment = 0.5; - /** - * If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * - * @member {boolean} - * @default false - */ - _this.native = false; - /** - * Line cap style. - * - * @member {PIXI.LINE_CAP} - * @default PIXI.LINE_CAP.BUTT - */ - _this.cap = exports.LINE_CAP.BUTT; - /** - * Line join style. - * - * @member {PIXI.LINE_JOIN} - * @default PIXI.LINE_JOIN.MITER - */ - _this.join = exports.LINE_JOIN.MITER; - /** - * Miter limit. - * - * @member {number} - * @default 10 - */ - _this.miterLimit = 10; - return _this; - } - /** - * Clones the object - * - * @return {PIXI.LineStyle} - */ - LineStyle.prototype.clone = function () { - var obj = new LineStyle(); - obj.color = this.color; - obj.alpha = this.alpha; - obj.texture = this.texture; - obj.matrix = this.matrix; - obj.visible = this.visible; - obj.width = this.width; - obj.alignment = this.alignment; - obj.native = this.native; - obj.cap = this.cap; - obj.join = this.join; - obj.miterLimit = this.miterLimit; - return obj; - }; - /** - * Reset the line style to default. - */ - LineStyle.prototype.reset = function () { - _super.prototype.reset.call(this); - // Override default line style color - this.color = 0x0; - this.alignment = 0.5; - this.width = 0; - this.native = false; - }; - return LineStyle; - }(FillStyle)); - - var temp = new Float32Array(3); - // a default shaders map used by graphics.. - var DEFAULT_SHADERS = {}; - /** - * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. - * - * Note that because Graphics can share a GraphicsGeometry with other instances, - * it is necessary to call `destroy()` to properly dereference the underlying - * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same - * Graphics instance and call `clear()` between redraws. - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Graphics = /** @class */ (function (_super) { - __extends$5(Graphics, _super); - /** - * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted - * will create a new GraphicsGeometry instance. - */ - function Graphics(geometry) { - if (geometry === void 0) { geometry = null; } - var _this = _super.call(this) || this; - _this._geometry = geometry || new GraphicsGeometry(); - _this._geometry.refCount++; - /** - * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. - * Can be shared between multiple Graphics objects. - * - * @member {PIXI.Shader} - */ - _this.shader = null; - /** - * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., - * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. - * - * @member {PIXI.State} - */ - _this.state = State.for2d(); - /** - * Current fill style - * - * @member {PIXI.FillStyle} - * @protected - */ - _this._fillStyle = new FillStyle(); - /** - * Current line style - * - * @member {PIXI.LineStyle} - * @protected - */ - _this._lineStyle = new LineStyle(); - /** - * Current shape transform matrix. - * - * @member {PIXI.Matrix} - * @protected - */ - _this._matrix = null; - /** - * Current hole mode is enabled. - * - * @member {boolean} - * @default false - * @protected - */ - _this._holeMode = false; - /** - * Current path - * - * @member {PIXI.Polygon} - * @protected - */ - _this.currentPath = null; - /** - * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. - * This is useful if your graphics element does not change often, as it will speed up the rendering - * of the object in exchange for taking up texture memory. It is also useful if you need the graphics - * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if - * you are constantly redrawing the graphics element. - * - * @name cacheAsBitmap - * @member {boolean} - * @memberof PIXI.Graphics# - * @default false - */ - /** - * A collections of batches! These can be drawn by the renderer batch system. - * - * @protected - * @member {object[]} - */ - _this.batches = []; - /** - * Update dirty for limiting calculating tints for batches. - * - * @protected - * @member {number} - * @default -1 - */ - _this.batchTint = -1; - /** - * Update dirty for limiting calculating batches. - * - * @protected - * @member {number} - * @default -1 - */ - _this.batchDirty = -1; - /** - * Copy of the object vertex data. - * - * @protected - * @member {Float32Array} - */ - _this.vertexData = null; - /** - * Renderer plugin for batching - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = 'batch'; - _this._transformID = -1; - // Set default - _this.tint = 0xFFFFFF; - _this.blendMode = exports.BLEND_MODES.NORMAL; - return _this; - } - Object.defineProperty(Graphics.prototype, "geometry", { - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh or Graphics objects. - * - * @member {PIXI.GraphicsGeometry} - * @readonly - */ - get: function () { - return this._geometry; - }, - enumerable: false, - configurable: true - }); - /** - * Creates a new Graphics object with the same values as this one. - * Note that only the geometry of the object is cloned, not its transform (position,scale,etc) - * - * @return {PIXI.Graphics} A clone of the graphics object - */ - Graphics.prototype.clone = function () { - this.finishPoly(); - return new Graphics(this._geometry); - }; - Object.defineProperty(Graphics.prototype, "blendMode", { - get: function () { - return this.state.blendMode; - }, - /** - * The blend mode to be applied to the graphic shape. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "tint", { - /** - * The tint applied to the graphic shape. This is a hex value. A value of - * 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "fill", { - /** - * The current fill style. - * - * @member {PIXI.FillStyle} - * @readonly - */ - get: function () { - return this._fillStyle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "line", { - /** - * The current line style. - * - * @member {PIXI.LineStyle} - * @readonly - */ - get: function () { - return this._lineStyle; - }, - enumerable: false, - configurable: true - }); - /** - * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() - * method or the drawCircle() method. - * - * @method PIXI.Graphics#lineStyle - * @param {number} [width=0] - width of the line to draw, will update the objects stored style - * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style - * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - /** - * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() - * method or the drawCircle() method. - * - * @param {object} [options] - Line style options - * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style - * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style - * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style - * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style - * @param {number}[options.miterLimit=10] - miter limit ratio - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineStyle = function (options) { - if (options === void 0) { options = null; } - // Support non-object params: (width, color, alpha, alignment, native) - if (typeof options === 'number') { - // eslint-disable-next-line - var args = arguments; - options = { - width: args[0] || 0, - color: args[1] || 0x0, - alpha: args[2] !== undefined ? args[2] : 1, - alignment: args[3] !== undefined ? args[3] : 0.5, - native: !!args[4], - }; - } - return this.lineTextureStyle(options); - }; - /** - * Like line style but support texture for line fill. - * - * @param {object} [options] - Collection of options for setting line style. - * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style - * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use - * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style. - * Default 0xFFFFFF if texture present. - * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture - * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style - * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style - * @param {number}[options.miterLimit=10] - miter limit ratio - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineTextureStyle = function (options) { - // backward compatibility with params: (width, texture, - // color, alpha, matrix, alignment, native) - if (typeof options === 'number') { - deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle'); - // eslint-disable-next-line - var _a = arguments, width = _a[0], texture = _a[1], color = _a[2], alpha = _a[3], matrix = _a[4], alignment = _a[5], native = _a[6]; - options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native }; - // Remove undefined keys - Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); - } - // Apply defaults - options = Object.assign({ - width: 0, - texture: Texture.WHITE, - color: (options && options.texture) ? 0xFFFFFF : 0x0, - alpha: 1, - matrix: null, - alignment: 0.5, - native: false, - cap: exports.LINE_CAP.BUTT, - join: exports.LINE_JOIN.MITER, - miterLimit: 10, - }, options); - if (this.currentPath) { - this.startPoly(); - } - var visible = options.width > 0 && options.alpha > 0; - if (!visible) { - this._lineStyle.reset(); - } - else { - if (options.matrix) { - options.matrix = options.matrix.clone(); - options.matrix.invert(); - } - Object.assign(this._lineStyle, { visible: visible }, options); - } - return this; - }; - /** - * Start a polygon object internally - * @protected - */ - Graphics.prototype.startPoly = function () { - if (this.currentPath) { - var points = this.currentPath.points; - var len = this.currentPath.points.length; - if (len > 2) { - this.drawShape(this.currentPath); - this.currentPath = new Polygon(); - this.currentPath.closeStroke = false; - this.currentPath.points.push(points[len - 2], points[len - 1]); - } - } - else { - this.currentPath = new Polygon(); - this.currentPath.closeStroke = false; - } - }; - /** - * Finish the polygon object. - * @protected - */ - Graphics.prototype.finishPoly = function () { - if (this.currentPath) { - if (this.currentPath.points.length > 2) { - this.drawShape(this.currentPath); - this.currentPath = null; - } - else { - this.currentPath.points.length = 0; - } - } - }; - /** - * Moves the current drawing position to x, y. - * - * @param {number} x - the X coordinate to move to - * @param {number} y - the Y coordinate to move to - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.moveTo = function (x, y) { - this.startPoly(); - this.currentPath.points[0] = x; - this.currentPath.points[1] = y; - return this; - }; - /** - * Draws a line using the current line style from the current drawing position to (x, y); - * The current drawing position is then set to (x, y). - * - * @param {number} x - the X coordinate to draw to - * @param {number} y - the Y coordinate to draw to - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineTo = function (x, y) { - if (!this.currentPath) { - this.moveTo(0, 0); - } - // remove duplicates.. - var points = this.currentPath.points; - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - if (fromX !== x || fromY !== y) { - points.push(x, y); - } - return this; - }; - /** - * Initialize the curve - * - * @protected - * @param {number} [x=0] - * @param {number} [y=0] - */ - Graphics.prototype._initCurve = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (this.currentPath) { - if (this.currentPath.points.length === 0) { - this.currentPath.points = [x, y]; - } - } - else { - this.moveTo(x, y); - } - }; - /** - * Calculate the points for a quadratic bezier curve and then draws it. - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY) { - this._initCurve(); - var points = this.currentPath.points; - if (points.length === 0) { - this.moveTo(0, 0); - } - QuadraticUtils.curveTo(cpX, cpY, toX, toY, points); - return this; - }; - /** - * Calculate the points for a bezier curve and then draws it. - * - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY) { - this._initCurve(); - BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points); - return this; - }; - /** - * The arcTo() method creates an arc/curve between two tangents on the canvas. - * - * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! - * - * @param {number} x1 - The x-coordinate of the first tangent point of the arc - * @param {number} y1 - The y-coordinate of the first tangent point of the arc - * @param {number} x2 - The x-coordinate of the end of the arc - * @param {number} y2 - The y-coordinate of the end of the arc - * @param {number} radius - The radius of the arc - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.arcTo = function (x1, y1, x2, y2, radius) { - this._initCurve(x1, y1); - var points = this.currentPath.points; - var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points); - if (result) { - var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise; - this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise); - } - return this; - }; - /** - * The arc method creates an arc/curve (used to create circles, or parts of circles). - * - * @param {number} cx - The x-coordinate of the center of the circle - * @param {number} cy - The y-coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position - * of the arc's circle) - * @param {number} endAngle - The ending angle, in radians - * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be - * counter-clockwise or clockwise. False is default, and indicates clockwise, while true - * indicates counter-clockwise. - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.arc = function (cx, cy, radius, startAngle, endAngle, anticlockwise) { - if (anticlockwise === void 0) { anticlockwise = false; } - if (startAngle === endAngle) { - return this; - } - if (!anticlockwise && endAngle <= startAngle) { - endAngle += PI_2; - } - else if (anticlockwise && startAngle <= endAngle) { - startAngle += PI_2; - } - var sweep = endAngle - startAngle; - if (sweep === 0) { - return this; - } - var startX = cx + (Math.cos(startAngle) * radius); - var startY = cy + (Math.sin(startAngle) * radius); - var eps = this._geometry.closePointEps; - // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path. - var points = this.currentPath ? this.currentPath.points : null; - if (points) { - // TODO: make a better fix. - // We check how far our start is from the last existing point - var xDiff = Math.abs(points[points.length - 2] - startX); - var yDiff = Math.abs(points[points.length - 1] - startY); - if (xDiff < eps && yDiff < eps) { ; } - else { - points.push(startX, startY); - } - } - else { - this.moveTo(startX, startY); - points = this.currentPath.points; - } - ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points); - return this; - }; - /** - * Specifies a simple one-color fill that subsequent calls to other Graphics methods - * (such as lineTo() or drawCircle()) use when drawing. - * - * @param {number} [color=0] - the color of the fill - * @param {number} [alpha=1] - the alpha of the fill - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.beginFill = function (color, alpha) { - if (color === void 0) { color = 0; } - if (alpha === void 0) { alpha = 1; } - return this.beginTextureFill({ texture: Texture.WHITE, color: color, alpha: alpha }); - }; - /** - * Begin the texture fill - * - * @param {object} [options] - Object object. - * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill - * @param {number} [options.color=0xffffff] - Background to fill behind texture - * @param {number} [options.alpha=1] - Alpha of fill - * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.beginTextureFill = function (options) { - // backward compatibility with params: (texture, color, alpha, matrix) - if (options instanceof Texture) { - deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill'); - // eslint-disable-next-line - var _a = arguments, texture = _a[0], color = _a[1], alpha = _a[2], matrix = _a[3]; - options = { texture: texture, color: color, alpha: alpha, matrix: matrix }; - // Remove undefined keys - Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); - } - // Apply defaults - options = Object.assign({ - texture: Texture.WHITE, - color: 0xFFFFFF, - alpha: 1, - matrix: null, - }, options); - if (this.currentPath) { - this.startPoly(); - } - var visible = options.alpha > 0; - if (!visible) { - this._fillStyle.reset(); - } - else { - if (options.matrix) { - options.matrix = options.matrix.clone(); - options.matrix.invert(); - } - Object.assign(this._fillStyle, { visible: visible }, options); - } - return this; - }; - /** - * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. - * - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.endFill = function () { - this.finishPoly(); - this._fillStyle.reset(); - return this; - }; - /** - * Draws a rectangle shape. - * - * @param {number} x - The X coord of the top-left of the rectangle - * @param {number} y - The Y coord of the top-left of the rectangle - * @param {number} width - The width of the rectangle - * @param {number} height - The height of the rectangle - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawRect = function (x, y, width, height) { - return this.drawShape(new Rectangle(x, y, width, height)); - }; - /** - * Draw a rectangle shape with rounded/beveled corners. - * - * @param {number} x - The X coord of the top-left of the rectangle - * @param {number} y - The Y coord of the top-left of the rectangle - * @param {number} width - The width of the rectangle - * @param {number} height - The height of the rectangle - * @param {number} radius - Radius of the rectangle corners - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawRoundedRect = function (x, y, width, height, radius) { - return this.drawShape(new RoundedRectangle(x, y, width, height, radius)); - }; - /** - * Draws a circle. - * - * @param {number} x - The X coordinate of the center of the circle - * @param {number} y - The Y coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawCircle = function (x, y, radius) { - return this.drawShape(new Circle(x, y, radius)); - }; - /** - * Draws an ellipse. - * - * @param {number} x - The X coordinate of the center of the ellipse - * @param {number} y - The Y coordinate of the center of the ellipse - * @param {number} width - The half width of the ellipse - * @param {number} height - The half height of the ellipse - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawEllipse = function (x, y, width, height) { - return this.drawShape(new Ellipse(x, y, width, height)); - }; - /** - * Draws a polygon using the given path. - * - * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon. - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawPolygon = function () { - var arguments$1 = arguments; - - var path = []; - for (var _i = 0; _i < arguments.length; _i++) { - path[_i] = arguments$1[_i]; - } - var points; - var closeStroke = true; // !!this._fillStyle; - var poly = path[0]; - // check if data has points.. - if (poly.points) { - closeStroke = poly.closeStroke; - points = poly.points; - } - else if (Array.isArray(path[0])) { - points = path[0]; - } - else { - points = path; - } - var shape = new Polygon(points); - shape.closeStroke = closeStroke; - this.drawShape(shape); - return this; - }; - /** - * Draw any shape. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawShape = function (shape) { - if (!this._holeMode) { - this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix); - } - else { - this._geometry.drawHole(shape, this._matrix); - } - return this; - }; - /** - * Draw a star shape with an arbitrary number of points. - * - * @param {number} x - Center X position of the star - * @param {number} y - Center Y position of the star - * @param {number} points - The number of points of the star, must be > 1 - * @param {number} radius - The outer radius of the star - * @param {number} [innerRadius] - The inner radius between points, default half `radius` - * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawStar = function (x, y, points, radius, innerRadius, rotation) { - if (rotation === void 0) { rotation = 0; } - return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation)); - }; - /** - * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. - * - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.clear = function () { - this._geometry.clear(); - this._lineStyle.reset(); - this._fillStyle.reset(); - this._boundsID++; - this._matrix = null; - this._holeMode = false; - this.currentPath = null; - return this; - }; - /** - * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and - * masked with gl.scissor. - * - * @returns {boolean} True if only 1 rect. - */ - Graphics.prototype.isFastRect = function () { - var data = this._geometry.graphicsData; - return data.length === 1 - && data[0].shape.type === exports.SHAPES.RECT - && !(data[0].lineStyle.visible && data[0].lineStyle.width); - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._render = function (renderer) { - this.finishPoly(); - var geometry = this._geometry; - var hasuint32 = renderer.context.supports.uint32Indices; - // batch part.. - // batch it! - geometry.updateBatches(hasuint32); - if (geometry.batchable) { - if (this.batchDirty !== geometry.batchDirty) { - this._populateBatches(); - } - this._renderBatched(renderer); - } - else { - // no batching... - renderer.batch.flush(); - this._renderDirect(renderer); - } - }; - /** - * Populating batches for rendering - * - * @protected - */ - Graphics.prototype._populateBatches = function () { - var geometry = this._geometry; - var blendMode = this.blendMode; - var len = geometry.batches.length; - this.batchTint = -1; - this._transformID = -1; - this.batchDirty = geometry.batchDirty; - this.batches.length = len; - this.vertexData = new Float32Array(geometry.points); - for (var i = 0; i < len; i++) { - var gI = geometry.batches[i]; - var color = gI.style.color; - var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); - var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); - var indices = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size); - var batch = { - vertexData: vertexData, - blendMode: blendMode, - indices: indices, - uvs: uvs, - _batchRGB: hex2rgb(color), - _tintRGB: color, - _texture: gI.style.texture, - alpha: gI.style.alpha, - worldAlpha: 1 - }; - this.batches[i] = batch; - } - }; - /** - * Renders the batches using the BathedRenderer plugin - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._renderBatched = function (renderer) { - if (!this.batches.length) { - return; - } - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - this.calculateVertices(); - this.calculateTints(); - for (var i = 0, l = this.batches.length; i < l; i++) { - var batch = this.batches[i]; - batch.worldAlpha = this.worldAlpha * batch.alpha; - renderer.plugins[this.pluginName].render(batch); - } - }; - /** - * Renders the graphics direct - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._renderDirect = function (renderer) { - var shader = this._resolveDirectShader(renderer); - var geometry = this._geometry; - var tint = this.tint; - var worldAlpha = this.worldAlpha; - var uniforms = shader.uniforms; - var drawCalls = geometry.drawCalls; - // lets set the transfomr - uniforms.translationMatrix = this.transform.worldTransform; - // and then lets set the tint.. - uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha; - uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha; - uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha; - uniforms.tint[3] = worldAlpha; - // the first draw call, we can set the uniforms of the shader directly here. - // this means that we can tack advantage of the sync function of pixi! - // bind and sync uniforms.. - // there is a way to optimise this.. - renderer.shader.bind(shader); - renderer.geometry.bind(geometry, shader); - // set state.. - renderer.state.set(this.state); - // then render the rest of them... - for (var i = 0, l = drawCalls.length; i < l; i++) { - this._renderDrawCallDirect(renderer, geometry.drawCalls[i]); - } - }; - /** - * Renders specific DrawCall - * - * @param {PIXI.Renderer} renderer - * @param {PIXI.BatchDrawCall} drawCall - */ - Graphics.prototype._renderDrawCallDirect = function (renderer, drawCall) { - var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start; - var groupTextureCount = texArray.count; - for (var j = 0; j < groupTextureCount; j++) { - renderer.texture.bind(texArray.elements[j], j); - } - renderer.geometry.draw(type, size, start); - }; - /** - * Resolves shader for direct rendering - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._resolveDirectShader = function (renderer) { - var shader = this.shader; - var pluginName = this.pluginName; - if (!shader) { - // if there is no shader here, we can use the default shader. - // and that only gets created if we actually need it.. - // but may be more than one plugins for graphics - if (!DEFAULT_SHADERS[pluginName]) { - var MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES; - var sampleValues = new Int32Array(MAX_TEXTURES); - for (var i = 0; i < MAX_TEXTURES; i++) { - sampleValues[i] = i; - } - var uniforms = { - tint: new Float32Array([1, 1, 1, 1]), - translationMatrix: new Matrix(), - default: UniformGroup.from({ uSamplers: sampleValues }, true), - }; - var program = renderer.plugins[pluginName]._shader.program; - DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms); - } - shader = DEFAULT_SHADERS[pluginName]; - } - return shader; - }; - /** - * Retrieves the bounds of the graphic shape as a rectangle object - * - * @protected - */ - Graphics.prototype._calculateBounds = function () { - this.finishPoly(); - var geometry = this._geometry; - // skipping when graphics is empty, like a container - if (!geometry.graphicsData.length) { - return; - } - var _a = geometry.bounds, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); - }; - /** - * Tests if a point is inside this graphics object - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Graphics.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, Graphics._TEMP_POINT); - return this._geometry.containsPoint(Graphics._TEMP_POINT); - }; - /** - * Recalcuate the tint by applying tin to batches using Graphics tint. - * @protected - */ - Graphics.prototype.calculateTints = function () { - if (this.batchTint !== this.tint) { - this.batchTint = this.tint; - var tintRGB = hex2rgb(this.tint, temp); - for (var i = 0; i < this.batches.length; i++) { - var batch = this.batches[i]; - var batchTint = batch._batchRGB; - var r = (tintRGB[0] * batchTint[0]) * 255; - var g = (tintRGB[1] * batchTint[1]) * 255; - var b = (tintRGB[2] * batchTint[2]) * 255; - // TODO Ivan, can this be done in one go? - var color = (r << 16) + (g << 8) + (b | 0); - batch._tintRGB = (color >> 16) - + (color & 0xff00) - + ((color & 0xff) << 16); - } - } - }; - /** - * If there's a transform update or a change to the shape of the - * geometry, recaculate the vertices. - * @protected - */ - Graphics.prototype.calculateVertices = function () { - var wtID = this.transform._worldID; - if (this._transformID === wtID) { - return; - } - this._transformID = wtID; - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var data = this._geometry.points; // batch.vertexDataOriginal; - var vertexData = this.vertexData; - var count = 0; - for (var i = 0; i < data.length; i += 2) { - var x = data[i]; - var y = data[i + 1]; - vertexData[count++] = (a * x) + (c * y) + tx; - vertexData[count++] = (d * y) + (b * x) + ty; - } - }; - /** - * Closes the current path. - * - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.closePath = function () { - var currentPath = this.currentPath; - if (currentPath) { - // we don't need to add extra point in the end because buildLine will take care of that - currentPath.closeStroke = true; - } - return this; - }; - /** - * Apply a matrix to the positional data. - * - * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape. - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.setMatrix = function (matrix) { - this._matrix = matrix; - return this; - }; - /** - * Begin adding holes to the last draw shape - * IMPORTANT: holes must be fully inside a shape to work - * Also weirdness ensues if holes overlap! - * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer, - * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle. - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.beginHole = function () { - this.finishPoly(); - this._holeMode = true; - return this; - }; - /** - * End adding holes to the last draw shape - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.endHole = function () { - this.finishPoly(); - this._holeMode = false; - return this; - }; - /** - * Destroys the Graphics object. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - Graphics.prototype.destroy = function (options) { - this._geometry.refCount--; - if (this._geometry.refCount === 0) { - this._geometry.dispose(); - } - this._matrix = null; - this.currentPath = null; - this._lineStyle.destroy(); - this._lineStyle = null; - this._fillStyle.destroy(); - this._fillStyle = null; - this._geometry = null; - this.shader = null; - this.vertexData = null; - this.batches.length = 0; - this.batches = null; - _super.prototype.destroy.call(this, options); - }; - /** - * Temporary point to use for containsPoint - * - * @static - * @private - * @member {PIXI.Point} - */ - Graphics._TEMP_POINT = new Point(); - return Graphics; - }(Container)); - - /*! - * @pixi/sprite - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$6 = function(d, b) { - extendStatics$6 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$6(d, b); - }; - - function __extends$6(d, b) { - extendStatics$6(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var tempPoint = new Point(); - var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); - /** - * The Sprite object is the base for all textured objects that are rendered to the screen - * - * A sprite can be created directly from an image like this: - * - * ```js - * let sprite = PIXI.Sprite.from('assets/image.png'); - * ``` - * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, - * as swapping base textures when rendering to the screen is inefficient. - * - * ```js - * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; - * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); - * ... - * } - * ``` - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Sprite = /** @class */ (function (_super) { - __extends$6(Sprite, _super); - /** - * @param {PIXI.Texture} [texture] - The texture for this sprite. - */ - function Sprite(texture) { - var _this = _super.call(this) || this; - /** - * The anchor point defines the normalized coordinates - * in the texture that map to the position of this - * sprite. - * - * By default, this is `(0,0)` (or `texture.defaultAnchor` - * if you have modified that), which means the position - * `(x,y)` of this `Sprite` will be the top-left corner. - * - * Note: Updating `texture.defaultAnchor` after - * constructing a `Sprite` does _not_ update its anchor. - * - * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html} - * - * @default `texture.defaultAnchor` - * @member {PIXI.ObservablePoint} - * @private - */ - _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); - /** - * The texture that the sprite is using - * - * @private - * @member {PIXI.Texture} - */ - _this._texture = null; - /** - * The width of the sprite (this is initially set by the texture) - * - * @protected - * @member {number} - */ - _this._width = 0; - /** - * The height of the sprite (this is initially set by the texture) - * - * @protected - * @member {number} - */ - _this._height = 0; - /** - * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 0xFFFFFF - */ - _this._tint = null; - /** - * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 16777215 - */ - _this._tintRGB = null; - _this.tint = 0xFFFFFF; - /** - * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - _this.blendMode = exports.BLEND_MODES.NORMAL; - /** - * Cached tint value so we can tell when the tint is changed. - * Value is used for 2d CanvasRenderer. - * - * @protected - * @member {number} - * @default 0xFFFFFF - */ - _this._cachedTint = 0xFFFFFF; - /** - * this is used to store the uvs data of the sprite, assigned at the same time - * as the vertexData in calculateVertices() - * - * @private - * @member {Float32Array} - */ - _this.uvs = null; - // call texture setter - _this.texture = texture || Texture.EMPTY; - /** - * this is used to store the vertex data of the sprite (basically a quad) - * - * @private - * @member {Float32Array} - */ - _this.vertexData = new Float32Array(8); - /** - * This is used to calculate the bounds of the object IF it is a trimmed sprite - * - * @private - * @member {Float32Array} - */ - _this.vertexTrimmedData = null; - _this._transformID = -1; - _this._textureID = -1; - _this._transformTrimmedID = -1; - _this._textureTrimmedID = -1; - // Batchable stuff.. - // TODO could make this a mixin? - _this.indices = indices; - /** - * Plugin that is responsible for rendering this element. - * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods. - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = 'batch'; - /** - * used to fast check if a sprite is.. a sprite! - * @member {boolean} - */ - _this.isSprite = true; - /** - * Internal roundPixels field - * - * @member {boolean} - * @private - */ - _this._roundPixels = settings.ROUND_PIXELS; - return _this; - } - /** - * When the texture is updated, this event will fire to update the scale and frame - * - * @protected - */ - Sprite.prototype._onTextureUpdate = function () { - this._textureID = -1; - this._textureTrimmedID = -1; - this._cachedTint = 0xFFFFFF; - // so if _width is 0 then width was not set.. - if (this._width) { - this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width; - } - if (this._height) { - this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height; - } - }; - /** - * Called when the anchor position updates. - * - * @private - */ - Sprite.prototype._onAnchorUpdate = function () { - this._transformID = -1; - this._transformTrimmedID = -1; - }; - /** - * calculates worldTransform * vertices, store it in vertexData - */ - Sprite.prototype.calculateVertices = function () { - var texture = this._texture; - if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { - return; - } - // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` - if (this._textureID !== texture._updateID) { - this.uvs = this._texture._uvs.uvsFloat32; - } - this._transformID = this.transform._worldID; - this._textureID = texture._updateID; - // set the vertex data - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var vertexData = this.vertexData; - var trim = texture.trim; - var orig = texture.orig; - var anchor = this._anchor; - var w0 = 0; - var w1 = 0; - var h0 = 0; - var h1 = 0; - if (trim) { - // if the sprite is trimmed and is not a tilingsprite then we need to add the extra - // space before transforming the sprite coords. - w1 = trim.x - (anchor._x * orig.width); - w0 = w1 + trim.width; - h1 = trim.y - (anchor._y * orig.height); - h0 = h1 + trim.height; - } - else { - w1 = -anchor._x * orig.width; - w0 = w1 + orig.width; - h1 = -anchor._y * orig.height; - h0 = h1 + orig.height; - } - // xy - vertexData[0] = (a * w1) + (c * h1) + tx; - vertexData[1] = (d * h1) + (b * w1) + ty; - // xy - vertexData[2] = (a * w0) + (c * h1) + tx; - vertexData[3] = (d * h1) + (b * w0) + ty; - // xy - vertexData[4] = (a * w0) + (c * h0) + tx; - vertexData[5] = (d * h0) + (b * w0) + ty; - // xy - vertexData[6] = (a * w1) + (c * h0) + tx; - vertexData[7] = (d * h0) + (b * w1) + ty; - if (this._roundPixels) { - var resolution = settings.RESOLUTION; - for (var i = 0; i < vertexData.length; ++i) { - vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); - } - } - }; - /** - * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData - * This is used to ensure that the true width and height of a trimmed texture is respected - */ - Sprite.prototype.calculateTrimmedVertices = function () { - if (!this.vertexTrimmedData) { - this.vertexTrimmedData = new Float32Array(8); - } - else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { - return; - } - this._transformTrimmedID = this.transform._worldID; - this._textureTrimmedID = this._texture._updateID; - // lets do some special trim code! - var texture = this._texture; - var vertexData = this.vertexTrimmedData; - var orig = texture.orig; - var anchor = this._anchor; - // lets calculate the new untrimmed bounds.. - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var w1 = -anchor._x * orig.width; - var w0 = w1 + orig.width; - var h1 = -anchor._y * orig.height; - var h0 = h1 + orig.height; - // xy - vertexData[0] = (a * w1) + (c * h1) + tx; - vertexData[1] = (d * h1) + (b * w1) + ty; - // xy - vertexData[2] = (a * w0) + (c * h1) + tx; - vertexData[3] = (d * h1) + (b * w0) + ty; - // xy - vertexData[4] = (a * w0) + (c * h0) + tx; - vertexData[5] = (d * h0) + (b * w0) + ty; - // xy - vertexData[6] = (a * w1) + (c * h0) + tx; - vertexData[7] = (d * h0) + (b * w1) + ty; - }; - /** - * - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The webgl renderer to use. - */ - Sprite.prototype._render = function (renderer) { - this.calculateVertices(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - }; - /** - * Updates the bounds of the sprite. - * - * @protected - */ - Sprite.prototype._calculateBounds = function () { - var trim = this._texture.trim; - var orig = this._texture.orig; - // First lets check to see if the current texture has a trim.. - if (!trim || (trim.width === orig.width && trim.height === orig.height)) { - // no trim! lets use the usual calculations.. - this.calculateVertices(); - this._bounds.addQuad(this.vertexData); - } - else { - // lets calculate a special trimmed bounds... - this.calculateTrimmedVertices(); - this._bounds.addQuad(this.vertexTrimmedData); - } - }; - /** - * Gets the local bounds of the sprite object. - * - * @param {PIXI.Rectangle} [rect] - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - Sprite.prototype.getLocalBounds = function (rect) { - // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) { - this._bounds.minX = this._texture.orig.width * -this._anchor._x; - this._bounds.minY = this._texture.orig.height * -this._anchor._y; - this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x); - this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y); - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - return this._bounds.getRectangle(rect); - } - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * Tests if a point is inside this sprite - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Sprite.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, tempPoint); - var width = this._texture.orig.width; - var height = this._texture.orig.height; - var x1 = -width * this.anchor.x; - var y1 = 0; - if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { - y1 = -height * this.anchor.y; - if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { - return true; - } - } - return false; - }; - /** - * Destroys this sprite and optionally its texture and children - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well - */ - Sprite.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this._texture.off('update', this._onTextureUpdate, this); - this._anchor = null; - var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; - if (destroyTexture) { - var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; - this._texture.destroy(!!destroyBaseTexture); - } - this._texture = null; - }; - // some helper functions.. - /** - * Helper function that creates a new sprite based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from - * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.Sprite} The newly created sprite - */ - Sprite.from = function (source, options) { - var texture = (source instanceof Texture) - ? source - : Texture.from(source, options); - return new Sprite(texture); - }; - Object.defineProperty(Sprite.prototype, "roundPixels", { - get: function () { - return this._roundPixels; - }, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - set: function (value) { - if (this._roundPixels !== value) { - this._transformID = -1; - } - this._roundPixels = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "width", { - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return Math.abs(this.scale.x) * this._texture.orig.width; - }, - set: function (value) { - var s = sign$1(this.scale.x) || 1; - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "height", { - /** - * The height of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return Math.abs(this.scale.y) * this._texture.orig.height; - }, - set: function (value) { - var s = sign$1(this.scale.y) || 1; - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "anchor", { - /** - * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} - * and passed to the constructor. - * - * The default is `(0,0)`, this means the sprite's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. - * - * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this._anchor; - }, - set: function (value) { - this._anchor.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "tint", { - /** - * The tint applied to the sprite. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "texture", { - /** - * The texture that the sprite is using - * - * @member {PIXI.Texture} - */ - get: function () { - return this._texture; - }, - set: function (value) { - if (this._texture === value) { - return; - } - if (this._texture) { - this._texture.off('update', this._onTextureUpdate, this); - } - this._texture = value || Texture.EMPTY; - this._cachedTint = 0xFFFFFF; - this._textureID = -1; - this._textureTrimmedID = -1; - if (value) { - // wait for the texture to load - if (value.baseTexture.valid) { - this._onTextureUpdate(); - } - else { - value.once('update', this._onTextureUpdate, this); - } - } - }, - enumerable: false, - configurable: true - }); - return Sprite; - }(Container)); - - /*! - * @pixi/text - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/text is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$7 = function(d, b) { - extendStatics$7 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$7(d, b); - }; - - function __extends$7(d, b) { - extendStatics$7(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Constants that define the type of gradient on text. - * - * @static - * @constant - * @name TEXT_GRADIENT - * @memberof PIXI - * @type {object} - * @property {number} LINEAR_VERTICAL Vertical gradient - * @property {number} LINEAR_HORIZONTAL Linear gradient - */ - - (function (TEXT_GRADIENT) { - TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_VERTICAL"] = 0] = "LINEAR_VERTICAL"; - TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_HORIZONTAL"] = 1] = "LINEAR_HORIZONTAL"; - })(exports.TEXT_GRADIENT || (exports.TEXT_GRADIENT = {})); - - // disabling eslint for now, going to rewrite this in v5 - var defaultStyle = { - align: 'left', - breakWords: false, - dropShadow: false, - dropShadowAlpha: 1, - dropShadowAngle: Math.PI / 6, - dropShadowBlur: 0, - dropShadowColor: 'black', - dropShadowDistance: 5, - fill: 'black', - fillGradientType: exports.TEXT_GRADIENT.LINEAR_VERTICAL, - fillGradientStops: [], - fontFamily: 'Arial', - fontSize: 26, - fontStyle: 'normal', - fontVariant: 'normal', - fontWeight: 'normal', - letterSpacing: 0, - lineHeight: 0, - lineJoin: 'miter', - miterLimit: 10, - padding: 0, - stroke: 'black', - strokeThickness: 0, - textBaseline: 'alphabetic', - trim: false, - whiteSpace: 'pre', - wordWrap: false, - wordWrapWidth: 100, - leading: 0, - }; - var genericFontFamilies = [ - 'serif', - 'sans-serif', - 'monospace', - 'cursive', - 'fantasy', - 'system-ui' ]; - /** - * A TextStyle Object contains information to decorate a Text objects. - * - * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. - * - * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). - * - * @class - * @memberof PIXI - */ - var TextStyle = /** @class */ (function () { - /** - * @param {object} [style] - The style parameters - * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), - * does not affect single line text - * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it - * needs wordWrap to be set to true - * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text - * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow - * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow - * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius - * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00' - * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow - * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas - * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient - * eg ['#000000','#FFFFFF'] - * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} - * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours - * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT} - * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set - * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. - * @param {string|string[]} [style.fontFamily='Arial'] - The font family - * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string, - * equivalents are '26px','20pt','160%' or '1.6em') - * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique') - * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps') - * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100', - * '200', '300', '400', '500', '600', '700', '800' or '900') - * @param {number} [style.leading=0] - The space between lines - * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0 - * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses - * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve - * spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" - * (creates a squared corner). - * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce - * or increase the spikiness of rendered text. - * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from - * happening by adding padding to all sides of the text. - * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke - * e.g 'blue', '#FCFF00' - * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. - * Default is 0 (no stroke) - * @param {boolean} [style.trim=false] - Trim transparent borders - * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered. - * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved "normal" - * (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true - * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used - * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true - */ - function TextStyle(style) { - this.styleID = 0; - this.reset(); - deepCopyProperties(this, style, style); - } - /** - * Creates a new TextStyle object with the same values as this one. - * Note that the only the properties of the object are cloned. - * - * @return {PIXI.TextStyle} New cloned TextStyle object - */ - TextStyle.prototype.clone = function () { - var clonedProperties = {}; - deepCopyProperties(clonedProperties, this, defaultStyle); - return new TextStyle(clonedProperties); - }; - /** - * Resets all properties to the defaults specified in TextStyle.prototype._default - */ - TextStyle.prototype.reset = function () { - deepCopyProperties(this, defaultStyle, defaultStyle); - }; - Object.defineProperty(TextStyle.prototype, "align", { - /** - * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text - * - * @member {string} - */ - get: function () { - return this._align; - }, - set: function (align) { - if (this._align !== align) { - this._align = align; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "breakWords", { - /** - * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true - * - * @member {boolean} - */ - get: function () { - return this._breakWords; - }, - set: function (breakWords) { - if (this._breakWords !== breakWords) { - this._breakWords = breakWords; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadow", { - /** - * Set a drop shadow for the text - * - * @member {boolean} - */ - get: function () { - return this._dropShadow; - }, - set: function (dropShadow) { - if (this._dropShadow !== dropShadow) { - this._dropShadow = dropShadow; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowAlpha", { - /** - * Set alpha for the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowAlpha; - }, - set: function (dropShadowAlpha) { - if (this._dropShadowAlpha !== dropShadowAlpha) { - this._dropShadowAlpha = dropShadowAlpha; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowAngle", { - /** - * Set a angle of the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowAngle; - }, - set: function (dropShadowAngle) { - if (this._dropShadowAngle !== dropShadowAngle) { - this._dropShadowAngle = dropShadowAngle; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowBlur", { - /** - * Set a shadow blur radius - * - * @member {number} - */ - get: function () { - return this._dropShadowBlur; - }, - set: function (dropShadowBlur) { - if (this._dropShadowBlur !== dropShadowBlur) { - this._dropShadowBlur = dropShadowBlur; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowColor", { - /** - * A fill style to be used on the dropshadow e.g 'red', '#00FF00' - * - * @member {string|number} - */ - get: function () { - return this._dropShadowColor; - }, - set: function (dropShadowColor) { - var outputColor = getColor(dropShadowColor); - if (this._dropShadowColor !== outputColor) { - this._dropShadowColor = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowDistance", { - /** - * Set a distance of the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowDistance; - }, - set: function (dropShadowDistance) { - if (this._dropShadowDistance !== dropShadowDistance) { - this._dropShadowDistance = dropShadowDistance; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fill", { - /** - * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. - * Can be an array to create a gradient eg ['#000000','#FFFFFF'] - * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} - * - * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} - */ - get: function () { - return this._fill; - }, - set: function (fill) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in - // without casting here. - var outputColor = getColor(fill); - if (this._fill !== outputColor) { - this._fill = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fillGradientType", { - /** - * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. - * See {@link PIXI.TEXT_GRADIENT} - * - * @member {number} - */ - get: function () { - return this._fillGradientType; - }, - set: function (fillGradientType) { - if (this._fillGradientType !== fillGradientType) { - this._fillGradientType = fillGradientType; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fillGradientStops", { - /** - * If fill is an array of colours to create a gradient, this array can set the stop points - * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. - * - * @member {number[]} - */ - get: function () { - return this._fillGradientStops; - }, - set: function (fillGradientStops) { - if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) { - this._fillGradientStops = fillGradientStops; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontFamily", { - /** - * The font family - * - * @member {string|string[]} - */ - get: function () { - return this._fontFamily; - }, - set: function (fontFamily) { - if (this.fontFamily !== fontFamily) { - this._fontFamily = fontFamily; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontSize", { - /** - * The font size - * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') - * - * @member {number|string} - */ - get: function () { - return this._fontSize; - }, - set: function (fontSize) { - if (this._fontSize !== fontSize) { - this._fontSize = fontSize; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontStyle", { - /** - * The font style - * ('normal', 'italic' or 'oblique') - * - * @member {string} - */ - get: function () { - return this._fontStyle; - }, - set: function (fontStyle) { - if (this._fontStyle !== fontStyle) { - this._fontStyle = fontStyle; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontVariant", { - /** - * The font variant - * ('normal' or 'small-caps') - * - * @member {string} - */ - get: function () { - return this._fontVariant; - }, - set: function (fontVariant) { - if (this._fontVariant !== fontVariant) { - this._fontVariant = fontVariant; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontWeight", { - /** - * The font weight - * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') - * - * @member {string} - */ - get: function () { - return this._fontWeight; - }, - set: function (fontWeight) { - if (this._fontWeight !== fontWeight) { - this._fontWeight = fontWeight; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "letterSpacing", { - /** - * The amount of spacing between letters, default is 0 - * - * @member {number} - */ - get: function () { - return this._letterSpacing; - }, - set: function (letterSpacing) { - if (this._letterSpacing !== letterSpacing) { - this._letterSpacing = letterSpacing; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "lineHeight", { - /** - * The line height, a number that represents the vertical space that a letter uses - * - * @member {number} - */ - get: function () { - return this._lineHeight; - }, - set: function (lineHeight) { - if (this._lineHeight !== lineHeight) { - this._lineHeight = lineHeight; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "leading", { - /** - * The space between lines - * - * @member {number} - */ - get: function () { - return this._leading; - }, - set: function (leading) { - if (this._leading !== leading) { - this._leading = leading; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "lineJoin", { - /** - * The lineJoin property sets the type of corner created, it can resolve spiked text issues. - * Default is 'miter' (creates a sharp corner). - * - * @member {string} - */ - get: function () { - return this._lineJoin; - }, - set: function (lineJoin) { - if (this._lineJoin !== lineJoin) { - this._lineJoin = lineJoin; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "miterLimit", { - /** - * The miter limit to use when using the 'miter' lineJoin mode - * This can reduce or increase the spikiness of rendered text. - * - * @member {number} - */ - get: function () { - return this._miterLimit; - }, - set: function (miterLimit) { - if (this._miterLimit !== miterLimit) { - this._miterLimit = miterLimit; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "padding", { - /** - * Occasionally some fonts are cropped. Adding some padding will prevent this from happening - * by adding padding to all sides of the text. - * - * @member {number} - */ - get: function () { - return this._padding; - }, - set: function (padding) { - if (this._padding !== padding) { - this._padding = padding; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "stroke", { - /** - * A canvas fillstyle that will be used on the text stroke - * e.g 'blue', '#FCFF00' - * - * @member {string|number} - */ - get: function () { - return this._stroke; - }, - set: function (stroke) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var outputColor = getColor(stroke); - if (this._stroke !== outputColor) { - this._stroke = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "strokeThickness", { - /** - * A number that represents the thickness of the stroke. - * Default is 0 (no stroke) - * - * @member {number} - */ - get: function () { - return this._strokeThickness; - }, - set: function (strokeThickness) { - if (this._strokeThickness !== strokeThickness) { - this._strokeThickness = strokeThickness; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "textBaseline", { - /** - * The baseline of the text that is rendered. - * - * @member {string} - */ - get: function () { - return this._textBaseline; - }, - set: function (textBaseline) { - if (this._textBaseline !== textBaseline) { - this._textBaseline = textBaseline; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "trim", { - /** - * Trim transparent borders - * - * @member {boolean} - */ - get: function () { - return this._trim; - }, - set: function (trim) { - if (this._trim !== trim) { - this._trim = trim; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "whiteSpace", { - /** - * How newlines and spaces should be handled. - * Default is 'pre' (preserve, preserve). - * - * value | New lines | Spaces - * --- | --- | --- - * 'normal' | Collapse | Collapse - * 'pre' | Preserve | Preserve - * 'pre-line' | Preserve | Collapse - * - * @member {string} - */ - get: function () { - return this._whiteSpace; - }, - set: function (whiteSpace) { - if (this._whiteSpace !== whiteSpace) { - this._whiteSpace = whiteSpace; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "wordWrap", { - /** - * Indicates if word wrap should be used - * - * @member {boolean} - */ - get: function () { - return this._wordWrap; - }, - set: function (wordWrap) { - if (this._wordWrap !== wordWrap) { - this._wordWrap = wordWrap; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "wordWrapWidth", { - /** - * The width at which text will wrap, it needs wordWrap to be set to true - * - * @member {number} - */ - get: function () { - return this._wordWrapWidth; - }, - set: function (wordWrapWidth) { - if (this._wordWrapWidth !== wordWrapWidth) { - this._wordWrapWidth = wordWrapWidth; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - /** - * Generates a font style string to use for `TextMetrics.measureFont()`. - * - * @return {string} Font style string, for passing to `TextMetrics.measureFont()` - */ - TextStyle.prototype.toFontString = function () { - // build canvas api font setting from individual components. Convert a numeric this.fontSize to px - var fontSizeString = (typeof this.fontSize === 'number') ? this.fontSize + "px" : this.fontSize; - // Clean-up fontFamily property by quoting each font name - // this will support font names with spaces - var fontFamilies = this.fontFamily; - if (!Array.isArray(this.fontFamily)) { - fontFamilies = this.fontFamily.split(','); - } - for (var i = fontFamilies.length - 1; i >= 0; i--) { - // Trim any extra white-space - var fontFamily = fontFamilies[i].trim(); - // Check if font already contains strings - if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) { - fontFamily = "\"" + fontFamily + "\""; - } - fontFamilies[i] = fontFamily; - } - return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + fontSizeString + " " + fontFamilies.join(','); - }; - return TextStyle; - }()); - /** - * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. - * @private - * @param {string|number} color - * @return {string} The color as a string. - */ - function getSingleColor(color) { - if (typeof color === 'number') { - return hex2string(color); - } - else if (typeof color === 'string') { - if (color.indexOf('0x') === 0) { - color = color.replace('0x', '#'); - } - } - return color; - } - function getColor(color) { - if (!Array.isArray(color)) { - return getSingleColor(color); - } - else { - for (var i = 0; i < color.length; ++i) { - color[i] = getSingleColor(color[i]); - } - return color; - } - } - /** - * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. - * This version can also convert array of colors - * @private - * @param {Array} array1 - First array to compare - * @param {Array} array2 - Second array to compare - * @return {boolean} Do the arrays contain the same values in the same order - */ - function areArraysEqual(array1, array2) { - if (!Array.isArray(array1) || !Array.isArray(array2)) { - return false; - } - if (array1.length !== array2.length) { - return false; - } - for (var i = 0; i < array1.length; ++i) { - if (array1[i] !== array2[i]) { - return false; - } - } - return true; - } - /** - * Utility function to ensure that object properties are copied by value, and not by reference - * @private - * @param {Object} target - Target object to copy properties into - * @param {Object} source - Source object for the properties to copy - * @param {string} propertyObj - Object containing properties names we want to loop over - */ - function deepCopyProperties(target, source, propertyObj) { - for (var prop in propertyObj) { - if (Array.isArray(source[prop])) { - target[prop] = source[prop].slice(); - } - else { - target[prop] = source[prop]; - } - } - } - - /** - * The TextMetrics object represents the measurement of a block of text with a specified style. - * - * ```js - * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}) - * let textMetrics = PIXI.TextMetrics.measureText('Your text', style) - * ``` - * - * @class - * @memberof PIXI - */ - var TextMetrics = /** @class */ (function () { - /** - * @param {string} text - the text that was measured - * @param {PIXI.TextStyle} style - the style that was measured - * @param {number} width - the measured width of the text - * @param {number} height - the measured height of the text - * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` - * @param {number} lineHeight - the measured line height for this style - * @param {number} maxLineWidth - the maximum line width for all measured lines - * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont - */ - function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) { - /** - * The text that was measured - * - * @member {string} - */ - this.text = text; - /** - * The style that was measured - * - * @member {PIXI.TextStyle} - */ - this.style = style; - /** - * The measured width of the text - * - * @member {number} - */ - this.width = width; - /** - * The measured height of the text - * - * @member {number} - */ - this.height = height; - /** - * An array of lines of the text broken by new lines and wrapping is specified in style - * - * @member {string[]} - */ - this.lines = lines; - /** - * An array of the line widths for each line matched to `lines` - * - * @member {number[]} - */ - this.lineWidths = lineWidths; - /** - * The measured line height for this style - * - * @member {number} - */ - this.lineHeight = lineHeight; - /** - * The maximum line width for all measured lines - * - * @member {number} - */ - this.maxLineWidth = maxLineWidth; - /** - * The font properties object from TextMetrics.measureFont - * - * @member {PIXI.IFontMetrics} - */ - this.fontProperties = fontProperties; - } - /** - * Measures the supplied string of text and returns a Rectangle. - * - * @param {string} text - the text to measure. - * @param {PIXI.TextStyle} style - the text style to use for measuring - * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {PIXI.TextMetrics} measured width and height of the text. - */ - TextMetrics.measureText = function (text, style, wordWrap, canvas) { - if (canvas === void 0) { canvas = TextMetrics._canvas; } - wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap; - var font = style.toFontString(); - var fontProperties = TextMetrics.measureFont(font); - // fallback in case UA disallow canvas data extraction - // (toDataURI, getImageData functions) - if (fontProperties.fontSize === 0) { - fontProperties.fontSize = style.fontSize; - fontProperties.ascent = style.fontSize; - } - var context = canvas.getContext('2d'); - context.font = font; - var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; - var lines = outputText.split(/(?:\r\n|\r|\n)/); - var lineWidths = new Array(lines.length); - var maxLineWidth = 0; - for (var i = 0; i < lines.length; i++) { - var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing); - lineWidths[i] = lineWidth; - maxLineWidth = Math.max(maxLineWidth, lineWidth); - } - var width = maxLineWidth + style.strokeThickness; - if (style.dropShadow) { - width += style.dropShadowDistance; - } - var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; - var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) - + ((lines.length - 1) * (lineHeight + style.leading)); - if (style.dropShadow) { - height += style.dropShadowDistance; - } - return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties); - }; - /** - * Applies newlines to a string to have it optimally fit into the horizontal - * bounds set by the Text object's wordWrapWidth property. - * - * @private - * @param {string} text - String to apply word wrapping to - * @param {PIXI.TextStyle} style - the style to use when wrapping - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {string} New string with new lines applied where required - */ - TextMetrics.wordWrap = function (text, style, canvas) { - if (canvas === void 0) { canvas = TextMetrics._canvas; } - var context = canvas.getContext('2d'); - var width = 0; - var line = ''; - var lines = ''; - var cache = Object.create(null); - var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace; - // How to handle whitespaces - var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); - var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); - // whether or not spaces may be added to the beginning of lines - var canPrependSpaces = !collapseSpaces; - // There is letterSpacing after every char except the last one - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! - // so for convenience the above needs to be compared to width + 1 extra letterSpace - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ - // ________________________________________________ - // And then the final space is simply no appended to each line - var wordWrapWidth = style.wordWrapWidth + letterSpacing; - // break text into words, spaces and newline chars - var tokens = TextMetrics.tokenize(text); - for (var i = 0; i < tokens.length; i++) { - // get the word, space or newlineChar - var token = tokens[i]; - // if word is a new line - if (TextMetrics.isNewline(token)) { - // keep the new line - if (!collapseNewlines) { - lines += TextMetrics.addLine(line); - canPrependSpaces = !collapseSpaces; - line = ''; - width = 0; - continue; - } - // if we should collapse new lines - // we simply convert it into a space - token = ' '; - } - // if we should collapse repeated whitespaces - if (collapseSpaces) { - // check both this and the last tokens for spaces - var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); - var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); - if (currIsBreakingSpace && lastIsBreakingSpace) { - continue; - } - } - // get word width from cache if possible - var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); - // word is longer than desired bounds - if (tokenWidth > wordWrapWidth) { - // if we are not already at the beginning of a line - if (line !== '') { - // start newlines for overflow words - lines += TextMetrics.addLine(line); - line = ''; - width = 0; - } - // break large word over multiple lines - if (TextMetrics.canBreakWords(token, style.breakWords)) { - // break word into characters - var characters = TextMetrics.wordWrapSplit(token); - // loop the characters - for (var j = 0; j < characters.length; j++) { - var char = characters[j]; - var k = 1; - // we are not at the end of the token - while (characters[j + k]) { - var nextChar = characters[j + k]; - var lastChar = char[char.length - 1]; - // should not split chars - if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) { - // combine chars & move forward one - char += nextChar; - } - else { - break; - } - k++; - } - j += char.length - 1; - var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); - if (characterWidth + width > wordWrapWidth) { - lines += TextMetrics.addLine(line); - canPrependSpaces = false; - line = ''; - width = 0; - } - line += char; - width += characterWidth; - } - } - // run word out of the bounds - else { - // if there are words in this line already - // finish that line and start a new one - if (line.length > 0) { - lines += TextMetrics.addLine(line); - line = ''; - width = 0; - } - var isLastToken = i === tokens.length - 1; - // give it its own line if it's not the end - lines += TextMetrics.addLine(token, !isLastToken); - canPrependSpaces = false; - line = ''; - width = 0; - } - } - // word could fit - else { - // word won't fit because of existing words - // start a new line - if (tokenWidth + width > wordWrapWidth) { - // if its a space we don't want it - canPrependSpaces = false; - // add a new line - lines += TextMetrics.addLine(line); - // start a new line - line = ''; - width = 0; - } - // don't add spaces to the beginning of lines - if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) { - // add the word to the current line - line += token; - // update width counter - width += tokenWidth; - } - } - } - lines += TextMetrics.addLine(line, false); - return lines; - }; - /** - * Convienience function for logging each line added during the wordWrap - * method - * - * @private - * @param {string} line - The line of text to add - * @param {boolean} newLine - Add new line character to end - * @return {string} A formatted line - */ - TextMetrics.addLine = function (line, newLine) { - if (newLine === void 0) { newLine = true; } - line = TextMetrics.trimRight(line); - line = (newLine) ? line + "\n" : line; - return line; - }; - /** - * Gets & sets the widths of calculated characters in a cache object - * - * @private - * @param {string} key - The key - * @param {number} letterSpacing - The letter spacing - * @param {object} cache - The cache - * @param {CanvasRenderingContext2D} context - The canvas context - * @return {number} The from cache. - */ - TextMetrics.getFromCache = function (key, letterSpacing, cache, context) { - var width = cache[key]; - if (typeof width !== 'number') { - var spacing = ((key.length) * letterSpacing); - width = context.measureText(key).width + spacing; - cache[key] = width; - } - return width; - }; - /** - * Determines whether we should collapse breaking spaces - * - * @private - * @param {string} whiteSpace - The TextStyle property whiteSpace - * @return {boolean} should collapse - */ - TextMetrics.collapseSpaces = function (whiteSpace) { - return (whiteSpace === 'normal' || whiteSpace === 'pre-line'); - }; - /** - * Determines whether we should collapse newLine chars - * - * @private - * @param {string} whiteSpace - The white space - * @return {boolean} should collapse - */ - TextMetrics.collapseNewlines = function (whiteSpace) { - return (whiteSpace === 'normal'); - }; - /** - * trims breaking whitespaces from string - * - * @private - * @param {string} text - The text - * @return {string} trimmed string - */ - TextMetrics.trimRight = function (text) { - if (typeof text !== 'string') { - return ''; - } - for (var i = text.length - 1; i >= 0; i--) { - var char = text[i]; - if (!TextMetrics.isBreakingSpace(char)) { - break; - } - text = text.slice(0, -1); - } - return text; - }; - /** - * Determines if char is a newline. - * - * @private - * @param {string} char - The character - * @return {boolean} True if newline, False otherwise. - */ - TextMetrics.isNewline = function (char) { - if (typeof char !== 'string') { - return false; - } - return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0); - }; - /** - * Determines if char is a breaking whitespace. - * - * @private - * @param {string} char - The character - * @return {boolean} True if whitespace, False otherwise. - */ - TextMetrics.isBreakingSpace = function (char) { - if (typeof char !== 'string') { - return false; - } - return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0); - }; - /** - * Splits a string into words, breaking-spaces and newLine characters - * - * @private - * @param {string} text - The text - * @return {string[]} A tokenized array - */ - TextMetrics.tokenize = function (text) { - var tokens = []; - var token = ''; - if (typeof text !== 'string') { - return tokens; - } - for (var i = 0; i < text.length; i++) { - var char = text[i]; - if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) { - if (token !== '') { - tokens.push(token); - token = ''; - } - tokens.push(char); - continue; - } - token += char; - } - if (token !== '') { - tokens.push(token); - } - return tokens; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to customise which words should break - * Examples are if the token is CJK or numbers. - * It must return a boolean. - * - * @param {string} token - The token - * @param {boolean} breakWords - The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakWords = function (_token, breakWords) { - return breakWords; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to determine whether a pair of characters - * should be broken by newlines - * For example certain characters in CJK langs or numbers. - * It must return a boolean. - * - * @param {string} char - The character - * @param {string} nextChar - The next character - * @param {string} token - The token/word the characters are from - * @param {number} index - The index in the token of the char - * @param {boolean} breakWords - The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakChars = function (_char, _nextChar, _token, _index, _breakWords) { - return true; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It is called when a token (usually a word) has to be split into separate pieces - * in order to determine the point to break a word. - * It must return an array of characters. - * - * @example - * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. - * TextMetrics.wordWrapSplit = (token) => [...token]; - * - * @param {string} token - The token to split - * @return {string[]} The characters of the token - */ - TextMetrics.wordWrapSplit = function (token) { - return token.split(''); - }; - /** - * Calculates the ascent, descent and fontSize of a given font-style - * - * @static - * @param {string} font - String representing the style of the font - * @return {PIXI.IFontMetrics} Font properties object - */ - TextMetrics.measureFont = function (font) { - // as this method is used for preparing assets, don't recalculate things if we don't need to - if (TextMetrics._fonts[font]) { - return TextMetrics._fonts[font]; - } - var properties = { - ascent: 0, - descent: 0, - fontSize: 0, - }; - var canvas = TextMetrics._canvas; - var context = TextMetrics._context; - context.font = font; - var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; - var width = Math.ceil(context.measureText(metricsString).width); - var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); - var height = 2 * baseline; - baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; - canvas.width = width; - canvas.height = height; - context.fillStyle = '#f00'; - context.fillRect(0, 0, width, height); - context.font = font; - context.textBaseline = 'alphabetic'; - context.fillStyle = '#000'; - context.fillText(metricsString, 0, baseline); - var imagedata = context.getImageData(0, 0, width, height).data; - var pixels = imagedata.length; - var line = width * 4; - var i = 0; - var idx = 0; - var stop = false; - // ascent. scan from top to bottom until we find a non red pixel - for (i = 0; i < baseline; ++i) { - for (var j = 0; j < line; j += 4) { - if (imagedata[idx + j] !== 255) { - stop = true; - break; - } - } - if (!stop) { - idx += line; - } - else { - break; - } - } - properties.ascent = baseline - i; - idx = pixels - line; - stop = false; - // descent. scan from bottom to top until we find a non red pixel - for (i = height; i > baseline; --i) { - for (var j = 0; j < line; j += 4) { - if (imagedata[idx + j] !== 255) { - stop = true; - break; - } - } - if (!stop) { - idx -= line; - } - else { - break; - } - } - properties.descent = i - baseline; - properties.fontSize = properties.ascent + properties.descent; - TextMetrics._fonts[font] = properties; - return properties; - }; - /** - * Clear font metrics in metrics cache. - * - * @static - * @param {string} [font] - font name. If font name not set then clear cache for all fonts. - */ - TextMetrics.clearMetrics = function (font) { - if (font === void 0) { font = ''; } - if (font) { - delete TextMetrics._fonts[font]; - } - else { - TextMetrics._fonts = {}; - } - }; - return TextMetrics; - }()); - /** - * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * - * @typedef {object} FontMetrics - * @property {number} ascent - The ascent distance - * @property {number} descent - The descent distance - * @property {number} fontSize - Font size from ascent to descent - * @memberof PIXI.TextMetrics - * @private - */ - var canvas = (function () { - try { - // OffscreenCanvas2D measureText can be up to 40% faster. - var c = new OffscreenCanvas(0, 0); - var context = c.getContext('2d'); - if (context && context.measureText) { - return c; - } - return document.createElement('canvas'); - } - catch (ex) { - return document.createElement('canvas'); - } - })(); - canvas.width = canvas.height = 10; - /** - * Cached canvas element for measuring text - * - * @memberof PIXI.TextMetrics - * @type {HTMLCanvasElement} - * @private - */ - TextMetrics._canvas = canvas; - /** - * Cache for context to use. - * - * @memberof PIXI.TextMetrics - * @type {CanvasRenderingContext2D} - * @private - */ - TextMetrics._context = canvas.getContext('2d'); - /** - * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. - * - * @memberof PIXI.TextMetrics - * @type {Object} - * @private - */ - TextMetrics._fonts = {}; - /** - * String used for calculate font metrics. - * These characters are all tall to help calculate the height required for text. - * - * @static - * @memberof PIXI.TextMetrics - * @name METRICS_STRING - * @type {string} - * @default |ÉqÅ - */ - TextMetrics.METRICS_STRING = '|ÉqÅ'; - /** - * Baseline symbol for calculate font metrics. - * - * @static - * @memberof PIXI.TextMetrics - * @name BASELINE_SYMBOL - * @type {string} - * @default M - */ - TextMetrics.BASELINE_SYMBOL = 'M'; - /** - * Baseline multiplier for calculate font metrics. - * - * @static - * @memberof PIXI.TextMetrics - * @name BASELINE_MULTIPLIER - * @type {number} - * @default 1.4 - */ - TextMetrics.BASELINE_MULTIPLIER = 1.4; - /** - * Cache of new line chars. - * - * @memberof PIXI.TextMetrics - * @type {number[]} - * @private - */ - TextMetrics._newlines = [ - 0x000A, - 0x000D ]; - /** - * Cache of breaking spaces. - * - * @memberof PIXI.TextMetrics - * @type {number[]} - * @private - */ - TextMetrics._breakingSpaces = [ - 0x0009, - 0x0020, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2008, - 0x2009, - 0x200A, - 0x205F, - 0x3000 ]; - /** - * A number, or a string containing a number. - * - * @memberof PIXI - * @typedef IFontMetrics - * @property {number} ascent - Font ascent - * @property {number} descent - Font descent - * @property {number} fontSize - Font size - */ - - var defaultDestroyOptions = { - texture: true, - children: false, - baseTexture: true, - }; - /** - * A Text Object will create a line or multiple lines of text. - * - * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). - * - * The primary advantage of this class over BitmapText is that you have great control over the style of the next, - * which you can change at runtime. - * - * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. - * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. - * - * To split a line you can use '\n' in your text string, or, on the `style` object, - * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. - * - * A Text can be created directly from a string and a style object, - * which can be generated [here](https://pixijs.io/pixi-text-style). - * - * ```js - * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}); - * ``` - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var Text = /** @class */ (function (_super) { - __extends$7(Text, _super); - /** - * @param {string} text - The string that you would like the text to display - * @param {object|PIXI.TextStyle} [style] - The style parameters - * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text - */ - function Text(text, style, canvas) { - var _this = this; - var ownCanvas = false; - if (!canvas) { - canvas = document.createElement('canvas'); - ownCanvas = true; - } - canvas.width = 3; - canvas.height = 3; - var texture = Texture.from(canvas); - texture.orig = new Rectangle(); - texture.trim = new Rectangle(); - _this = _super.call(this, texture) || this; - /** - * Keep track if this Text object created it's own canvas - * element (`true`) or uses the constructor argument (`false`). - * Used to workaround a GC issues with Safari < 13 when - * destroying Text. See `destroy` for more info. - * - * @member {boolean} - * @private - */ - _this._ownCanvas = ownCanvas; - /** - * The canvas element that everything is drawn to - * - * @member {HTMLCanvasElement} - */ - _this.canvas = canvas; - /** - * The canvas 2d context that everything is drawn with - * @member {CanvasRenderingContext2D} - */ - _this.context = _this.canvas.getContext('2d'); - /** - * The resolution / device pixel ratio of the canvas. - * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. - * @member {number} - * @default 1 - */ - _this._resolution = settings.RESOLUTION; - _this._autoResolution = true; - /** - * Private tracker for the current text. - * - * @member {string} - * @private - */ - _this._text = null; - /** - * Private tracker for the current style. - * - * @member {object} - * @private - */ - _this._style = null; - /** - * Private listener to track style changes. - * - * @member {Function} - * @private - */ - _this._styleListener = null; - /** - * Private tracker for the current font. - * - * @member {string} - * @private - */ - _this._font = ''; - _this.text = text; - _this.style = style; - _this.localStyleID = -1; - return _this; - } - /** - * Renders text to its canvas, and updates its texture. - * By default this is used internally to ensure the texture is correct before rendering, - * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text, - * and then shared across multiple Sprites. - * - * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called. - */ - Text.prototype.updateText = function (respectDirty) { - var style = this._style; - // check if style has changed.. - if (this.localStyleID !== style.styleID) { - this.dirty = true; - this.localStyleID = style.styleID; - } - if (!this.dirty && respectDirty) { - return; - } - this._font = this._style.toFontString(); - var context = this.context; - var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas); - var width = measured.width; - var height = measured.height; - var lines = measured.lines; - var lineHeight = measured.lineHeight; - var lineWidths = measured.lineWidths; - var maxLineWidth = measured.maxLineWidth; - var fontProperties = measured.fontProperties; - this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution); - this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution); - context.scale(this._resolution, this._resolution); - context.clearRect(0, 0, this.canvas.width, this.canvas.height); - context.font = this._font; - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - var linePositionX; - var linePositionY; - // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text - var passesCount = style.dropShadow ? 2 : 1; - // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex, - // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow. - // - // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more - // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill - // and the stroke; and fill drop shadows would appear over the top of the stroke. - // - // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal - // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the - // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow - // beneath the text, whilst also having the proper text shadow styling. - for (var i = 0; i < passesCount; ++i) { - var isShadowPass = style.dropShadow && i === 0; - // we only want the drop shadow, so put text way off-screen - var dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0; - var dsOffsetShadow = dsOffsetText * this._resolution; - if (isShadowPass) { - // On Safari, text with gradient and drop shadows together do not position correctly - // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689 - // Therefore we'll set the styles to be a plain black whilst generating this drop shadow - context.fillStyle = 'black'; - context.strokeStyle = 'black'; - var dropShadowColor = style.dropShadowColor; - var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); - context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; - context.shadowBlur = style.dropShadowBlur; - context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; - context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow; - } - else { - // set canvas text styles - context.fillStyle = this._generateFillStyle(style, lines, measured); - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - context.strokeStyle = style.stroke; - context.shadowColor = 'black'; - context.shadowBlur = 0; - context.shadowOffsetX = 0; - context.shadowOffsetY = 0; - } - // draw lines line by line - for (var i_1 = 0; i_1 < lines.length; i_1++) { - linePositionX = style.strokeThickness / 2; - linePositionY = ((style.strokeThickness / 2) + (i_1 * lineHeight)) + fontProperties.ascent; - if (style.align === 'right') { - linePositionX += maxLineWidth - lineWidths[i_1]; - } - else if (style.align === 'center') { - linePositionX += (maxLineWidth - lineWidths[i_1]) / 2; - } - if (style.stroke && style.strokeThickness) { - this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true); - } - if (style.fill) { - this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText); - } - } - } - this.updateTexture(); - }; - /** - * Render the text with letter-spacing. - * @param {string} text - The text to draw - * @param {number} x - Horizontal position to draw the text - * @param {number} y - Vertical position to draw the text - * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the - * text? If not, it's for the inside fill - * @private - */ - Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) { - if (isStroke === void 0) { isStroke = false; } - var style = this._style; - // letterSpacing of 0 means normal - var letterSpacing = style.letterSpacing; - if (letterSpacing === 0) { - if (isStroke) { - this.context.strokeText(text, x, y); - } - else { - this.context.fillText(text, x, y); - } - return; - } - var currentPosition = x; - // Using Array.from correctly splits characters whilst keeping emoji together. - // This is not supported on IE as it requires ES6, so regular text splitting occurs. - // This also doesn't account for emoji that are multiple emoji put together to make something else. - // Handling all of this would require a big library itself. - // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516 - // https://github.com/orling/grapheme-splitter - var stringArray = Array.from ? Array.from(text) : text.split(''); - var previousWidth = this.context.measureText(text).width; - var currentWidth = 0; - for (var i = 0; i < stringArray.length; ++i) { - var currentChar = stringArray[i]; - if (isStroke) { - this.context.strokeText(currentChar, currentPosition, y); - } - else { - this.context.fillText(currentChar, currentPosition, y); - } - currentWidth = this.context.measureText(text.substring(i + 1)).width; - currentPosition += previousWidth - currentWidth + letterSpacing; - previousWidth = currentWidth; - } - }; - /** - * Updates texture size based on canvas size - * - * @private - */ - Text.prototype.updateTexture = function () { - var canvas = this.canvas; - if (this._style.trim) { - var trimmed = trimCanvas(canvas); - if (trimmed.data) { - canvas.width = trimmed.width; - canvas.height = trimmed.height; - this.context.putImageData(trimmed.data, 0, 0); - } - } - var texture = this._texture; - var style = this._style; - var padding = style.trim ? 0 : style.padding; - var baseTexture = texture.baseTexture; - texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution); - texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution); - texture.trim.x = -padding; - texture.trim.y = -padding; - texture.orig.width = texture._frame.width - (padding * 2); - texture.orig.height = texture._frame.height - (padding * 2); - // call sprite onTextureUpdate to update scale if _width or _height were set - this._onTextureUpdate(); - baseTexture.setRealSize(canvas.width, canvas.height, this._resolution); - // Recursively updates transform of all objects from the root to this one - this._recursivePostUpdateTransform(); - this.dirty = false; - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Text.prototype._render = function (renderer) { - if (this._autoResolution && this._resolution !== renderer.resolution) { - this._resolution = renderer.resolution; - this.dirty = true; - } - this.updateText(true); - _super.prototype._render.call(this, renderer); - }; - /** - * Gets the local bounds of the text object. - * - * @param {PIXI.Rectangle} rect - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - Text.prototype.getLocalBounds = function (rect) { - this.updateText(true); - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. - * @protected - */ - Text.prototype._calculateBounds = function () { - this.updateText(true); - this.calculateVertices(); - // if we have already done this on THIS frame. - this._bounds.addQuad(this.vertexData); - }; - /** - * Generates the fill style. Can automatically generate a gradient based on the fill style being an array - * - * @private - * @param {object} style - The style. - * @param {string[]} lines - The lines of text. - * @return {string|number|CanvasGradient} The fill style - */ - Text.prototype._generateFillStyle = function (style, lines, metrics) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var fillStyle = style.fill; - if (!Array.isArray(fillStyle)) { - return fillStyle; - } - else if (fillStyle.length === 1) { - return fillStyle[0]; - } - // the gradient will be evenly spaced out according to how large the array is. - // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 - var gradient; - // a dropshadow will enlarge the canvas and result in the gradient being - // generated with the incorrect dimensions - var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; - // should also take padding into account, padding can offset the gradient - var padding = style.padding || 0; - var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2); - var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2); - // make a copy of the style settings, so we can manipulate them later - var fill = fillStyle.slice(); - var fillGradientStops = style.fillGradientStops.slice(); - // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 - if (!fillGradientStops.length) { - var lengthPlus1 = fill.length + 1; - for (var i = 1; i < lengthPlus1; ++i) { - fillGradientStops.push(i / lengthPlus1); - } - } - // stop the bleeding of the last gradient on the line above to the top gradient of the this line - // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 - fill.unshift(fillStyle[0]); - fillGradientStops.unshift(0); - fill.push(fillStyle[fillStyle.length - 1]); - fillGradientStops.push(1); - if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { - // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas - gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding); - // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect - // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 - // There's potential for floating point precision issues at the seams between gradient repeats. - // The loop below generates the stops in order, so track the last generated one to prevent - // floating point precision from making us go the teeniest bit backwards, resulting in - // the first and last colors getting swapped. - var lastIterationStop = 0; - // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc - var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; - // textHeight, but as a 0-1 size in global gradient stop space - var gradStopLineHeight = textHeight / height; - for (var i = 0; i < lines.length; i++) { - var thisLineTop = metrics.lineHeight * i; - for (var j = 0; j < fill.length; j++) { - // 0-1 stop point for the current line, multiplied to global space afterwards - var lineStop = 0; - if (typeof fillGradientStops[j] === 'number') { - lineStop = fillGradientStops[j]; - } - else { - lineStop = j / fill.length; - } - var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); - // Prevent color stop generation going backwards from floating point imprecision - var clampedStop = Math.max(lastIterationStop, globalStop); - clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. - gradient.addColorStop(clampedStop, fill[j]); - lastIterationStop = clampedStop; - } - } - } - else { - // start the gradient at the center left of the canvas, and end at the center right of the canvas - gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2); - // can just evenly space out the gradients in this case, as multiple lines makes no difference - // to an even left to right gradient - var totalIterations = fill.length + 1; - var currentIteration = 1; - for (var i = 0; i < fill.length; i++) { - var stop = void 0; - if (typeof fillGradientStops[i] === 'number') { - stop = fillGradientStops[i]; - } - else { - stop = currentIteration / totalIterations; - } - gradient.addColorStop(stop, fill[i]); - currentIteration++; - } - } - return gradient; - }; - /** - * Destroys this text object. - * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as - * the majority of the time the texture will not be shared with any other Sprites. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their - * destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well - */ - Text.prototype.destroy = function (options) { - if (typeof options === 'boolean') { - options = { children: options }; - } - options = Object.assign({}, defaultDestroyOptions, options); - _super.prototype.destroy.call(this, options); - // set canvas width and height to 0 to workaround memory leak in Safari < 13 - // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12 - if (this._ownCanvas) { - this.canvas.height = this.canvas.width = 0; - } - // make sure to reset the the context and canvas.. dont want this hanging around in memory! - this.context = null; - this.canvas = null; - this._style = null; - }; - Object.defineProperty(Text.prototype, "width", { - /** - * The width of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - this.updateText(true); - return Math.abs(this.scale.x) * this._texture.orig.width; - }, - set: function (value) { - this.updateText(true); - var s = sign$1(this.scale.x) || 1; - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "height", { - /** - * The height of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - this.updateText(true); - return Math.abs(this.scale.y) * this._texture.orig.height; - }, - set: function (value) { - this.updateText(true); - var s = sign$1(this.scale.y) || 1; - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "style", { - /** - * Set the style of the text. Set up an event listener to listen for changes on the style - * object and mark the text as dirty. - * - * @member {object|PIXI.TextStyle} - */ - get: function () { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle - // since the setter creates the TextStyle. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - return this._style; - }, - set: function (style) { - style = style || {}; - if (style instanceof TextStyle) { - this._style = style; - } - else { - this._style = new TextStyle(style); - } - this.localStyleID = -1; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "text", { - /** - * Set the copy for the text object. To split a line you can use '\n'. - * - * @member {string} - */ - get: function () { - return this._text; - }, - set: function (text) { - text = String(text === null || text === undefined ? '' : text); - if (this._text === text) { - return; - } - this._text = text; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "resolution", { - /** - * The resolution / device pixel ratio of the canvas. - * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. - * @member {number} - * @default 1 - */ - get: function () { - return this._resolution; - }, - set: function (value) { - this._autoResolution = false; - if (this._resolution === value) { - return; - } - this._resolution = value; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - return Text; - }(Sprite)); - - /*! - * @pixi/prepare - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/prepare is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Default number of uploads per frame using prepare plugin. - * - * @static - * @memberof PIXI.settings - * @name UPLOADS_PER_FRAME - * @type {number} - * @default 4 - */ - settings.UPLOADS_PER_FRAME = 4; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$8 = function(d, b) { - extendStatics$8 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$8(d, b); - }; - - function __extends$8(d, b) { - extendStatics$8(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified - * number of items per frame. - * - * @class - * @memberof PIXI - */ - var CountLimiter = /** @class */ (function () { - /** - * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame. - */ - function CountLimiter(maxItemsPerFrame) { - /** - * The maximum number of items that can be prepared each frame. - * @type {number} - * @private - */ - this.maxItemsPerFrame = maxItemsPerFrame; - /** - * The number of items that can be prepared in the current frame. - * @type {number} - * @private - */ - this.itemsLeft = 0; - } - /** - * Resets any counting properties to start fresh on a new frame. - */ - CountLimiter.prototype.beginFrame = function () { - this.itemsLeft = this.maxItemsPerFrame; - }; - /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. - */ - CountLimiter.prototype.allowedToUpload = function () { - return this.itemsLeft-- > 0; - }; - return CountLimiter; - }()); - - /** - * Built-in hook to find multiple textures from objects like AnimatedSprites. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findMultipleBaseTextures(item, queue) { - var result = false; - // Objects with multiple textures - if (item && item._textures && item._textures.length) { - for (var i = 0; i < item._textures.length; i++) { - if (item._textures[i] instanceof Texture) { - var baseTexture = item._textures[i].baseTexture; - if (queue.indexOf(baseTexture) === -1) { - queue.push(baseTexture); - result = true; - } - } - } - } - return result; - } - /** - * Built-in hook to find BaseTextures from Texture. - * - * @private - * @param {PIXI.Texture} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findBaseTexture(item, queue) { - if (item.baseTexture instanceof BaseTexture) { - var texture = item.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to find textures from objects. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findTexture(item, queue) { - if (item._texture && item._texture instanceof Texture) { - var texture = item._texture.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to draw PIXI.Text to its texture. - * - * @private - * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function drawText(_helper, item) { - if (item instanceof Text) { - // updating text will return early if it is not dirty - item.updateText(true); - return true; - } - return false; - } - /** - * Built-in hook to calculate a text style for a PIXI.Text object. - * - * @private - * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function calculateTextStyle(_helper, item) { - if (item instanceof TextStyle) { - var font = item.toFontString(); - TextMetrics.measureFont(font); - return true; - } - return false; - } - /** - * Built-in hook to find Text objects. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Text object was found. - */ - function findText(item, queue) { - if (item instanceof Text) { - // push the text style to prepare it - this can be really expensive - if (queue.indexOf(item.style) === -1) { - queue.push(item.style); - } - // also push the text object so that we can render it (to canvas/texture) if needed - if (queue.indexOf(item) === -1) { - queue.push(item); - } - // also push the Text's texture for upload to GPU - var texture = item._texture.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to find TextStyle objects. - * - * @private - * @param {PIXI.TextStyle} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.TextStyle object was found. - */ - function findTextStyle(item, queue) { - if (item instanceof TextStyle) { - if (queue.indexOf(item) === -1) { - queue.push(item); - } - return true; - } - return false; - } - /** - * The prepare manager provides functionality to upload content to the GPU. - * - * BasePrepare handles basic queuing functionality and is extended by - * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare} - * to provide preparation capabilities specific to their respective renderers. - * - * @example - * // Create a sprite - * const sprite = PIXI.Sprite.from('something.png'); - * - * // Load object into GPU - * app.renderer.plugins.prepare.upload(sprite, () => { - * - * //Texture(s) has been uploaded to GPU - * app.stage.addChild(sprite); - * - * }) - * - * @abstract - * @class - * @memberof PIXI - */ - var BasePrepare = /** @class */ (function () { - /** - * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer - */ - function BasePrepare(renderer) { - var _this = this; - /** - * The limiter to be used to control how quickly items are prepared. - * @type {PIXI.CountLimiter|PIXI.TimeLimiter} - */ - this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); - /** - * Reference to the renderer. - * @type {PIXI.AbstractRenderer} - * @protected - */ - this.renderer = renderer; - /** - * The only real difference between CanvasPrepare and Prepare is what they pass - * to upload hooks. That different parameter is stored here. - * @type {object} - * @protected - */ - this.uploadHookHelper = null; - /** - * Collection of items to uploads at once. - * @type {Array<*>} - * @private - */ - this.queue = []; - /** - * Collection of additional hooks for finding assets. - * @type {Array} - * @private - */ - this.addHooks = []; - /** - * Collection of additional hooks for processing assets. - * @type {Array} - * @private - */ - this.uploadHooks = []; - /** - * Callback to call after completed. - * @type {Array} - * @private - */ - this.completes = []; - /** - * If prepare is ticking (running). - * @type {boolean} - * @private - */ - this.ticking = false; - /** - * 'bound' call for prepareItems(). - * @type {Function} - * @private - */ - this.delayedTick = function () { - // unlikely, but in case we were destroyed between tick() and delayedTick() - if (!_this.queue) { - return; - } - _this.prepareItems(); - }; - // hooks to find the correct texture - this.registerFindHook(findText); - this.registerFindHook(findTextStyle); - this.registerFindHook(findMultipleBaseTextures); - this.registerFindHook(findBaseTexture); - this.registerFindHook(findTexture); - // upload hooks - this.registerUploadHook(drawText); - this.registerUploadHook(calculateTextStyle); - } - /** - * Upload all the textures and graphics to the GPU. - * - * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - - * Either the container or display object to search for items to upload, the items to upload themselves, - * or the callback function, if items have been added using `prepare.add`. - * @param {Function} [done] - Optional callback when all queued uploads have completed - */ - BasePrepare.prototype.upload = function (item, done) { - if (typeof item === 'function') { - done = item; - item = null; - } - // If a display object, search for items - // that we could upload - if (item) { - this.add(item); - } - // Get the items for upload from the display - if (this.queue.length) { - if (done) { - this.completes.push(done); - } - if (!this.ticking) { - this.ticking = true; - Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); - } - } - else if (done) { - done(); - } - }; - /** - * Handle tick update - * - * @private - */ - BasePrepare.prototype.tick = function () { - setTimeout(this.delayedTick, 0); - }; - /** - * Actually prepare items. This is handled outside of the tick because it will take a while - * and we do NOT want to block the current animation frame from rendering. - * - * @private - */ - BasePrepare.prototype.prepareItems = function () { - this.limiter.beginFrame(); - // Upload the graphics - while (this.queue.length && this.limiter.allowedToUpload()) { - var item = this.queue[0]; - var uploaded = false; - if (item && !item._destroyed) { - for (var i = 0, len = this.uploadHooks.length; i < len; i++) { - if (this.uploadHooks[i](this.uploadHookHelper, item)) { - this.queue.shift(); - uploaded = true; - break; - } - } - } - if (!uploaded) { - this.queue.shift(); - } - } - // We're finished - if (!this.queue.length) { - this.ticking = false; - var completes = this.completes.slice(0); - this.completes.length = 0; - for (var i = 0, len = completes.length; i < len; i++) { - completes[i](); - } - } - else { - // if we are not finished, on the next rAF do this again - Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); - } - }; - /** - * Adds hooks for finding items. - * - * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` - * function must return `true` if it was able to add item to the queue. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerFindHook = function (addHook) { - if (addHook) { - this.addHooks.push(addHook); - } - return this; - }; - /** - * Adds hooks for uploading items. - * - * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and - * function must return `true` if it was able to handle upload of item. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerUploadHook = function (uploadHook) { - if (uploadHook) { - this.uploadHooks.push(uploadHook); - } - return this; - }; - /** - * Manually add an item to the uploading queue. - * - * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to - * add to the queue - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.add = function (item) { - // Add additional hooks for finding elements on special - // types of objects that - for (var i = 0, len = this.addHooks.length; i < len; i++) { - if (this.addHooks[i](item, this.queue)) { - break; - } - } - // Get children recursively - if (item instanceof Container) { - for (var i = item.children.length - 1; i >= 0; i--) { - this.add(item.children[i]); - } - } - return this; - }; - /** - * Destroys the plugin, don't use after this. - * - */ - BasePrepare.prototype.destroy = function () { - if (this.ticking) { - Ticker.system.remove(this.tick, this); - } - this.ticking = false; - this.addHooks = null; - this.uploadHooks = null; - this.renderer = null; - this.completes = null; - this.queue = null; - this.limiter = null; - this.uploadHookHelper = null; - }; - return BasePrepare; - }()); - - /** - * Built-in hook to upload PIXI.Texture objects to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.BaseTexture} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadBaseTextures(renderer, item) { - if (item instanceof BaseTexture) { - // if the texture already has a GL texture, then the texture has been prepared or rendered - // before now. If the texture changed, then the changer should be calling texture.update() which - // reuploads the texture without need for preparing it again - if (!item._glTextures[renderer.CONTEXT_UID]) { - renderer.texture.bind(item); - } - return true; - } - return false; - } - /** - * Built-in hook to upload PIXI.Graphics to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadGraphics(renderer, item) { - if (!(item instanceof Graphics)) { - return false; - } - var geometry = item.geometry; - // update dirty graphics to get batches - item.finishPoly(); - geometry.updateBatches(); - var batches = geometry.batches; - // upload all textures found in styles - for (var i = 0; i < batches.length; i++) { - var texture = batches[i].style.texture; - if (texture) { - uploadBaseTextures(renderer, texture.baseTexture); - } - } - // if its not batchable - update vao for particular shader - if (!geometry.batchable) { - renderer.geometry.bind(geometry, item._resolveDirectShader(renderer)); - } - return true; - } - /** - * Built-in hook to find graphics. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Graphics object was found. - */ - function findGraphics(item, queue) { - if (item instanceof Graphics) { - queue.push(item); - return true; - } - return false; - } - /** - * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for - * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed. - * - * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. - * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. - * @example - * // Create a new application - * const app = new PIXI.Application(); - * document.body.appendChild(app.view); - * - * // Don't start rendering right away - * app.stop(); - * - * // create a display object - * const rect = new PIXI.Graphics() - * .beginFill(0x00ff00) - * .drawRect(40, 40, 200, 200); - * - * // Add to the stage - * app.stage.addChild(rect); - * - * // Don't start rendering until the graphic is uploaded to the GPU - * app.renderer.plugins.prepare.upload(app.stage, () => { - * app.start(); - * }); - * - * @class - * @extends PIXI.BasePrepare - * @memberof PIXI - */ - var Prepare = /** @class */ (function (_super) { - __extends$8(Prepare, _super); - /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer - */ - function Prepare(renderer) { - var _this = _super.call(this, renderer) || this; - _this.uploadHookHelper = _this.renderer; - // Add textures and graphics to upload - _this.registerFindHook(findGraphics); - _this.registerUploadHook(uploadBaseTextures); - _this.registerUploadHook(uploadGraphics); - return _this; - } - return Prepare; - }(BasePrepare)); - - /** - * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified - * number of milliseconds per frame. - * - * @class - * @memberof PIXI - */ - var TimeLimiter = /** @class */ (function () { - /** - * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. - */ - function TimeLimiter(maxMilliseconds) { - /** - * The maximum milliseconds that can be spent preparing items each frame. - * @type {number} - * @private - */ - this.maxMilliseconds = maxMilliseconds; - /** - * The start time of the current frame. - * @type {number} - * @private - */ - this.frameStart = 0; - } - /** - * Resets any counting properties to start fresh on a new frame. - */ - TimeLimiter.prototype.beginFrame = function () { - this.frameStart = Date.now(); - }; - /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. - */ - TimeLimiter.prototype.allowedToUpload = function () { - return Date.now() - this.frameStart < this.maxMilliseconds; - }; - return TimeLimiter; - }()); - - /*! - * @pixi/spritesheet - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/spritesheet is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Utility class for maintaining reference to a collection - * of Textures on a single Spritesheet. - * - * To access a sprite sheet from your code pass its JSON data file to Pixi's loader: - * - * ```js - * PIXI.Loader.shared.add("images/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["images/spritesheet.json"].spritesheet; - * ... - * } - * ``` - * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite. - * - * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker}, - * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}. - * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only - * supported by TexturePacker. - * - * @class - * @memberof PIXI - */ - var Spritesheet = /** @class */ (function () { - /** - * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object. - * @param {Object} data - Spritesheet image data. - * @param {string} [resolutionFilename] - The filename to consider when determining - * the resolution of the spritesheet. If not provided, the imageUrl will - * be used on the BaseTexture. - */ - function Spritesheet(texture, data, resolutionFilename) { - if (resolutionFilename === void 0) { resolutionFilename = null; } - /** - * Reference to original source image from the Loader. This reference is retained so we - * can destroy the Texture later on. It is never used internally. - * @type {PIXI.Texture} - * @private - */ - this._texture = texture instanceof Texture ? texture : null; - /** - * Reference to ths source texture. - * @type {PIXI.BaseTexture} - */ - this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture; - /** - * A map containing all textures of the sprite sheet. - * Can be used to create a {@link PIXI.Sprite|Sprite}: - * ```js - * new PIXI.Sprite(sheet.textures["image.png"]); - * ``` - * @member {Object} - */ - this.textures = {}; - /** - * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: - * ```js - * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) - * ``` - * @member {Object} - */ - this.animations = {}; - /** - * Reference to the original JSON data. - * @type {Object} - */ - this.data = data; - var resource = this.baseTexture.resource; - /** - * The resolution of the spritesheet. - * @type {number} - */ - this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)); - /** - * Map of spritesheet frames. - * @type {Object} - * @private - */ - this._frames = this.data.frames; - /** - * Collection of frame names. - * @type {string[]} - * @private - */ - this._frameKeys = Object.keys(this._frames); - /** - * Current batch index being processed. - * @type {number} - * @private - */ - this._batchIndex = 0; - /** - * Callback when parse is completed. - * @type {Function} - * @private - */ - this._callback = null; - } - /** - * Generate the resolution from the filename or fallback - * to the meta.scale field of the JSON data. - * - * @private - * @param {string} resolutionFilename - The filename to use for resolving - * the default resolution. - * @return {number} Resolution to use for spritesheet. - */ - Spritesheet.prototype._updateResolution = function (resolutionFilename) { - if (resolutionFilename === void 0) { resolutionFilename = null; } - var scale = this.data.meta.scale; - // Use a defaultValue of `null` to check if a url-based resolution is set - var resolution = getResolutionOfUrl(resolutionFilename, null); - // No resolution found via URL - if (resolution === null) { - // Use the scale value or default to 1 - resolution = scale !== undefined ? parseFloat(scale) : 1; - } - // For non-1 resolutions, update baseTexture - if (resolution !== 1) { - this.baseTexture.setResolution(resolution); - } - return resolution; - }; - /** - * Parser spritesheet from loaded data. This is done asynchronously - * to prevent creating too many Texture within a single process. - * - * @param {Function} callback - Callback when complete returns - * a map of the Textures for this spritesheet. - */ - Spritesheet.prototype.parse = function (callback) { - this._batchIndex = 0; - this._callback = callback; - if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) { - this._processFrames(0); - this._processAnimations(); - this._parseComplete(); - } - else { - this._nextBatch(); - } - }; - /** - * Process a batch of frames - * - * @private - * @param {number} initialFrameIndex - The index of frame to start. - */ - Spritesheet.prototype._processFrames = function (initialFrameIndex) { - var frameIndex = initialFrameIndex; - var maxFrames = Spritesheet.BATCH_SIZE; - while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) { - var i = this._frameKeys[frameIndex]; - var data = this._frames[i]; - var rect = data.frame; - if (rect) { - var frame = null; - var trim = null; - var sourceSize = data.trimmed !== false && data.sourceSize - ? data.sourceSize : data.frame; - var orig = new Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution); - if (data.rotated) { - frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution); - } - else { - frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); - } - // Check to see if the sprite is trimmed - if (data.trimmed !== false && data.spriteSourceSize) { - trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); - } - this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor); - // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions - Texture.addToCache(this.textures[i], i); - } - frameIndex++; - } - }; - /** - * Parse animations config - * - * @private - */ - Spritesheet.prototype._processAnimations = function () { - var animations = this.data.animations || {}; - for (var animName in animations) { - this.animations[animName] = []; - for (var i = 0; i < animations[animName].length; i++) { - var frameName = animations[animName][i]; - this.animations[animName].push(this.textures[frameName]); - } - } - }; - /** - * The parse has completed. - * - * @private - */ - Spritesheet.prototype._parseComplete = function () { - var callback = this._callback; - this._callback = null; - this._batchIndex = 0; - callback.call(this, this.textures); - }; - /** - * Begin the next batch of textures. - * - * @private - */ - Spritesheet.prototype._nextBatch = function () { - var _this = this; - this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); - this._batchIndex++; - setTimeout(function () { - if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) { - _this._nextBatch(); - } - else { - _this._processAnimations(); - _this._parseComplete(); - } - }, 0); - }; - /** - * Destroy Spritesheet and don't use after this. - * - * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well - */ - Spritesheet.prototype.destroy = function (destroyBase) { - var _a; - if (destroyBase === void 0) { destroyBase = false; } - for (var i in this.textures) { - this.textures[i].destroy(); - } - this._frames = null; - this._frameKeys = null; - this.data = null; - this.textures = null; - if (destroyBase) { - (_a = this._texture) === null || _a === void 0 ? void 0 : _a.destroy(); - this.baseTexture.destroy(); - } - this._texture = null; - this.baseTexture = null; - }; - /** - * The maximum number of Textures to build per process. - * - * @type {number} - * @default 1000 - */ - Spritesheet.BATCH_SIZE = 1000; - return Spritesheet; - }()); - - /** - * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with - * TexturePacker or similar JSON-based spritesheet. - * - * This middleware automatically generates Texture resources. - * - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var SpritesheetLoader = /** @class */ (function () { - function SpritesheetLoader() { - } - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - SpritesheetLoader.use = function (resource, next) { - // because this is middleware, it execute in loader context. `this` = loader - var loader = this; - var imageResourceName = resource.name + "_image"; - // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists - if (!resource.data - || resource.type !== LoaderResource.TYPE.JSON - || !resource.data.frames - || loader.resources[imageResourceName]) { - next(); - return; - } - var loadOptions = { - crossOrigin: resource.crossOrigin, - metadata: resource.metadata.imageMetadata, - parentResource: resource, - }; - var resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl); - // load the image for this sheet - loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) { - if (res.error) { - next(res.error); - return; - } - var spritesheet = new Spritesheet(res.texture, resource.data, resource.url); - spritesheet.parse(function () { - resource.spritesheet = spritesheet; - resource.textures = spritesheet.textures; - next(); - }); - }); - }; - /** - * Get the spritesheets root path - * @param {PIXI.LoaderResource} resource - Resource to check path - * @param {string} baseUrl - Base root url - */ - SpritesheetLoader.getResourcePath = function (resource, baseUrl) { - // Prepend url path unless the resource image is a data url - if (resource.isDataUrl) { - return resource.data.meta.image; - } - return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); - }; - return SpritesheetLoader; - }()); - - /*! - * @pixi/sprite-tiling - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite-tiling is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$9 = function(d, b) { - extendStatics$9 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$9(d, b); - }; - - function __extends$9(d, b) { - extendStatics$9(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var tempPoint$1 = new Point(); - /** - * A tiling sprite is a fast way of rendering a tiling image - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var TilingSprite = /** @class */ (function (_super) { - __extends$9(TilingSprite, _super); - /** - * @param {PIXI.Texture} texture - the texture of the tiling sprite - * @param {number} [width=100] - the width of the tiling sprite - * @param {number} [height=100] - the height of the tiling sprite - */ - function TilingSprite(texture, width, height) { - if (width === void 0) { width = 100; } - if (height === void 0) { height = 100; } - var _this = _super.call(this, texture) || this; - /** - * Tile transform - * - * @member {PIXI.Transform} - */ - _this.tileTransform = new Transform(); - /** - * The with of the tiling sprite - * - * @member {number} - * @private - */ - _this._width = width; - /** - * The height of the tiling sprite - * - * @member {number} - * @private - */ - _this._height = height; - /** - * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space - * - * @member {PIXI.TextureMatrix} - */ - _this.uvMatrix = _this.texture.uvMatrix || new TextureMatrix(texture); - /** - * Plugin that is responsible for rendering this element. - * Allows to customize the rendering process without overriding '_render' method. - * - * @member {string} - * @default 'tilingSprite' - */ - _this.pluginName = 'tilingSprite'; - /** - * Whether or not anchor affects uvs - * - * @member {boolean} - * @default false - */ - _this.uvRespectAnchor = false; - return _this; - } - Object.defineProperty(TilingSprite.prototype, "clampMargin", { - /** - * Changes frame clamping in corresponding textureTransform, shortcut - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} - */ - get: function () { - return this.uvMatrix.clampMargin; - }, - set: function (value) { - this.uvMatrix.clampMargin = value; - this.uvMatrix.update(true); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "tileScale", { - /** - * The scaling of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.tileTransform.scale; - }, - set: function (value) { - this.tileTransform.scale.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "tilePosition", { - /** - * The offset of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.tileTransform.position; - }, - set: function (value) { - this.tileTransform.position.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - /** - * @protected - */ - TilingSprite.prototype._onTextureUpdate = function () { - if (this.uvMatrix) { - this.uvMatrix.texture = this._texture; - } - this._cachedTint = 0xFFFFFF; - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - TilingSprite.prototype._render = function (renderer) { - // tweak our texture temporarily.. - var texture = this._texture; - if (!texture || !texture.valid) { - return; - } - this.tileTransform.updateLocalTransform(); - this.uvMatrix.update(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - }; - /** - * Updates the bounds of the tiling sprite. - * - * @protected - */ - TilingSprite.prototype._calculateBounds = function () { - var minX = this._width * -this._anchor._x; - var minY = this._height * -this._anchor._y; - var maxX = this._width * (1 - this._anchor._x); - var maxY = this._height * (1 - this._anchor._y); - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); - }; - /** - * Gets the local bounds of the sprite object. - * - * @param {PIXI.Rectangle} rect - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - TilingSprite.prototype.getLocalBounds = function (rect) { - // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) { - this._bounds.minX = this._width * -this._anchor._x; - this._bounds.minY = this._height * -this._anchor._y; - this._bounds.maxX = this._width * (1 - this._anchor._x); - this._bounds.maxY = this._height * (1 - this._anchor._y); - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - return this._bounds.getRectangle(rect); - } - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * Checks if a point is inside this tiling sprite. - * - * @param {PIXI.IPointData} point - the point to check - * @return {boolean} Whether or not the sprite contains the point. - */ - TilingSprite.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, tempPoint$1); - var width = this._width; - var height = this._height; - var x1 = -width * this.anchor._x; - if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width) { - var y1 = -height * this.anchor._y; - if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height) { - return true; - } - } - return false; - }; - /** - * Destroys this sprite and optionally its texture and children - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well - */ - TilingSprite.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.tileTransform = null; - this.uvMatrix = null; - }; - /** - * Helper function that creates a new tiling sprite based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from - * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options. - * @param {number} options.width - required width of the tiling sprite - * @param {number} options.height - required height of the tiling sprite - * @return {PIXI.TilingSprite} The newly created texture - */ - TilingSprite.from = function (source, options) { - // Deprecated - if (typeof options === 'number') { - deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args'); - // eslint-disable-next-line prefer-rest-params - options = { width: options, height: arguments[2] }; - } - return new TilingSprite(Texture.from(source, options), options.width, options.height); - }; - Object.defineProperty(TilingSprite.prototype, "width", { - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this._width; - }, - set: function (value) { - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "height", { - /** - * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this._height; - }, - set: function (value) { - this._height = value; - }, - enumerable: false, - configurable: true - }); - return TilingSprite; - }(Sprite)); - - var vertex$2 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n"; - - var fragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture2D(uSampler, coord);\n gl_FragColor = texSample * uColor;\n}\n"; - - var fragmentSimple = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n"; - - var tempMat$1 = new Matrix(); - /** - * WebGL renderer plugin for tiling sprites - * - * @class - * @memberof PIXI - * @extends PIXI.ObjectRenderer - */ - var TilingSpriteRenderer = /** @class */ (function (_super) { - __extends$9(TilingSpriteRenderer, _super); - /** - * constructor for renderer - * - * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for. - */ - function TilingSpriteRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - var uniforms = { globals: _this.renderer.globalUniforms }; - _this.shader = Shader.from(vertex$2, fragment$2, uniforms); - _this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); - _this.quad = new QuadUv(); - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - return _this; - } - /** - * - * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered - */ - TilingSpriteRenderer.prototype.render = function (ts) { - var renderer = this.renderer; - var quad = this.quad; - var vertices = quad.vertices; - vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x; - vertices[1] = vertices[3] = ts._height * -ts.anchor.y; - vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x); - vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y); - if (ts.uvRespectAnchor) { - vertices = quad.uvs; - vertices[0] = vertices[6] = -ts.anchor.x; - vertices[1] = vertices[3] = -ts.anchor.y; - vertices[2] = vertices[4] = 1.0 - ts.anchor.x; - vertices[5] = vertices[7] = 1.0 - ts.anchor.y; - } - quad.invalidate(); - var tex = ts._texture; - var baseTex = tex.baseTexture; - var lt = ts.tileTransform.localTransform; - var uv = ts.uvMatrix; - var isSimple = baseTex.isPowerOfTwo - && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; - // auto, force repeat wrapMode for big tiling textures - if (isSimple) { - if (!baseTex._glTextures[renderer.CONTEXT_UID]) { - if (baseTex.wrapMode === exports.WRAP_MODES.CLAMP) { - baseTex.wrapMode = exports.WRAP_MODES.REPEAT; - } - } - else { - isSimple = baseTex.wrapMode !== exports.WRAP_MODES.CLAMP; - } - } - var shader = isSimple ? this.simpleShader : this.shader; - var w = tex.width; - var h = tex.height; - var W = ts._width; - var H = ts._height; - tempMat$1.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); - // that part is the same as above: - // tempMat.identity(); - // tempMat.scale(tex.width, tex.height); - // tempMat.prepend(lt); - // tempMat.scale(1.0 / ts._width, 1.0 / ts._height); - tempMat$1.invert(); - if (isSimple) { - tempMat$1.prepend(uv.mapCoord); - } - else { - shader.uniforms.uMapCoord = uv.mapCoord.toArray(true); - shader.uniforms.uClampFrame = uv.uClampFrame; - shader.uniforms.uClampOffset = uv.uClampOffset; - } - shader.uniforms.uTransform = tempMat$1.toArray(true); - shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.alphaMode); - shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true); - shader.uniforms.uSampler = tex; - renderer.shader.bind(shader); - renderer.geometry.bind(quad); - this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode); - renderer.state.set(this.state); - renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0); - }; - return TilingSpriteRenderer; - }(ObjectRenderer)); - - /*! - * @pixi/mesh - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mesh is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$a = function(d, b) { - extendStatics$a = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$a(d, b); - }; - - function __extends$a(d, b) { - extendStatics$a(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space. - * - * @class - * @memberof PIXI - */ - var MeshBatchUvs = /** @class */ (function () { - /** - * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's - * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix - */ - function MeshBatchUvs(uvBuffer, uvMatrix) { - /** - * Buffer with normalized UV's - * @member {PIXI.Buffer} - */ - this.uvBuffer = uvBuffer; - /** - * Material UV matrix - * @member {PIXI.TextureMatrix} - */ - this.uvMatrix = uvMatrix; - /** - * UV Buffer data - * @member {Float32Array} - * @readonly - */ - this.data = null; - this._bufferUpdateId = -1; - this._textureUpdateId = -1; - this._updateID = 0; - } - /** - * updates - * - * @param {boolean} [forceUpdate] - force the update - */ - MeshBatchUvs.prototype.update = function (forceUpdate) { - if (!forceUpdate - && this._bufferUpdateId === this.uvBuffer._updateID - && this._textureUpdateId === this.uvMatrix._updateID) { - return; - } - this._bufferUpdateId = this.uvBuffer._updateID; - this._textureUpdateId = this.uvMatrix._updateID; - var data = this.uvBuffer.data; - if (!this.data || this.data.length !== data.length) { - this.data = new Float32Array(data.length); - } - this.uvMatrix.multiplyUvs(data, this.data); - this._updateID++; - }; - return MeshBatchUvs; - }()); - - var tempPoint$2 = new Point(); - var tempPolygon = new Polygon(); - /** - * Base mesh class. - * - * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. - * This class assumes a certain level of WebGL knowledge. - * If you know a bit this should abstract enough away to make you life easier! - * - * Pretty much ALL WebGL can be broken down into the following: - * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) - * - State - This is the state of WebGL required to render the mesh. - * - * Through a combination of the above elements you can render anything you want, 2D or 3D! - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Mesh = /** @class */ (function (_super) { - __extends$a(Mesh, _super); - /** - * @param {PIXI.Geometry} geometry - the geometry the mesh will use - * @param {PIXI.MeshMaterial} shader - the shader the mesh will use - * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh - * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. - * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts - */ - function Mesh(geometry, shader, state, drawMode) { - if (drawMode === void 0) { drawMode = exports.DRAW_MODES.TRIANGLES; } - var _this = _super.call(this) || this; - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh objects. - * @member {PIXI.Geometry} - * @readonly - */ - _this.geometry = geometry; - geometry.refCount++; - /** - * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. - * Can be shared between multiple Mesh objects. - * @member {PIXI.Shader|PIXI.MeshMaterial} - */ - _this.shader = shader; - /** - * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., - * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. - * @member {PIXI.State} - */ - _this.state = state || State.for2d(); - /** - * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. - * - * @member {number} - * @see PIXI.DRAW_MODES - */ - _this.drawMode = drawMode; - /** - * Typically the index of the IndexBuffer where to start drawing. - * @member {number} - * @default 0 - */ - _this.start = 0; - /** - * How much of the geometry to draw, by default `0` renders everything. - * @member {number} - * @default 0 - */ - _this.size = 0; - /** - * thease are used as easy access for batching - * @member {Float32Array} - * @private - */ - _this.uvs = null; - /** - * thease are used as easy access for batching - * @member {Uint16Array} - * @private - */ - _this.indices = null; - /** - * this is the caching layer used by the batcher - * @member {Float32Array} - * @private - */ - _this.vertexData = new Float32Array(1); - /** - * If geometry is changed used to decide to re-transform - * the vertexData. - * @member {number} - * @private - */ - _this.vertexDirty = 0; - _this._transformID = -1; - /** - * Internal roundPixels field - * - * @member {boolean} - * @private - */ - _this._roundPixels = settings.ROUND_PIXELS; - /** - * Batched UV's are cached for atlas textures - * @member {PIXI.MeshBatchUvs} - * @private - */ - _this.batchUvs = null; - return _this; - } - Object.defineProperty(Mesh.prototype, "uvBuffer", { - /** - * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @member {PIXI.Buffer} - * @readonly - */ - get: function () { - return this.geometry.buffers[1]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "verticesBuffer", { - /** - * To change mesh vertices, change its uvBuffer data and increment its _updateID. - * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @member {PIXI.Buffer} - * @readonly - */ - get: function () { - return this.geometry.buffers[0]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "material", { - get: function () { - return this.shader; - }, - /** - * Alias for {@link PIXI.Mesh#shader}. - * @member {PIXI.MeshMaterial} - */ - set: function (value) { - this.shader = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "blendMode", { - get: function () { - return this.state.blendMode; - }, - /** - * The blend mode to be applied to the Mesh. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "roundPixels", { - get: function () { - return this._roundPixels; - }, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - set: function (value) { - if (this._roundPixels !== value) { - this._transformID = -1; - } - this._roundPixels = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "tint", { - /** - * The multiply tint applied to the Mesh. This is a hex value. A value of - * `0xFFFFFF` will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this.shader.tint; - }, - set: function (value) { - this.shader.tint = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "texture", { - /** - * The texture that the Mesh uses. - * - * @member {PIXI.Texture} - */ - get: function () { - return this.shader.texture; - }, - set: function (value) { - this.shader.texture = value; - }, - enumerable: false, - configurable: true - }); - /** - * Standard renderer draw. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._render = function (renderer) { - // set properties for batching.. - // TODO could use a different way to grab verts? - var vertices = this.geometry.buffers[0].data; - // TODO benchmark check for attribute size.. - if (this.shader.batchable - && this.drawMode === exports.DRAW_MODES.TRIANGLES - && vertices.length < Mesh.BATCHABLE_SIZE * 2) { - this._renderToBatch(renderer); - } - else { - this._renderDefault(renderer); - } - }; - /** - * Standard non-batching way of rendering. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderDefault = function (renderer) { - var shader = this.shader; - shader.alpha = this.worldAlpha; - if (shader.update) { - shader.update(); - } - renderer.batch.flush(); - if (shader.program.uniformData.translationMatrix) { - shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true); - } - // bind and sync uniforms.. - renderer.shader.bind(shader); - // set state.. - renderer.state.set(this.state); - // bind the geometry... - renderer.geometry.bind(this.geometry, shader); - // then render it - renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount); - }; - /** - * Rendering by using the Batch system. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderToBatch = function (renderer) { - var geometry = this.geometry; - if (this.shader.uvMatrix) { - this.shader.uvMatrix.update(); - this.calculateUvs(); - } - // set properties for batching.. - this.calculateVertices(); - this.indices = geometry.indexBuffer.data; - this._tintRGB = this.shader._tintRGB; - this._texture = this.shader.texture; - var pluginName = this.material.pluginName; - renderer.batch.setObjectRenderer(renderer.plugins[pluginName]); - renderer.plugins[pluginName].render(this); - }; - /** - * Updates vertexData field based on transform and vertices - */ - Mesh.prototype.calculateVertices = function () { - var geometry = this.geometry; - var vertices = geometry.buffers[0].data; - if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) { - return; - } - this._transformID = this.transform._worldID; - if (this.vertexData.length !== vertices.length) { - this.vertexData = new Float32Array(vertices.length); - } - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var vertexData = this.vertexData; - for (var i = 0; i < vertexData.length / 2; i++) { - var x = vertices[(i * 2)]; - var y = vertices[(i * 2) + 1]; - vertexData[(i * 2)] = (a * x) + (c * y) + tx; - vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty; - } - if (this._roundPixels) { - var resolution = settings.RESOLUTION; - for (var i = 0; i < vertexData.length; ++i) { - vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); - } - } - this.vertexDirty = geometry.vertexDirtyId; - }; - /** - * Updates uv field based on from geometry uv's or batchUvs - */ - Mesh.prototype.calculateUvs = function () { - var geomUvs = this.geometry.buffers[1]; - if (!this.shader.uvMatrix.isSimple) { - if (!this.batchUvs) { - this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix); - } - this.batchUvs.update(); - this.uvs = this.batchUvs.data; - } - else { - this.uvs = geomUvs.data; - } - }; - /** - * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. - * - * @protected - */ - Mesh.prototype._calculateBounds = function () { - this.calculateVertices(); - this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length); - }; - /** - * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES. - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Mesh.prototype.containsPoint = function (point) { - if (!this.getBounds().contains(point.x, point.y)) { - return false; - } - this.worldTransform.applyInverse(point, tempPoint$2); - var vertices = this.geometry.getBuffer('aVertexPosition').data; - var points = tempPolygon.points; - var indices = this.geometry.getIndex().data; - var len = indices.length; - var step = this.drawMode === 4 ? 3 : 1; - for (var i = 0; i + 2 < len; i += step) { - var ind0 = indices[i] * 2; - var ind1 = indices[i + 1] * 2; - var ind2 = indices[i + 2] * 2; - points[0] = vertices[ind0]; - points[1] = vertices[ind0 + 1]; - points[2] = vertices[ind1]; - points[3] = vertices[ind1 + 1]; - points[4] = vertices[ind2]; - points[5] = vertices[ind2 + 1]; - if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y)) { - return true; - } - } - return false; - }; - /** - * Destroys the Mesh object. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - */ - Mesh.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.geometry.refCount--; - if (this.geometry.refCount === 0) { - this.geometry.dispose(); - } - this.geometry = null; - this.shader = null; - this.state = null; - this.uvs = null; - this.indices = null; - this.vertexData = null; - }; - /** - * The maximum number of vertices to consider batchable. Generally, the complexity - * of the geometry. - * @memberof PIXI.Mesh - * @static - * @member {number} BATCHABLE_SIZE - */ - Mesh.BATCHABLE_SIZE = 100; - return Mesh; - }(Container)); - - var fragment$3 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"; - - var vertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"; - - /** - * Slightly opinionated default shader for PixiJS 2D objects. - * @class - * @memberof PIXI - * @extends PIXI.Shader - */ - var MeshMaterial = /** @class */ (function (_super) { - __extends$a(MeshMaterial, _super); - /** - * @param {PIXI.Texture} uSampler - Texture that material uses to render. - * @param {object} [options] - Additional options - * @param {number} [options.alpha=1] - Default alpha. - * @param {number} [options.tint=0xFFFFFF] - Default tint. - * @param {string} [options.pluginName='batch'] - Renderer plugin for batching. - * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program. - * @param {object} [options.uniforms] - Custom uniforms. - */ - function MeshMaterial(uSampler, options) { - var _this = this; - var uniforms = { - uSampler: uSampler, - alpha: 1, - uTextureMatrix: Matrix.IDENTITY, - uColor: new Float32Array([1, 1, 1, 1]), - }; - // Set defaults - options = Object.assign({ - tint: 0xFFFFFF, - alpha: 1, - pluginName: 'batch', - }, options); - if (options.uniforms) { - Object.assign(uniforms, options.uniforms); - } - _this = _super.call(this, options.program || Program.from(vertex$3, fragment$3), uniforms) || this; - /** - * Only do update if tint or alpha changes. - * @member {boolean} - * @private - * @default false - */ - _this._colorDirty = false; - /** - * TextureMatrix instance for this Mesh, used to track Texture changes - * - * @member {PIXI.TextureMatrix} - * @readonly - */ - _this.uvMatrix = new TextureMatrix(uSampler); - /** - * `true` if shader can be batch with the renderer's batch system. - * @member {boolean} - * @default true - */ - _this.batchable = options.program === undefined; - /** - * Renderer plugin for batching - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = options.pluginName; - _this.tint = options.tint; - _this.alpha = options.alpha; - return _this; - } - Object.defineProperty(MeshMaterial.prototype, "texture", { - /** - * Reference to the texture being rendered. - * @member {PIXI.Texture} - */ - get: function () { - return this.uniforms.uSampler; - }, - set: function (value) { - if (this.uniforms.uSampler !== value) { - this.uniforms.uSampler = value; - this.uvMatrix.texture = value; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MeshMaterial.prototype, "alpha", { - get: function () { - return this._alpha; - }, - /** - * This gets automatically set by the object using this. - * - * @default 1 - * @member {number} - */ - set: function (value) { - if (value === this._alpha) - { return; } - this._alpha = value; - this._colorDirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MeshMaterial.prototype, "tint", { - get: function () { - return this._tint; - }, - /** - * Multiply tint for the material. - * @member {number} - * @default 0xFFFFFF - */ - set: function (value) { - if (value === this._tint) - { return; } - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - this._colorDirty = true; - }, - enumerable: false, - configurable: true - }); - /** - * Gets called automatically by the Mesh. Intended to be overridden for custom - * MeshMaterial objects. - */ - MeshMaterial.prototype.update = function () { - if (this._colorDirty) { - this._colorDirty = false; - var baseTexture = this.texture.baseTexture; - premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode); - } - if (this.uvMatrix.update()) { - this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord; - } - }; - return MeshMaterial; - }(Shader)); - - /** - * Standard 2D geometry used in PixiJS. - * - * Geometry can be defined without passing in a style or data if required. - * - * ```js - * const geometry = new PIXI.Geometry(); - * - * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); - * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2); - * geometry.addIndex([0,1,2,1,3,2]); - * - * ``` - * @class - * @memberof PIXI - * @extends PIXI.Geometry - */ - var MeshGeometry = /** @class */ (function (_super) { - __extends$a(MeshGeometry, _super); - /** - * @param {Float32Array|number[]} [vertices] - Positional data on geometry. - * @param {Float32Array|number[]} [uvs] - Texture UVs. - * @param {Uint16Array|number[]} [index] - IndexBuffer - */ - function MeshGeometry(vertices, uvs, index) { - var _this = _super.call(this) || this; - var verticesBuffer = new Buffer(vertices); - var uvsBuffer = new Buffer(uvs, true); - var indexBuffer = new Buffer(index, true, true); - _this.addAttribute('aVertexPosition', verticesBuffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', uvsBuffer, 2, false, exports.TYPES.FLOAT) - .addIndex(indexBuffer); - /** - * Dirty flag to limit update calls on Mesh. For example, - * limiting updates on a single Mesh instance with a shared Geometry - * within the render loop. - * @private - * @member {number} - * @default -1 - */ - _this._updateId = -1; - return _this; - } - Object.defineProperty(MeshGeometry.prototype, "vertexDirtyId", { - /** - * If the vertex position is updated. - * @member {number} - * @readonly - * @private - */ - get: function () { - return this.buffers[0]._updateID; - }, - enumerable: false, - configurable: true - }); - return MeshGeometry; - }(Geometry)); - - /*! - * @pixi/text-bitmap - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/text-bitmap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$b = function(d, b) { - extendStatics$b = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$b(d, b); - }; - - function __extends$b(d, b) { - extendStatics$b(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /* eslint-disable max-len */ - /** - * Normalized parsed data from .fnt files. - * - * @class - * @memberof PIXI - */ - var BitmapFontData = /** @class */ (function () { - function BitmapFontData() { - /** - * @member {PIXI.IBitmapFontDataInfo[]} - * @readOnly - */ - this.info = []; - /** - * @member {PIXI.IBitmapFontDataCommon[]} - * @readOnly - */ - this.common = []; - /** - * @member {PIXI.IBitmapFontDataPage[]} - * @readOnly - */ - this.page = []; - /** - * @member {PIXI.IBitmapFontDataChar[]} - * @readOnly - */ - this.char = []; - /** - * @member {PIXI.IBitmapFontDataKerning[]} - * @readOnly - */ - this.kerning = []; - } - return BitmapFontData; - }()); - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataInfo - * @property {string} face - * @property {number} size - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataCommon - * @property {number} lineHeight - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataPage - * @property {number} id - * @property {string} file - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataChar - * @property {string} id - * @property {number} page - * @property {number} x - * @property {number} y - * @property {number} width - * @property {number} height - * @property {number} xoffset - * @property {number} yoffset - * @property {number} xadvance - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataKerning - * @property {number} first - * @property {number} second - * @property {number} amount - */ - - /** - * BitmapFont format that's Text-based. - * - * @class - * @private - */ - var TextFormat = /** @class */ (function () { - function TextFormat() { - } - /** - * Check if resource refers to txt font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - TextFormat.test = function (data) { - return typeof data === 'string' && data.indexOf('info face=') === 0; - }; - /** - * Convert text font data to a javascript object. - * - * @static - * @private - * @param {string} txt - Raw string data to be converted - * @return {PIXI.BitmapFontData} Parsed font data - */ - TextFormat.parse = function (txt) { - // Retrieve data item - var items = txt.match(/^[a-z]+\s+.+$/gm); - var rawData = { - info: [], - common: [], - page: [], - char: [], - chars: [], - kerning: [], - kernings: [], - }; - for (var i in items) { - // Extract item name - var name = items[i].match(/^[a-z]+/gm)[0]; - // Extract item attribute list as string ex.: "width=10" - var attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm); - // Convert attribute list into an object - var itemData = {}; - for (var i_1 in attributeList) { - // Split key-value pairs - var split = attributeList[i_1].split('='); - var key = split[0]; - // Remove eventual quotes from value - var strValue = split[1].replace(/"/gm, ''); - // Try to convert value into float - var floatValue = parseFloat(strValue); - // Use string value case float value is NaN - var value = isNaN(floatValue) ? strValue : floatValue; - itemData[key] = value; - } - // Push current item to the resulting data - rawData[name].push(itemData); - } - var font = new BitmapFontData(); - rawData.info.forEach(function (info) { return font.info.push({ - face: info.face, - size: parseInt(info.size, 10), - }); }); - rawData.common.forEach(function (common) { return font.common.push({ - lineHeight: parseInt(common.lineHeight, 10), - }); }); - rawData.page.forEach(function (page) { return font.page.push({ - id: parseInt(page.id, 10), - file: page.file, - }); }); - rawData.char.forEach(function (char) { return font.char.push({ - id: parseInt(char.id, 10), - page: parseInt(char.page, 10), - x: parseInt(char.x, 10), - y: parseInt(char.y, 10), - width: parseInt(char.width, 10), - height: parseInt(char.height, 10), - xoffset: parseInt(char.xoffset, 10), - yoffset: parseInt(char.yoffset, 10), - xadvance: parseInt(char.xadvance, 10), - }); }); - rawData.kerning.forEach(function (kerning) { return font.kerning.push({ - first: parseInt(kerning.first, 10), - second: parseInt(kerning.second, 10), - amount: parseInt(kerning.amount, 10), - }); }); - return font; - }; - return TextFormat; - }()); - - /** - * BitmapFont format that's XML-based. - * - * @class - * @private - */ - var XMLFormat = /** @class */ (function () { - function XMLFormat() { - } - /** - * Check if resource refers to xml font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - XMLFormat.test = function (data) { - return data instanceof XMLDocument - && data.getElementsByTagName('page').length - && data.getElementsByTagName('info')[0].getAttribute('face') !== null; - }; - /** - * Convert the XML into BitmapFontData that we can use. - * - * @static - * @private - * @param {XMLDocument} xml - * @return {BitmapFontData} Data to use for BitmapFont - */ - XMLFormat.parse = function (xml) { - var data = new BitmapFontData(); - var info = xml.getElementsByTagName('info'); - var common = xml.getElementsByTagName('common'); - var page = xml.getElementsByTagName('page'); - var char = xml.getElementsByTagName('char'); - var kerning = xml.getElementsByTagName('kerning'); - for (var i = 0; i < info.length; i++) { - data.info.push({ - face: info[i].getAttribute('face'), - size: parseInt(info[i].getAttribute('size'), 10), - }); - } - for (var i = 0; i < common.length; i++) { - data.common.push({ - lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10), - }); - } - for (var i = 0; i < page.length; i++) { - data.page.push({ - id: parseInt(page[i].getAttribute('id'), 10) || 0, - file: page[i].getAttribute('file'), - }); - } - for (var i = 0; i < char.length; i++) { - var letter = char[i]; - data.char.push({ - id: parseInt(letter.getAttribute('id'), 10), - page: parseInt(letter.getAttribute('page'), 10) || 0, - x: parseInt(letter.getAttribute('x'), 10), - y: parseInt(letter.getAttribute('y'), 10), - width: parseInt(letter.getAttribute('width'), 10), - height: parseInt(letter.getAttribute('height'), 10), - xoffset: parseInt(letter.getAttribute('xoffset'), 10), - yoffset: parseInt(letter.getAttribute('yoffset'), 10), - xadvance: parseInt(letter.getAttribute('xadvance'), 10), - }); - } - for (var i = 0; i < kerning.length; i++) { - data.kerning.push({ - first: parseInt(kerning[i].getAttribute('first'), 10), - second: parseInt(kerning[i].getAttribute('second'), 10), - amount: parseInt(kerning[i].getAttribute('amount'), 10), - }); - } - return data; - }; - return XMLFormat; - }()); - - /** - * BitmapFont format that's XML-based. - * - * @class - * @private - */ - var XMLStringFormat = /** @class */ (function () { - function XMLStringFormat() { - } - /** - * Check if resource refers to text xml font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - XMLStringFormat.test = function (data) { - if (typeof data === 'string' && data.indexOf('') > -1) { - var xml = new self.DOMParser().parseFromString(data, 'text/xml'); - return XMLFormat.test(xml); - } - return false; - }; - /** - * Convert the text XML into BitmapFontData that we can use. - * - * @static - * @private - * @param {string} xmlTxt - * @return {BitmapFontData} Data to use for BitmapFont - */ - XMLStringFormat.parse = function (xmlTxt) { - var xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml'); - return XMLFormat.parse(xml); - }; - return XMLStringFormat; - }()); - - // Registered formats, maybe make this extensible in the future? - var formats = [ - TextFormat, - XMLFormat, - XMLStringFormat ]; - /** - * Auto-detect BitmapFont parsing format based on data. - * @private - * @param {any} data - Data to detect format - * @return {any} Format or null - */ - function autoDetectFormat(data) { - for (var i = 0; i < formats.length; i++) { - if (formats[i].test(data)) { - return formats[i]; - } - } - return null; - } - - // TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle - /** - * Generates the fill style. Can automatically generate a gradient based on the fill style being an array - * - * @private - * @param {object} style - The style. - * @param {string[]} lines - The lines of text. - * @return {string|number|CanvasGradient} The fill style - */ - function generateFillStyle(canvas, context, style, resolution, lines, metrics) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var fillStyle = style.fill; - if (!Array.isArray(fillStyle)) { - return fillStyle; - } - else if (fillStyle.length === 1) { - return fillStyle[0]; - } - // the gradient will be evenly spaced out according to how large the array is. - // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 - var gradient; - // a dropshadow will enlarge the canvas and result in the gradient being - // generated with the incorrect dimensions - var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; - // should also take padding into account, padding can offset the gradient - var padding = style.padding || 0; - var width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2); - var height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2); - // make a copy of the style settings, so we can manipulate them later - var fill = fillStyle.slice(); - var fillGradientStops = style.fillGradientStops.slice(); - // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 - if (!fillGradientStops.length) { - var lengthPlus1 = fill.length + 1; - for (var i = 1; i < lengthPlus1; ++i) { - fillGradientStops.push(i / lengthPlus1); - } - } - // stop the bleeding of the last gradient on the line above to the top gradient of the this line - // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 - fill.unshift(fillStyle[0]); - fillGradientStops.unshift(0); - fill.push(fillStyle[fillStyle.length - 1]); - fillGradientStops.push(1); - if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { - // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas - gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding); - // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect - // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 - // There's potential for floating point precision issues at the seams between gradient repeats. - // The loop below generates the stops in order, so track the last generated one to prevent - // floating point precision from making us go the teeniest bit backwards, resulting in - // the first and last colors getting swapped. - var lastIterationStop = 0; - // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc - var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; - // textHeight, but as a 0-1 size in global gradient stop space - var gradStopLineHeight = textHeight / height; - for (var i = 0; i < lines.length; i++) { - var thisLineTop = metrics.lineHeight * i; - for (var j = 0; j < fill.length; j++) { - // 0-1 stop point for the current line, multiplied to global space afterwards - var lineStop = 0; - if (typeof fillGradientStops[j] === 'number') { - lineStop = fillGradientStops[j]; - } - else { - lineStop = j / fill.length; - } - var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); - // Prevent color stop generation going backwards from floating point imprecision - var clampedStop = Math.max(lastIterationStop, globalStop); - clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. - gradient.addColorStop(clampedStop, fill[j]); - lastIterationStop = clampedStop; - } - } - } - else { - // start the gradient at the center left of the canvas, and end at the center right of the canvas - gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2); - // can just evenly space out the gradients in this case, as multiple lines makes no difference - // to an even left to right gradient - var totalIterations = fill.length + 1; - var currentIteration = 1; - for (var i = 0; i < fill.length; i++) { - var stop = void 0; - if (typeof fillGradientStops[i] === 'number') { - stop = fillGradientStops[i]; - } - else { - stop = currentIteration / totalIterations; - } - gradient.addColorStop(stop, fill[i]); - currentIteration++; - } - } - return gradient; - } - - // TODO: Prevent code duplication b/w drawGlyph & Text#updateText - /** - * Draws the glyph `metrics.text` on the given canvas. - * - * Ignored because not directly exposed. - * - * @ignore - * @param {HTMLCanvasElement} canvas - * @param {CanvasRenderingContext2D} context - * @param {TextMetrics} metrics - * @param {number} x - * @param {number} y - * @param {number} resolution - * @param {TextStyle} style - */ - function drawGlyph(canvas, context, metrics, x, y, resolution, style) { - var char = metrics.text; - var fontProperties = metrics.fontProperties; - context.translate(x, y); - context.scale(resolution, resolution); - var tx = style.strokeThickness / 2; - var ty = -(style.strokeThickness / 2); - context.font = style.toFontString(); - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - // set canvas text styles - context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); - context.strokeStyle = style.stroke; - context.font = style.toFontString(); - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - // set canvas text styles - context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); - context.strokeStyle = style.stroke; - var dropShadowColor = style.dropShadowColor; - var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); - if (style.dropShadow) { - context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; - context.shadowBlur = style.dropShadowBlur; - context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; - context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance; - } - else { - context.shadowColor = 'black'; - context.shadowBlur = 0; - context.shadowOffsetX = 0; - context.shadowOffsetY = 0; - } - if (style.stroke && style.strokeThickness) { - context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent); - } - if (style.fill) { - context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent); - } - context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29) - context.fillStyle = 'rgba(0, 0, 0, 0)'; - } - - /** - * Processes the passed character set data and returns a flattened array of all the characters. - * - * Ignored because not directly exposed. - * - * @ignore - * @param {string | string[] | string[][] } chars - * @returns {string[]} - */ - function resolveCharacters(chars) { - // Split the chars string into individual characters - if (typeof chars === 'string') { - chars = [chars]; - } - // Handle an array of characters+ranges - var result = []; - for (var i = 0, j = chars.length; i < j; i++) { - var item = chars[i]; - // Handle range delimited by start/end chars - if (Array.isArray(item)) { - if (item.length !== 2) { - throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + item.length + "."); - } - var startCode = item[0].charCodeAt(0); - var endCode = item[1].charCodeAt(0); - if (endCode < startCode) { - throw new Error('[BitmapFont]: Invalid character range.'); - } - for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) { - result.push(String.fromCharCode(i_1)); - } - } - // Handle a character set string - else { - result.push.apply(result, item.split('')); - } - } - if (result.length === 0) { - throw new Error('[BitmapFont]: Empty set when resolving characters.'); - } - return result; - } - - /** - * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install` - * method for adding a font to be used. - * - * @class - * @memberof PIXI - */ - var BitmapFont = /** @class */ (function () { - /** - * @param {PIXI.BitmapFontData} data - * @param {PIXI.Texture[]|Object.} textures - */ - function BitmapFont(data, textures) { - var info = data.info[0]; - var common = data.common[0]; - var page = data.page[0]; - var res = getResolutionOfUrl(page.file); - var pageTextures = {}; - /** - * The name of the font face. - * - * @member {string} - * @readonly - */ - this.font = info.face; - /** - * The size of the font face in pixels. - * - * @member {number} - * @readonly - */ - this.size = info.size; - /** - * The line-height of the font face in pixels. - * - * @member {number} - * @readonly - */ - this.lineHeight = common.lineHeight / res; - /** - * The map of characters by character code. - * - * @member {object} - * @readonly - */ - this.chars = {}; - /** - * The map of base page textures (i.e., sheets of glyphs). - * - * @member {object} - * @readonly - * @private - */ - this.pageTextures = pageTextures; - // Convert the input Texture, Textures or object - // into a page Texture lookup by "id" - for (var i = 0; i < data.page.length; i++) { - var _a = data.page[i], id = _a.id, file = _a.file; - pageTextures[id] = textures instanceof Array - ? textures[i] : textures[file]; - } - // parse letters - for (var i = 0; i < data.char.length; i++) { - var _b = data.char[i], id = _b.id, page_1 = _b.page; - var _c = data.char[i], x = _c.x, y = _c.y, width = _c.width, height = _c.height, xoffset = _c.xoffset, yoffset = _c.yoffset, xadvance = _c.xadvance; - x /= res; - y /= res; - width /= res; - height /= res; - xoffset /= res; - yoffset /= res; - xadvance /= res; - var rect = new Rectangle(x + (pageTextures[page_1].frame.x / res), y + (pageTextures[page_1].frame.y / res), width, height); - this.chars[id] = { - xOffset: xoffset, - yOffset: yoffset, - xAdvance: xadvance, - kerning: {}, - texture: new Texture(pageTextures[page_1].baseTexture, rect), - page: page_1, - }; - } - // parse kernings - for (var i = 0; i < data.kerning.length; i++) { - var _d = data.kerning[i], first = _d.first, second = _d.second, amount = _d.amount; - first /= res; - second /= res; - amount /= res; - if (this.chars[second]) { - this.chars[second].kerning[first] = amount; - } - } - } - /** - * Remove references to created glyph textures. - */ - BitmapFont.prototype.destroy = function () { - for (var id in this.chars) { - this.chars[id].texture.destroy(); - this.chars[id].texture = null; - } - for (var id in this.pageTextures) { - this.pageTextures[id].destroy(true); - this.pageTextures[id] = null; - } - // Set readonly null. - this.chars = null; - this.pageTextures = null; - }; - /** - * Register a new bitmap font. - * - * @static - * @param {XMLDocument|string|PIXI.BitmapFontData} data - The - * characters map that could be provided as xml or raw string. - * @param {Object.|PIXI.Texture|PIXI.Texture[]} - * textures - List of textures for each page. - * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight - * and char fields. - */ - BitmapFont.install = function (data, textures) { - var fontData; - if (data instanceof BitmapFontData) { - fontData = data; - } - else { - var format = autoDetectFormat(data); - if (!format) { - throw new Error('Unrecognized data format for font.'); - } - fontData = format.parse(data); - } - // Single texture, convert to list - if (textures instanceof Texture) { - textures = [textures]; - } - var font = new BitmapFont(fontData, textures); - BitmapFont.available[font.font] = font; - return font; - }; - /** - * Remove bitmap font by name. - * - * @static - * @param {string} name - */ - BitmapFont.uninstall = function (name) { - var font = BitmapFont.available[name]; - if (!font) { - throw new Error("No font found named '" + name + "'"); - } - font.destroy(); - delete BitmapFont.available[name]; - }; - /** - * Generates a bitmap-font for the given style and character set. This does not support - * kernings yet. With `style` properties, only the following non-layout properties are used: - * - * - {@link PIXI.TextStyle#dropShadow|dropShadow} - * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance} - * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor} - * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur} - * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle} - * - {@link PIXI.TextStyle#fill|fill} - * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops} - * - {@link PIXI.TextStyle#fillGradientType|fillGradientType} - * - {@link PIXI.TextStyle#fontFamily|fontFamily} - * - {@link PIXI.TextStyle#fontSize|fontSize} - * - {@link PIXI.TextStyle#fontVariant|fontVariant} - * - {@link PIXI.TextStyle#fontWeight|fontWeight} - * - {@link PIXI.TextStyle#lineJoin|lineJoin} - * - {@link PIXI.TextStyle#miterLimit|miterLimit} - * - {@link PIXI.TextStyle#stroke|stroke} - * - {@link PIXI.TextStyle#strokeThickness|strokeThickness} - * - {@link PIXI.TextStyle#textBaseline|textBaseline} - * - * @param {string} name - The name of the custom font to use with BitmapText. - * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont. - * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font. - * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included - * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], "!@#$%^&*()~{}[] "]`. - * Don't forget to include spaces ' ' in your character set! - * @param {number} [options.resolution=1] - Render resolution for glyphs. - * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory. - * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory. - * @param {number} [options.padding=4] - Padding between glyphs on texture atlas. - * @return {PIXI.BitmapFont} Font generated by style options. - * @static - * @example - * PIXI.BitmapFont.from("TitleFont", { - * fontFamily: "Arial", - * fontSize: 12, - * strokeThickness: 2, - * fill: "purple" - * }); - * - * const title = new PIXI.BitmapText("This is the title", { fontName: "TitleFont" }); - */ - BitmapFont.from = function (name, textStyle, options) { - if (!name) { - throw new Error('[BitmapFont] Property `name` is required.'); - } - var _a = Object.assign({}, BitmapFont.defaultOptions, options), chars = _a.chars, padding = _a.padding, resolution = _a.resolution, textureWidth = _a.textureWidth, textureHeight = _a.textureHeight; - var charsList = resolveCharacters(chars); - var style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle); - var lineWidth = textureWidth; - var fontData = new BitmapFontData(); - fontData.info[0] = { - face: style.fontFamily, - size: style.fontSize, - }; - fontData.common[0] = { - lineHeight: style.fontSize, - }; - var positionX = 0; - var positionY = 0; - var canvas; - var context; - var baseTexture; - var maxCharHeight = 0; - var textures = []; - for (var i = 0; i < charsList.length; i++) { - if (!canvas) { - canvas = document.createElement('canvas'); - canvas.width = textureWidth; - canvas.height = textureHeight; - context = canvas.getContext('2d'); - baseTexture = new BaseTexture(canvas, { resolution: resolution }); - textures.push(new Texture(baseTexture)); - fontData.page.push({ - id: textures.length - 1, - file: '', - }); - } - // Measure glyph dimensions - var metrics = TextMetrics.measureText(charsList[i], style, false, canvas); - var width = metrics.width; - var height = Math.ceil(metrics.height); - // This is ugly - but italics are given more space so they don't overlap - var textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width); - // Can't fit char anymore: next canvas please! - if (positionY >= textureHeight - (height * resolution)) { - if (positionY === 0) { - // We don't want user debugging an infinite loop (or do we? :) - throw new Error("[BitmapFont] textureHeight " + textureHeight + "px is " - + ("too small for " + style.fontSize + "px fonts")); - } - --i; - // Create new atlas once current has filled up - canvas = null; - context = null; - baseTexture = null; - positionY = 0; - positionX = 0; - maxCharHeight = 0; - continue; - } - maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight); - // Wrap line once full row has been rendered - if ((textureGlyphWidth * resolution) + positionX >= lineWidth) { - --i; - positionY += maxCharHeight * resolution; - positionY = Math.ceil(positionY); - positionX = 0; - maxCharHeight = 0; - continue; - } - drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style); - // Unique (numeric) ID mapping to this glyph - var id = metrics.text.charCodeAt(0); - // Create a texture holding just the glyph - fontData.char.push({ - id: id, - page: textures.length - 1, - x: positionX / resolution, - y: positionY / resolution, - width: textureGlyphWidth, - height: height, - xoffset: 0, - yoffset: 0, - xadvance: Math.ceil(width - - (style.dropShadow ? style.dropShadowDistance : 0) - - (style.stroke ? style.strokeThickness : 0)), - }); - positionX += (textureGlyphWidth + (2 * padding)) * resolution; - positionX = Math.ceil(positionX); - } - var font = new BitmapFont(fontData, textures); - // Make it easier to replace a font - if (BitmapFont.available[name] !== undefined) { - BitmapFont.uninstall(name); - } - BitmapFont.available[name] = font; - return font; - }; - /** - * This character set includes all the letters in the alphabet (both lower- and upper- case). - * @readonly - * @static - * @member {string[][]} - * @example - * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.ALPHA }) - */ - BitmapFont.ALPHA = [['a', 'z'], ['A', 'Z'], ' ']; - /** - * This character set includes all decimal digits (from 0 to 9). - * @readonly - * @static - * @member {string[][]} - * @example - * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.NUMERIC }) - */ - BitmapFont.NUMERIC = [['0', '9']]; - /** - * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`. - * @readonly - * @static - * @member {string[][]} - */ - BitmapFont.ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' ']; - /** - * This character set consists of all the ASCII table. - * @readonly - * @static - * @member {string[][]} - * @see http://www.asciitable.com/ - */ - BitmapFont.ASCII = [[' ', '~']]; - /** - * Collection of default options when using `BitmapFont.from`. - * - * @readonly - * @static - * @member {PIXI.IBitmapFontOptions} - * @property {number} resolution=1 - * @property {number} textureWidth=512 - * @property {number} textureHeight=512 - * @property {number} padding=4 - * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC - */ - BitmapFont.defaultOptions = { - resolution: 1, - textureWidth: 512, - textureHeight: 512, - padding: 4, - chars: BitmapFont.ALPHANUMERIC, - }; - /** - * Collection of available/installed fonts. - * - * @readonly - * @static - * @member {Object.} - */ - BitmapFont.available = {}; - return BitmapFont; - }()); - /** - * @memberof PIXI - * @interface IBitmapFontOptions - * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate - * @property {number} [resolution=1] - the resolution for rendering - * @property {number} [padding=4] - the padding between glyphs in the atlas - * @property {number} [textureWidth=512] - the width of the texture atlas - * @property {number} [textureHeight=512] - the height of the texture atlas - */ - - var pageMeshDataPool = []; - var charRenderDataPool = []; - /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. - * - * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, - * meaning that rendering is fast, and changing text has no performance implications. - * - * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. - * - * To split a line you can use '\n', '\r' or '\r\n' in your string. - * - * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by: - * http://www.angelcode.com/products/bmfont/ for Windows or - * http://www.bmglyph.com/ for Mac. - * - * A BitmapText can only be created when the font is loaded. - * - * ```js - * // in this case the font is in a file called 'desyrel.fnt' - * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); - * ``` - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var BitmapText = /** @class */ (function (_super) { - __extends$b(BitmapText, _super); - /** - * @param {string} text - A string that you would like the text to display. - * @param {object} style - The style parameters. - * @param {string} style.fontName - The installed BitmapFont name. - * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined, - *. this will default to the BitmapFont size. - * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), - * does not affect single line text. - * @param {number} [style.tint=0xFFFFFF] - The tint color. - * @param {number} [style.letterSpacing=0] - The amount of spacing between letters. - * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping. - */ - function BitmapText(text, style) { - if (style === void 0) { style = {}; } - var _this = _super.call(this) || this; - _this._tint = 0xFFFFFF; - if (style.font) { - deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.'); - _this._upgradeStyle(style); - } - // Apply the defaults - var _a = Object.assign({}, BitmapText.styleDefaults, style), align = _a.align, tint = _a.tint, maxWidth = _a.maxWidth, letterSpacing = _a.letterSpacing, fontName = _a.fontName, fontSize = _a.fontSize; - if (!BitmapFont.available[fontName]) { - throw new Error("Missing BitmapFont \"" + fontName + "\""); - } - /** - * Collection of page mesh data. - * - * @member {object} - * @private - */ - _this._activePagesMeshData = []; - /** - * Private tracker for the width of the overall text - * - * @member {number} - * @private - */ - _this._textWidth = 0; - /** - * Private tracker for the height of the overall text - * - * @member {number} - * @private - */ - _this._textHeight = 0; - /** - * Private tracker for the current text align. - * - * @member {string} - * @private - */ - _this._align = align; - /** - * Private tracker for the current tint. - * - * @member {number} - * @private - */ - _this._tint = tint; - /** - * Private tracker for the current font name. - * - * @member {string} - * @private - */ - _this._fontName = fontName; - /** - * Private tracker for the current font size. - * - * @member {number} - * @private - */ - _this._fontSize = fontSize || BitmapFont.available[fontName].size; - /** - * Private tracker for the current text. - * - * @member {string} - * @private - */ - _this._text = text; - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the - * value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting value to 0 - * - * @member {number} - * @private - */ - _this._maxWidth = maxWidth; - /** - * The max line height. This is useful when trying to use the total height of the Text, - * ie: when trying to vertically align. (Internally used) - * - * @member {number} - * @private - */ - _this._maxLineHeight = 0; - /** - * Letter spacing. This is useful for setting the space between characters. - * @member {number} - * @private - */ - _this._letterSpacing = letterSpacing; - /** - * Text anchor. read-only - * - * @member {PIXI.ObservablePoint} - * @private - */ - _this._anchor = new ObservablePoint(function () { _this.dirty = true; }, _this, 0, 0); - /** - * If true PixiJS will Math.floor() x/y values when rendering - * - * @member {boolean} - * @default PIXI.settings.ROUND_PIXELS - */ - _this._roundPixels = settings.ROUND_PIXELS; - /** - * Set to `true` if the BitmapText needs to be redrawn. - * - * @member {boolean} - */ - _this.dirty = true; - /** - * Cached char texture is destroyed when BitmapText is destroyed - * @member {Record} - * @private - */ - _this._textureCache = {}; - return _this; - } - /** - * Renders text and updates it when needed. This should only be called - * if the BitmapFont is regenerated. - */ - BitmapText.prototype.updateText = function () { - var _a; - var data = BitmapFont.available[this._fontName]; - var scale = this._fontSize / data.size; - var pos = new Point(); - var chars = []; - var lineWidths = []; - var text = this._text.replace(/(?:\r\n|\r)/g, '\n') || ' '; - var textLength = text.length; - var maxWidth = this._maxWidth * data.size / this._fontSize; - var prevCharCode = null; - var lastLineWidth = 0; - var maxLineWidth = 0; - var line = 0; - var lastBreakPos = -1; - var lastBreakWidth = 0; - var spacesRemoved = 0; - var maxLineHeight = 0; - for (var i = 0; i < textLength; i++) { - var charCode = text.charCodeAt(i); - var char = text.charAt(i); - if ((/(?:\s)/).test(char)) { - lastBreakPos = i; - lastBreakWidth = lastLineWidth; - } - if (char === '\r' || char === '\n') { - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - ++line; - ++spacesRemoved; - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - continue; - } - var charData = data.chars[charCode]; - if (!charData) { - continue; - } - if (prevCharCode && charData.kerning[prevCharCode]) { - pos.x += charData.kerning[prevCharCode]; - } - var charRenderData = charRenderDataPool.pop() || { - texture: Texture.EMPTY, - line: 0, - charCode: 0, - position: new Point(), - }; - charRenderData.texture = charData.texture; - charRenderData.line = line; - charRenderData.charCode = charCode; - charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2); - charRenderData.position.y = pos.y + charData.yOffset; - chars.push(charRenderData); - pos.x += charData.xAdvance + this._letterSpacing; - lastLineWidth = pos.x; - maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height)); - prevCharCode = charCode; - if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) { - ++spacesRemoved; - removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos); - i = lastBreakPos; - lastBreakPos = -1; - lineWidths.push(lastBreakWidth); - maxLineWidth = Math.max(maxLineWidth, lastBreakWidth); - line++; - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - } - } - var lastChar = text.charAt(text.length - 1); - if (lastChar !== '\r' && lastChar !== '\n') { - if ((/(?:\s)/).test(lastChar)) { - lastLineWidth = lastBreakWidth; - } - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - } - var lineAlignOffsets = []; - for (var i = 0; i <= line; i++) { - var alignOffset = 0; - if (this._align === 'right') { - alignOffset = maxLineWidth - lineWidths[i]; - } - else if (this._align === 'center') { - alignOffset = (maxLineWidth - lineWidths[i]) / 2; - } - lineAlignOffsets.push(alignOffset); - } - var lenChars = chars.length; - var pagesMeshData = {}; - var newPagesMeshData = []; - var activePagesMeshData = this._activePagesMeshData; - for (var i = 0; i < activePagesMeshData.length; i++) { - pageMeshDataPool.push(activePagesMeshData[i]); - } - for (var i = 0; i < lenChars; i++) { - var texture = chars[i].texture; - var baseTextureUid = texture.baseTexture.uid; - if (!pagesMeshData[baseTextureUid]) { - var pageMeshData = pageMeshDataPool.pop(); - if (!pageMeshData) { - var geometry = new MeshGeometry(); - var material = new MeshMaterial(Texture.EMPTY); - var mesh = new Mesh(geometry, material); - pageMeshData = { - index: 0, - indexCount: 0, - vertexCount: 0, - uvsCount: 0, - total: 0, - mesh: mesh, - vertices: null, - uvs: null, - indices: null, - }; - } - // reset data.. - pageMeshData.index = 0; - pageMeshData.indexCount = 0; - pageMeshData.vertexCount = 0; - pageMeshData.uvsCount = 0; - pageMeshData.total = 0; - // TODO need to get page texture here somehow.. - var _textureCache = this._textureCache; - _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture); - pageMeshData.mesh.texture = _textureCache[baseTextureUid]; - pageMeshData.mesh.tint = this._tint; - newPagesMeshData.push(pageMeshData); - pagesMeshData[baseTextureUid] = pageMeshData; - } - pagesMeshData[baseTextureUid].total++; - } - // lets find any previously active pageMeshDatas that are no longer required for - // the updated text (if any), removed and return them to the pool. - for (var i = 0; i < activePagesMeshData.length; i++) { - if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) { - this.removeChild(activePagesMeshData[i].mesh); - } - } - // next lets add any new meshes, that have not yet been added to this BitmapText - // we only add if its not already a child of this BitmapObject - for (var i = 0; i < newPagesMeshData.length; i++) { - if (newPagesMeshData[i].mesh.parent !== this) { - this.addChild(newPagesMeshData[i].mesh); - } - } - // active page mesh datas are set to be the new pages added. - this._activePagesMeshData = newPagesMeshData; - for (var i in pagesMeshData) { - var pageMeshData = pagesMeshData[i]; - var total = pageMeshData.total; - // lets only allocate new buffers if we can fit the new text in the current ones.. - // unless that is, we will be batching. Currently batching dose not respect the size property of mesh - if (!(((_a = pageMeshData.indices) === null || _a === void 0 ? void 0 : _a.length) > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2) { - pageMeshData.vertices = new Float32Array(4 * 2 * total); - pageMeshData.uvs = new Float32Array(4 * 2 * total); - pageMeshData.indices = new Uint16Array(6 * total); - } - else { - var total_1 = pageMeshData.total; - var vertices = pageMeshData.vertices; - // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation. - for (var i_1 = total_1 * 4 * 2; i_1 < vertices.length; i_1++) { - vertices[i_1] = 0; - } - } - // as a buffer maybe bigger than the current word, we set the size of the meshMaterial - // to match the number of letters needed - pageMeshData.mesh.size = 6 * total; - } - for (var i = 0; i < lenChars; i++) { - var char = chars[i]; - var offset = char.position.x + lineAlignOffsets[char.line]; - if (this._roundPixels) { - offset = Math.round(offset); - } - var xPos = offset * scale; - var yPos = char.position.y * scale; - var texture = char.texture; - var pageMesh = pagesMeshData[texture.baseTexture.uid]; - var textureFrame = texture.frame; - var textureUvs = texture._uvs; - var index = pageMesh.index++; - pageMesh.indices[(index * 6) + 0] = 0 + (index * 4); - pageMesh.indices[(index * 6) + 1] = 1 + (index * 4); - pageMesh.indices[(index * 6) + 2] = 2 + (index * 4); - pageMesh.indices[(index * 6) + 3] = 0 + (index * 4); - pageMesh.indices[(index * 6) + 4] = 2 + (index * 4); - pageMesh.indices[(index * 6) + 5] = 3 + (index * 4); - pageMesh.vertices[(index * 8) + 0] = xPos; - pageMesh.vertices[(index * 8) + 1] = yPos; - pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale); - pageMesh.vertices[(index * 8) + 3] = yPos; - pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale); - pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale); - pageMesh.vertices[(index * 8) + 6] = xPos; - pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale); - pageMesh.uvs[(index * 8) + 0] = textureUvs.x0; - pageMesh.uvs[(index * 8) + 1] = textureUvs.y0; - pageMesh.uvs[(index * 8) + 2] = textureUvs.x1; - pageMesh.uvs[(index * 8) + 3] = textureUvs.y1; - pageMesh.uvs[(index * 8) + 4] = textureUvs.x2; - pageMesh.uvs[(index * 8) + 5] = textureUvs.y2; - pageMesh.uvs[(index * 8) + 6] = textureUvs.x3; - pageMesh.uvs[(index * 8) + 7] = textureUvs.y3; - } - this._textWidth = maxLineWidth * scale; - this._textHeight = (pos.y + data.lineHeight) * scale; - for (var i in pagesMeshData) { - var pageMeshData = pagesMeshData[i]; - // apply anchor - if (this.anchor.x !== 0 || this.anchor.y !== 0) { - var vertexCount = 0; - var anchorOffsetX = this._textWidth * this.anchor.x; - var anchorOffsetY = this._textHeight * this.anchor.y; - for (var i_2 = 0; i_2 < pageMeshData.total; i_2++) { - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - } - } - this._maxLineHeight = maxLineHeight * scale; - var vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition'); - var textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord'); - var indexBuffer = pageMeshData.mesh.geometry.getIndex(); - vertexBuffer.data = pageMeshData.vertices; - textureBuffer.data = pageMeshData.uvs; - indexBuffer.data = pageMeshData.indices; - vertexBuffer.update(); - textureBuffer.update(); - indexBuffer.update(); - } - for (var i = 0; i < chars.length; i++) { - charRenderDataPool.push(chars[i]); - } - }; - /** - * Updates the transform of this object - * - * @private - */ - BitmapText.prototype.updateTransform = function () { - this.validate(); - this.containerUpdateTransform(); - }; - /** - * Validates text before calling parent's getLocalBounds - * - * @return {PIXI.Rectangle} The rectangular bounding area - */ - BitmapText.prototype.getLocalBounds = function () { - this.validate(); - return _super.prototype.getLocalBounds.call(this); - }; - /** - * Updates text when needed - * - * @private - */ - BitmapText.prototype.validate = function () { - if (this.dirty) { - this.updateText(); - this.dirty = false; - } - }; - Object.defineProperty(BitmapText.prototype, "tint", { - /** - * The tint of the BitmapText object. - * - * @member {number} - * @default 0xffffff - */ - get: function () { - return this._tint; - }, - set: function (value) { - if (this._tint === value) - { return; } - this._tint = value; - for (var i = 0; i < this._activePagesMeshData.length; i++) { - this._activePagesMeshData[i].mesh.tint = value; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "align", { - /** - * The alignment of the BitmapText object. - * - * @member {string} - * @default 'left' - */ - get: function () { - return this._align; - }, - set: function (value) { - if (this._align !== value) { - this._align = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "fontName", { - /** - * The name of the BitmapFont. - * - * @member {string} - */ - get: function () { - return this._fontName; - }, - set: function (value) { - if (!BitmapFont.available[value]) { - throw new Error("Missing BitmapFont \"" + value + "\""); - } - if (this._fontName !== value) { - this._fontName = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "fontSize", { - /** - * The size of the font to display. - * - * @member {number} - */ - get: function () { - return this._fontSize; - }, - set: function (value) { - if (this._fontSize !== value) { - this._fontSize = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "anchor", { - /** - * The anchor sets the origin point of the text. - * - * The default is `(0,0)`, this means the text's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. - * - * @member {PIXI.Point | number} - */ - get: function () { - return this._anchor; - }, - set: function (value) { - if (typeof value === 'number') { - this._anchor.set(value); - } - else { - this._anchor.copyFrom(value); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "text", { - /** - * The text of the BitmapText object. - * - * @member {string} - */ - get: function () { - return this._text; - }, - set: function (text) { - text = String(text === null || text === undefined ? '' : text); - if (this._text === text) { - return; - } - this._text = text; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "maxWidth", { - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the - * value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting the value to 0. - * - * @member {number} - */ - get: function () { - return this._maxWidth; - }, - set: function (value) { - if (this._maxWidth === value) { - return; - } - this._maxWidth = value; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "maxLineHeight", { - /** - * The max line height. This is useful when trying to use the total height of the Text, - * i.e. when trying to vertically align. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._maxLineHeight; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "textWidth", { - /** - * The width of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._textWidth; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "letterSpacing", { - /** - * Additional space between characters. - * - * @member {number} - */ - get: function () { - return this._letterSpacing; - }, - set: function (value) { - if (this._letterSpacing !== value) { - this._letterSpacing = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "roundPixels", { - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default PIXI.settings.ROUND_PIXELS - */ - get: function () { - return this._roundPixels; - }, - set: function (value) { - if (value !== this._roundPixels) { - this._roundPixels = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "textHeight", { - /** - * The height of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._textHeight; - }, - enumerable: false, - configurable: true - }); - /** - * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties. - * - * @private - * @deprecated since 5.3.0 - */ - BitmapText.prototype._upgradeStyle = function (style) { - if (typeof style.font === 'string') { - var valueSplit = style.font.split(' '); - style.fontName = valueSplit.length === 1 - ? valueSplit[0] - : valueSplit.slice(1).join(' '); - if (valueSplit.length >= 2) { - style.fontSize = parseInt(valueSplit[0], 10); - } - } - else { - style.fontName = style.font.name; - style.fontSize = typeof style.font.size === 'number' - ? style.font.size - : parseInt(style.font.size, 10); - } - }; - BitmapText.prototype.destroy = function (options) { - var _textureCache = this._textureCache; - for (var id in _textureCache) { - var texture = _textureCache[id]; - texture.destroy(); - delete _textureCache[id]; - } - this._textureCache = null; - _super.prototype.destroy.call(this, options); - }; - /** - * Register a bitmap font with data and a texture. - * - * @deprecated since 5.3.0 - * @see PIXI.BitmapFont.install - * @static - */ - BitmapText.registerFont = function (data, textures) { - deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install'); - return BitmapFont.install(data, textures); - }; - Object.defineProperty(BitmapText, "fonts", { - /** - * Get the list of installed fonts. - * - * @see PIXI.BitmapFont.available - * @deprecated since 5.3.0 - * @static - * @readonly - * @member {Object.} - */ - get: function () { - deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available'); - return BitmapFont.available; - }, - enumerable: false, - configurable: true - }); - BitmapText.styleDefaults = { - align: 'left', - tint: 0xFFFFFF, - maxWidth: 0, - letterSpacing: 0, - }; - return BitmapText; - }(Container)); - - /** - * {@link PIXI.Loader Loader} middleware for loading - * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var BitmapFontLoader = /** @class */ (function () { - function BitmapFontLoader() { - } - /** - * Called when the plugin is installed. - * - * @see PIXI.Loader.registerPlugin - */ - BitmapFontLoader.add = function () { - LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT); - }; - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - BitmapFontLoader.use = function (resource, next) { - var format = autoDetectFormat(resource.data); - // Resource was not recognised as any of the expected font data format - if (!format) { - next(); - return; - } - var baseUrl = BitmapFontLoader.getBaseUrl(this, resource); - var data = format.parse(resource.data); - var textures = {}; - // Handle completed, when the number of textures - // load is the same number as references in the fnt file - var completed = function (page) { - textures[page.metadata.pageFile] = page.texture; - if (Object.keys(textures).length === data.page.length) { - resource.bitmapFont = BitmapFont.install(data, textures); - next(); - } - }; - for (var i = 0; i < data.page.length; ++i) { - var pageFile = data.page[i].file; - var url = baseUrl + pageFile; - var exists = false; - // incase the image is loaded outside - // using the same loader, resource will be available - for (var name in this.resources) { - var bitmapResource = this.resources[name]; - if (bitmapResource.url === url) { - bitmapResource.metadata.pageFile = pageFile; - if (bitmapResource.texture) { - completed(bitmapResource); - } - else { - bitmapResource.onAfterMiddleware.add(completed); - } - exists = true; - break; - } - } - // texture is not loaded, we'll attempt to add - // it to the load and add the texture to the list - if (!exists) { - // Standard loading options for images - var options = { - crossOrigin: resource.crossOrigin, - loadType: LoaderResource.LOAD_TYPE.IMAGE, - metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata), - parentResource: resource, - }; - this.add(url, options, completed); - } - } - }; - /** - * Get folder path from a resource - * @private - * @param {PIXI.Loader} loader - * @param {PIXI.LoaderResource} resource - * @return {string} - */ - BitmapFontLoader.getBaseUrl = function (loader, resource) { - var resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : ''; - if (resource.isDataUrl) { - if (resUrl === '.') { - resUrl = ''; - } - if (loader.baseUrl && resUrl) { - // if baseurl has a trailing slash then add one to resUrl so the replace works below - if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/') { - resUrl += '/'; - } - } - } - // remove baseUrl from resUrl - resUrl = resUrl.replace(loader.baseUrl, ''); - // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. - if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/') { - resUrl += '/'; - } - return resUrl; - }; - /** - * Replacement for NodeJS's path.dirname - * @private - * @param {string} url - Path to get directory for - */ - BitmapFontLoader.dirname = function (url) { - var dir = url - .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character - .replace(/\/$/, '') // replace trailing slash - .replace(/\/[^\/]*$/, ''); // remove everything after the last - // File request is relative, use current directory - if (dir === url) { - return '.'; - } - // Started with a slash - else if (dir === '') { - return '/'; - } - return dir; - }; - return BitmapFontLoader; - }()); - - /*! - * @pixi/filter-alpha - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-alpha is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$c = function(d, b) { - extendStatics$c = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$c(d, b); - }; - - function __extends$c(d, b) { - extendStatics$c(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$4 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n"; - - /** - * Simplest filter - applies alpha. - * - * Use this instead of Container's alpha property to avoid visual layering of individual elements. - * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. - * If elements are not opaque, they will blend with each other anyway. - * - * Very handy if you want to use common features of all filters: - * - * 1. Assign a blendMode to this filter, blend all elements inside display object with background. - * - * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var AlphaFilter = /** @class */ (function (_super) { - __extends$c(AlphaFilter, _super); - /** - * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent - */ - function AlphaFilter(alpha) { - if (alpha === void 0) { alpha = 1.0; } - var _this = _super.call(this, _default, fragment$4, { uAlpha: 1 }) || this; - _this.alpha = alpha; - return _this; - } - Object.defineProperty(AlphaFilter.prototype, "alpha", { - /** - * Coefficient for alpha multiplication - * - * @member {number} - * @default 1 - */ - get: function () { - return this.uniforms.uAlpha; - }, - set: function (value) { - this.uniforms.uAlpha = value; - }, - enumerable: false, - configurable: true - }); - return AlphaFilter; - }(Filter)); - - /*! - * @pixi/filter-blur - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$d = function(d, b) { - extendStatics$d = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$d(d, b); - }; - - function __extends$d(d, b) { - extendStatics$d(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var vertTemplate = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }"; - function generateBlurVertSource(kernelSize, x) { - var halfLength = Math.ceil(kernelSize / 2); - var vertSource = vertTemplate; - var blurLoop = ''; - var template; - if (x) { - template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);'; - } - else { - template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);'; - } - for (var i = 0; i < kernelSize; i++) { - var blur = template.replace('%index%', i.toString()); - blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + ".0"); - blurLoop += blur; - blurLoop += '\n'; - } - vertSource = vertSource.replace('%blur%', blurLoop); - vertSource = vertSource.replace('%size%', kernelSize.toString()); - return vertSource; - } - - var GAUSSIAN_VALUES = { - 5: [0.153388, 0.221461, 0.250301], - 7: [0.071303, 0.131514, 0.189879, 0.214607], - 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236], - 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596], - 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641], - 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448], - }; - var fragTemplate$1 = [ - 'varying vec2 vBlurTexCoords[%size%];', - 'uniform sampler2D uSampler;', - 'void main(void)', - '{', - ' gl_FragColor = vec4(0.0);', - ' %blur%', - '}' ].join('\n'); - function generateBlurFragSource(kernelSize) { - var kernel = GAUSSIAN_VALUES[kernelSize]; - var halfLength = kernel.length; - var fragSource = fragTemplate$1; - var blurLoop = ''; - var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;'; - var value; - for (var i = 0; i < kernelSize; i++) { - var blur = template.replace('%index%', i.toString()); - value = i; - if (i >= halfLength) { - value = kernelSize - i - 1; - } - blur = blur.replace('%value%', kernel[value].toString()); - blurLoop += blur; - blurLoop += '\n'; - } - fragSource = fragSource.replace('%blur%', blurLoop); - fragSource = fragSource.replace('%size%', kernelSize.toString()); - return fragSource; - } - - /** - * Different types of environments for WebGL. - * - * @static - * @memberof PIXI - * @name ENV - * @enum {number} - * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experience unexplained flickering prefer this environment. - * @property {number} WEBGL - Version 1 of WebGL - * @property {number} WEBGL2 - Version 2 of WebGL - */ - var ENV; - (function (ENV) { - ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; - ENV[ENV["WEBGL"] = 1] = "WEBGL"; - ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; - })(ENV || (ENV = {})); - /** - * Constant to identify the Renderer Type. - * - * @static - * @memberof PIXI - * @name RENDERER_TYPE - * @enum {number} - * @property {number} UNKNOWN - Unknown render type. - * @property {number} WEBGL - WebGL render type. - * @property {number} CANVAS - Canvas render type. - */ - var RENDERER_TYPE; - (function (RENDERER_TYPE) { - RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; - RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; - RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; - })(RENDERER_TYPE || (RENDERER_TYPE = {})); - /** - * Bitwise OR of masks that indicate the buffers to be cleared. - * - * @static - * @memberof PIXI - * @name BUFFER_BITS - * @enum {number} - * @property {number} COLOR - Indicates the buffers currently enabled for color writing. - * @property {number} DEPTH - Indicates the depth buffer. - * @property {number} STENCIL - Indicates the stencil buffer. - */ - var BUFFER_BITS; - (function (BUFFER_BITS) { - BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; - BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; - BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; - })(BUFFER_BITS || (BUFFER_BITS = {})); - /** - * Various blend modes supported by PIXI. - * - * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. - * Anything else will silently act like NORMAL. - * - * @memberof PIXI - * @name BLEND_MODES - * @enum {number} - * @property {number} NORMAL - * @property {number} ADD - * @property {number} MULTIPLY - * @property {number} SCREEN - * @property {number} OVERLAY - * @property {number} DARKEN - * @property {number} LIGHTEN - * @property {number} COLOR_DODGE - * @property {number} COLOR_BURN - * @property {number} HARD_LIGHT - * @property {number} SOFT_LIGHT - * @property {number} DIFFERENCE - * @property {number} EXCLUSION - * @property {number} HUE - * @property {number} SATURATION - * @property {number} COLOR - * @property {number} LUMINOSITY - * @property {number} NORMAL_NPM - * @property {number} ADD_NPM - * @property {number} SCREEN_NPM - * @property {number} NONE - * @property {number} SRC_IN - * @property {number} SRC_OUT - * @property {number} SRC_ATOP - * @property {number} DST_OVER - * @property {number} DST_IN - * @property {number} DST_OUT - * @property {number} DST_ATOP - * @property {number} SUBTRACT - * @property {number} SRC_OVER - * @property {number} ERASE - * @property {number} XOR - */ - var BLEND_MODES; - (function (BLEND_MODES) { - BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; - BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; - BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; - BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; - BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; - BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; - BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; - BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; - BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; - BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; - BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; - BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; - BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; - BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; - BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; - BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; - BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; - BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; - BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; - BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; - BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; - BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; - BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; - BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; - BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; - BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; - BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; - BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; - BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; - BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; - BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; - BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; - })(BLEND_MODES || (BLEND_MODES = {})); - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @memberof PIXI - * @static - * @name DRAW_MODES - * @enum {number} - * @property {number} POINTS - * @property {number} LINES - * @property {number} LINE_LOOP - * @property {number} LINE_STRIP - * @property {number} TRIANGLES - * @property {number} TRIANGLE_STRIP - * @property {number} TRIANGLE_FAN - */ - var DRAW_MODES; - (function (DRAW_MODES) { - DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; - DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; - DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; - DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; - DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; - })(DRAW_MODES || (DRAW_MODES = {})); - /** - * Various GL texture/resources formats. - * - * @memberof PIXI - * @static - * @name FORMATS - * @enum {number} - * @property {number} RGBA=6408 - * @property {number} RGB=6407 - * @property {number} ALPHA=6406 - * @property {number} LUMINANCE=6409 - * @property {number} LUMINANCE_ALPHA=6410 - * @property {number} DEPTH_COMPONENT=6402 - * @property {number} DEPTH_STENCIL=34041 - */ - var FORMATS; - (function (FORMATS) { - FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; - FORMATS[FORMATS["RGB"] = 6407] = "RGB"; - FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; - FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; - FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; - FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; - FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; - })(FORMATS || (FORMATS = {})); - /** - * Various GL target types. - * - * @memberof PIXI - * @static - * @name TARGETS - * @enum {number} - * @property {number} TEXTURE_2D=3553 - * @property {number} TEXTURE_CUBE_MAP=34067 - * @property {number} TEXTURE_2D_ARRAY=35866 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 - */ - var TARGETS; - (function (TARGETS) { - TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; - TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; - })(TARGETS || (TARGETS = {})); - /** - * Various GL data format types. - * - * @memberof PIXI - * @static - * @name TYPES - * @enum {number} - * @property {number} UNSIGNED_BYTE=5121 - * @property {number} UNSIGNED_SHORT=5123 - * @property {number} UNSIGNED_SHORT_5_6_5=33635 - * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 - * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 - * @property {number} FLOAT=5126 - * @property {number} HALF_FLOAT=36193 - */ - var TYPES; - (function (TYPES) { - TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; - TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; - TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; - TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; - TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; - TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; - TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; - })(TYPES || (TYPES = {})); - /** - * The scale modes that are supported by pixi. - * - * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @memberof PIXI - * @static - * @name SCALE_MODES - * @enum {number} - * @property {number} LINEAR Smooth scaling - * @property {number} NEAREST Pixelating scaling - */ - var SCALE_MODES; - (function (SCALE_MODES) { - SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; - SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; - })(SCALE_MODES || (SCALE_MODES = {})); - /** - * The wrap modes that are supported by pixi. - * - * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as WebGL can - * only use REPEAT if the texture is po2. - * - * This property only affects WebGL. - * - * @name WRAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} CLAMP - The textures uvs are clamped - * @property {number} REPEAT - The texture uvs tile and repeat - * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring - */ - var WRAP_MODES; - (function (WRAP_MODES) { - WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; - WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; - WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; - })(WRAP_MODES || (WRAP_MODES = {})); - /** - * Mipmap filtering modes that are supported by pixi. - * - * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. - * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, - * or its `POW2` and texture dimensions are powers of 2. - * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. - * - * This property only affects WebGL. - * - * @name MIPMAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} OFF - No mipmaps - * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 - * @property {number} ON - Always generate mipmaps - */ - var MIPMAP_MODES; - (function (MIPMAP_MODES) { - MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; - MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; - MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; - })(MIPMAP_MODES || (MIPMAP_MODES = {})); - /** - * How to treat textures with premultiplied alpha - * - * @name ALPHA_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. - * Option for compressed and data textures that are created from typed arrays. - * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. - * Default option, used for all loaded images. - * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied - * Example: spine atlases with `_pma` suffix. - * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. - * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. - * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. - */ - var ALPHA_MODES; - (function (ALPHA_MODES) { - ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; - ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; - ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; - ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; - })(ALPHA_MODES || (ALPHA_MODES = {})); - /** - * How to clear renderTextures in filter - * - * @name CLEAR_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} BLEND - Preserve the information in the texture, blend above - * @property {number} CLEAR - Must use `gl.clear` operation - * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia - * @property {number} NO - Alias for BLEND, same as `false` in earlier versions - * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions - * @property {number} AUTO - Alias for BLIT - */ - var CLEAR_MODES; - (function (CLEAR_MODES) { - CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; - CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; - CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; - CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; - CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; - CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; - })(CLEAR_MODES || (CLEAR_MODES = {})); - /** - * The gc modes that are supported by pixi. - * - * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO - * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not - * used for a specified period of time they will be removed from the GPU. They will of course - * be uploaded again when they are required. This is a silent behind the scenes process that - * should ensure that the GPU does not get filled up. - * - * Handy for mobile devices! - * This property only affects WebGL. - * - * @name GC_MODES - * @enum {number} - * @static - * @memberof PIXI - * @property {number} AUTO - Garbage collection will happen periodically automatically - * @property {number} MANUAL - Garbage collection will need to be called manually - */ - var GC_MODES; - (function (GC_MODES) { - GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; - GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; - })(GC_MODES || (GC_MODES = {})); - /** - * Constants that specify float precision in shaders. - * - * @name PRECISION - * @memberof PIXI - * @constant - * @static - * @enum {string} - * @property {string} LOW='lowp' - * @property {string} MEDIUM='mediump' - * @property {string} HIGH='highp' - */ - var PRECISION; - (function (PRECISION) { - PRECISION["LOW"] = "lowp"; - PRECISION["MEDIUM"] = "mediump"; - PRECISION["HIGH"] = "highp"; - })(PRECISION || (PRECISION = {})); - /** - * Constants for mask implementations. - * We use `type` suffix because it leads to very different behaviours - * - * @name MASK_TYPES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - Mask is ignored - * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap - * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil - * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture - */ - var MASK_TYPES; - (function (MASK_TYPES) { - MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; - MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; - MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; - MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; - })(MASK_TYPES || (MASK_TYPES = {})); - /** - * Constants for multi-sampling antialiasing. - * - * @see PIXI.Framebuffer#multisample - * - * @name MSAA_QUALITY - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - No multisampling for this renderTexture - * @property {number} LOW - Try 2 samples - * @property {number} MEDIUM - Try 4 samples - * @property {number} HIGH - Try 8 samples - */ - var MSAA_QUALITY; - (function (MSAA_QUALITY) { - MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; - MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; - MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; - MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; - })(MSAA_QUALITY || (MSAA_QUALITY = {})); - - /** - * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var BlurFilterPass = /** @class */ (function (_super) { - __extends$d(BlurFilterPass, _super); - /** - * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`). - * @param {number} [strength=8] - The strength of the blur filter. - * @param {number} [quality=4] - The quality of the blur filter. - * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. - * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. - */ - function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) { - if (strength === void 0) { strength = 8; } - if (quality === void 0) { quality = 4; } - if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } - if (kernelSize === void 0) { kernelSize = 5; } - var _this = this; - var vertSrc = generateBlurVertSource(kernelSize, horizontal); - var fragSrc = generateBlurFragSource(kernelSize); - _this = _super.call(this, - // vertex shader - vertSrc, - // fragment shader - fragSrc) || this; - _this.horizontal = horizontal; - _this.resolution = resolution; - _this._quality = 0; - _this.quality = quality; - _this.blur = strength; - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - How to clear - */ - BlurFilterPass.prototype.apply = function (filterManager, input, output, clearMode) { - if (output) { - if (this.horizontal) { - this.uniforms.strength = (1 / output.width) * (output.width / input.width); - } - else { - this.uniforms.strength = (1 / output.height) * (output.height / input.height); - } - } - else { - if (this.horizontal) // eslint-disable-line - { - this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width); - } - else { - this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line - } - } - // screen space! - this.uniforms.strength *= this.strength; - this.uniforms.strength /= this.passes; - if (this.passes === 1) { - filterManager.applyFilter(this, input, output, clearMode); - } - else { - var renderTarget = filterManager.getFilterTexture(); - var renderer = filterManager.renderer; - var flip = input; - var flop = renderTarget; - this.state.blend = false; - filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR); - for (var i = 1; i < this.passes - 1; i++) { - filterManager.bindAndClear(flip, CLEAR_MODES.BLIT); - this.uniforms.uSampler = flop; - var temp = flop; - flop = flip; - flip = temp; - renderer.shader.bind(this); - renderer.geometry.draw(5); - } - this.state.blend = true; - filterManager.applyFilter(this, flop, output, clearMode); - filterManager.returnFilterTexture(renderTarget); - } - }; - Object.defineProperty(BlurFilterPass.prototype, "blur", { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @default 16 - */ - get: function () { - return this.strength; - }, - set: function (value) { - this.padding = 1 + (Math.abs(value) * 2); - this.strength = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilterPass.prototype, "quality", { - /** - * Sets the quality of the blur by modifying the number of passes. More passes means higher - * quaility bluring but the lower the performance. - * - * @member {number} - * @default 4 - */ - get: function () { - return this._quality; - }, - set: function (value) { - this._quality = value; - this.passes = value; - }, - enumerable: false, - configurable: true - }); - return BlurFilterPass; - }(Filter)); - - /** - * The BlurFilter applies a Gaussian blur to an object. - * - * The strength of the blur can be set for the x-axis and y-axis separately. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var BlurFilter = /** @class */ (function (_super) { - __extends$d(BlurFilter, _super); - /** - * @param {number} [strength=8] - The strength of the blur filter. - * @param {number} [quality=4] - The quality of the blur filter. - * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. - * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. - */ - function BlurFilter(strength, quality, resolution, kernelSize) { - if (strength === void 0) { strength = 8; } - if (quality === void 0) { quality = 4; } - if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } - if (kernelSize === void 0) { kernelSize = 5; } - var _this = _super.call(this) || this; - _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize); - _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize); - _this.resolution = resolution; - _this.quality = quality; - _this.blur = strength; - _this.repeatEdgePixels = false; - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - How to clear - */ - BlurFilter.prototype.apply = function (filterManager, input, output, clearMode) { - var xStrength = Math.abs(this.blurXFilter.strength); - var yStrength = Math.abs(this.blurYFilter.strength); - if (xStrength && yStrength) { - var renderTarget = filterManager.getFilterTexture(); - this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR); - this.blurYFilter.apply(filterManager, renderTarget, output, clearMode); - filterManager.returnFilterTexture(renderTarget); - } - else if (yStrength) { - this.blurYFilter.apply(filterManager, input, output, clearMode); - } - else { - this.blurXFilter.apply(filterManager, input, output, clearMode); - } - }; - BlurFilter.prototype.updatePadding = function () { - if (this._repeatEdgePixels) { - this.padding = 0; - } - else { - this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; - } - }; - Object.defineProperty(BlurFilter.prototype, "blur", { - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurXFilter.blur; - }, - set: function (value) { - this.blurXFilter.blur = this.blurYFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "quality", { - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @default 1 - */ - get: function () { - return this.blurXFilter.quality; - }, - set: function (value) { - this.blurXFilter.quality = this.blurYFilter.quality = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blurX", { - /** - * Sets the strength of the blurX property - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurXFilter.blur; - }, - set: function (value) { - this.blurXFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blurY", { - /** - * Sets the strength of the blurY property - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurYFilter.blur; - }, - set: function (value) { - this.blurYFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blendMode", { - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - get: function () { - return this.blurYFilter.blendMode; - }, - set: function (value) { - this.blurYFilter.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "repeatEdgePixels", { - /** - * If set to true the edge of the target will be clamped - * - * @member {boolean} - * @default false - */ - get: function () { - return this._repeatEdgePixels; - }, - set: function (value) { - this._repeatEdgePixels = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - return BlurFilter; - }(Filter)); - - /*! - * @pixi/filter-color-matrix - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-color-matrix is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$e = function(d, b) { - extendStatics$e = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$e(d, b); - }; - - function __extends$e(d, b) { - extendStatics$e(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$5 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n"; - - /** - * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA - * color and alpha values of every pixel on your displayObject to produce a result - * with a new set of RGBA color and alpha values. It's pretty powerful! - * - * ```js - * let colorMatrix = new PIXI.filters.ColorMatrixFilter(); - * container.filters = [colorMatrix]; - * colorMatrix.contrast(2); - * ``` - * @author Clément Chenebault - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var ColorMatrixFilter = /** @class */ (function (_super) { - __extends$e(ColorMatrixFilter, _super); - function ColorMatrixFilter() { - var _this = this; - var uniforms = { - m: new Float32Array([1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0]), - uAlpha: 1, - }; - _this = _super.call(this, defaultFilter, fragment$5, uniforms) || this; - _this.alpha = 1; - return _this; - } - /** - * Transforms current matrix and set the new one - * - * @param {number[]} matrix - 5x4 matrix - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) { - if (multiply === void 0) { multiply = false; } - var newMatrix = matrix; - if (multiply) { - this._multiply(newMatrix, this.uniforms.m, matrix); - newMatrix = this._colorMatrix(newMatrix); - } - // set the new matrix - this.uniforms.m = newMatrix; - }; - /** - * Multiplies two mat5's - * - * @private - * @param {number[]} out - 5x4 matrix the receiving matrix - * @param {number[]} a - 5x4 matrix the first operand - * @param {number[]} b - 5x4 matrix the second operand - * @returns {number[]} 5x4 matrix - */ - ColorMatrixFilter.prototype._multiply = function (out, a, b) { - // Red Channel - out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); - out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); - out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); - out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); - out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4]; - // Green Channel - out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); - out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); - out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); - out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); - out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9]; - // Blue Channel - out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); - out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); - out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); - out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); - out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14]; - // Alpha Channel - out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); - out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); - out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); - out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); - out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19]; - return out; - }; - /** - * Create a Float32 Array and normalize the offset component to 0-1 - * - * @private - * @param {number[]} matrix - 5x4 matrix - * @return {number[]} 5x4 matrix with all values between 0-1 - */ - ColorMatrixFilter.prototype._colorMatrix = function (matrix) { - // Create a Float32 Array and normalize the offset component to 0-1 - var m = new Float32Array(matrix); - m[4] /= 255; - m[9] /= 255; - m[14] /= 255; - m[19] /= 255; - return m; - }; - /** - * Adjusts brightness - * - * @param {number} b - value of the brigthness (0-1, where 0 is black) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.brightness = function (b, multiply) { - var matrix = [ - b, 0, 0, 0, 0, - 0, b, 0, 0, 0, - 0, 0, b, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the matrices in grey scales - * - * @param {number} scale - value of the grey (0-1, where 0 is black) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.greyscale = function (scale, multiply) { - var matrix = [ - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the black and white matrice. - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.blackAndWhite = function (multiply) { - var matrix = [ - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the hue property of the color - * - * @param {number} rotation - in degrees - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.hue = function (rotation, multiply) { - rotation = (rotation || 0) / 180 * Math.PI; - var cosR = Math.cos(rotation); - var sinR = Math.sin(rotation); - var sqrt = Math.sqrt; - /* a good approximation for hue rotation - This matrix is far better than the versions with magic luminance constants - formerly used here, but also used in the starling framework (flash) and known from this - old part of the internet: quasimondo.com/archives/000565.php - - This new matrix is based on rgb cube rotation in space. Look here for a more descriptive - implementation as a shader not a general matrix: - https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js - - This is the source for the code: - see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751 - */ - var w = 1 / 3; - var sqrW = sqrt(w); // weight is - var a00 = cosR + ((1.0 - cosR) * w); - var a01 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a02 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a10 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a11 = cosR + (w * (1.0 - cosR)); - var a12 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a20 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a21 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a22 = cosR + (w * (1.0 - cosR)); - var matrix = [ - a00, a01, a02, 0, 0, - a10, a11, a12, 0, 0, - a20, a21, a22, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the contrast matrix, increase the separation between dark and bright - * Increase contrast : shadows darker and highlights brighter - * Decrease contrast : bring the shadows up and the highlights down - * - * @param {number} amount - value of the contrast (0-1) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.contrast = function (amount, multiply) { - var v = (amount || 0) + 1; - var o = -0.5 * (v - 1); - var matrix = [ - v, 0, 0, 0, o, - 0, v, 0, 0, o, - 0, 0, v, 0, o, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the saturation matrix, increase the separation between colors - * Increase saturation : increase contrast, brightness, and sharpness - * - * @param {number} amount - The saturation amount (0-1) - * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.saturate = function (amount, multiply) { - if (amount === void 0) { amount = 0; } - var x = (amount * 2 / 3) + 1; - var y = ((x - 1) * -0.5); - var matrix = [ - x, y, y, 0, 0, - y, x, y, 0, 0, - y, y, x, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Desaturate image (remove color) - * - * Call the saturate function - * - */ - ColorMatrixFilter.prototype.desaturate = function () { - this.saturate(-1); - }; - /** - * Negative image (inverse of classic rgb matrix) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.negative = function (multiply) { - var matrix = [ - -1, 0, 0, 1, 0, - 0, -1, 0, 1, 0, - 0, 0, -1, 1, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Sepia image - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.sepia = function (multiply) { - var matrix = [ - 0.393, 0.7689999, 0.18899999, 0, 0, - 0.349, 0.6859999, 0.16799999, 0, 0, - 0.272, 0.5339999, 0.13099999, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Color motion picture process invented in 1916 (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.technicolor = function (multiply) { - var matrix = [ - 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, - -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, - -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Polaroid filter - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.polaroid = function (multiply) { - var matrix = [ - 1.438, -0.062, -0.062, 0, 0, - -0.122, 1.378, -0.122, 0, 0, - -0.016, -0.016, 1.483, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Filter who transforms : Red -> Blue and Blue -> Red - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.toBGR = function (multiply) { - var matrix = [ - 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.kodachrome = function (multiply) { - var matrix = [ - 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, - -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, - -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Brown delicious browni filter (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.browni = function (multiply) { - var matrix = [ - 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, - -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, - 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Vintage filter (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.vintage = function (multiply) { - var matrix = [ - 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, - 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, - 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * We don't know exactly what it does, kind of gradient map, but funny to play with! - * - * @param {number} desaturation - Tone values. - * @param {number} toned - Tone values. - * @param {number} lightColor - Tone values, example: `0xFFE580` - * @param {number} darkColor - Tone values, example: `0xFFE580` - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) { - desaturation = desaturation || 0.2; - toned = toned || 0.15; - lightColor = lightColor || 0xFFE580; - darkColor = darkColor || 0x338000; - var lR = ((lightColor >> 16) & 0xFF) / 255; - var lG = ((lightColor >> 8) & 0xFF) / 255; - var lB = (lightColor & 0xFF) / 255; - var dR = ((darkColor >> 16) & 0xFF) / 255; - var dG = ((darkColor >> 8) & 0xFF) / 255; - var dB = (darkColor & 0xFF) / 255; - var matrix = [ - 0.3, 0.59, 0.11, 0, 0, - lR, lG, lB, desaturation, 0, - dR, dG, dB, toned, 0, - lR - dR, lG - dG, lB - dB, 0, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Night effect - * - * @param {number} intensity - The intensity of the night effect. - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.night = function (intensity, multiply) { - intensity = intensity || 0.1; - var matrix = [ - intensity * (-2.0), -intensity, 0, 0, 0, - -intensity, 0, intensity, 0, 0, - 0, intensity, intensity * 2.0, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Predator effect - * - * Erase the current matrix by setting a new indepent one - * - * @param {number} amount - how much the predator feels his future victim - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.predator = function (amount, multiply) { - var matrix = [ - // row 1 - 11.224130630493164 * amount, - -4.794486999511719 * amount, - -2.8746118545532227 * amount, - 0 * amount, - 0.40342438220977783 * amount, - // row 2 - -3.6330697536468506 * amount, - 9.193157196044922 * amount, - -2.951810836791992 * amount, - 0 * amount, - -1.316135048866272 * amount, - // row 3 - -3.2184197902679443 * amount, - -4.2375030517578125 * amount, - 7.476448059082031 * amount, - 0 * amount, - 0.8044459223747253 * amount, - // row 4 - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * LSD effect - * - * Multiply the current matrix - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.lsd = function (multiply) { - var matrix = [ - 2, -0.4, 0.5, 0, 0, - -0.5, 2, -0.4, 0, 0, - -0.4, -0.5, 3, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Erase the current matrix by setting the default one - * - */ - ColorMatrixFilter.prototype.reset = function () { - var matrix = [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, false); - }; - Object.defineProperty(ColorMatrixFilter.prototype, "matrix", { - /** - * The matrix of the color matrix filter - * - * @member {number[]} - * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] - */ - get: function () { - return this.uniforms.m; - }, - set: function (value) { - this.uniforms.m = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ColorMatrixFilter.prototype, "alpha", { - /** - * The opacity value to use when mixing the original and resultant colors. - * - * When the value is 0, the original color is used without modification. - * When the value is 1, the result color is used. - * When in the range (0, 1) the color is interpolated between the original and result by this amount. - * - * @member {number} - * @default 1 - */ - get: function () { - return this.uniforms.uAlpha; - }, - set: function (value) { - this.uniforms.uAlpha = value; - }, - enumerable: false, - configurable: true - }); - return ColorMatrixFilter; - }(Filter)); - // Americanized alias - ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; - - /*! - * @pixi/filter-displacement - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-displacement is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$f = function(d, b) { - extendStatics$f = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$f(d, b); - }; - - function __extends$f(d, b) { - extendStatics$f(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$6 = "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n"; - - var vertex$4 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n"; - - /** - * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. - * - * You can use this filter to apply all manor of crazy warping effects. - * Currently the `r` property of the texture is used to offset the `x` - * and the `g` property of the texture is used to offset the `y`. - * - * The way it works is it uses the values of the displacement map to look up the - * correct pixels to output. This means it's not technically moving the original. - * Instead, it's starting at the output and asking "which pixel from the original goes here". - * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`, - * this filter will output the pixel approximately 20 pixels to the right of the original. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var DisplacementFilter = /** @class */ (function (_super) { - __extends$f(DisplacementFilter, _super); - /** - * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} [scale] - The scale of the displacement - */ - function DisplacementFilter(sprite, scale) { - var _this = this; - var maskMatrix = new Matrix(); - sprite.renderable = false; - _this = _super.call(this, vertex$4, fragment$6, { - mapSampler: sprite._texture, - filterMatrix: maskMatrix, - scale: { x: 1, y: 1 }, - rotation: new Float32Array([1, 0, 0, 1]), - }) || this; - _this.maskSprite = sprite; - _this.maskMatrix = maskMatrix; - if (scale === null || scale === undefined) { - scale = 20; - } - /** - * scaleX, scaleY for displacements - * @member {PIXI.Point} - */ - _this.scale = new Point(scale, scale); - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - clearMode. - */ - DisplacementFilter.prototype.apply = function (filterManager, input, output, clearMode) { - // fill maskMatrix with _normalized sprite texture coords_ - this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); - this.uniforms.scale.x = this.scale.x; - this.uniforms.scale.y = this.scale.y; - // Extract rotation from world transform - var wt = this.maskSprite.worldTransform; - var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b)); - var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d)); - if (lenX !== 0 && lenY !== 0) { - this.uniforms.rotation[0] = wt.a / lenX; - this.uniforms.rotation[1] = wt.b / lenX; - this.uniforms.rotation[2] = wt.c / lenY; - this.uniforms.rotation[3] = wt.d / lenY; - } - // draw the filter... - filterManager.applyFilter(this, input, output, clearMode); - }; - Object.defineProperty(DisplacementFilter.prototype, "map", { - /** - * The texture used for the displacement map. Must be power of 2 sized texture. - * - * @member {PIXI.Texture} - */ - get: function () { - return this.uniforms.mapSampler; - }, - set: function (value) { - this.uniforms.mapSampler = value; - }, - enumerable: false, - configurable: true - }); - return DisplacementFilter; - }(Filter)); - - /*! - * @pixi/filter-fxaa - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-fxaa is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$g = function(d, b) { - extendStatics$g = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$g(d, b); - }; - - function __extends$g(d, b) { - extendStatics$g(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var vertex$5 = "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n"; - - var fragment$7 = "varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it's\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n"; - - /** - * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com - * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. - * - * @see https://github.com/mitsuhiko/webgl-meincraft - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - * - */ - var FXAAFilter = /** @class */ (function (_super) { - __extends$g(FXAAFilter, _super); - function FXAAFilter() { - // TODO - needs work - return _super.call(this, vertex$5, fragment$7) || this; - } - return FXAAFilter; - }(Filter)); - - /*! - * @pixi/filter-noise - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-noise is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$h = function(d, b) { - extendStatics$h = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$h(d, b); - }; - - function __extends$h(d, b) { - extendStatics$h(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$8 = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"; - - /** - * @author Vico @vicocotea - * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js - */ - /** - * A Noise effect filter. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var NoiseFilter = /** @class */ (function (_super) { - __extends$h(NoiseFilter, _super); - /** - * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. - */ - function NoiseFilter(noise, seed) { - if (noise === void 0) { noise = 0.5; } - if (seed === void 0) { seed = Math.random(); } - var _this = _super.call(this, defaultFilter, fragment$8, { - uNoise: 0, - uSeed: 0, - }) || this; - _this.noise = noise; - _this.seed = seed; - return _this; - } - Object.defineProperty(NoiseFilter.prototype, "noise", { - /** - * The amount of noise to apply, this value should be in the range (0, 1]. - * - * @member {number} - * @default 0.5 - */ - get: function () { - return this.uniforms.uNoise; - }, - set: function (value) { - this.uniforms.uNoise = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NoiseFilter.prototype, "seed", { - /** - * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. - * - * @member {number} - */ - get: function () { - return this.uniforms.uSeed; - }, - set: function (value) { - this.uniforms.uSeed = value; - }, - enumerable: false, - configurable: true - }); - return NoiseFilter; - }(Filter)); - - /*! - * @pixi/mixin-cache-as-bitmap - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-cache-as-bitmap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var _tempMatrix = new Matrix(); - DisplayObject.prototype._cacheAsBitmap = false; - DisplayObject.prototype._cacheData = null; - // figured there's no point adding ALL the extra variables to prototype. - // this model can hold the information needed. This can also be generated on demand as - // most objects are not cached as bitmaps. - /** - * @class - * @ignore - */ - var CacheData = /** @class */ (function () { - function CacheData() { - this.textureCacheId = null; - this.originalRender = null; - this.originalRenderCanvas = null; - this.originalCalculateBounds = null; - this.originalGetLocalBounds = null; - this.originalUpdateTransform = null; - this.originalDestroy = null; - this.originalMask = null; - this.originalFilterArea = null; - this.originalContainsPoint = null; - this.sprite = null; - } - return CacheData; - }()); - Object.defineProperties(DisplayObject.prototype, { - /** - * Set this to true if you want this display object to be cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can - * provide a performance benefit for complex static displayObjects. - * To remove simply set this property to `false` - * - * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true - * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear. - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - cacheAsBitmap: { - get: function () { - return this._cacheAsBitmap; - }, - set: function (value) { - if (this._cacheAsBitmap === value) { - return; - } - this._cacheAsBitmap = value; - var data; - if (value) { - if (!this._cacheData) { - this._cacheData = new CacheData(); - } - data = this._cacheData; - data.originalRender = this.render; - data.originalRenderCanvas = this.renderCanvas; - data.originalUpdateTransform = this.updateTransform; - data.originalCalculateBounds = this.calculateBounds; - data.originalGetLocalBounds = this.getLocalBounds; - data.originalDestroy = this.destroy; - data.originalContainsPoint = this.containsPoint; - data.originalMask = this._mask; - data.originalFilterArea = this.filterArea; - this.render = this._renderCached; - this.renderCanvas = this._renderCachedCanvas; - this.destroy = this._cacheAsBitmapDestroy; - } - else { - data = this._cacheData; - if (data.sprite) { - this._destroyCachedDisplayObject(); - } - this.render = data.originalRender; - this.renderCanvas = data.originalRenderCanvas; - this.calculateBounds = data.originalCalculateBounds; - this.getLocalBounds = data.originalGetLocalBounds; - this.destroy = data.originalDestroy; - this.updateTransform = data.originalUpdateTransform; - this.containsPoint = data.originalContainsPoint; - this._mask = data.originalMask; - this.filterArea = data.originalFilterArea; - } - }, - }, - }); - /** - * Renders a cached version of the sprite with WebGL - * - * @private - * @function _renderCached - * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer - */ - DisplayObject.prototype._renderCached = function _renderCached(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - this._initCachedDisplayObject(renderer); - this._cacheData.sprite.transform._worldID = this.transform._worldID; - this._cacheData.sprite.worldAlpha = this.worldAlpha; - this._cacheData.sprite._render(renderer); - }; - /** - * Prepares the WebGL renderer to cache the sprite - * - * @private - * @function _initCachedDisplayObject - * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer - */ - DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) { - if (this._cacheData && this._cacheData.sprite) { - return; - } - // make sure alpha is set to 1 otherwise it will get rendered as invisible! - var cacheAlpha = this.alpha; - this.alpha = 1; - // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) - renderer.batch.flush(); - // this.filters= []; - // next we find the dimensions of the untransformed object - // this function also calls updatetransform on all its children as part of the measuring. - // This means we don't need to update the transform again in this function - // TODO pass an object to clone too? saves having to create a new one each time! - var bounds = this.getLocalBounds(null, true).clone(); - // add some padding! - if (this.filters) { - var padding = this.filters[0].padding; - bounds.pad(padding); - } - bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the WebGL renderer is currently using. - // this could be more elegant.. - var cachedRenderTexture = renderer.renderTexture.current; - var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone(); - var cachedProjectionTransform = renderer.projection.transform; - // We also store the filter stack - I will definitely look to change how this works a little later down the line. - // const stack = renderer.filterManager.filterStack; - // this renderTexture will be used to store the cached DisplayObject - var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); - var textureCacheId = "cacheAsBitmap_" + uid(); - this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); - Texture.addToCache(renderTexture, textureCacheId); - // need to set // - var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y); - // set all properties to there original so we can render to a texture - this.render = this._cacheData.originalRender; - renderer.render(this, renderTexture, true, m, false); - // now restore the state be setting the new properties - renderer.projection.transform = cachedProjectionTransform; - renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame); - // renderer.filterManager.filterStack = stack; - this.render = this._renderCached; - // the rest is the same as for Canvas - this.updateTransform = this.displayObjectUpdateTransform; - this.calculateBounds = this._calculateCachedBounds; - this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; - this.filterArea = null; - // create our cached sprite - var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; - cachedSprite.anchor.x = -(bounds.x / bounds.width); - cachedSprite.anchor.y = -(bounds.y / bounds.height); - cachedSprite.alpha = cacheAlpha; - cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; - // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) { - this.enableTempParent(); - this.updateTransform(); - this.disableTempParent(null); - } - else { - this.updateTransform(); - } - // map the hit test.. - this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); - }; - /** - * Renders a cached version of the sprite with canvas - * - * @private - * @function _renderCachedCanvas - * @memberof PIXI.DisplayObject# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer - */ - DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - this._initCachedDisplayObjectCanvas(renderer); - this._cacheData.sprite.worldAlpha = this.worldAlpha; - this._cacheData.sprite._renderCanvas(renderer); - }; - // TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. - /** - * Prepares the Canvas renderer to cache the sprite - * - * @private - * @function _initCachedDisplayObjectCanvas - * @memberof PIXI.DisplayObject# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer - */ - DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) { - if (this._cacheData && this._cacheData.sprite) { - return; - } - // get bounds actually transforms the object for us already! - var bounds = this.getLocalBounds(null, true); - var cacheAlpha = this.alpha; - this.alpha = 1; - var cachedRenderTarget = renderer.context; - var cachedProjectionTransform = renderer._projTransform; - bounds.ceil(settings.RESOLUTION); - var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); - var textureCacheId = "cacheAsBitmap_" + uid(); - this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); - Texture.addToCache(renderTexture, textureCacheId); - // need to set // - var m = _tempMatrix; - this.transform.localTransform.copyTo(m); - m.invert(); - m.tx -= bounds.x; - m.ty -= bounds.y; - // m.append(this.transform.worldTransform.) - // set all properties to there original so we can render to a texture - this.renderCanvas = this._cacheData.originalRenderCanvas; - renderer.render(this, renderTexture, true, m, false); - // now restore the state be setting the new properties - renderer.context = cachedRenderTarget; - renderer._projTransform = cachedProjectionTransform; - this.renderCanvas = this._renderCachedCanvas; - // the rest is the same as for WebGL - this.updateTransform = this.displayObjectUpdateTransform; - this.calculateBounds = this._calculateCachedBounds; - this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; - this.filterArea = null; - // create our cached sprite - var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; - cachedSprite.anchor.x = -(bounds.x / bounds.width); - cachedSprite.anchor.y = -(bounds.y / bounds.height); - cachedSprite.alpha = cacheAlpha; - cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; - // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) { - this.parent = renderer._tempDisplayObjectParent; - this.updateTransform(); - this.parent = null; - } - else { - this.updateTransform(); - } - // map the hit test.. - this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); - }; - /** - * Calculates the bounds of the cached sprite - * - * @private - */ - DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() { - this._bounds.clear(); - this._cacheData.sprite.transform._worldID = this.transform._worldID; - this._cacheData.sprite._calculateBounds(); - this._bounds.updateID = this._boundsID; - }; - /** - * Gets the bounds of the cached sprite. - * - * @private - * @return {Rectangle} The local bounds. - */ - DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() { - return this._cacheData.sprite.getLocalBounds(null); - }; - /** - * Destroys the cached sprite. - * - * @private - */ - DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() { - this._cacheData.sprite._texture.destroy(true); - this._cacheData.sprite = null; - BaseTexture.removeFromCache(this._cacheData.textureCacheId); - Texture.removeFromCache(this._cacheData.textureCacheId); - this._cacheData.textureCacheId = null; - }; - /** - * Destroys the cached object. - * - * @private - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value. - * Used when destroying containers, see the Container.destroy method. - */ - DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) { - this.cacheAsBitmap = false; - this.destroy(options); - }; - - /*! - * @pixi/mixin-get-child-by-name - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-get-child-by-name is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The instance name of the object. - * - * @memberof PIXI.DisplayObject# - * @member {string} name - */ - DisplayObject.prototype.name = null; - /** - * Returns the display object in the container. - * - * Recursive searches are done in a preorder traversal. - * - * @method getChildByName - * @memberof PIXI.Container# - * @param {string} name - Instance name. - * @param {boolean}[deep=false] - Whether to search recursively - * @return {PIXI.DisplayObject} The child with the specified name. - */ - Container.prototype.getChildByName = function getChildByName(name, deep) { - for (var i = 0, j = this.children.length; i < j; i++) { - if (this.children[i].name === name) { - return this.children[i]; - } - } - if (deep) { - for (var i = 0, j = this.children.length; i < j; i++) { - var child = this.children[i]; - if (!child.getChildByName) { - continue; - } - var target = this.children[i].getChildByName(name, true); - if (target) { - return target; - } - } - } - return null; - }; - - /*! - * @pixi/mixin-get-global-position - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-get-global-position is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot. - * - * @method getGlobalPosition - * @memberof PIXI.DisplayObject# - * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to. - * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from - * being updated. This means the calculation returned MAY be out of date BUT will give you a - * nice performance boost. - * @return {PIXI.Point} The updated point. - */ - DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) { - if (point === void 0) { point = new Point(); } - if (skipUpdate === void 0) { skipUpdate = false; } - if (this.parent) { - this.parent.toGlobal(this.position, point, skipUpdate); - } - else { - point.x = this.position.x; - point.y = this.position.y; - } - return point; - }; - - /*! - * @pixi/mesh-extras - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mesh-extras is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$i = function(d, b) { - extendStatics$i = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$i(d, b); - }; - - function __extends$i(d, b) { - extendStatics$i(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var PlaneGeometry = /** @class */ (function (_super) { - __extends$i(PlaneGeometry, _super); - function PlaneGeometry(width, height, segWidth, segHeight) { - if (width === void 0) { width = 100; } - if (height === void 0) { height = 100; } - if (segWidth === void 0) { segWidth = 10; } - if (segHeight === void 0) { segHeight = 10; } - var _this = _super.call(this) || this; - _this.segWidth = segWidth; - _this.segHeight = segHeight; - _this.width = width; - _this.height = height; - _this.build(); - return _this; - } - /** - * Refreshes plane coordinates - * @private - */ - PlaneGeometry.prototype.build = function () { - var total = this.segWidth * this.segHeight; - var verts = []; - var uvs = []; - var indices = []; - var segmentsX = this.segWidth - 1; - var segmentsY = this.segHeight - 1; - var sizeX = (this.width) / segmentsX; - var sizeY = (this.height) / segmentsY; - for (var i = 0; i < total; i++) { - var x = (i % this.segWidth); - var y = ((i / this.segWidth) | 0); - verts.push(x * sizeX, y * sizeY); - uvs.push(x / segmentsX, y / segmentsY); - } - var totalSub = segmentsX * segmentsY; - for (var i = 0; i < totalSub; i++) { - var xpos = i % segmentsX; - var ypos = (i / segmentsX) | 0; - var value = (ypos * this.segWidth) + xpos; - var value2 = (ypos * this.segWidth) + xpos + 1; - var value3 = ((ypos + 1) * this.segWidth) + xpos; - var value4 = ((ypos + 1) * this.segWidth) + xpos + 1; - indices.push(value, value2, value3, value2, value4, value3); - } - this.buffers[0].data = new Float32Array(verts); - this.buffers[1].data = new Float32Array(uvs); - this.indexBuffer.data = new Uint16Array(indices); - // ensure that the changes are uploaded - this.buffers[0].update(); - this.buffers[1].update(); - this.indexBuffer.update(); - }; - return PlaneGeometry; - }(MeshGeometry)); - - /** - * RopeGeometry allows you to draw a geometry across several points and then manipulate these points. - * - * ```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * const rope = new PIXI.RopeGeometry(100, points); - * ``` - * - * @class - * @extends PIXI.MeshGeometry - * @memberof PIXI - * - */ - var RopeGeometry = /** @class */ (function (_super) { - __extends$i(RopeGeometry, _super); - /** - * @param {number} [width=200] - The width (i.e., thickness) of the rope. - * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope. - * @param {number} [textureScale=0] - By default the rope texture will be stretched to match - * rope length. If textureScale is positive this value will be treated as a scaling - * factor and the texture will preserve its aspect ratio instead. To create a tiling rope - * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture, - * then set textureScale=1 to keep the original texture pixel size. - * In order to reduce alpha channel artifacts provide a larger texture and downsample - - * i.e. set textureScale=0.5 to scale it down twice. - */ - function RopeGeometry(width, points, textureScale) { - if (width === void 0) { width = 200; } - if (textureScale === void 0) { textureScale = 0; } - var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this; - /** - * An array of points that determine the rope - * @member {PIXI.Point[]} - */ - _this.points = points; - /** - * The width (i.e., thickness) of the rope. - * @member {number} - * @readOnly - */ - _this._width = width; - /** - * Rope texture scale, if zero then the rope texture is stretched. - * @member {number} - * @readOnly - */ - _this.textureScale = textureScale; - _this.build(); - return _this; - } - Object.defineProperty(RopeGeometry.prototype, "width", { - /** - * The width (i.e., thickness) of the rope. - * @member {number} - * @readOnly - */ - get: function () { - return this._width; - }, - enumerable: false, - configurable: true - }); - /** - * Refreshes Rope indices and uvs - * @private - */ - RopeGeometry.prototype.build = function () { - var points = this.points; - if (!points) - { return; } - var vertexBuffer = this.getBuffer('aVertexPosition'); - var uvBuffer = this.getBuffer('aTextureCoord'); - var indexBuffer = this.getIndex(); - // if too little points, or texture hasn't got UVs set yet just move on. - if (points.length < 1) { - return; - } - // if the number of points has changed we will need to recreate the arraybuffers - if (vertexBuffer.data.length / 4 !== points.length) { - vertexBuffer.data = new Float32Array(points.length * 4); - uvBuffer.data = new Float32Array(points.length * 4); - indexBuffer.data = new Uint16Array((points.length - 1) * 6); - } - var uvs = uvBuffer.data; - var indices = indexBuffer.data; - uvs[0] = 0; - uvs[1] = 0; - uvs[2] = 0; - uvs[3] = 1; - var amount = 0; - var prev = points[0]; - var textureWidth = this._width * this.textureScale; - var total = points.length; // - 1; - for (var i = 0; i < total; i++) { - // time to do some smart drawing! - var index = i * 4; - if (this.textureScale > 0) { - // calculate pixel distance from previous point - var dx = prev.x - points[i].x; - var dy = prev.y - points[i].y; - var distance = Math.sqrt((dx * dx) + (dy * dy)); - prev = points[i]; - amount += distance / textureWidth; - } - else { - // stretch texture - amount = i / (total - 1); - } - uvs[index] = amount; - uvs[index + 1] = 0; - uvs[index + 2] = amount; - uvs[index + 3] = 1; - } - var indexCount = 0; - for (var i = 0; i < total - 1; i++) { - var index = i * 2; - indices[indexCount++] = index; - indices[indexCount++] = index + 1; - indices[indexCount++] = index + 2; - indices[indexCount++] = index + 2; - indices[indexCount++] = index + 1; - indices[indexCount++] = index + 3; - } - // ensure that the changes are uploaded - uvBuffer.update(); - indexBuffer.update(); - this.updateVertices(); - }; - /** - * refreshes vertices of Rope mesh - */ - RopeGeometry.prototype.updateVertices = function () { - var points = this.points; - if (points.length < 1) { - return; - } - var lastPoint = points[0]; - var nextPoint; - var perpX = 0; - var perpY = 0; - var vertices = this.buffers[0].data; - var total = points.length; - for (var i = 0; i < total; i++) { - var point = points[i]; - var index = i * 4; - if (i < points.length - 1) { - nextPoint = points[i + 1]; - } - else { - nextPoint = point; - } - perpY = -(nextPoint.x - lastPoint.x); - perpX = nextPoint.y - lastPoint.y; - var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY)); - var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2; - perpX /= perpLength; - perpY /= perpLength; - perpX *= num; - perpY *= num; - vertices[index] = point.x + perpX; - vertices[index + 1] = point.y + perpY; - vertices[index + 2] = point.x - perpX; - vertices[index + 3] = point.y - perpY; - lastPoint = point; - } - this.buffers[0].update(); - }; - RopeGeometry.prototype.update = function () { - if (this.textureScale > 0) { - this.build(); // we need to update UVs - } - else { - this.updateVertices(); - } - }; - return RopeGeometry; - }(MeshGeometry)); - - /** - * The rope allows you to draw a texture across several points and then manipulate these points - * - *```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * let rope = new PIXI.SimpleRope(PIXI.Texture.from("snake.png"), points); - * ``` - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - * - */ - var SimpleRope = /** @class */ (function (_super) { - __extends$i(SimpleRope, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the rope. - * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope. - * @param {number} [textureScale=0] - Optional. Positive values scale rope texture - * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture - * and downsampling here. If set to zero, texture will be streched instead. - */ - function SimpleRope(texture, points, textureScale) { - if (textureScale === void 0) { textureScale = 0; } - var _this = this; - var ropeGeometry = new RopeGeometry(texture.height, points, textureScale); - var meshMaterial = new MeshMaterial(texture); - if (textureScale > 0) { - // attempt to set UV wrapping, will fail on non-power of two textures - texture.baseTexture.wrapMode = exports.WRAP_MODES.REPEAT; - } - _this = _super.call(this, ropeGeometry, meshMaterial) || this; - /** - * re-calculate vertices by rope points each frame - * - * @member {boolean} - */ - _this.autoUpdate = true; - return _this; - } - SimpleRope.prototype._render = function (renderer) { - var geometry = this.geometry; - if (this.autoUpdate || geometry._width !== this.shader.texture.height) { - geometry._width = this.shader.texture.height; - geometry.update(); - } - _super.prototype._render.call(this, renderer); - }; - return SimpleRope; - }(Mesh)); - - /** - * The SimplePlane allows you to draw a texture across several points and then manipulate these points - * - *```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from("snake.png"), points); - * ``` - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - * - */ - var SimplePlane = /** @class */ (function (_super) { - __extends$i(SimplePlane, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the SimplePlane. - * @param {number} verticesX - The number of vertices in the x-axis - * @param {number} verticesY - The number of vertices in the y-axis - */ - function SimplePlane(texture, verticesX, verticesY) { - var _this = this; - var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY); - var meshMaterial = new MeshMaterial(Texture.WHITE); - _this = _super.call(this, planeGeometry, meshMaterial) || this; - // lets call the setter to ensure all necessary updates are performed - _this.texture = texture; - return _this; - } - /** - * Method used for overrides, to do something in case texture frame was changed. - * Meshes based on plane can override it and change more details based on texture. - */ - SimplePlane.prototype.textureUpdated = function () { - this._textureID = this.shader.texture._updateID; - var geometry = this.geometry; - geometry.width = this.shader.texture.width; - geometry.height = this.shader.texture.height; - geometry.build(); - }; - Object.defineProperty(SimplePlane.prototype, "texture", { - get: function () { - return this.shader.texture; - }, - set: function (value) { - // Track texture same way sprite does. - // For generated meshes like NineSlicePlane it can change the geometry. - // Unfortunately, this method might not work if you directly change texture in material. - if (this.shader.texture === value) { - return; - } - this.shader.texture = value; - this._textureID = -1; - if (value.baseTexture.valid) { - this.textureUpdated(); - } - else { - value.once('update', this.textureUpdated, this); - } - }, - enumerable: false, - configurable: true - }); - SimplePlane.prototype._render = function (renderer) { - if (this._textureID !== this.shader.texture._updateID) { - this.textureUpdated(); - } - _super.prototype._render.call(this, renderer); - }; - SimplePlane.prototype.destroy = function (options) { - this.shader.texture.off('update', this.textureUpdated, this); - _super.prototype.destroy.call(this, options); - }; - return SimplePlane; - }(Mesh)); - - /** - * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. - * For more robust customization, use {@link PIXI.Mesh}. - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - */ - var SimpleMesh = /** @class */ (function (_super) { - __extends$i(SimpleMesh, _super); - /** - * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use - * @param {Float32Array} [vertices] - if you want to specify the vertices - * @param {Float32Array} [uvs] - if you want to specify the uvs - * @param {Uint16Array} [indices] - if you want to specify the indices - * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts - */ - function SimpleMesh(texture, vertices, uvs, indices, drawMode) { - if (texture === void 0) { texture = Texture.EMPTY; } - var _this = this; - var geometry = new MeshGeometry(vertices, uvs, indices); - geometry.getBuffer('aVertexPosition').static = false; - var meshMaterial = new MeshMaterial(texture); - _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this; - /** - * upload vertices buffer each frame - * @member {boolean} - */ - _this.autoUpdate = true; - return _this; - } - Object.defineProperty(SimpleMesh.prototype, "vertices", { - /** - * Collection of vertices data. - * @member {Float32Array} - */ - get: function () { - return this.geometry.getBuffer('aVertexPosition').data; - }, - set: function (value) { - this.geometry.getBuffer('aVertexPosition').data = value; - }, - enumerable: false, - configurable: true - }); - SimpleMesh.prototype._render = function (renderer) { - if (this.autoUpdate) { - this.geometry.getBuffer('aVertexPosition').update(); - } - _super.prototype._render.call(this, renderer); - }; - return SimpleMesh; - }(Mesh)); - - var DEFAULT_BORDER_SIZE = 10; - /** - * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful - * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically - * - *```js - * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15); - * ``` - *
-	 *      A                          B
-	 *    +---+----------------------+---+
-	 *  C | 1 |          2           | 3 |
-	 *    +---+----------------------+---+
-	 *    |   |                      |   |
-	 *    | 4 |          5           | 6 |
-	 *    |   |                      |   |
-	 *    +---+----------------------+---+
-	 *  D | 7 |          8           | 9 |
-	 *    +---+----------------------+---+
-
-	 *  When changing this objects width and/or height:
-	 *     areas 1 3 7 and 9 will remain unscaled.
-	 *     areas 2 and 8 will be stretched horizontally
-	 *     areas 4 and 6 will be stretched vertically
-	 *     area 5 will be stretched both horizontally and vertically
-	 * 
- * - * @class - * @extends PIXI.SimplePlane - * @memberof PIXI - * - */ - var NineSlicePlane = /** @class */ (function (_super) { - __extends$i(NineSlicePlane, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {number} [leftWidth=10] - size of the left vertical bar (A) - * @param {number} [topHeight=10] - size of the top horizontal bar (C) - * @param {number} [rightWidth=10] - size of the right vertical bar (B) - * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D) - */ - function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) { - if (leftWidth === void 0) { leftWidth = DEFAULT_BORDER_SIZE; } - if (topHeight === void 0) { topHeight = DEFAULT_BORDER_SIZE; } - if (rightWidth === void 0) { rightWidth = DEFAULT_BORDER_SIZE; } - if (bottomHeight === void 0) { bottomHeight = DEFAULT_BORDER_SIZE; } - var _this = _super.call(this, Texture.WHITE, 4, 4) || this; - _this._origWidth = texture.orig.width; - _this._origHeight = texture.orig.height; - /** - * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - * @override - */ - _this._width = _this._origWidth; - /** - * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - * @override - */ - _this._height = _this._origHeight; - /** - * The width of the left column (a) - * - * @member {number} - * @private - */ - _this._leftWidth = leftWidth; - /** - * The width of the right column (b) - * - * @member {number} - * @private - */ - _this._rightWidth = rightWidth; - /** - * The height of the top row (c) - * - * @member {number} - * @private - */ - _this._topHeight = topHeight; - /** - * The height of the bottom row (d) - * - * @member {number} - * @private - */ - _this._bottomHeight = bottomHeight; - // lets call the setter to ensure all necessary updates are performed - _this.texture = texture; - return _this; - } - NineSlicePlane.prototype.textureUpdated = function () { - this._textureID = this.shader.texture._updateID; - this._refresh(); - }; - Object.defineProperty(NineSlicePlane.prototype, "vertices", { - get: function () { - return this.geometry.getBuffer('aVertexPosition').data; - }, - set: function (value) { - this.geometry.getBuffer('aVertexPosition').data = value; - }, - enumerable: false, - configurable: true - }); - /** - * Updates the horizontal vertices. - * - */ - NineSlicePlane.prototype.updateHorizontalVertices = function () { - var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; - vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale); - vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height; - }; - /** - * Updates the vertical vertices. - * - */ - NineSlicePlane.prototype.updateVerticalVertices = function () { - var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; - vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale); - vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; - }; - /** - * Returns the smaller of a set of vertical and horizontal scale of nine slice corners. - * - * @return {number} Smaller number of vertical and horizontal scale. - * @private - */ - NineSlicePlane.prototype._getMinScale = function () { - var w = this._leftWidth + this._rightWidth; - var scaleW = this._width > w ? 1.0 : this._width / w; - var h = this._topHeight + this._bottomHeight; - var scaleH = this._height > h ? 1.0 : this._height / h; - var scale = Math.min(scaleW, scaleH); - return scale; - }; - Object.defineProperty(NineSlicePlane.prototype, "width", { - /** - * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - get: function () { - return this._width; - }, - set: function (value) { - this._width = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "height", { - /** - * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - get: function () { - return this._height; - }, - set: function (value) { - this._height = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "leftWidth", { - /** - * The width of the left column - * - * @member {number} - */ - get: function () { - return this._leftWidth; - }, - set: function (value) { - this._leftWidth = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "rightWidth", { - /** - * The width of the right column - * - * @member {number} - */ - get: function () { - return this._rightWidth; - }, - set: function (value) { - this._rightWidth = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "topHeight", { - /** - * The height of the top row - * - * @member {number} - */ - get: function () { - return this._topHeight; - }, - set: function (value) { - this._topHeight = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "bottomHeight", { - /** - * The height of the bottom row - * - * @member {number} - */ - get: function () { - return this._bottomHeight; - }, - set: function (value) { - this._bottomHeight = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - /** - * Refreshes NineSlicePlane coords. All of them. - */ - NineSlicePlane.prototype._refresh = function () { - var texture = this.texture; - var uvs = this.geometry.buffers[1].data; - this._origWidth = texture.orig.width; - this._origHeight = texture.orig.height; - var _uvw = 1.0 / this._origWidth; - var _uvh = 1.0 / this._origHeight; - uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0; - uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0; - uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1; - uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1; - uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth; - uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth); - uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight; - uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight); - this.updateHorizontalVertices(); - this.updateVerticalVertices(); - this.geometry.buffers[0].update(); - this.geometry.buffers[1].update(); - }; - return NineSlicePlane; - }(SimplePlane)); - - /*! - * @pixi/sprite-animated - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite-animated is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$j = function(d, b) { - extendStatics$j = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$j(d, b); - }; - - function __extends$j(d, b) { - extendStatics$j(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. - * - * ```js - * let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; - * let textureArray = []; - * - * for (let i=0; i < 4; i++) - * { - * let texture = PIXI.Texture.from(alienImages[i]); - * textureArray.push(texture); - * }; - * - * let animatedSprite = new PIXI.AnimatedSprite(textureArray); - * ``` - * - * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} - * containing the animation definitions: - * - * ```js - * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); - * ... - * } - * ``` - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var AnimatedSprite = /** @class */ (function (_super) { - __extends$j(AnimatedSprite, _super); - /** - * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame - * objects that make up the animation. - * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. - */ - function AnimatedSprite(textures, autoUpdate) { - if (autoUpdate === void 0) { autoUpdate = true; } - var _this = _super.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture) || this; - /** - * @type {PIXI.Texture[]} - * @private - */ - _this._textures = null; - /** - * @type {number[]} - * @private - */ - _this._durations = null; - /** - * `true` uses PIXI.Ticker.shared to auto update animation time. - * - * @type {boolean} - * @default true - * @private - */ - _this._autoUpdate = autoUpdate; - /** - * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time. - * - * @type {boolean} - * @default false - * @private - */ - _this._isConnectedToTicker = false; - /** - * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower. - * - * @member {number} - * @default 1 - */ - _this.animationSpeed = 1; - /** - * Whether or not the animate sprite repeats after playing. - * - * @member {boolean} - * @default true - */ - _this.loop = true; - /** - * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes. - * - * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools. - * Changing anchor for each frame allows to pin sprite origin to certain moving feature - * of the frame (e.g. left foot). - * - * Note: Enabling this will override any previously set `anchor` on each frame change. - * - * @member {boolean} - * @default false - */ - _this.updateAnchor = false; - /** - * User-assigned function to call when an AnimatedSprite finishes playing. - * - * @example - * animation.onComplete = function () { - * // finished! - * }; - * @member {Function} - */ - _this.onComplete = null; - /** - * User-assigned function to call when an AnimatedSprite changes which texture is being rendered. - * - * @example - * animation.onFrameChange = function () { - * // updated! - * }; - * @member {Function} - */ - _this.onFrameChange = null; - /** - * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and - * loops around to start again. - * - * @example - * animation.onLoop = function () { - * // looped! - * }; - * @member {Function} - */ - _this.onLoop = null; - /** - * Elapsed time since animation has been started, used internally to display current texture. - * - * @member {number} - * @private - */ - _this._currentTime = 0; - _this._playing = false; - /** - * The texture index that was displayed last time - * - * @member {number} - * @private - */ - _this._previousFrame = null; - _this.textures = textures; - return _this; - } - /** - * Stops the AnimatedSprite. - * - */ - AnimatedSprite.prototype.stop = function () { - if (!this._playing) { - return; - } - this._playing = false; - if (this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - }; - /** - * Plays the AnimatedSprite. - * - */ - AnimatedSprite.prototype.play = function () { - if (this._playing) { - return; - } - this._playing = true; - if (this._autoUpdate && !this._isConnectedToTicker) { - Ticker.shared.add(this.update, this, exports.UPDATE_PRIORITY.HIGH); - this._isConnectedToTicker = true; - } - }; - /** - * Stops the AnimatedSprite and goes to a specific frame. - * - * @param {number} frameNumber - Frame index to stop at. - */ - AnimatedSprite.prototype.gotoAndStop = function (frameNumber) { - this.stop(); - var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - if (previousFrame !== this.currentFrame) { - this.updateTexture(); - } - }; - /** - * Goes to a specific frame and begins playing the AnimatedSprite. - * - * @param {number} frameNumber - Frame index to start at. - */ - AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) { - var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - if (previousFrame !== this.currentFrame) { - this.updateTexture(); - } - this.play(); - }; - /** - * Updates the object transform for rendering. - * - * @param {number} deltaTime - Time since last tick. - */ - AnimatedSprite.prototype.update = function (deltaTime) { - if (!this._playing) { - return; - } - var elapsed = this.animationSpeed * deltaTime; - var previousFrame = this.currentFrame; - if (this._durations !== null) { - var lag = this._currentTime % 1 * this._durations[this.currentFrame]; - lag += elapsed / 60 * 1000; - while (lag < 0) { - this._currentTime--; - lag += this._durations[this.currentFrame]; - } - var sign = Math.sign(this.animationSpeed * deltaTime); - this._currentTime = Math.floor(this._currentTime); - while (lag >= this._durations[this.currentFrame]) { - lag -= this._durations[this.currentFrame] * sign; - this._currentTime += sign; - } - this._currentTime += lag / this._durations[this.currentFrame]; - } - else { - this._currentTime += elapsed; - } - if (this._currentTime < 0 && !this.loop) { - this.gotoAndStop(0); - if (this.onComplete) { - this.onComplete(); - } - } - else if (this._currentTime >= this._textures.length && !this.loop) { - this.gotoAndStop(this._textures.length - 1); - if (this.onComplete) { - this.onComplete(); - } - } - else if (previousFrame !== this.currentFrame) { - if (this.loop && this.onLoop) { - if (this.animationSpeed > 0 && this.currentFrame < previousFrame) { - this.onLoop(); - } - else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) { - this.onLoop(); - } - } - this.updateTexture(); - } - }; - /** - * Updates the displayed texture to match the current frame index. - * - * @private - */ - AnimatedSprite.prototype.updateTexture = function () { - var currentFrame = this.currentFrame; - if (this._previousFrame === currentFrame) { - return; - } - this._previousFrame = currentFrame; - this._texture = this._textures[currentFrame]; - this._textureID = -1; - this._textureTrimmedID = -1; - this._cachedTint = 0xFFFFFF; - this.uvs = this._texture._uvs.uvsFloat32; - if (this.updateAnchor) { - this._anchor.copyFrom(this._texture.defaultAnchor); - } - if (this.onFrameChange) { - this.onFrameChange(this.currentFrame); - } - }; - /** - * Stops the AnimatedSprite and destroys it. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value. - * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well. - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well. - */ - AnimatedSprite.prototype.destroy = function (options) { - this.stop(); - _super.prototype.destroy.call(this, options); - this.onComplete = null; - this.onFrameChange = null; - this.onLoop = null; - }; - /** - * A short hand way of creating an AnimatedSprite from an array of frame ids. - * - * @static - * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames. - * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames. - */ - AnimatedSprite.fromFrames = function (frames) { - var textures = []; - for (var i = 0; i < frames.length; ++i) { - textures.push(Texture.from(frames[i])); - } - return new AnimatedSprite(textures); - }; - /** - * A short hand way of creating an AnimatedSprite from an array of image ids. - * - * @static - * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames. - * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames. - */ - AnimatedSprite.fromImages = function (images) { - var textures = []; - for (var i = 0; i < images.length; ++i) { - textures.push(Texture.from(images[i])); - } - return new AnimatedSprite(textures); - }; - Object.defineProperty(AnimatedSprite.prototype, "totalFrames", { - /** - * The total number of frames in the AnimatedSprite. This is the same as number of textures - * assigned to the AnimatedSprite. - * - * @readonly - * @member {number} - * @default 0 - */ - get: function () { - return this._textures.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "textures", { - /** - * The array of textures used for this AnimatedSprite. - * - * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} - */ - get: function () { - return this._textures; - }, - set: function (value) { - if (value[0] instanceof Texture) { - this._textures = value; - this._durations = null; - } - else { - this._textures = []; - this._durations = []; - for (var i = 0; i < value.length; i++) { - this._textures.push(value[i].texture); - this._durations.push(value[i].time); - } - } - this._previousFrame = null; - this.gotoAndStop(0); - this.updateTexture(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "currentFrame", { - /** - * The AnimatedSprites current frame index. - * - * @member {number} - * @readonly - */ - get: function () { - var currentFrame = Math.floor(this._currentTime) % this._textures.length; - if (currentFrame < 0) { - currentFrame += this._textures.length; - } - return currentFrame; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "playing", { - /** - * Indicates if the AnimatedSprite is currently playing. - * - * @member {boolean} - * @readonly - */ - get: function () { - return this._playing; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "autoUpdate", { - /** - * Whether to use PIXI.Ticker.shared to auto update animation time - * - * @member {boolean} - */ - get: function () { - return this._autoUpdate; - }, - set: function (value) { - if (value !== this._autoUpdate) { - this._autoUpdate = value; - if (!this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - } - }, - enumerable: false, - configurable: true - }); - return AnimatedSprite; - }(Sprite)); - - /*! - * pixi.js - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * pixi.js is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$k = function(d, b) { - extendStatics$k = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$k(d, b); - }; - - function __extends$k(d, b) { - extendStatics$k(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var v5 = '5.0.0'; - /** - * Deprecations (backward compatibilities) are automatically applied for browser bundles - * in the UMD module format. If using Webpack or Rollup, you'll need to apply these - * deprecations manually by doing something like this: - * @example - * import * as PIXI from 'pixi.js'; - * PIXI.useDeprecated(); // MUST be bound to namespace - * @memberof PIXI - * @function useDeprecated - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function useDeprecated() { - // eslint-disable-next-line @typescript-eslint/no-this-alias - var PIXI = this; - Object.defineProperties(PIXI, { - /** - * @constant {RegExp|string} SVG_SIZE - * @memberof PIXI - * @see PIXI.resources.SVGResource.SVG_SIZE - * @deprecated since 5.0.0 - */ - SVG_SIZE: { - get: function () { - deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE'); - return PIXI.SVGResource.SVG_SIZE; - }, - }, - /** - * @class PIXI.TransformStatic - * @deprecated since 5.0.0 - * @see PIXI.Transform - */ - TransformStatic: { - get: function () { - deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform'); - return PIXI.Transform; - }, - }, - /** - * @class PIXI.TransformBase - * @deprecated since 5.0.0 - * @see PIXI.Transform - */ - TransformBase: { - get: function () { - deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform'); - return PIXI.Transform; - }, - }, - /** - * Constants that specify the transform type. - * - * @static - * @constant - * @name TRANSFORM_MODE - * @memberof PIXI - * @enum {number} - * @deprecated since 5.0.0 - * @property {number} STATIC - * @property {number} DYNAMIC - */ - TRANSFORM_MODE: { - get: function () { - deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed'); - return { STATIC: 0, DYNAMIC: 1 }; - }, - }, - /** - * @class PIXI.WebGLRenderer - * @see PIXI.Renderer - * @deprecated since 5.0.0 - */ - WebGLRenderer: { - get: function () { - deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer'); - return PIXI.Renderer; - }, - }, - /** - * @class PIXI.CanvasRenderTarget - * @see PIXI.utils.CanvasRenderTarget - * @deprecated since 5.0.0 - */ - CanvasRenderTarget: { - get: function () { - deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget'); - return PIXI.utils.CanvasRenderTarget; - }, - }, - /** - * @memberof PIXI - * @name loader - * @type {PIXI.Loader} - * @see PIXI.Loader.shared - * @deprecated since 5.0.0 - */ - loader: { - get: function () { - deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared'); - return PIXI.Loader.shared; - }, - }, - /** - * @class PIXI.FilterManager - * @see PIXI.systems.FilterSystem - * @deprecated since 5.0.0 - */ - FilterManager: { - get: function () { - deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem'); - return PIXI.systems.FilterSystem; - }, - }, - /** - * @namespace PIXI.CanvasTinter - * @see PIXI.canvasUtils - * @deprecated since 5.2.0 - */ - CanvasTinter: { - get: function () { - deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils'); - return PIXI.canvasUtils; - }, - }, - /** - * @namespace PIXI.GroupD8 - * @see PIXI.groupD8 - * @deprecated since 5.2.0 - */ - GroupD8: { - get: function () { - deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8'); - return PIXI.groupD8; - }, - }, - }); - /** - * @namespace PIXI.accessibility - * @see PIXI - * @deprecated since 5.3.0 - */ - PIXI.accessibility = {}; - Object.defineProperties(PIXI.accessibility, { - /** - * @class PIXI.accessibility.AccessibilityManager - * @deprecated since 5.3.0 - * @see PIXI.AccessibilityManager - */ - AccessibilityManager: { - get: function () { - deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager'); - return PIXI.AccessibilityManager; - }, - }, - }); - /** - * @namespace PIXI.interaction - * @see PIXI - * @deprecated since 5.3.0 - */ - PIXI.interaction = {}; - Object.defineProperties(PIXI.interaction, { - /** - * @class PIXI.interaction.InteractionManager - * @deprecated since 5.3.0 - * @see PIXI.InteractionManager - */ - InteractionManager: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager'); - return PIXI.InteractionManager; - }, - }, - /** - * @class PIXI.interaction.InteractionData - * @deprecated since 5.3.0 - * @see PIXI.InteractionData - */ - InteractionData: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData'); - return PIXI.InteractionData; - }, - }, - /** - * @class PIXI.interaction.InteractionEvent - * @deprecated since 5.3.0 - * @see PIXI.InteractionEvent - */ - InteractionEvent: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent'); - return PIXI.InteractionEvent; - }, - }, - }); - /** - * @namespace PIXI.prepare - * @see PIXI - * @deprecated since 5.2.1 - */ - PIXI.prepare = {}; - Object.defineProperties(PIXI.prepare, { - /** - * @class PIXI.prepare.BasePrepare - * @deprecated since 5.2.1 - * @see PIXI.BasePrepare - */ - BasePrepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare'); - return PIXI.BasePrepare; - }, - }, - /** - * @class PIXI.prepare.Prepare - * @deprecated since 5.2.1 - * @see PIXI.Prepare - */ - Prepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare'); - return PIXI.Prepare; - }, - }, - /** - * @class PIXI.prepare.CanvasPrepare - * @deprecated since 5.2.1 - * @see PIXI.CanvasPrepare - */ - CanvasPrepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare'); - return PIXI.CanvasPrepare; - }, - }, - }); - /** - * @namespace PIXI.extract - * @see PIXI - * @deprecated since 5.2.1 - */ - PIXI.extract = {}; - Object.defineProperties(PIXI.extract, { - /** - * @class PIXI.extract.Extract - * @deprecated since 5.2.1 - * @see PIXI.Extract - */ - Extract: { - get: function () { - deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract'); - return PIXI.Extract; - }, - }, - /** - * @class PIXI.extract.CanvasExtract - * @deprecated since 5.2.1 - * @see PIXI.CanvasExtract - */ - CanvasExtract: { - get: function () { - deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract'); - return PIXI.CanvasExtract; - }, - }, - }); - /** - * This namespace has been removed. All classes previous nested - * under this namespace have been moved to the top-level `PIXI` object. - * @namespace PIXI.extras - * @deprecated since 5.0.0 - */ - PIXI.extras = {}; - Object.defineProperties(PIXI.extras, { - /** - * @class PIXI.extras.TilingSprite - * @see PIXI.TilingSprite - * @deprecated since 5.0.0 - */ - TilingSprite: { - get: function () { - deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite'); - return PIXI.TilingSprite; - }, - }, - /** - * @class PIXI.extras.TilingSpriteRenderer - * @see PIXI.TilingSpriteRenderer - * @deprecated since 5.0.0 - */ - TilingSpriteRenderer: { - get: function () { - deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer'); - return PIXI.TilingSpriteRenderer; - }, - }, - /** - * @class PIXI.extras.AnimatedSprite - * @see PIXI.AnimatedSprite - * @deprecated since 5.0.0 - */ - AnimatedSprite: { - get: function () { - deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite'); - return PIXI.AnimatedSprite; - }, - }, - /** - * @class PIXI.extras.BitmapText - * @see PIXI.BitmapText - * @deprecated since 5.0.0 - */ - BitmapText: { - get: function () { - deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText'); - return PIXI.BitmapText; - }, - }, - }); - /** - * @static - * @method PIXI.TilingSprite.fromFrame - * @deprecated since 5.3.0 - * @see PIXI.TilingSprite.from - */ - PIXI.TilingSprite.fromFrame = function fromFrame(frameId, width, height) { - deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from'); - return PIXI.TilingSprite.from(frameId, { width: width, height: height }); - }; - /** - * @static - * @method PIXI.TilingSprite.fromImage - * @deprecated since 5.3.0 - * @see PIXI.TilingSprite.from - */ - PIXI.TilingSprite.fromImage = function fromImage(imageId, width, height, options) { - if (options === void 0) { options = {}; } - deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from'); - // Fallback support for crossorigin, scaleMode parameters - if (options && typeof options !== 'object') { - options = { - // eslint-disable-next-line prefer-rest-params - scaleMode: arguments[4], - resourceOptions: { - // eslint-disable-next-line prefer-rest-params - crossorigin: arguments[3], - }, - }; - } - options.width = width; - options.height = height; - return PIXI.TilingSprite.from(imageId, options); - }; - Object.defineProperties(PIXI.utils, { - /** - * @function PIXI.utils.getSvgSize - * @see PIXI.resources.SVGResource.getSize - * @deprecated since 5.0.0 - */ - getSvgSize: { - get: function () { - deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize'); - return PIXI.resources.SVGResource.getSize; - }, - }, - }); - /** - * All classes on this namespace have moved to the high-level `PIXI` object. - * @namespace PIXI.mesh - * @deprecated since 5.0.0 - */ - PIXI.mesh = {}; - Object.defineProperties(PIXI.mesh, { - /** - * @class PIXI.mesh.Mesh - * @see PIXI.SimpleMesh - * @deprecated since 5.0.0 - */ - Mesh: { - get: function () { - deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh'); - return PIXI.SimpleMesh; - }, - }, - /** - * @class PIXI.mesh.NineSlicePlane - * @see PIXI.NineSlicePlane - * @deprecated since 5.0.0 - */ - NineSlicePlane: { - get: function () { - deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane'); - return PIXI.NineSlicePlane; - }, - }, - /** - * @class PIXI.mesh.Plane - * @see PIXI.SimplePlane - * @deprecated since 5.0.0 - */ - Plane: { - get: function () { - deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane'); - return PIXI.SimplePlane; - }, - }, - /** - * @class PIXI.mesh.Rope - * @see PIXI.SimpleRope - * @deprecated since 5.0.0 - */ - Rope: { - get: function () { - deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope'); - return PIXI.SimpleRope; - }, - }, - /** - * @class PIXI.mesh.RawMesh - * @see PIXI.Mesh - * @deprecated since 5.0.0 - */ - RawMesh: { - get: function () { - deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh'); - return PIXI.Mesh; - }, - }, - /** - * @class PIXI.mesh.CanvasMeshRenderer - * @see PIXI.CanvasMeshRenderer - * @deprecated since 5.0.0 - */ - CanvasMeshRenderer: { - get: function () { - deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer'); - return PIXI.CanvasMeshRenderer; - }, - }, - /** - * @class PIXI.mesh.MeshRenderer - * @see PIXI.MeshRenderer - * @deprecated since 5.0.0 - */ - MeshRenderer: { - get: function () { - deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer'); - return PIXI.MeshRenderer; - }, - }, - }); - /** - * This namespace has been removed and items have been moved to - * the top-level `PIXI` object. - * @namespace PIXI.particles - * @deprecated since 5.0.0 - */ - PIXI.particles = {}; - Object.defineProperties(PIXI.particles, { - /** - * @class PIXI.particles.ParticleContainer - * @deprecated since 5.0.0 - * @see PIXI.ParticleContainer - */ - ParticleContainer: { - get: function () { - deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer'); - return PIXI.ParticleContainer; - }, - }, - /** - * @class PIXI.particles.ParticleRenderer - * @deprecated since 5.0.0 - * @see PIXI.ParticleRenderer - */ - ParticleRenderer: { - get: function () { - deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer'); - return PIXI.ParticleRenderer; - }, - }, - }); - /** - * This namespace has been removed and items have been moved to - * the top-level `PIXI` object. - * @namespace PIXI.ticker - * @deprecated since 5.0.0 - */ - PIXI.ticker = {}; - Object.defineProperties(PIXI.ticker, { - /** - * @class PIXI.ticker.Ticker - * @deprecated since 5.0.0 - * @see PIXI.Ticker - */ - Ticker: { - get: function () { - deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker'); - return PIXI.Ticker; - }, - }, - /** - * @name PIXI.ticker.shared - * @type {PIXI.Ticker} - * @deprecated since 5.0.0 - * @see PIXI.Ticker.shared - */ - shared: { - get: function () { - deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared'); - return PIXI.Ticker.shared; - }, - }, - }); - /** - * All classes on this namespace have moved to the high-level `PIXI` object. - * @namespace PIXI.loaders - * @deprecated since 5.0.0 - */ - PIXI.loaders = {}; - Object.defineProperties(PIXI.loaders, { - /** - * @class PIXI.loaders.Loader - * @see PIXI.Loader - * @deprecated since 5.0.0 - */ - Loader: { - get: function () { - deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader'); - return PIXI.Loader; - }, - }, - /** - * @class PIXI.loaders.Resource - * @see PIXI.LoaderResource - * @deprecated since 5.0.0 - */ - Resource: { - get: function () { - deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource'); - return PIXI.LoaderResource; - }, - }, - /** - * @function PIXI.loaders.bitmapFontParser - * @see PIXI.BitmapFontLoader.use - * @deprecated since 5.0.0 - */ - bitmapFontParser: { - get: function () { - deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use'); - return PIXI.BitmapFontLoader.use; - }, - }, - /** - * @function PIXI.loaders.parseBitmapFontData - * @deprecated since 5.0.0 - */ - parseBitmapFontData: { - get: function () { - deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed'); - }, - }, - /** - * @function PIXI.loaders.spritesheetParser - * @see PIXI.SpritesheetLoader.use - * @deprecated since 5.0.0 - */ - spritesheetParser: { - get: function () { - deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use'); - return PIXI.SpritesheetLoader.use; - }, - }, - /** - * @function PIXI.loaders.getResourcePath - * @see PIXI.SpritesheetLoader.getResourcePath - * @deprecated since 5.0.0 - */ - getResourcePath: { - get: function () { - deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath'); - return PIXI.SpritesheetLoader.getResourcePath; - }, - }, - }); - /** - * @function PIXI.loaders.Loader.addPixiMiddleware - * @see PIXI.Loader.registerPlugin - * @deprecated since 5.0.0 - * @param {function} middleware - */ - PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) { - deprecation(v5, 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'); - return PIXI.loaders.Loader.registerPlugin({ use: middleware() }); - }; - // convenience for converting event name to signal name - var eventToSignal = function (event) { - return "on" + event.charAt(0).toUpperCase() + event.slice(1); - }; - Object.assign(PIXI.Loader.prototype, { - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#on - * @deprecated since 5.0.0 - */ - on: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#on is completely deprecated, use PIXI.Loader#" + signal + ".add"); - }, - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#once - * @deprecated since 5.0.0 - */ - once: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#once is completely deprecated, use PIXI.Loader#" + signal + ".once"); - }, - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#off - * @deprecated since 5.0.0 - */ - off: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#off is completely deprecated, use PIXI.Loader#" + signal + ".detach"); - }, - }); - /** - * @class PIXI.extract.WebGLExtract - * @deprecated since 5.0.0 - * @see PIXI.Extract - */ - Object.defineProperty(PIXI.extract, 'WebGLExtract', { - get: function () { - deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract'); - return PIXI.Extract; - }, - }); - /** - * @class PIXI.prepare.WebGLPrepare - * @deprecated since 5.0.0 - * @see PIXI.Prepare - */ - Object.defineProperty(PIXI.prepare, 'WebGLPrepare', { - get: function () { - deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare'); - return PIXI.Prepare; - }, - }); - /** - * @method PIXI.Container#_renderWebGL - * @private - * @deprecated since 5.0.0 - * @see PIXI.Container#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) { - deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render'); - this._render(renderer); - }; - /** - * @method PIXI.Container#renderWebGL - * @deprecated since 5.0.0 - * @see PIXI.Container#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) { - deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render'); - this.render(renderer); - }; - /** - * @method PIXI.DisplayObject#renderWebGL - * @deprecated since 5.0.0 - * @see PIXI.DisplayObject#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) { - deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render'); - this.render(renderer); - }; - /** - * @method PIXI.Container#renderAdvancedWebGL - * @deprecated since 5.0.0 - * @see PIXI.Container#renderAdvanced - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) { - deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced'); - this.renderAdvanced(renderer); - }; - Object.defineProperties(PIXI.settings, { - /** - * Default transform type. - * - * @static - * @deprecated since 5.0.0 - * @memberof PIXI.settings - * @type {PIXI.TRANSFORM_MODE} - * @default PIXI.TRANSFORM_MODE.STATIC - */ - TRANSFORM_MODE: { - get: function () { - deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); - return 0; - }, - set: function () { - deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); - }, - }, - }); - var BaseTextureAny = PIXI.BaseTexture; - /** - * @method loadSource - * @memberof PIXI.BaseTexture# - * @deprecated since 5.0.0 - */ - BaseTextureAny.prototype.loadSource = function loadSource(image) { - deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated'); - var resource = PIXI.resources.autoDetectResource(image); - resource.internal = true; - this.setResource(resource); - this.update(); - }; - var baseTextureIdDeprecation = false; - Object.defineProperties(BaseTextureAny.prototype, { - /** - * @name PIXI.BaseTexture#hasLoaded - * @type {boolean} - * @deprecated since 5.0.0 - * @readonly - * @see PIXI.BaseTexture#valid - */ - hasLoaded: { - get: function () { - deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid'); - return this.valid; - }, - }, - /** - * @name PIXI.BaseTexture#imageUrl - * @type {string} - * @deprecated since 5.0.0 - * @see PIXI.resources.ImageResource#url - */ - imageUrl: { - get: function () { - var _a; - deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - return (_a = this.resource) === null || _a === void 0 ? void 0 : _a.url; - }, - set: function (imageUrl) { - deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - if (this.resource) { - this.resource.url = imageUrl; - } - }, - }, - /** - * @name PIXI.BaseTexture#source - * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} - * @deprecated since 5.0.0 - * @readonly - * @see PIXI.resources.BaseImageResource#source - */ - source: { - get: function () { - deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`'); - return this.resource.source; - }, - set: function (source) { - deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` ' - + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.'); - if (this.resource) { - this.resource.source = source; - } - }, - }, - /** - * @name PIXI.BaseTexture#premultiplyAlpha - * @type {boolean} - * @deprecated since 5.2.0 - * @readonly - * @see PIXI.BaseTexture#alphaMode - */ - premultiplyAlpha: { - get: function () { - deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' - + ', see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; - }, - set: function (value) { - deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' - + ', see `PIXI.ALPHA_MODES`'); - this.alphaMode = Number(value); - }, - }, - /** - * Batch local field, stores current texture location - * - * @name PIXI.BaseTexture#_id - * @deprecated since 5.2.0 - * @type {number} - * @see PIXI.BaseTexture#_batchLocation - */ - _id: { - get: function () { - if (!baseTextureIdDeprecation) { - // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible - deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`'); - baseTextureIdDeprecation = true; - } - return this._batchLocation; - }, - set: function (value) { - this._batchLocation = value; - }, - }, - }); - /** - * @method fromImage - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) { - deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); - }; - /** - * @method fromCanvas - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromCanvas = function fromCanvas(canvas, scaleMode) { - deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from'); - return BaseTextureAny.from(canvas, { scaleMode: scaleMode }); - }; - /** - * @method fromSVG - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) { - deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); - }; - Object.defineProperties(PIXI.resources.ImageResource.prototype, { - /** - * @name PIXI.resources.ImageResource#premultiplyAlpha - * @type {boolean} - * @deprecated since 5.2.0 - * @readonly - * @see PIXI.resources.ImageResource#alphaMode - */ - premultiplyAlpha: { - get: function () { - deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' - + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; - }, - set: function (value) { - deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' - + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); - this.alphaMode = Number(value); - }, - }, - }); - /** - * @method PIXI.Point#copy - * @deprecated since 5.0.0 - * @see PIXI.Point#copyFrom - */ - PIXI.Point.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.ObservablePoint#copy - * @deprecated since 5.0.0 - * @see PIXI.ObservablePoint#copyFrom - */ - PIXI.ObservablePoint.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.Rectangle#copy - * @deprecated since 5.0.0 - * @see PIXI.Rectangle#copyFrom - */ - PIXI.Rectangle.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.Matrix#copy - * @deprecated since 5.0.0 - * @see PIXI.Matrix#copyTo - */ - PIXI.Matrix.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo'); - return this.copyTo(p); - }; - /** - * @method PIXI.systems.StateSystem#setState - * @deprecated since 5.1.0 - * @see PIXI.systems.StateSystem#set - */ - PIXI.systems.StateSystem.prototype.setState = function setState(s) { - deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set'); - return this.set(s); - }; - Object.assign(PIXI.systems.FilterSystem.prototype, { - /** - * @method PIXI.FilterManager#getRenderTarget - * @deprecated since 5.0.0 - * @see PIXI.systems.FilterSystem#getFilterTexture - */ - getRenderTarget: function (_clear, resolution) { - deprecation(v5, 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'); - return this.getFilterTexture(null, resolution); - }, - /** - * @method PIXI.FilterManager#returnRenderTarget - * @deprecated since 5.0.0 - * @see PIXI.systems.FilterSystem#returnFilterTexture - */ - returnRenderTarget: function (renderTexture) { - deprecation(v5, 'PIXI.FilterManager.returnRenderTarget method has been replaced with ' - + 'PIXI.systems.FilterSystem.returnFilterTexture'); - this.returnFilterTexture(renderTexture); - }, - /** - * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix - * @deprecated since 5.0.0 - * @param {PIXI.Matrix} outputMatrix - the matrix to output to. - * @return {PIXI.Matrix} The mapped matrix. - */ - calculateScreenSpaceMatrix: function (outputMatrix) { - deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, ' - + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead'); - var mappedMatrix = outputMatrix.identity(); - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); - mappedMatrix.scale(destinationFrame.width, destinationFrame.height); - return mappedMatrix; - }, - /** - * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix - * @deprecated since 5.0.0 - * @param {PIXI.Matrix} outputMatrix - The matrix to output to. - * @return {PIXI.Matrix} The mapped matrix. - */ - calculateNormalizedScreenSpaceMatrix: function (outputMatrix) { - deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, ' - + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.'); - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var mappedMatrix = outputMatrix.identity(); - mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); - var translateScaleX = (destinationFrame.width / sourceFrame.width); - var translateScaleY = (destinationFrame.height / sourceFrame.height); - mappedMatrix.scale(translateScaleX, translateScaleY); - return mappedMatrix; - }, - }); - Object.defineProperties(PIXI.RenderTexture.prototype, { - /** - * @name PIXI.RenderTexture#sourceFrame - * @type {PIXI.Rectangle} - * @deprecated since 5.0.0 - * @readonly - */ - sourceFrame: { - get: function () { - deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed'); - return this.filterFrame; - }, - }, - /** - * @name PIXI.RenderTexture#size - * @type {PIXI.Rectangle} - * @deprecated since 5.0.0 - * @readonly - */ - size: { - get: function () { - deprecation(v5, 'PIXI.RenderTexture.size property has been removed'); - return this._frame; - }, - }, - }); - /** - * @class BlurXFilter - * @memberof PIXI.filters - * @deprecated since 5.0.0 - * @see PIXI.filters.BlurFilterPass - */ - var BlurXFilter = /** @class */ (function (_super) { - __extends$k(BlurXFilter, _super); - function BlurXFilter(strength, quality, resolution, kernelSize) { - var _this = this; - deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - _this = _super.call(this, true, strength, quality, resolution, kernelSize) || this; - return _this; - } - return BlurXFilter; - }(PIXI.filters.BlurFilterPass)); - /** - * @class BlurYFilter - * @memberof PIXI.filters - * @deprecated since 5.0.0 - * @see PIXI.filters.BlurFilterPass - */ - var BlurYFilter = /** @class */ (function (_super) { - __extends$k(BlurYFilter, _super); - function BlurYFilter(strength, quality, resolution, kernelSize) { - var _this = this; - deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - _this = _super.call(this, false, strength, quality, resolution, kernelSize) || this; - return _this; - } - return BlurYFilter; - }(PIXI.filters.BlurFilterPass)); - Object.assign(PIXI.filters, { - BlurXFilter: BlurXFilter, - BlurYFilter: BlurYFilter, - }); - var SpriteAny = PIXI.Sprite, TextureAny = PIXI.Texture, GraphicsAny = PIXI.Graphics; - // Support for pixi.js-legacy bifurcation - // give users a friendly assist to use legacy - if (!GraphicsAny.prototype.generateCanvasTexture) { - GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture() { - deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in "pixi.js-legacy"'); - }; - } - /** - * @deprecated since 5.0.0 - * @member {PIXI.Graphics} PIXI.Graphics#graphicsData - * @see PIXI.Graphics#geometry - * @readonly - */ - Object.defineProperty(GraphicsAny.prototype, 'graphicsData', { - get: function () { - deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData'); - return this.geometry.graphicsData; - }, - }); - // Use these to deprecate all the Sprite from* methods - function spriteFrom(name, source, crossorigin, scaleMode) { - deprecation(v5, "PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from"); - return SpriteAny.from(source, { - resourceOptions: { - scale: scaleMode, - crossorigin: crossorigin, - }, - }); - } - /** - * @deprecated since 5.0.0 - * @see PIXI.Sprite.from - * @method PIXI.Sprite.fromImage - * @return {PIXI.Sprite} - */ - SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromSVG - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromCanvas - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromVideo - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromFrame - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame'); - // Use these to deprecate all the Texture from* methods - function textureFrom(name, source, crossorigin, scaleMode) { - deprecation(v5, "PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from"); - return TextureAny.from(source, { - resourceOptions: { - scale: scaleMode, - crossorigin: crossorigin, - }, - }); - } - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromImage - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromImage = textureFrom.bind(null, 'fromImage'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromSVG - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromCanvas - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromVideo - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromFrame - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame'); - /** - * @deprecated since 5.0.0 - * @member {boolean} PIXI.AbstractRenderer#autoResize - * @see PIXI.AbstractRenderer#autoDensity - */ - Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', { - get: function () { - deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' - + 'use PIXI.AbstractRenderer.autoDensity'); - return this.autoDensity; - }, - set: function (value) { - deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' - + 'use PIXI.AbstractRenderer.autoDensity'); - this.autoDensity = value; - }, - }); - /** - * @deprecated since 5.0.0 - * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager - * @see PIXI.Renderer#texture - */ - Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', { - get: function () { - deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture'); - return this.texture; - }, - }); - /** - * @namespace PIXI.utils.mixins - * @deprecated since 5.0.0 - */ - PIXI.utils.mixins = { - /** - * @memberof PIXI.utils.mixins - * @function mixin - * @deprecated since 5.0.0 - */ - mixin: function () { - deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available'); - }, - /** - * @memberof PIXI.utils.mixins - * @function delayMixin - * @deprecated since 5.0.0 - */ - delayMixin: function () { - deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available'); - }, - /** - * @memberof PIXI.utils.mixins - * @function performMixins - * @deprecated since 5.0.0 - */ - performMixins: function () { - deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available'); - }, - }; - /** - * @memberof PIXI.BitmapText - * @member {object} font - * @deprecated since 5.3.0 - */ - Object.defineProperty(PIXI.BitmapText.prototype, 'font', { - get: function () { - deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' - + 'use fontName, fontSize, tint or align properties'); - return { - name: this._fontName, - size: this._fontSize, - tint: this._tint, - align: this._align, - }; - }, - set: function (value) { - deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' - + 'use fontName, fontSize, tint or align properties'); - if (!value) { - return; - } - var style = { font: value }; - this._upgradeStyle(style); - style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size; - this._fontName = style.fontName; - this._fontSize = style.fontSize; - this.dirty = true; - }, - }); - } - - // Install renderer plugins - Renderer.registerPlugin('accessibility', AccessibilityManager); - Renderer.registerPlugin('extract', Extract); - Renderer.registerPlugin('interaction', InteractionManager); - Renderer.registerPlugin('particle', ParticleRenderer); - Renderer.registerPlugin('prepare', Prepare); - Renderer.registerPlugin('batch', BatchRenderer); - Renderer.registerPlugin('tilingSprite', TilingSpriteRenderer); - Loader$1.registerPlugin(BitmapFontLoader); - Loader$1.registerPlugin(SpritesheetLoader); - Application.registerPlugin(TickerPlugin); - Application.registerPlugin(AppLoaderPlugin); - /** - * String of the current PIXI version. - * - * @static - * @constant - * @memberof PIXI - * @name VERSION - * @type {string} - */ - var VERSION$1 = '5.3.8'; - /** - * @namespace PIXI - */ - /** - * This namespace contains WebGL-only display filters that can be applied - * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. - * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. - * - * All filters must extend {@link PIXI.Filter}. - * - * @example - * // Create a new application - * const app = new PIXI.Application(); - * - * // Draw a green rectangle - * const rect = new PIXI.Graphics() - * .beginFill(0x00ff00) - * .drawRect(40, 40, 200, 200); - * - * // Add a blur filter - * rect.filters = [new PIXI.filters.BlurFilter()]; - * - * // Display rectangle - * app.stage.addChild(rect); - * document.body.appendChild(app.view); - * @namespace PIXI.filters - */ - var filters = { - AlphaFilter: AlphaFilter, - BlurFilter: BlurFilter, - BlurFilterPass: BlurFilterPass, - ColorMatrixFilter: ColorMatrixFilter, - DisplacementFilter: DisplacementFilter, - FXAAFilter: FXAAFilter, - NoiseFilter: NoiseFilter, - }; - - /*! - * @pixi/canvas-renderer - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-renderer is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$l = function(d, b) { - extendStatics$l = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$l(d, b); - }; - - function __extends$l(d, b) { - extendStatics$l(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * A set of functions used to handle masking. - * - * Sprite masking is not supported on the CanvasRenderer. - * - * @class - * @memberof PIXI - */ - var CanvasMaskManager = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. - */ - function CanvasMaskManager(renderer) { - this.renderer = renderer; - this._foundShapes = []; - } - /** - * This method adds it to the current stack of masks. - * - * @param {PIXI.MaskData | PIXI.Graphics} maskData - the maskData that will be pushed - */ - CanvasMaskManager.prototype.pushMask = function (maskData) { - var renderer = this.renderer; - var maskObject = (maskData.maskObject || maskData); - renderer.context.save(); - // TODO support sprite alpha masks?? - // lots of effort required. If demand is great enough.. - var foundShapes = this._foundShapes; - this.recursiveFindShapes(maskObject, foundShapes); - if (foundShapes.length > 0) { - var context = renderer.context; - context.beginPath(); - for (var i = 0; i < foundShapes.length; i++) { - var shape = foundShapes[i]; - var transform = shape.transform.worldTransform; - this.renderer.setContextTransform(transform); - this.renderGraphicsShape(shape); - } - foundShapes.length = 0; - context.clip(); - } - }; - /** - * Renders all PIXI.Graphics shapes in a subtree. - * - * @param {PIXI.Container} container - container to scan. - * @param {PIXI.Graphics[]} out - where to put found shapes - */ - CanvasMaskManager.prototype.recursiveFindShapes = function (container, out) { - if (container.geometry && container.geometry.graphicsData) { - out.push(container); - } - var children = container.children; - if (children) { - for (var i = 0; i < children.length; i++) { - this.recursiveFindShapes(children[i], out); - } - } - }; - /** - * Renders a PIXI.Graphics shape. - * - * @param {PIXI.Graphics} graphics - The object to render. - */ - CanvasMaskManager.prototype.renderGraphicsShape = function (graphics) { - graphics.finishPoly(); - var context = this.renderer.context; - var graphicsData = graphics.geometry.graphicsData; - var len = graphicsData.length; - if (len === 0) { - return; - } - for (var i = 0; i < len; i++) { - var data = graphicsData[i]; - var shape = data.shape; - if (shape.type === exports.SHAPES.POLY) { - var points = shape.points; - context.moveTo(points[0], points[1]); - for (var j = 1; j < points.length / 2; j++) { - context.lineTo(points[j * 2], points[(j * 2) + 1]); - } - // if the first and last point are the same close the path - much neater :) - if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1]) { - context.closePath(); - } - } - else if (shape.type === exports.SHAPES.RECT) { - context.rect(shape.x, shape.y, shape.width, shape.height); - context.closePath(); - } - else if (shape.type === exports.SHAPES.CIRC) { - // TODO - need to be Undefined! - context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI); - context.closePath(); - } - else if (shape.type === exports.SHAPES.ELIP) { - // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas - var w = shape.width * 2; - var h = shape.height * 2; - var x = shape.x - (w / 2); - var y = shape.y - (h / 2); - var kappa = 0.5522848; - var ox = (w / 2) * kappa; // control point offset horizontal - var oy = (h / 2) * kappa; // control point offset vertical - var xe = x + w; // x-end - var ye = y + h; // y-end - var xm = x + (w / 2); // x-middle - var ym = y + (h / 2); // y-middle - context.moveTo(x, ym); - context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); - context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - context.closePath(); - } - else if (shape.type === exports.SHAPES.RREC) { - var rx = shape.x; - var ry = shape.y; - var width = shape.width; - var height = shape.height; - var radius = shape.radius; - var maxRadius = Math.min(width, height) / 2 | 0; - radius = radius > maxRadius ? maxRadius : radius; - context.moveTo(rx, ry + radius); - context.lineTo(rx, ry + height - radius); - context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height); - context.lineTo(rx + width - radius, ry + height); - context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius); - context.lineTo(rx + width, ry + radius); - context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry); - context.lineTo(rx + radius, ry); - context.quadraticCurveTo(rx, ry, rx, ry + radius); - context.closePath(); - } - } - }; - /** - * Restores the current drawing context to the state it was before the mask was applied. - * - * @param {PIXI.CanvasRenderer} renderer - The renderer context to use. - */ - CanvasMaskManager.prototype.popMask = function (renderer) { - renderer.context.restore(); - renderer.invalidateBlendMode(); - }; - /** - * Destroys this canvas mask manager. - * - */ - CanvasMaskManager.prototype.destroy = function () { - /* empty */ - }; - return CanvasMaskManager; - }()); - - /** - * Creates a little colored canvas - * - * @ignore - * @param {string} color - The color to make the canvas - * @return {canvas} a small canvas element - */ - function createColoredCanvas(color) { - var canvas = document.createElement('canvas'); - canvas.width = 6; - canvas.height = 1; - var context = canvas.getContext('2d'); - context.fillStyle = color; - context.fillRect(0, 0, 6, 1); - return canvas; - } - /** - * Checks whether the Canvas BlendModes are supported by the current browser - * - * @private - * @return {boolean} whether they are supported - */ - function canUseNewCanvasBlendModes() { - if (typeof document === 'undefined') { - return false; - } - var magenta = createColoredCanvas('#ff00ff'); - var yellow = createColoredCanvas('#ffff00'); - var canvas = document.createElement('canvas'); - canvas.width = 6; - canvas.height = 1; - var context = canvas.getContext('2d'); - context.globalCompositeOperation = 'multiply'; - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); - var imageData = context.getImageData(2, 0, 1, 1); - if (!imageData) { - return false; - } - var data = imageData.data; - return (data[0] === 255 && data[1] === 0 && data[2] === 0); - } - - /** - * Maps blend combinations to Canvas. - * - * @memberof PIXI - * @function mapCanvasBlendModesToPixi - * @private - * @param {string[]} [array=[]] - The array to output into. - * @return {string[]} Mapped modes. - */ - function mapCanvasBlendModesToPixi(array) { - if (array === void 0) { array = []; } - if (canUseNewCanvasBlendModes()) { - array[exports.BLEND_MODES.NORMAL] = 'source-over'; - array[exports.BLEND_MODES.ADD] = 'lighter'; // IS THIS OK??? - array[exports.BLEND_MODES.MULTIPLY] = 'multiply'; - array[exports.BLEND_MODES.SCREEN] = 'screen'; - array[exports.BLEND_MODES.OVERLAY] = 'overlay'; - array[exports.BLEND_MODES.DARKEN] = 'darken'; - array[exports.BLEND_MODES.LIGHTEN] = 'lighten'; - array[exports.BLEND_MODES.COLOR_DODGE] = 'color-dodge'; - array[exports.BLEND_MODES.COLOR_BURN] = 'color-burn'; - array[exports.BLEND_MODES.HARD_LIGHT] = 'hard-light'; - array[exports.BLEND_MODES.SOFT_LIGHT] = 'soft-light'; - array[exports.BLEND_MODES.DIFFERENCE] = 'difference'; - array[exports.BLEND_MODES.EXCLUSION] = 'exclusion'; - array[exports.BLEND_MODES.HUE] = 'hue'; - array[exports.BLEND_MODES.SATURATION] = 'saturate'; - array[exports.BLEND_MODES.COLOR] = 'color'; - array[exports.BLEND_MODES.LUMINOSITY] = 'luminosity'; - } - else { - // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough' - array[exports.BLEND_MODES.NORMAL] = 'source-over'; - array[exports.BLEND_MODES.ADD] = 'lighter'; // IS THIS OK??? - array[exports.BLEND_MODES.MULTIPLY] = 'source-over'; - array[exports.BLEND_MODES.SCREEN] = 'source-over'; - array[exports.BLEND_MODES.OVERLAY] = 'source-over'; - array[exports.BLEND_MODES.DARKEN] = 'source-over'; - array[exports.BLEND_MODES.LIGHTEN] = 'source-over'; - array[exports.BLEND_MODES.COLOR_DODGE] = 'source-over'; - array[exports.BLEND_MODES.COLOR_BURN] = 'source-over'; - array[exports.BLEND_MODES.HARD_LIGHT] = 'source-over'; - array[exports.BLEND_MODES.SOFT_LIGHT] = 'source-over'; - array[exports.BLEND_MODES.DIFFERENCE] = 'source-over'; - array[exports.BLEND_MODES.EXCLUSION] = 'source-over'; - array[exports.BLEND_MODES.HUE] = 'source-over'; - array[exports.BLEND_MODES.SATURATION] = 'source-over'; - array[exports.BLEND_MODES.COLOR] = 'source-over'; - array[exports.BLEND_MODES.LUMINOSITY] = 'source-over'; - } - // not-premultiplied, only for webgl - array[exports.BLEND_MODES.NORMAL_NPM] = array[exports.BLEND_MODES.NORMAL]; - array[exports.BLEND_MODES.ADD_NPM] = array[exports.BLEND_MODES.ADD]; - array[exports.BLEND_MODES.SCREEN_NPM] = array[exports.BLEND_MODES.SCREEN]; - // composite operations - array[exports.BLEND_MODES.SRC_IN] = 'source-in'; - array[exports.BLEND_MODES.SRC_OUT] = 'source-out'; - array[exports.BLEND_MODES.SRC_ATOP] = 'source-atop'; - array[exports.BLEND_MODES.DST_OVER] = 'destination-over'; - array[exports.BLEND_MODES.DST_IN] = 'destination-in'; - array[exports.BLEND_MODES.DST_OUT] = 'destination-out'; - array[exports.BLEND_MODES.DST_ATOP] = 'destination-atop'; - array[exports.BLEND_MODES.XOR] = 'xor'; - // SUBTRACT from flash, does not exist in canvas - array[exports.BLEND_MODES.SUBTRACT] = 'source-over'; - return array; - } - - var tempMatrix$1 = new Matrix(); - /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. - * - * This renderer should be used for browsers that do not support WebGL. - * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! - * - * @class - * @memberof PIXI - * @extends PIXI.AbstractRenderer - */ - var CanvasRenderer = /** @class */ (function (_super) { - __extends$l(CanvasRenderer, _super); - /** - * @param {object} [options] - The optional renderer parameters - * @param {number} [options.width=800] - the width of the screen - * @param {number} [options.height=600] - the height of the screen - * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional - * @param {boolean} [options.transparent=false] - If the render view is transparent, default false - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1 - * @param {boolean} [options.antialias=false] - sets antialias - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The - * resolution of the renderer retina would be 2. - * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, - * enable this if you need to call toDataUrl on the webgl context. - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - */ - function CanvasRenderer(options) { - var _this = _super.call(this, exports.RENDERER_TYPE.CANVAS, options) || this; - /** - * The root canvas 2d context that everything is drawn with. - * - * @member {CanvasRenderingContext2D} - */ - _this.rootContext = _this.view.getContext('2d', { alpha: _this.transparent }); - /** - * The currently active canvas 2d context (could change with renderTextures) - * - * @member {CanvasRenderingContext2D} - */ - _this.context = _this.rootContext; - /** - * Boolean flag controlling canvas refresh. - * - * @member {boolean} - */ - _this.refresh = true; - /** - * Instance of a CanvasMaskManager, handles masking when using the canvas renderer. - * - * @member {PIXI.CanvasMaskManager} - */ - _this.maskManager = new CanvasMaskManager(_this); - /** - * The canvas property used to set the canvas smoothing property. - * - * @member {string} - */ - _this.smoothProperty = 'imageSmoothingEnabled'; - if (!_this.rootContext.imageSmoothingEnabled) { - var rc = _this.rootContext; - if (rc.webkitImageSmoothingEnabled) { - _this.smoothProperty = 'webkitImageSmoothingEnabled'; - } - else if (rc.mozImageSmoothingEnabled) { - _this.smoothProperty = 'mozImageSmoothingEnabled'; - } - else if (rc.oImageSmoothingEnabled) { - _this.smoothProperty = 'oImageSmoothingEnabled'; - } - else if (rc.msImageSmoothingEnabled) { - _this.smoothProperty = 'msImageSmoothingEnabled'; - } - } - _this.initPlugins(CanvasRenderer.__plugins); - /** - * Tracks the blend modes useful for this renderer. - * - * @member {object} - */ - _this.blendModes = mapCanvasBlendModesToPixi(); - _this._activeBlendMode = null; - _this._outerBlend = false; - /** - * Projection transform, passed in render() stored here - * @type {null} - * @private - */ - _this._projTransform = null; - _this.renderingToScreen = false; - sayHello('Canvas'); - /** - * Fired after rendering finishes. - * - * @event PIXI.CanvasRenderer#postrender - */ - /** - * Fired before rendering starts. - * - * @event PIXI.CanvasRenderer#prerender - */ - _this.resize(_this.options.width, _this.options.height); - return _this; - } - /** - * Renders the object to this canvas view - * - * @param {PIXI.DisplayObject} displayObject - The object to be rendered - * @param {PIXI.RenderTexture} [renderTexture] - A render texture to be rendered to. - * If unset, it will render to the root context. - * @param {boolean} [clear=this.clearBeforeRender] - Whether to clear the canvas before drawing - * @param {PIXI.Matrix} [transform] - A transformation to be applied - * @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform - */ - CanvasRenderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { - if (!this.view) { - return; - } - // can be handy to know! - this.renderingToScreen = !renderTexture; - this.emit('prerender'); - var rootResolution = this.resolution; - if (renderTexture) { - renderTexture = renderTexture.castToBaseTexture(); - if (!renderTexture._canvasRenderTarget) { - renderTexture._canvasRenderTarget = new CanvasRenderTarget(renderTexture.width, renderTexture.height, renderTexture.resolution); - renderTexture.resource = new index.CanvasResource(renderTexture._canvasRenderTarget.canvas); - renderTexture.valid = true; - } - this.context = renderTexture._canvasRenderTarget.context; - this.resolution = renderTexture._canvasRenderTarget.resolution; - } - else { - this.context = this.rootContext; - } - var context = this.context; - this._projTransform = transform || null; - if (!renderTexture) { - this._lastObjectRendered = displayObject; - } - if (!skipUpdateTransform) { - // update the scene graph - var cacheParent = displayObject.enableTempParent(); - displayObject.updateTransform(); - displayObject.disableTempParent(cacheParent); - } - context.save(); - context.setTransform(1, 0, 0, 1, 0, 0); - context.globalAlpha = 1; - this._activeBlendMode = exports.BLEND_MODES.NORMAL; - this._outerBlend = false; - context.globalCompositeOperation = this.blendModes[exports.BLEND_MODES.NORMAL]; - if (clear !== undefined ? clear : this.clearBeforeRender) { - if (this.renderingToScreen) { - if (this.transparent) { - context.clearRect(0, 0, this.width, this.height); - } - else { - context.fillStyle = this._backgroundColorString; - context.fillRect(0, 0, this.width, this.height); - } - } - else { - renderTexture = renderTexture; - renderTexture._canvasRenderTarget.clear(); - var clearColor = renderTexture.clearColor; - if (clearColor[3] > 0) { - context.fillStyle = hex2string(rgb2hex(clearColor)); - context.fillRect(0, 0, renderTexture.realWidth, renderTexture.realHeight); - } - } - } - // TODO RENDER TARGET STUFF HERE.. - var tempContext = this.context; - this.context = context; - displayObject.renderCanvas(this); - this.context = tempContext; - context.restore(); - this.resolution = rootResolution; - this._projTransform = null; - this.emit('postrender'); - }; - /** - * sets matrix of context - * called only from render() methods - * takes care about resolution - * @param {PIXI.Matrix} transform - world matrix of current element - * @param {boolean} [roundPixels] - whether to round (tx,ty) coords - * @param {number} [localResolution] - If specified, used instead of `renderer.resolution` for local scaling - */ - CanvasRenderer.prototype.setContextTransform = function (transform, roundPixels, localResolution) { - var mat = transform; - var proj = this._projTransform; - var resolution = this.resolution; - localResolution = localResolution || resolution; - if (proj) { - mat = tempMatrix$1; - mat.copyFrom(transform); - mat.prepend(proj); - } - if (roundPixels) { - this.context.setTransform(mat.a * localResolution, mat.b * localResolution, mat.c * localResolution, mat.d * localResolution, (mat.tx * resolution) | 0, (mat.ty * resolution) | 0); - } - else { - this.context.setTransform(mat.a * localResolution, mat.b * localResolution, mat.c * localResolution, mat.d * localResolution, mat.tx * resolution, mat.ty * resolution); - } - }; - /** - * Clear the canvas of renderer. - * - * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent. - */ - CanvasRenderer.prototype.clear = function (clearColor) { - var context = this.context; - clearColor = clearColor || this._backgroundColorString; - if (!this.transparent && clearColor) { - context.fillStyle = clearColor; - context.fillRect(0, 0, this.width, this.height); - } - else { - context.clearRect(0, 0, this.width, this.height); - } - }; - /** - * Sets the blend mode of the renderer. - * - * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values. - * @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite. - * Pass `true` only if you are ready to use them. - */ - CanvasRenderer.prototype.setBlendMode = function (blendMode, readyForOuterBlend) { - var outerBlend = blendMode === exports.BLEND_MODES.SRC_IN - || blendMode === exports.BLEND_MODES.SRC_OUT - || blendMode === exports.BLEND_MODES.DST_IN - || blendMode === exports.BLEND_MODES.DST_ATOP; - if (!readyForOuterBlend && outerBlend) { - blendMode = exports.BLEND_MODES.NORMAL; - } - if (this._activeBlendMode === blendMode) { - return; - } - this._activeBlendMode = blendMode; - this._outerBlend = outerBlend; - this.context.globalCompositeOperation = this.blendModes[blendMode]; - }; - /** - * Removes everything from the renderer and optionally removes the Canvas DOM element. - * - * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. - */ - CanvasRenderer.prototype.destroy = function (removeView) { - // call the base destroy - _super.prototype.destroy.call(this, removeView); - this.context = null; - this.refresh = true; - this.maskManager.destroy(); - this.maskManager = null; - this.smoothProperty = null; - }; - /** - * Resizes the canvas view to the specified width and height. - * - * @extends PIXI.AbstractRenderer#resize - * - * @param {number} screenWidth - the new width of the screen - * @param {number} screenHeight - the new height of the screen - */ - CanvasRenderer.prototype.resize = function (screenWidth, screenHeight) { - _super.prototype.resize.call(this, screenWidth, screenHeight); - // reset the scale mode.. oddly this seems to be reset when the canvas is resized. - // surely a browser bug?? Let PixiJS fix that for you.. - if (this.smoothProperty) { - this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === exports.SCALE_MODES.LINEAR); - } - }; - /** - * Checks if blend mode has changed. - */ - CanvasRenderer.prototype.invalidateBlendMode = function () { - this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation); - }; - /** - * Collection of installed plugins. These are included by default in PIXI, but can be excluded - * by creating a custom build. Consult the README for more information about creating custom - * builds and excluding plugins. - * @name PIXI.CanvasRenderer#plugins - * @type {object} - * @readonly - * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.CanvasExtract} extract Extract image data from renderer. - * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.CanvasPrepare} prepare Pre-render display objects. - */ - /** - * Adds a plugin to the renderer. - * - * @method - * @param {string} pluginName - The name of the plugin. - * @param {Function} ctor - The constructor function or class for the plugin. - */ - CanvasRenderer.registerPlugin = function (pluginName, ctor) { - CanvasRenderer.__plugins = CanvasRenderer.__plugins || {}; - CanvasRenderer.__plugins[pluginName] = ctor; - }; - return CanvasRenderer; - }(AbstractRenderer)); - - /** - * Utility methods for Sprite/Texture tinting. - * - * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, - * so be aware of the performance implications. - * - * @namespace PIXI.canvasUtils - * @memberof PIXI - */ - var canvasUtils = { - canvas: null, - /** - * Basically this method just needs a sprite and a color and tints the sprite with the given color. - * - * @memberof PIXI.canvasUtils - * @param {PIXI.Sprite} sprite - the sprite to tint - * @param {number} color - the color to use to tint the sprite with - * @return {HTMLCanvasElement} The tinted canvas - */ - getTintedCanvas: function (sprite, color) { - var texture = sprite.texture; - color = canvasUtils.roundColor(color); - var stringColor = "#" + ("00000" + (color | 0).toString(16)).substr(-6); - texture.tintCache = texture.tintCache || {}; - var cachedCanvas = texture.tintCache[stringColor]; - var canvas; - if (cachedCanvas) { - if (cachedCanvas.tintId === texture._updateID) { - return texture.tintCache[stringColor]; - } - canvas = texture.tintCache[stringColor]; - } - else { - canvas = document.createElement('canvas'); - } - canvasUtils.tintMethod(texture, color, canvas); - canvas.tintId = texture._updateID; - if (canvasUtils.convertTintToImage) { - // is this better? - var tintImage = new Image(); - tintImage.src = canvas.toDataURL(); - texture.tintCache[stringColor] = tintImage; - } - else { - texture.tintCache[stringColor] = canvas; - } - return canvas; - }, - /** - * Basically this method just needs a sprite and a color and tints the sprite with the given color. - * - * @memberof PIXI.canvasUtils - * @param {PIXI.Texture} texture - the sprite to tint - * @param {number} color - the color to use to tint the sprite with - * @return {HTMLCanvasElement} The tinted canvas - */ - getTintedPattern: function (texture, color) { - color = canvasUtils.roundColor(color); - var stringColor = "#" + ("00000" + (color | 0).toString(16)).substr(-6); - texture.patternCache = texture.patternCache || {}; - var pattern = texture.patternCache[stringColor]; - if (pattern && pattern.tintId === texture._updateID) { - return pattern; - } - if (!canvasUtils.canvas) { - canvasUtils.canvas = document.createElement('canvas'); - } - canvasUtils.tintMethod(texture, color, canvasUtils.canvas); - pattern = canvasUtils.canvas.getContext('2d').createPattern(canvasUtils.canvas, 'repeat'); - pattern.tintId = texture._updateID; - texture.patternCache[stringColor] = pattern; - return pattern; - }, - /** - * Tint a texture using the 'multiply' operation. - * - * @memberof PIXI.canvasUtils - * @param {PIXI.Texture} texture - the texture to tint - * @param {number} color - the color to use to tint the sprite with - * @param {HTMLCanvasElement} canvas - the current canvas - */ - tintWithMultiply: function (texture, color, canvas) { - var context = canvas.getContext('2d'); - var crop = texture._frame.clone(); - var resolution = texture.baseTexture.resolution; - crop.x *= resolution; - crop.y *= resolution; - crop.width *= resolution; - crop.height *= resolution; - canvas.width = Math.ceil(crop.width); - canvas.height = Math.ceil(crop.height); - context.save(); - context.fillStyle = "#" + ("00000" + (color | 0).toString(16)).substr(-6); - context.fillRect(0, 0, crop.width, crop.height); - context.globalCompositeOperation = 'multiply'; - var source = texture.baseTexture.getDrawableSource(); - context.drawImage(source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); - context.globalCompositeOperation = 'destination-atop'; - context.drawImage(source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); - context.restore(); - }, - /** - * Tint a texture using the 'overlay' operation. - * - * @memberof PIXI.canvasUtils - * @param {PIXI.Texture} texture - the texture to tint - * @param {number} color - the color to use to tint the sprite with - * @param {HTMLCanvasElement} canvas - the current canvas - */ - tintWithOverlay: function (texture, color, canvas) { - var context = canvas.getContext('2d'); - var crop = texture._frame.clone(); - var resolution = texture.baseTexture.resolution; - crop.x *= resolution; - crop.y *= resolution; - crop.width *= resolution; - crop.height *= resolution; - canvas.width = Math.ceil(crop.width); - canvas.height = Math.ceil(crop.height); - context.save(); - context.globalCompositeOperation = 'copy'; - context.fillStyle = "#" + ("00000" + (color | 0).toString(16)).substr(-6); - context.fillRect(0, 0, crop.width, crop.height); - context.globalCompositeOperation = 'destination-atop'; - context.drawImage(texture.baseTexture.getDrawableSource(), crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); - // context.globalCompositeOperation = 'copy'; - context.restore(); - }, - /** - * Tint a texture pixel per pixel. - * - * @memberof PIXI.canvasUtils - * @param {PIXI.Texture} texture - the texture to tint - * @param {number} color - the color to use to tint the sprite with - * @param {HTMLCanvasElement} canvas - the current canvas - */ - tintWithPerPixel: function (texture, color, canvas) { - var context = canvas.getContext('2d'); - var crop = texture._frame.clone(); - var resolution = texture.baseTexture.resolution; - crop.x *= resolution; - crop.y *= resolution; - crop.width *= resolution; - crop.height *= resolution; - canvas.width = Math.ceil(crop.width); - canvas.height = Math.ceil(crop.height); - context.save(); - context.globalCompositeOperation = 'copy'; - context.drawImage(texture.baseTexture.getDrawableSource(), crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); - context.restore(); - var rgbValues = hex2rgb(color); - var r = rgbValues[0]; - var g = rgbValues[1]; - var b = rgbValues[2]; - var pixelData = context.getImageData(0, 0, crop.width, crop.height); - var pixels = pixelData.data; - for (var i = 0; i < pixels.length; i += 4) { - pixels[i + 0] *= r; - pixels[i + 1] *= g; - pixels[i + 2] *= b; - } - context.putImageData(pixelData, 0, 0); - }, - /** - * Rounds the specified color according to the canvasUtils.cacheStepsPerColorChannel. - * - * @memberof PIXI.canvasUtils - * @param {number} color - the color to round, should be a hex color - * @return {number} The rounded color. - */ - roundColor: function (color) { - var step = canvasUtils.cacheStepsPerColorChannel; - var rgbValues = hex2rgb(color); - rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step); - rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step); - rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step); - return rgb2hex(rgbValues); - }, - /** - * Number of steps which will be used as a cap when rounding colors. - * - * @memberof PIXI.canvasUtils - * @type {number} - */ - cacheStepsPerColorChannel: 8, - /** - * Tint cache boolean flag. - * - * @memberof PIXI.canvasUtils - * @type {boolean} - */ - convertTintToImage: false, - /** - * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method. - * - * @memberof PIXI.canvasUtils - * @type {boolean} - */ - canUseMultiply: canUseNewCanvasBlendModes(), - /** - * The tinting method that will be used. - * - * @memberof PIXI.canvasUtils - * @type {Function} - */ - tintMethod: null, - }; - canvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel; - - // Reference to Renderer.create static function - var parentCreate = Renderer.create; - /** - * Override the Renderer.create to fallback to use CanvasRenderer. - * Also supports forceCanvas option with Application or autoDetectRenderer. - * @private - */ - Renderer.create = function create(options) { - var forceCanvas = options && options.forceCanvas; - if (!forceCanvas) { - try { - return parentCreate(options); - } - catch (err) { - // swallow WebGL-unsupported error - } - } - return new CanvasRenderer(options); - }; - - /** - * Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable - * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package. - * @method getDrawableSource - * @memberof PIXI.BaseTexture# - * @return {PIXI.ICanvasImageSource} Source to render with CanvasRenderer - */ - BaseTexture.prototype.getDrawableSource = function getDrawableSource() { - var resource = this.resource; - return resource ? (resource.bitmap || resource.source) : null; - }; - /** - * A reference to the canvas render target (we only need one as this can be shared across renderers) - * - * @protected - * @member {PIXI.utils.CanvasRenderTarget} _canvasRenderTarget - * @memberof PIXI.BaseRenderTexture# - */ - BaseRenderTexture.prototype._canvasRenderTarget = null; - Texture.prototype.patternCache = null; - Texture.prototype.tintCache = null; - - /*! - * @pixi/canvas-mesh - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-mesh is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Renderer dedicated to meshes. - * - * @class - * @protected - * @memberof PIXI - */ - var CanvasMeshRenderer = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer} renderer - The renderer this downport works for - */ - function CanvasMeshRenderer(renderer) { - this.renderer = renderer; - } - /** - * Renders the Mesh - * - * @param {PIXI.Mesh} mesh - the Mesh to render - */ - CanvasMeshRenderer.prototype.render = function (mesh) { - var renderer = this.renderer; - var transform = mesh.worldTransform; - renderer.context.globalAlpha = mesh.worldAlpha; - renderer.setBlendMode(mesh.blendMode); - renderer.setContextTransform(transform, mesh.roundPixels); - if (mesh.drawMode !== exports.DRAW_MODES.TRIANGLES) { - this._renderTriangleMesh(mesh); - } - else { - this._renderTriangles(mesh); - } - }; - /** - * Draws the object in Triangle Mesh mode - * - * @private - * @param {PIXI.Mesh} mesh - the Mesh to render - */ - CanvasMeshRenderer.prototype._renderTriangleMesh = function (mesh) { - // draw triangles!! - var length = mesh.geometry.buffers[0].data.length; - for (var i = 0; i < length - 2; i++) { - // draw some triangles! - var index = i * 2; - this._renderDrawTriangle(mesh, index, (index + 2), (index + 4)); - } - }; - /** - * Draws the object in triangle mode using canvas - * - * @private - * @param {PIXI.Mesh} mesh - the current mesh - */ - CanvasMeshRenderer.prototype._renderTriangles = function (mesh) { - // draw triangles!! - var indices = mesh.geometry.getIndex().data; - var length = indices.length; - for (var i = 0; i < length; i += 3) { - // draw some triangles! - var index0 = indices[i] * 2; - var index1 = indices[i + 1] * 2; - var index2 = indices[i + 2] * 2; - this._renderDrawTriangle(mesh, index0, index1, index2); - } - }; - /** - * Draws one of the triangles that from the Mesh - * - * @private - * @param {PIXI.Mesh} mesh - the current mesh - * @param {number} index0 - the index of the first vertex - * @param {number} index1 - the index of the second vertex - * @param {number} index2 - the index of the third vertex - */ - CanvasMeshRenderer.prototype._renderDrawTriangle = function (mesh, index0, index1, index2) { - var context = this.renderer.context; - var vertices = mesh.geometry.buffers[0].data; - var uvs = mesh.uvs, texture = mesh.texture; - if (!texture.valid) { - return; - } - var isTinted = mesh.tint !== 0xFFFFFF; - var base = texture.baseTexture; - var textureWidth = base.width; - var textureHeight = base.height; - if (isTinted) { - if (mesh._cachedTint !== mesh.tint) { - mesh._cachedTint = mesh.tint; - mesh._tintedCanvas = canvasUtils.getTintedCanvas(mesh, mesh.tint); - } - } - var textureSource = isTinted ? mesh._tintedCanvas : base.getDrawableSource(); - var u0 = uvs[index0] * base.width; - var u1 = uvs[index1] * base.width; - var u2 = uvs[index2] * base.width; - var v0 = uvs[index0 + 1] * base.height; - var v1 = uvs[index1 + 1] * base.height; - var v2 = uvs[index2 + 1] * base.height; - var x0 = vertices[index0]; - var x1 = vertices[index1]; - var x2 = vertices[index2]; - var y0 = vertices[index0 + 1]; - var y1 = vertices[index1 + 1]; - var y2 = vertices[index2 + 1]; - var canvasPadding = mesh.canvasPadding / this.renderer.resolution; - if (canvasPadding > 0) { - var paddingX = canvasPadding / Math.abs(mesh.worldTransform.a); - var paddingY = canvasPadding / Math.abs(mesh.worldTransform.d); - var centerX = (x0 + x1 + x2) / 3; - var centerY = (y0 + y1 + y2) / 3; - var normX = x0 - centerX; - var normY = y0 - centerY; - var dist = Math.sqrt((normX * normX) + (normY * normY)); - x0 = centerX + ((normX / dist) * (dist + paddingX)); - y0 = centerY + ((normY / dist) * (dist + paddingY)); - // - normX = x1 - centerX; - normY = y1 - centerY; - dist = Math.sqrt((normX * normX) + (normY * normY)); - x1 = centerX + ((normX / dist) * (dist + paddingX)); - y1 = centerY + ((normY / dist) * (dist + paddingY)); - normX = x2 - centerX; - normY = y2 - centerY; - dist = Math.sqrt((normX * normX) + (normY * normY)); - x2 = centerX + ((normX / dist) * (dist + paddingX)); - y2 = centerY + ((normY / dist) * (dist + paddingY)); - } - context.save(); - context.beginPath(); - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.closePath(); - context.clip(); - // Compute matrix transform - var delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2); - var deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2); - var deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2); - var deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2); - var deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2); - var deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2); - var deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2); - context.transform(deltaA / delta, deltaD / delta, deltaB / delta, deltaE / delta, deltaC / delta, deltaF / delta); - context.drawImage(textureSource, 0, 0, textureWidth * base.resolution, textureHeight * base.resolution, 0, 0, textureWidth, textureHeight); - context.restore(); - this.renderer.invalidateBlendMode(); - }; - /** - * Renders a flat Mesh - * - * @private - * @param {PIXI.Mesh} mesh - The Mesh to render - */ - CanvasMeshRenderer.prototype.renderMeshFlat = function (mesh) { - var context = this.renderer.context; - var vertices = mesh.geometry.getBuffer('aVertexPosition').data; - var length = vertices.length / 2; - // this.count++; - context.beginPath(); - for (var i = 1; i < length - 2; ++i) { - // draw some triangles! - var index = i * 2; - var x0 = vertices[index]; - var y0 = vertices[index + 1]; - var x1 = vertices[index + 2]; - var y1 = vertices[index + 3]; - var x2 = vertices[index + 4]; - var y2 = vertices[index + 5]; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - } - context.fillStyle = '#FF0000'; - context.fill(); - context.closePath(); - }; - /** - * destroy the the renderer. - * - */ - CanvasMeshRenderer.prototype.destroy = function () { - this.renderer = null; - }; - return CanvasMeshRenderer; - }()); - - /** - * Default `canvasPadding` for canvas-based Mesh rendering. - * - * @see PIXI.Mesh2d#canvasPadding - * @static - * @name MESH_CANVAS_PADDING - * @memberof PIXI.settings - * @type {number} - * @default 0 - */ - settings.MESH_CANVAS_PADDING = 0; - - /** - * Renders the mesh using the Canvas renderer - * - * @protected - * @method render - * @memberof PIXI.MeshMaterial# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. - * @param {PIXI.Mesh} mesh - Mesh to render. - */ - MeshMaterial.prototype._renderCanvas = function _renderCanvas(renderer, mesh) { - renderer.plugins.mesh.render(mesh); - }; - - /** - * Cached tint value so we can tell when the tint is changed. - * @memberof PIXI.NineSlicePlane# - * @member {number} _cachedTint - * @protected - */ - NineSlicePlane.prototype._cachedTint = 0xFFFFFF; - /** - * Cached tinted texture. - * @memberof PIXI.NineSlicePlane# - * @member {HTMLCanvasElement} _tintedCanvas - * @protected - */ - NineSlicePlane.prototype._tintedCanvas = null; - /** - * Temporary storage for canvas source coords - * @memberof PIXI.NineSlicePlane# - * @member {number[]} _canvasUvs - * @private - */ - NineSlicePlane.prototype._canvasUvs = null; - /** - * Renders the object using the Canvas renderer - * - * @private - * @method _renderCanvas - * @memberof PIXI.NineSlicePlane# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with. - */ - NineSlicePlane.prototype._renderCanvas = function _renderCanvas(renderer) { - var context = renderer.context; - var transform = this.worldTransform; - var isTinted = this.tint !== 0xFFFFFF; - var texture = this.texture; - if (!texture.valid) { - return; - } - // Work out tinting - if (isTinted) { - if (this._cachedTint !== this.tint) { - // Tint has changed, need to update the tinted texture and use that instead - this._cachedTint = this.tint; - this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint); - } - } - var textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas; - if (!this._canvasUvs) { - this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0]; - } - var vertices = this.vertices; - var uvs = this._canvasUvs; - var u0 = isTinted ? 0 : texture.frame.x; - var v0 = isTinted ? 0 : texture.frame.y; - var u1 = u0 + texture.frame.width; - var v1 = v0 + texture.frame.height; - uvs[0] = u0; - uvs[1] = u0 + this._leftWidth; - uvs[2] = u1 - this._rightWidth; - uvs[3] = u1; - uvs[4] = v0; - uvs[5] = v0 + this._topHeight; - uvs[6] = v1 - this._bottomHeight; - uvs[7] = v1; - for (var i = 0; i < 8; i++) { - uvs[i] *= texture.baseTexture.resolution; - } - context.globalAlpha = this.worldAlpha; - renderer.setBlendMode(this.blendMode); - renderer.setContextTransform(transform, this.roundPixels); - for (var row = 0; row < 3; row++) { - for (var col = 0; col < 3; col++) { - var ind = (col * 2) + (row * 8); - var sw = Math.max(1, uvs[col + 1] - uvs[col]); - var sh = Math.max(1, uvs[row + 5] - uvs[row + 4]); - var dw = Math.max(1, vertices[ind + 10] - vertices[ind]); - var dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]); - context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh, vertices[ind], vertices[ind + 1], dw, dh); - } - } - }; - - var warned = false; - /** - * Cached tint value so we can tell when the tint is changed. - * @memberof PIXI.Mesh# - * @member {number} _cachedTint - * @protected - */ - Mesh.prototype._cachedTint = 0xFFFFFF; - /** - * Cached tinted texture. - * @memberof PIXI.Mesh# - * @member {HTMLCanvasElement} _tintedCanvas - * @protected - */ - Mesh.prototype._tintedCanvas = null; - /** - * Renders the object using the Canvas renderer - * - * @private - * @method _renderCanvas - * @memberof PIXI.Mesh# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. - */ - Mesh.prototype._renderCanvas = function _renderCanvas(renderer) { - if (this.shader.uvMatrix) { - this.shader.uvMatrix.update(); - this.calculateUvs(); - } - if (this.material._renderCanvas) { - this.material._renderCanvas(renderer, this); - } - else if (!warned) { - warned = true; - if (window.console) { - console.warn('Mesh with custom shaders are not supported in CanvasRenderer.'); - } - } - }; - // IMPORTANT: Please do NOT use this as a precedent to use `settings` after the object is created - // this was merely created to completely decouple canvas from the base Mesh class and we are - // unable to add `canvasPadding` in the constructor anymore, as the case was for PixiJS v4. - /** - * Internal variable for `canvasPadding`. - * - * @private - * @memberof PIXI.Mesh - * @member {number} - * @default null - */ - Mesh.prototype._canvasPadding = null; - /** - * Triangles in canvas mode are automatically antialiased, use this value to force triangles - * to overlap a bit with each other. To set the global default, set {@link PIXI.settings.MESH_CANVAS_PADDING} - * - * @see PIXI.settings.MESH_CANVAS_PADDING - * @member {number} canvasPadding - * @memberof PIXI.SimpleMesh# - * @default 0 - */ - Object.defineProperty(Mesh.prototype, 'canvasPadding', { - get: function () { - return this._canvasPadding !== null ? this._canvasPadding : settings.MESH_CANVAS_PADDING; - }, - set: function (value) { - this._canvasPadding = value; - }, - }); - - /** - * Renders the object using the Canvas renderer - * - * @private - * @method _renderCanvas - * @memberof PIXI.Mesh# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. - */ - SimpleMesh.prototype._renderCanvas = function _renderCanvas(renderer) { - if (this.autoUpdate) { - this.geometry.getBuffer('aVertexPosition').update(); - } - if (this.shader.update) { - this.shader.update(); - } - this.calculateUvs(); - this.material._renderCanvas(renderer, this); - }; - - /** - * Renders the object using the Canvas renderer - * - * @protected - * @method _renderCanvas - * @memberof PIXI.Mesh# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. - */ - SimpleRope.prototype._renderCanvas = function _renderCanvas(renderer) { - if (this.autoUpdate - || this.geometry._width !== this.shader.texture.height) { - this.geometry._width = this.shader.texture.height; - this.geometry.update(); - } - if (this.shader.update) { - this.shader.update(); - } - this.calculateUvs(); - this.material._renderCanvas(renderer, this); - }; - - /*! - * @pixi/canvas-graphics - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-graphics is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they - * now share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's CanvasGraphicsRenderer: - * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java - */ - /** - * Renderer dedicated to drawing and batching graphics objects. - * - * @class - * @protected - * @memberof PIXI - */ - var CanvasGraphicsRenderer = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer} renderer - The current PIXI renderer. - */ - function CanvasGraphicsRenderer(renderer) { - this.renderer = renderer; - this._svgMatrix = null; - this._tempMatrix = new Matrix(); - } - /** - * calculates fill/stroke style for canvas - * - * @private - * @param {PIXI.FillStyle} style - * @param {number} tint - * @returns {string|CanvasPattern} - */ - CanvasGraphicsRenderer.prototype._calcCanvasStyle = function (style, tint) { - var res; - if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture) { - if (style.texture.valid) { - res = canvasUtils.getTintedPattern(style.texture, tint); - this.setPatternTransform(res, style.matrix || Matrix.IDENTITY); - } - else { - res = '#808080'; - } - } - else { - res = "#" + ("00000" + (tint | 0).toString(16)).substr(-6); - } - return res; - }; - /** - * Renders a Graphics object to a canvas. - * - * @param {PIXI.Graphics} graphics - the actual graphics object to render - */ - CanvasGraphicsRenderer.prototype.render = function (graphics) { - var renderer = this.renderer; - var context = renderer.context; - var worldAlpha = graphics.worldAlpha; - var transform = graphics.transform.worldTransform; - renderer.setContextTransform(transform); - renderer.setBlendMode(graphics.blendMode); - var graphicsData = graphics.geometry.graphicsData; - var contextFillStyle; - var contextStrokeStyle; - var tintR = ((graphics.tint >> 16) & 0xFF) / 255; - var tintG = ((graphics.tint >> 8) & 0xFF) / 255; - var tintB = (graphics.tint & 0xFF) / 255; - for (var i = 0; i < graphicsData.length; i++) { - var data = graphicsData[i]; - var shape = data.shape; - var fillStyle = data.fillStyle; - var lineStyle = data.lineStyle; - var fillColor = data.fillStyle.color | 0; - var lineColor = data.lineStyle.color | 0; - if (data.matrix) { - renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix)); - } - if (fillStyle.visible) { - var fillTint = ((((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16) - + (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8) - + (((fillColor & 0xFF) / 255) * tintB * 255)); - contextFillStyle = this._calcCanvasStyle(fillStyle, fillTint); - } - if (lineStyle.visible) { - var lineTint = ((((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16) - + (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8) - + (((lineColor & 0xFF) / 255) * tintB * 255)); - contextStrokeStyle = this._calcCanvasStyle(lineStyle, lineTint); - } - context.lineWidth = lineStyle.width; - context.lineCap = lineStyle.cap; - context.lineJoin = lineStyle.join; - context.miterLimit = lineStyle.miterLimit; - if (data.type === exports.SHAPES.POLY) { - context.beginPath(); - var tempShape = shape; - var points = tempShape.points; - var holes = data.holes; - var outerArea = void 0; - var innerArea = void 0; - var px = void 0; - var py = void 0; - context.moveTo(points[0], points[1]); - for (var j = 2; j < points.length; j += 2) { - context.lineTo(points[j], points[j + 1]); - } - if (tempShape.closeStroke) { - context.closePath(); - } - if (holes.length > 0) { - outerArea = 0; - px = points[0]; - py = points[1]; - for (var j = 2; j + 2 < points.length; j += 2) { - outerArea += ((points[j] - px) * (points[j + 3] - py)) - - ((points[j + 2] - px) * (points[j + 1] - py)); - } - for (var k = 0; k < holes.length; k++) { - points = holes[k].shape.points; - if (!points) { - continue; - } - innerArea = 0; - px = points[0]; - py = points[1]; - for (var j = 2; j + 2 < points.length; j += 2) { - innerArea += ((points[j] - px) * (points[j + 3] - py)) - - ((points[j + 2] - px) * (points[j + 1] - py)); - } - if (innerArea * outerArea < 0) { - context.moveTo(points[0], points[1]); - for (var j = 2; j < points.length; j += 2) { - context.lineTo(points[j], points[j + 1]); - } - } - else { - context.moveTo(points[points.length - 2], points[points.length - 1]); - for (var j = points.length - 4; j >= 0; j -= 2) { - context.lineTo(points[j], points[j + 1]); - } - } - if (holes[k].shape.closeStroke) { - context.closePath(); - } - } - } - if (fillStyle.visible) { - context.globalAlpha = fillStyle.alpha * worldAlpha; - context.fillStyle = contextFillStyle; - context.fill(); - } - if (lineStyle.visible) { - context.globalAlpha = lineStyle.alpha * worldAlpha; - context.strokeStyle = contextStrokeStyle; - context.stroke(); - } - } - else if (data.type === exports.SHAPES.RECT) { - var tempShape = shape; - if (fillStyle.visible) { - context.globalAlpha = fillStyle.alpha * worldAlpha; - context.fillStyle = contextFillStyle; - context.fillRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height); - } - if (lineStyle.visible) { - context.globalAlpha = lineStyle.alpha * worldAlpha; - context.strokeStyle = contextStrokeStyle; - context.strokeRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height); - } - } - else if (data.type === exports.SHAPES.CIRC) { - var tempShape = shape; - // TODO - need to be Undefined! - context.beginPath(); - context.arc(tempShape.x, tempShape.y, tempShape.radius, 0, 2 * Math.PI); - context.closePath(); - if (fillStyle.visible) { - context.globalAlpha = fillStyle.alpha * worldAlpha; - context.fillStyle = contextFillStyle; - context.fill(); - } - if (lineStyle.visible) { - context.globalAlpha = lineStyle.alpha * worldAlpha; - context.strokeStyle = contextStrokeStyle; - context.stroke(); - } - } - else if (data.type === exports.SHAPES.ELIP) { - // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas - var tempShape = shape; - var w = tempShape.width * 2; - var h = tempShape.height * 2; - var x = tempShape.x - (w / 2); - var y = tempShape.y - (h / 2); - context.beginPath(); - var kappa = 0.5522848; - var ox = (w / 2) * kappa; // control point offset horizontal - var oy = (h / 2) * kappa; // control point offset vertical - var xe = x + w; // x-end - var ye = y + h; // y-end - var xm = x + (w / 2); // x-middle - var ym = y + (h / 2); // y-middle - context.moveTo(x, ym); - context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); - context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - context.closePath(); - if (fillStyle.visible) { - context.globalAlpha = fillStyle.alpha * worldAlpha; - context.fillStyle = contextFillStyle; - context.fill(); - } - if (lineStyle.visible) { - context.globalAlpha = lineStyle.alpha * worldAlpha; - context.strokeStyle = contextStrokeStyle; - context.stroke(); - } - } - else if (data.type === exports.SHAPES.RREC) { - var tempShape = shape; - var rx = tempShape.x; - var ry = tempShape.y; - var width = tempShape.width; - var height = tempShape.height; - var radius = tempShape.radius; - var maxRadius = Math.min(width, height) / 2 | 0; - radius = radius > maxRadius ? maxRadius : radius; - context.beginPath(); - context.moveTo(rx, ry + radius); - context.lineTo(rx, ry + height - radius); - context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height); - context.lineTo(rx + width - radius, ry + height); - context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius); - context.lineTo(rx + width, ry + radius); - context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry); - context.lineTo(rx + radius, ry); - context.quadraticCurveTo(rx, ry, rx, ry + radius); - context.closePath(); - if (fillStyle.visible) { - context.globalAlpha = fillStyle.alpha * worldAlpha; - context.fillStyle = contextFillStyle; - context.fill(); - } - if (lineStyle.visible) { - context.globalAlpha = lineStyle.alpha * worldAlpha; - context.strokeStyle = contextStrokeStyle; - context.stroke(); - } - } - } - }; - CanvasGraphicsRenderer.prototype.setPatternTransform = function (pattern, matrix) { - if (this._svgMatrix === false) { - return; - } - if (!this._svgMatrix) { - var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - if (svg && svg.createSVGMatrix) { - this._svgMatrix = svg.createSVGMatrix(); - } - if (!this._svgMatrix || !pattern.setTransform) { - this._svgMatrix = false; - return; - } - } - this._svgMatrix.a = matrix.a; - this._svgMatrix.b = matrix.b; - this._svgMatrix.c = matrix.c; - this._svgMatrix.d = matrix.d; - this._svgMatrix.e = matrix.tx; - this._svgMatrix.f = matrix.ty; - pattern.setTransform(this._svgMatrix.inverse()); - }; - /** - * destroy graphics object - * - */ - CanvasGraphicsRenderer.prototype.destroy = function () { - this.renderer = null; - this._svgMatrix = null; - this._tempMatrix = null; - }; - return CanvasGraphicsRenderer; - }()); - - var canvasRenderer; - var tempMatrix$2 = new Matrix(); - /** - * Generates a canvas texture. Only available with **pixi.js-legacy** bundle - * or the **@pixi/canvas-graphics** package. - * @method generateCanvasTexture - * @memberof PIXI.Graphics# - * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture. - * @param {number} resolution - The resolution of the texture. - * @return {PIXI.Texture} The new texture. - */ - Graphics.prototype.generateCanvasTexture = function generateCanvasTexture(scaleMode, resolution) { - if (resolution === void 0) { resolution = 1; } - var bounds = this.getLocalBounds(); - var canvasBuffer = RenderTexture.create({ - width: bounds.width, - height: bounds.height, - scaleMode: scaleMode, - resolution: resolution, - }); - if (!canvasRenderer) { - canvasRenderer = new CanvasRenderer(); - } - this.transform.updateLocalTransform(); - this.transform.localTransform.copyTo(tempMatrix$2); - tempMatrix$2.invert(); - tempMatrix$2.tx -= bounds.x; - tempMatrix$2.ty -= bounds.y; - canvasRenderer.render(this, canvasBuffer, true, tempMatrix$2); - var texture = Texture.from(canvasBuffer.baseTexture._canvasRenderTarget.canvas, { - scaleMode: scaleMode, - }); - texture.baseTexture.setResolution(resolution); - return texture; - }; - Graphics.prototype.cachedGraphicsData = []; - /** - * Renders the object using the Canvas renderer - * - * @method _renderCanvas - * @memberof PIXI.Graphics# - * @private - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - Graphics.prototype._renderCanvas = function _renderCanvas(renderer) { - if (this.isMask === true) { - return; - } - this.finishPoly(); - renderer.plugins.graphics.render(this); - }; - - /*! - * @pixi/canvas-sprite - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-sprite is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var canvasRenderWorldTransform = new Matrix(); - /** - * Types that can be passed to drawImage - * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource - * @memberof PIXI - */ - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now - * share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's CanvasSpriteRenderer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java - */ - /** - * Renderer dedicated to drawing and batching sprites. - * - * @class - * @protected - * @memberof PIXI - */ - var CanvasSpriteRenderer = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer -The renderer sprite this batch works for. - */ - function CanvasSpriteRenderer(renderer) { - this.renderer = renderer; - } - /** - * Renders the sprite object. - * - * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch - */ - CanvasSpriteRenderer.prototype.render = function (sprite) { - var texture = sprite._texture; - var renderer = this.renderer; - var context = renderer.context; - var width = texture._frame.width; - var height = texture._frame.height; - var wt = sprite.transform.worldTransform; - var dx = 0; - var dy = 0; - var source = texture.baseTexture.getDrawableSource(); - if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.valid || !source) { - return; - } - if (!texture.valid) { - return; - } - renderer.setBlendMode(sprite.blendMode, true); - renderer.context.globalAlpha = sprite.worldAlpha; - // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture - var smoothingEnabled = texture.baseTexture.scaleMode === exports.SCALE_MODES.LINEAR; - if (renderer.smoothProperty - && renderer.context[renderer.smoothProperty] !== smoothingEnabled) { - context[renderer.smoothProperty] = smoothingEnabled; - } - if (texture.trim) { - dx = (texture.trim.width / 2) + texture.trim.x - (sprite.anchor.x * texture.orig.width); - dy = (texture.trim.height / 2) + texture.trim.y - (sprite.anchor.y * texture.orig.height); - } - else { - dx = (0.5 - sprite.anchor.x) * texture.orig.width; - dy = (0.5 - sprite.anchor.y) * texture.orig.height; - } - if (texture.rotate) { - wt.copyTo(canvasRenderWorldTransform); - wt = canvasRenderWorldTransform; - groupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy); - // the anchor has already been applied above, so lets set it to zero - dx = 0; - dy = 0; - } - dx -= width / 2; - dy -= height / 2; - renderer.setContextTransform(wt, sprite.roundPixels, 1); - // Allow for pixel rounding - if (sprite.roundPixels) { - dx = dx | 0; - dy = dy | 0; - } - var resolution = texture.baseTexture.resolution; - var outerBlend = renderer._outerBlend; - if (outerBlend) { - context.save(); - context.beginPath(); - context.rect(dx * renderer.resolution, dy * renderer.resolution, width * renderer.resolution, height * renderer.resolution); - context.clip(); - } - if (sprite.tint !== 0xFFFFFF) { - if (sprite._cachedTint !== sprite.tint || sprite._tintedCanvas.tintId !== sprite._texture._updateID) { - sprite._cachedTint = sprite.tint; - // TODO clean up caching - how to clean up the caches? - sprite._tintedCanvas = canvasUtils.getTintedCanvas(sprite, sprite.tint); - } - context.drawImage(sprite._tintedCanvas, 0, 0, Math.floor(width * resolution), Math.floor(height * resolution), Math.floor(dx * renderer.resolution), Math.floor(dy * renderer.resolution), Math.floor(width * renderer.resolution), Math.floor(height * renderer.resolution)); - } - else { - context.drawImage(source, texture._frame.x * resolution, texture._frame.y * resolution, Math.floor(width * resolution), Math.floor(height * resolution), Math.floor(dx * renderer.resolution), Math.floor(dy * renderer.resolution), Math.floor(width * renderer.resolution), Math.floor(height * renderer.resolution)); - } - if (outerBlend) { - context.restore(); - } - // just in case, leaking outer blend here will be catastrophic! - renderer.setBlendMode(exports.BLEND_MODES.NORMAL); - }; - /** - * destroy the sprite object. - * - */ - CanvasSpriteRenderer.prototype.destroy = function () { - this.renderer = null; - }; - return CanvasSpriteRenderer; - }()); - - /** - * Cached tinted texture. - * @memberof PIXI.Sprite# - * @member {HTMLCanvasElement} _tintedCanvas - * @protected - */ - Sprite.prototype._tintedCanvas = null; - /** - * Renders the object using the Canvas renderer - * - * @private - * @method _renderCanvas - * @memberof PIXI.Sprite# - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - Sprite.prototype._renderCanvas = function _renderCanvas(renderer) { - renderer.plugins.sprite.render(this); - }; - - /*! - * @pixi/canvas-extract - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-extract is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var TEMP_RECT$1 = new Rectangle(); - /** - * The extract manager provides functionality to export content from the renderers. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` - * - * @class - * @memberof PIXI - */ - var CanvasExtract = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer - */ - function CanvasExtract(renderer) { - this.renderer = renderer; - } - /** - * Will return a HTML Image of the target - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {HTMLImageElement} HTML Image of the target - */ - CanvasExtract.prototype.image = function (target, format, quality) { - var image = new Image(); - image.src = this.base64(target, format, quality); - return image; - }; - /** - * Will return a a base64 encoded string of this target. It works by calling - * `CanvasExtract.getCanvas` and then running toDataURL on that. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {string} A base64 encoded string of the texture. - */ - CanvasExtract.prototype.base64 = function (target, format, quality) { - return this.canvas(target).toDataURL(format, quality); - }; - /** - * Creates a Canvas element, renders this target to it and then returns it. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ - CanvasExtract.prototype.canvas = function (target) { - var renderer = this.renderer; - var context; - var resolution; - var frame; - var renderTexture; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = renderer.generateTexture(target); - } - } - if (renderTexture) { - context = renderTexture.baseTexture._canvasRenderTarget.context; - resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; - frame = renderTexture.frame; - } - else { - context = renderer.rootContext; - resolution = renderer.resolution; - frame = TEMP_RECT$1; - frame.width = this.renderer.width; - frame.height = this.renderer.height; - } - var width = Math.floor((frame.width * resolution) + 1e-4); - var height = Math.floor((frame.height * resolution) + 1e-4); - var canvasBuffer = new CanvasRenderTarget(width, height, 1); - var canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height); - canvasBuffer.context.putImageData(canvasData, 0, 0); - // send the canvas back.. - return canvasBuffer.canvas; - }; - /** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA - * order, with integer values between 0 and 255 (included). - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture - */ - CanvasExtract.prototype.pixels = function (target) { - var renderer = this.renderer; - var context; - var resolution; - var frame; - var renderTexture; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = renderer.generateTexture(target); - } - } - if (renderTexture) { - context = renderTexture.baseTexture._canvasRenderTarget.context; - resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; - frame = renderTexture.frame; - } - else { - context = renderer.rootContext; - frame = TEMP_RECT$1; - frame.width = renderer.width; - frame.height = renderer.height; - } - return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data; - }; - /** - * Destroys the extract - * - */ - CanvasExtract.prototype.destroy = function () { - this.renderer = null; - }; - return CanvasExtract; - }()); - /** - * @name PIXI.CanvasRenderer#extract - * @type {PIXI.CanvasExtract} - * @see PIXI.CanvasRenderer#plugins - * @deprecated since 5.3.0 - */ - Object.defineProperty(CanvasRenderer.prototype, 'extract', { - get: function () { - deprecation('v5.3.0', 'CanvasRenderer#extract is deprecated, use CanvasRenderer#plugins.extract'); - return this.plugins.extract; - }, - }); - - /*! - * @pixi/canvas-prepare - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-prepare is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$m = function(d, b) { - extendStatics$m = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$m(d, b); - }; - - function __extends$m(d, b) { - extendStatics$m(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var CANVAS_START_SIZE = 16; - /** - * Built-in hook to upload PIXI.Texture objects to the GPU. - * - * @private - * @param {*} prepare - Instance of CanvasPrepare - * @param {*} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadBaseTextures$1(prepare, item) { - var tempPrepare = prepare; - if (item instanceof BaseTexture) { - var image = item.source; - // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone. - // So if the width or height is equal to zero then use the canvas size - // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions. - var imageWidth = image.width === 0 ? tempPrepare.canvas.width : Math.min(tempPrepare.canvas.width, image.width); - var imageHeight = image.height === 0 ? tempPrepare.canvas.height - : Math.min(tempPrepare.canvas.height, image.height); - // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU - // A smaller draw can be faster. - tempPrepare.ctx.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, tempPrepare.canvas.width, tempPrepare.canvas.height); - return true; - } - return false; - } - /** - * The prepare manager provides functionality to upload content to the GPU. - * - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` - * - * @class - * @extends PIXI.BasePrepare - * @memberof PIXI - */ - var CanvasPrepare = /** @class */ (function (_super) { - __extends$m(CanvasPrepare, _super); - /** - * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer - */ - function CanvasPrepare(renderer) { - var _this = _super.call(this, renderer) || this; - _this.uploadHookHelper = _this; - /** - * An offline canvas to render textures to - * @type {HTMLCanvasElement} - * @private - */ - _this.canvas = document.createElement('canvas'); - _this.canvas.width = CANVAS_START_SIZE; - _this.canvas.height = CANVAS_START_SIZE; - /** - * The context to the canvas - * @type {CanvasRenderingContext2D} - * @private - */ - _this.ctx = _this.canvas.getContext('2d'); - // Add textures to upload - _this.registerUploadHook(uploadBaseTextures$1); - return _this; - } - /** - * Destroys the plugin, don't use after this. - * - */ - CanvasPrepare.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.ctx = null; - this.canvas = null; - }; - return CanvasPrepare; - }(BasePrepare)); - - /*! - * @pixi/canvas-sprite-tiling - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-sprite-tiling is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Renders the object using the Canvas renderer - * - * @protected - * @function _renderCanvas - * @memberof PIXI.TilingSprite# - * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer - */ - TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) { - var texture = this._texture; - if (!texture.baseTexture.valid) { - return; - } - var context = renderer.context; - var transform = this.worldTransform; - var baseTexture = texture.baseTexture; - var source = baseTexture.getDrawableSource(); - var baseTextureResolution = baseTexture.resolution; - var modX = ((this.tilePosition.x / this.tileScale.x) % texture._frame.width) * baseTextureResolution; - var modY = ((this.tilePosition.y / this.tileScale.y) % texture._frame.height) * baseTextureResolution; - // create a nice shiny pattern! - if (this._textureID !== this._texture._updateID || this._cachedTint !== this.tint) { - this._textureID = this._texture._updateID; - // cut an object from a spritesheet.. - var tempCanvas = new CanvasRenderTarget(texture._frame.width, texture._frame.height, baseTextureResolution); - // Tint the tiling sprite - if (this.tint !== 0xFFFFFF) { - this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint); - tempCanvas.context.drawImage(this._tintedCanvas, 0, 0); - } - else { - tempCanvas.context.drawImage(source, -texture._frame.x * baseTextureResolution, -texture._frame.y * baseTextureResolution); - } - this._cachedTint = this.tint; - this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat'); - } - // set context state.. - context.globalAlpha = this.worldAlpha; - renderer.setBlendMode(this.blendMode); - renderer.setContextTransform(transform); - // fill the pattern! - context.fillStyle = this._canvasPattern; - // TODO - this should be rolled into the setTransform above.. - context.scale(this.tileScale.x / baseTextureResolution, this.tileScale.y / baseTextureResolution); - var anchorX = this.anchor.x * -this._width; - var anchorY = this.anchor.y * -this._height; - if (this.uvRespectAnchor) { - context.translate(modX, modY); - context.fillRect(-modX + anchorX, -modY + anchorY, this._width / this.tileScale.x * baseTextureResolution, this._height / this.tileScale.y * baseTextureResolution); - } - else { - context.translate(modX + anchorX, modY + anchorY); - context.fillRect(-modX, -modY, this._width / this.tileScale.x * baseTextureResolution, this._height / this.tileScale.y * baseTextureResolution); - } - }; - - /*! - * @pixi/canvas-particles - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-particles is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Renders the object using the Canvas renderer - * @method renderCanvas - * @memberof PIXI.ParticleContainer# - * @private - * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer - */ - ParticleContainer.prototype.renderCanvas = function renderCanvas(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { - return; - } - var context = renderer.context; - var transform = this.worldTransform; - var isRotated = true; - var positionX = 0; - var positionY = 0; - var finalWidth = 0; - var finalHeight = 0; - renderer.setBlendMode(this.blendMode); - context.globalAlpha = this.worldAlpha; - this.displayObjectUpdateTransform(); - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i]; - if (!child.visible) { - continue; - } - if (!child._texture.valid) { - continue; - } - var frame = child._texture.frame; - context.globalAlpha = this.worldAlpha * child.alpha; - if (child.rotation % (Math.PI * 2) === 0) { - // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call - if (isRotated) { - renderer.setContextTransform(transform, false, 1); - isRotated = false; - } - positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5; - positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5; - finalWidth = frame.width * child.scale.x; - finalHeight = frame.height * child.scale.y; - } - else { - if (!isRotated) { - isRotated = true; - } - child.displayObjectUpdateTransform(); - var childTransform = child.worldTransform; - renderer.setContextTransform(childTransform, this.roundPixels, 1); - positionX = ((child.anchor.x) * (-frame.width)) + 0.5; - positionY = ((child.anchor.y) * (-frame.height)) + 0.5; - finalWidth = frame.width; - finalHeight = frame.height; - } - var resolution = child._texture.baseTexture.resolution; - context.drawImage(child._texture.baseTexture.getDrawableSource(), frame.x * resolution, frame.y * resolution, frame.width * resolution, frame.height * resolution, positionX * renderer.resolution, positionY * renderer.resolution, finalWidth * renderer.resolution, finalHeight * renderer.resolution); - } - }; - - /*! - * @pixi/canvas-display - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-display is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * To be overridden by the subclass - * @method _renderCanvas - * @memberof PIXI.Container# - * @protected - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - Container.prototype._renderCanvas = function _renderCanvas(_renderer) { - // this is where content itself gets rendered... - }; - /** - * Renders the object using the Canvas renderer - * @method renderCanvas - * @memberof PIXI.Container# - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - Container.prototype.renderCanvas = function renderCanvas(renderer) { - // if not visible or the alpha is 0 then no need to render this - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - if (this._mask) { - renderer.maskManager.pushMask(this._mask); - } - this._renderCanvas(renderer); - for (var i = 0, j = this.children.length; i < j; ++i) { - this.children[i].renderCanvas(renderer); - } - if (this._mask) { - renderer.maskManager.popMask(renderer); - } - }; - - /** - * Renders the object using the Canvas renderer - * @method renderCanvas - * @memberof PIXI.Container# - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - DisplayObject.prototype.renderCanvas = function renderCanvas(_renderer) { - // OVERWRITE; - }; - - /*! - * @pixi/canvas-text - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/canvas-text is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Renders the object using the Canvas renderer - * - * @method _renderCanvas - * @memberof PIXI.Text# - * @private - * @param {PIXI.CanvasRenderer} renderer - The renderer - */ - Text.prototype._renderCanvas = function _renderCanvas(renderer) { - if (this._autoResolution && this._resolution !== renderer.resolution) { - this._resolution = renderer.resolution; - this.dirty = true; - } - this.updateText(true); - Sprite.prototype._renderCanvas.call(this, renderer); - }; - - CanvasRenderer.registerPlugin('accessibility', AccessibilityManager); - CanvasRenderer.registerPlugin('extract', CanvasExtract); - CanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer); - CanvasRenderer.registerPlugin('interaction', InteractionManager); - CanvasRenderer.registerPlugin('mesh', CanvasMeshRenderer); - CanvasRenderer.registerPlugin('prepare', CanvasPrepare); - CanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer); - - exports.AbstractBatchRenderer = AbstractBatchRenderer; - exports.AbstractRenderer = AbstractRenderer; - exports.AccessibilityManager = AccessibilityManager; - exports.AnimatedSprite = AnimatedSprite; - exports.AppLoaderPlugin = AppLoaderPlugin; - exports.Application = Application; - exports.Attribute = Attribute; - exports.BasePrepare = BasePrepare; - exports.BaseRenderTexture = BaseRenderTexture; - exports.BaseTexture = BaseTexture; - exports.BatchDrawCall = BatchDrawCall; - exports.BatchGeometry = BatchGeometry; - exports.BatchPluginFactory = BatchPluginFactory; - exports.BatchRenderer = BatchRenderer; - exports.BatchShaderGenerator = BatchShaderGenerator; - exports.BatchTextureArray = BatchTextureArray; - exports.BitmapFont = BitmapFont; - exports.BitmapFontData = BitmapFontData; - exports.BitmapFontLoader = BitmapFontLoader; - exports.BitmapText = BitmapText; - exports.Bounds = Bounds; - exports.Buffer = Buffer; - exports.CanvasExtract = CanvasExtract; - exports.CanvasGraphicsRenderer = CanvasGraphicsRenderer; - exports.CanvasMeshRenderer = CanvasMeshRenderer; - exports.CanvasPrepare = CanvasPrepare; - exports.CanvasRenderer = CanvasRenderer; - exports.CanvasSpriteRenderer = CanvasSpriteRenderer; - exports.Circle = Circle; - exports.Container = Container; - exports.CountLimiter = CountLimiter; - exports.DEG_TO_RAD = DEG_TO_RAD; - exports.DisplayObject = DisplayObject; - exports.Ellipse = Ellipse; - exports.Extract = Extract; - exports.FillStyle = FillStyle; - exports.Filter = Filter; - exports.FilterState = FilterState; - exports.Framebuffer = Framebuffer; - exports.GLFramebuffer = GLFramebuffer; - exports.GLProgram = GLProgram; - exports.GLTexture = GLTexture; - exports.GRAPHICS_CURVES = GRAPHICS_CURVES; - exports.Geometry = Geometry; - exports.Graphics = Graphics; - exports.GraphicsData = GraphicsData; - exports.GraphicsGeometry = GraphicsGeometry; - exports.IGLUniformData = IGLUniformData; - exports.InteractionData = InteractionData; - exports.InteractionEvent = InteractionEvent; - exports.InteractionManager = InteractionManager; - exports.InteractionTrackingData = InteractionTrackingData; - exports.LineStyle = LineStyle; - exports.Loader = Loader$1; - exports.LoaderResource = LoaderResource; - exports.MaskData = MaskData; - exports.Matrix = Matrix; - exports.Mesh = Mesh; - exports.MeshBatchUvs = MeshBatchUvs; - exports.MeshGeometry = MeshGeometry; - exports.MeshMaterial = MeshMaterial; - exports.NineSlicePlane = NineSlicePlane; - exports.ObjectRenderer = ObjectRenderer; - exports.ObservablePoint = ObservablePoint; - exports.PI_2 = PI_2; - exports.ParticleContainer = ParticleContainer; - exports.ParticleRenderer = ParticleRenderer; - exports.PlaneGeometry = PlaneGeometry; - exports.Point = Point; - exports.Polygon = Polygon; - exports.Prepare = Prepare; - exports.Program = Program; - exports.Quad = Quad; - exports.QuadUv = QuadUv; - exports.RAD_TO_DEG = RAD_TO_DEG; - exports.Rectangle = Rectangle; - exports.RenderTexture = RenderTexture; - exports.RenderTexturePool = RenderTexturePool; - exports.Renderer = Renderer; - exports.RopeGeometry = RopeGeometry; - exports.RoundedRectangle = RoundedRectangle; - exports.Runner = Runner; - exports.Shader = Shader; - exports.SimpleMesh = SimpleMesh; - exports.SimplePlane = SimplePlane; - exports.SimpleRope = SimpleRope; - exports.Sprite = Sprite; - exports.SpriteMaskFilter = SpriteMaskFilter; - exports.Spritesheet = Spritesheet; - exports.SpritesheetLoader = SpritesheetLoader; - exports.State = State; - exports.System = System; - exports.TemporaryDisplayObject = TemporaryDisplayObject; - exports.Text = Text; - exports.TextMetrics = TextMetrics; - exports.TextStyle = TextStyle; - exports.Texture = Texture; - exports.TextureLoader = TextureLoader; - exports.TextureMatrix = TextureMatrix; - exports.TextureUvs = TextureUvs; - exports.Ticker = Ticker; - exports.TickerPlugin = TickerPlugin; - exports.TilingSprite = TilingSprite; - exports.TilingSpriteRenderer = TilingSpriteRenderer; - exports.TimeLimiter = TimeLimiter; - exports.Transform = Transform; - exports.UniformGroup = UniformGroup; - exports.VERSION = VERSION$1; - exports.ViewableBuffer = ViewableBuffer; - exports.accessibleTarget = accessibleTarget; - exports.autoDetectRenderer = autoDetectRenderer; - exports.canvasUtils = canvasUtils; - exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; - exports.defaultFilterVertex = defaultFilter; - exports.defaultVertex = _default; - exports.filters = filters; - exports.graphicsUtils = index$2; - exports.groupD8 = groupD8; - exports.interactiveTarget = interactiveTarget; - exports.isMobile = isMobile$1; - exports.resources = index; - exports.settings = settings; - exports.systems = systems; - exports.uniformParsers = uniformParsers; - exports.useDeprecated = useDeprecated; - exports.utils = utils_es; - - return exports; - -}({})); -PIXI.useDeprecated(); -//# sourceMappingURL=pixi-legacy.js.map diff --git a/www/js/libs/pixi-legacy.js.map b/www/js/libs/pixi-legacy.js.map deleted file mode 100644 index 4f50d7d..0000000 --- a/www/js/libs/pixi-legacy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pixi-legacy.js","sources":["../../../node_modules/es6-promise-polyfill/promise.js","../../../node_modules/object-assign/index.js","../../../packages/polyfill/src/Promise.ts","../../../packages/polyfill/src/Object.assign.ts","../../../packages/polyfill/src/requestAnimationFrame.ts","../../../packages/polyfill/src/Math.sign.ts","../../../packages/polyfill/src/Number.isInteger.ts","../../../packages/polyfill/src/index.ts","../../../node_modules/ismobilejs/src/isMobile.ts","../../../packages/settings/src/utils/isMobile.ts","../../../packages/settings/src/utils/maxRecommendedTextures.ts","../../../packages/settings/src/utils/canUploadSameBuffer.ts","../../../packages/settings/src/settings.ts","../../../node_modules/eventemitter3/index.js","../../../node_modules/earcut/src/earcut.js","../../../node_modules/url/node_modules/punycode/punycode.js","../../../node_modules/url/util.js","../../../node_modules/querystring/decode.js","../../../node_modules/querystring/encode.js","../../../node_modules/querystring/index.js","../../../node_modules/url/url.js","../../../packages/constants/src/index.ts","../../../packages/utils/src/settings.ts","../../../packages/utils/src/browser/hello.ts","../../../packages/utils/src/browser/isWebGLSupported.ts","../../../packages/utils/src/color/hex.ts","../../../packages/utils/src/color/premultiply.ts","../../../packages/utils/src/data/createIndicesForQuads.ts","../../../packages/utils/src/data/getBufferType.ts","../../../packages/utils/src/data/interleaveTypedArrays.ts","../../../packages/utils/src/data/pow2.ts","../../../packages/utils/src/data/removeItems.ts","../../../packages/utils/src/data/sign.ts","../../../packages/utils/src/data/uid.ts","../../../packages/utils/src/logging/deprecation.ts","../../../packages/utils/src/media/caches.ts","../../../packages/utils/src/media/CanvasRenderTarget.ts","../../../packages/utils/src/media/trimCanvas.ts","../../../packages/utils/src/const.ts","../../../packages/utils/src/network/decomposeDataUri.ts","../../../packages/utils/src/network/determineCrossOrigin.ts","../../../packages/utils/src/network/getResolutionOfUrl.ts","../../../packages/math/src/const.ts","../../../packages/math/src/shapes/Rectangle.ts","../../../packages/math/src/shapes/Circle.ts","../../../packages/math/src/shapes/Ellipse.ts","../../../packages/math/src/shapes/Polygon.ts","../../../packages/math/src/shapes/RoundedRectangle.ts","../../../packages/math/src/Point.ts","../../../packages/math/src/ObservablePoint.ts","../../../packages/math/src/Matrix.ts","../../../packages/math/src/groupD8.ts","../../../packages/math/src/Transform.ts","../../../packages/display/src/settings.ts","../../../packages/display/src/Bounds.ts","../../../node_modules/tslib/tslib.es6.js","../../../packages/display/src/DisplayObject.ts","../../../packages/display/src/Container.ts","../../../packages/accessibility/src/accessibleTarget.ts","../../../packages/accessibility/src/AccessibilityManager.ts","../../../packages/ticker/src/settings.ts","../../../packages/ticker/src/const.ts","../../../packages/ticker/src/TickerListener.ts","../../../packages/ticker/src/Ticker.ts","../../../packages/ticker/src/TickerPlugin.ts","../../../packages/interaction/src/InteractionData.ts","../../../packages/interaction/src/InteractionEvent.ts","../../../packages/interaction/src/InteractionTrackingData.ts","../../../packages/interaction/src/TreeSearch.ts","../../../packages/interaction/src/interactiveTarget.ts","../../../packages/interaction/src/InteractionManager.ts","../../../packages/runner/src/Runner.ts","../../../packages/core/src/settings.ts","../../../packages/core/src/textures/resources/autoDetectResource.ts","../../../packages/core/src/textures/resources/Resource.ts","../../../packages/core/src/textures/resources/BufferResource.ts","../../../packages/core/src/textures/BaseTexture.ts","../../../packages/core/src/textures/resources/AbstractMultiResource.ts","../../../packages/core/src/textures/resources/ArrayResource.ts","../../../packages/core/src/textures/resources/BaseImageResource.ts","../../../packages/core/src/textures/resources/CanvasResource.ts","../../../packages/core/src/textures/resources/CubeResource.ts","../../../packages/core/src/textures/resources/ImageResource.ts","../../../packages/core/src/textures/resources/SVGResource.ts","../../../packages/core/src/textures/resources/VideoResource.ts","../../../packages/core/src/textures/resources/ImageBitmapResource.ts","../../../packages/core/src/textures/resources/index.ts","../../../packages/core/src/System.ts","../../../packages/core/src/textures/resources/DepthResource.ts","../../../packages/core/src/framebuffer/Framebuffer.ts","../../../packages/core/src/renderTexture/BaseRenderTexture.ts","../../../packages/core/src/textures/TextureUvs.ts","../../../packages/core/src/textures/Texture.ts","../../../packages/core/src/renderTexture/RenderTexture.ts","../../../packages/core/src/renderTexture/RenderTexturePool.ts","../../../packages/core/src/geometry/Attribute.ts","../../../packages/core/src/geometry/Buffer.ts","../../../packages/core/src/geometry/utils/getBufferType.ts","../../../packages/core/src/geometry/utils/interleaveTypedArrays.ts","../../../packages/core/src/geometry/Geometry.ts","../../../packages/core/src/utils/Quad.ts","../../../packages/core/src/utils/QuadUv.ts","../../../packages/core/src/shader/UniformGroup.ts","../../../packages/core/src/filters/FilterState.ts","../../../packages/core/src/filters/FilterSystem.ts","../../../packages/core/src/batch/ObjectRenderer.ts","../../../packages/core/src/batch/BatchSystem.ts","../../../packages/core/src/context/ContextSystem.ts","../../../packages/core/src/framebuffer/GLFramebuffer.ts","../../../packages/core/src/framebuffer/FramebufferSystem.ts","../../../packages/core/src/geometry/GLBuffer.ts","../../../packages/core/src/geometry/GeometrySystem.ts","../../../packages/core/src/mask/MaskData.ts","../../../packages/core/src/shader/utils/compileProgram.ts","../../../packages/core/src/shader/utils/defaultValue.ts","../../../packages/core/src/shader/utils/getTestContext.ts","../../../packages/core/src/shader/utils/getMaxFragmentPrecision.ts","../../../packages/core/src/shader/utils/setPrecision.ts","../../../packages/core/src/shader/utils/mapSize.ts","../../../packages/core/src/shader/utils/mapType.ts","../../../packages/core/src/shader/utils/uniformParsers.ts","../../../packages/core/src/shader/utils/generateUniformsSync.ts","../../../packages/core/src/shader/utils/checkMaxIfStatementsInShader.ts","../../../packages/core/src/shader/utils/unsafeEvalSupported.ts","../../../packages/core/src/shader/Program.ts","../../../packages/core/src/shader/Shader.ts","../../../packages/core/src/state/State.ts","../../../packages/core/src/filters/Filter.ts","../../../packages/core/src/textures/TextureMatrix.ts","../../../packages/core/src/filters/spriteMask/SpriteMaskFilter.ts","../../../packages/core/src/mask/MaskSystem.ts","../../../packages/core/src/mask/AbstractMaskSystem.ts","../../../packages/core/src/mask/ScissorSystem.ts","../../../packages/core/src/mask/StencilSystem.ts","../../../packages/core/src/projection/ProjectionSystem.ts","../../../packages/core/src/renderTexture/RenderTextureSystem.ts","../../../packages/core/src/shader/GLProgram.ts","../../../packages/core/src/shader/ShaderSystem.ts","../../../packages/core/src/state/utils/mapWebGLBlendModesToPixi.ts","../../../packages/core/src/state/StateSystem.ts","../../../packages/core/src/textures/TextureGCSystem.ts","../../../packages/core/src/textures/GLTexture.ts","../../../packages/core/src/textures/TextureSystem.ts","../../../packages/core/src/AbstractRenderer.ts","../../../packages/core/src/Renderer.ts","../../../packages/core/src/autoDetectRenderer.ts","../../../packages/core/src/batch/BatchDrawCall.ts","../../../packages/core/src/batch/BatchTextureArray.ts","../../../packages/core/src/geometry/ViewableBuffer.ts","../../../packages/core/src/batch/AbstractBatchRenderer.ts","../../../packages/core/src/batch/BatchShaderGenerator.ts","../../../packages/core/src/batch/BatchGeometry.ts","../../../packages/core/src/batch/BatchPluginFactory.ts","../../../packages/app/src/Application.ts","../../../packages/app/src/ResizePlugin.ts","../../../packages/app/src/index.ts","../../../packages/extract/src/Extract.ts","../../../node_modules/parse-uri/index.js","../../../node_modules/mini-signals/lib/mini-signals.js","../../../node_modules/resource-loader/src/async.js","../../../node_modules/resource-loader/src/middleware/caching.js","../../../node_modules/resource-loader/src/Resource.js","../../../node_modules/resource-loader/src/encodeBinary.js","../../../node_modules/resource-loader/src/middleware/parsing.js","../../../node_modules/resource-loader/src/Loader.js","../../../packages/loaders/src/LoaderResource.ts","../../../packages/loaders/src/TextureLoader.ts","../../../packages/loaders/src/Loader.ts","../../../packages/loaders/src/AppLoaderPlugin.ts","../../../packages/particles/src/ParticleContainer.ts","../../../packages/particles/src/ParticleBuffer.ts","../../../packages/particles/src/ParticleRenderer.ts","../../../packages/graphics/src/const.ts","../../../packages/graphics/src/styles/FillStyle.ts","../../../packages/graphics/src/utils/buildPoly.ts","../../../packages/graphics/src/utils/buildCircle.ts","../../../packages/graphics/src/utils/buildRectangle.ts","../../../packages/graphics/src/utils/buildRoundedRectangle.ts","../../../packages/graphics/src/utils/buildLine.ts","../../../packages/graphics/src/utils/Star.ts","../../../packages/graphics/src/utils/ArcUtils.ts","../../../packages/graphics/src/utils/BezierUtils.ts","../../../packages/graphics/src/utils/QuadraticUtils.ts","../../../packages/graphics/src/utils/BatchPart.ts","../../../packages/graphics/src/utils/index.ts","../../../packages/graphics/src/GraphicsData.ts","../../../packages/graphics/src/GraphicsGeometry.ts","../../../packages/graphics/src/styles/LineStyle.ts","../../../packages/graphics/src/Graphics.ts","../../../packages/sprite/src/Sprite.ts","../../../packages/text/src/const.ts","../../../packages/text/src/TextStyle.ts","../../../packages/text/src/TextMetrics.ts","../../../packages/text/src/Text.ts","../../../packages/prepare/src/settings.ts","../../../packages/prepare/src/CountLimiter.ts","../../../packages/prepare/src/BasePrepare.ts","../../../packages/prepare/src/Prepare.ts","../../../packages/prepare/src/TimeLimiter.ts","../../../packages/spritesheet/src/Spritesheet.ts","../../../packages/spritesheet/src/SpritesheetLoader.ts","../../../packages/sprite-tiling/src/TilingSprite.ts","../../../packages/sprite-tiling/src/TilingSpriteRenderer.ts","../../../packages/mesh/src/MeshBatchUvs.ts","../../../packages/mesh/src/Mesh.ts","../../../packages/mesh/src/MeshMaterial.ts","../../../packages/mesh/src/MeshGeometry.ts","../../../packages/text-bitmap/src/BitmapFontData.ts","../../../packages/text-bitmap/src/formats/TextFormat.ts","../../../packages/text-bitmap/src/formats/XMLFormat.ts","../../../packages/text-bitmap/src/formats/XMLStringFormat.ts","../../../packages/text-bitmap/src/formats/index.ts","../../../packages/text-bitmap/src/utils/generateFillStyle.ts","../../../packages/text-bitmap/src/utils/drawGlyph.ts","../../../packages/text-bitmap/src/utils/resolveCharacters.ts","../../../packages/text-bitmap/src/BitmapFont.ts","../../../packages/text-bitmap/src/BitmapText.ts","../../../packages/text-bitmap/src/BitmapFontLoader.ts","../../../packages/filters/filter-alpha/src/AlphaFilter.ts","../../../packages/filters/filter-blur/src/generateBlurVertSource.ts","../../../packages/filters/filter-blur/src/generateBlurFragSource.ts","../../../packages/filters/filter-blur/src/BlurFilterPass.ts","../../../packages/filters/filter-blur/src/BlurFilter.ts","../../../packages/filters/filter-color-matrix/src/ColorMatrixFilter.ts","../../../packages/filters/filter-displacement/src/DisplacementFilter.ts","../../../packages/filters/filter-fxaa/src/FXAAFilter.ts","../../../packages/filters/filter-noise/src/NoiseFilter.ts","../../../packages/mixin-cache-as-bitmap/src/index.ts","../../../packages/mixin-get-child-by-name/src/index.ts","../../../packages/mixin-get-global-position/src/index.ts","../../../packages/mesh-extras/src/geometry/PlaneGeometry.ts","../../../packages/mesh-extras/src/geometry/RopeGeometry.ts","../../../packages/mesh-extras/src/SimpleRope.ts","../../../packages/mesh-extras/src/SimplePlane.ts","../../../packages/mesh-extras/src/SimpleMesh.ts","../../../packages/mesh-extras/src/NineSlicePlane.ts","../../../packages/sprite-animated/src/AnimatedSprite.ts","../../pixi.js/src/useDeprecated.ts","../../pixi.js/src/index.ts","../../../packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.ts","../../../packages/canvas/canvas-renderer/src/utils/canUseNewCanvasBlendModes.ts","../../../packages/canvas/canvas-renderer/src/utils/mapCanvasBlendModesToPixi.ts","../../../packages/canvas/canvas-renderer/src/CanvasRenderer.ts","../../../packages/canvas/canvas-renderer/src/canvasUtils.ts","../../../packages/canvas/canvas-renderer/src/Renderer.ts","../../../packages/canvas/canvas-renderer/src/BaseTexture.ts","../../../packages/canvas/canvas-mesh/src/CanvasMeshRenderer.ts","../../../packages/canvas/canvas-mesh/src/settings.ts","../../../packages/canvas/canvas-mesh/src/MeshMaterial.ts","../../../packages/canvas/canvas-mesh/src/NineSlicePlane.ts","../../../packages/canvas/canvas-mesh/src/Mesh.ts","../../../packages/canvas/canvas-mesh/src/SimpleMesh.ts","../../../packages/canvas/canvas-mesh/src/SimpleRope.ts","../../../packages/canvas/canvas-graphics/src/CanvasGraphicsRenderer.ts","../../../packages/canvas/canvas-graphics/src/Graphics.ts","../../../packages/canvas/canvas-sprite/src/CanvasSpriteRenderer.ts","../../../packages/canvas/canvas-sprite/src/Sprite.ts","../../../packages/canvas/canvas-extract/src/CanvasExtract.ts","../../../packages/canvas/canvas-prepare/src/CanvasPrepare.ts","../../../packages/canvas/canvas-sprite-tiling/src/TilingSprite.ts","../../../packages/canvas/canvas-particles/src/ParticleContainer.ts","../../../packages/canvas/canvas-display/src/Container.ts","../../../packages/canvas/canvas-display/src/DisplayObject.ts","../../../packages/canvas/canvas-text/src/Text.ts","../src/index.ts"],"sourcesContent":["(function(global){\n\n//\n// Check for native Promise and it has correct interface\n//\n\nvar NativePromise = global['Promise'];\nvar nativePromiseSupported =\n NativePromise &&\n // Some of these methods are missing from\n // Firefox/Chrome experimental implementations\n 'resolve' in NativePromise &&\n 'reject' in NativePromise &&\n 'all' in NativePromise &&\n 'race' in NativePromise &&\n // Older version of the spec had a resolver object\n // as the arg rather than a function\n (function(){\n var resolve;\n new NativePromise(function(r){ resolve = r; });\n return typeof resolve === 'function';\n })();\n\n\n//\n// export if necessary\n//\n\nif (typeof exports !== 'undefined' && exports)\n{\n // node.js\n exports.Promise = nativePromiseSupported ? NativePromise : Promise;\n exports.Polyfill = Promise;\n}\nelse\n{\n // AMD\n if (typeof define == 'function' && define.amd)\n {\n define(function(){\n return nativePromiseSupported ? NativePromise : Promise;\n });\n }\n else\n {\n // in browser add to global\n if (!nativePromiseSupported)\n global['Promise'] = Promise;\n }\n}\n\n\n//\n// Polyfill\n//\n\nvar PENDING = 'pending';\nvar SEALED = 'sealed';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\nvar NOOP = function(){};\n\nfunction isArray(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n}\n\n// async calls\nvar asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush(){\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++)\n asyncQueue[i][0](asyncQueue[i][1]);\n\n // reset async asyncQueue\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg){\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer)\n {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch(e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber){\n var owner = subscriber.owner;\n var settled = owner.state_;\n var value = owner.data_; \n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function')\n {\n settled = FULFILLED;\n try {\n value = callback(value);\n } catch(e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value))\n {\n if (settled === FULFILLED)\n resolve(promise, value);\n\n if (settled === REJECTED)\n reject(promise, value);\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value)\n throw new TypeError('A promises callback cannot return that same promise.');\n\n if (value && (typeof value === 'function' || typeof value === 'object'))\n {\n var then = value.then; // then should be retrived only once\n\n if (typeof then === 'function')\n {\n then.call(value, function(val){\n if (!resolved)\n {\n resolved = true;\n\n if (value !== val)\n resolve(promise, val);\n else\n fulfill(promise, val);\n }\n }, function(reason){\n if (!resolved)\n {\n resolved = true;\n\n reject(promise, reason);\n }\n });\n\n return true;\n }\n }\n } catch (e) {\n if (!resolved)\n reject(promise, e);\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value){\n if (promise === value || !handleThenable(promise, value))\n fulfill(promise, value);\n}\n\nfunction fulfill(promise, value){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = value;\n\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = reason;\n\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n var callbacks = promise.then_;\n promise.then_ = undefined;\n\n for (var i = 0; i < callbacks.length; i++) {\n invokeCallback(callbacks[i]);\n }\n}\n\nfunction publishFulfillment(promise){\n promise.state_ = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise){\n promise.state_ = REJECTED;\n publish(promise);\n}\n\n/**\n* @class\n*/\nfunction Promise(resolver){\n if (typeof resolver !== 'function')\n throw new TypeError('Promise constructor takes a function argument');\n\n if (this instanceof Promise === false)\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n\n this.then_ = [];\n\n invokeResolver(resolver, this);\n}\n\nPromise.prototype = {\n constructor: Promise,\n\n state_: PENDING,\n then_: null,\n data_: undefined,\n\n then: function(onFulfillment, onRejection){\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if (this.state_ === FULFILLED || this.state_ === REJECTED)\n {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n }\n else\n {\n // subscribe\n this.then_.push(subscriber);\n }\n\n return subscriber.then;\n },\n\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nPromise.all = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.all().');\n\n return new Class(function(resolve, reject){\n var results = [];\n var remaining = 0;\n\n function resolver(index){\n remaining++;\n return function(value){\n results[index] = value;\n if (!--remaining)\n resolve(results);\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolver(i), reject);\n else\n results[i] = promise;\n }\n\n if (!remaining)\n resolve(results);\n });\n};\n\nPromise.race = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.race().');\n\n return new Class(function(resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolve, reject);\n else\n resolve(promise);\n }\n });\n};\n\nPromise.resolve = function(value){\n var Class = this;\n\n if (value && typeof value === 'object' && value.constructor === Class)\n return value;\n\n return new Class(function(resolve){\n resolve(value);\n });\n};\n\nPromise.reject = function(reason){\n var Class = this;\n\n return new Class(function(resolve, reject){\n reject(reason);\n });\n};\n\n})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : this);\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","import { Polyfill } from 'es6-promise-polyfill';\n\n// Support for IE 9 - 11 which does not include Promises\nif (!window.Promise)\n{\n window.Promise = Polyfill;\n}\n","// References:\n// https://github.com/sindresorhus/object-assign\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\nimport objectAssign from 'object-assign';\n\nif (!Object.assign)\n{\n Object.assign = objectAssign;\n}\n","// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\n\nconst ONE_FRAME_TIME = 16;\n\n// Date.now\nif (!(Date.now && Date.prototype.getTime))\n{\n Date.now = function now(): number\n {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(window.performance && window.performance.now))\n{\n const startTime = Date.now();\n\n if (!window.performance)\n {\n (window as any).performance = {};\n }\n\n window.performance.now = (): number => Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n window.requestAnimationFrame = (window as any)[`${p}RequestAnimationFrame`];\n window.cancelAnimationFrame = (window as any)[`${p}CancelAnimationFrame`]\n || (window as any)[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!window.requestAnimationFrame)\n{\n window.requestAnimationFrame = (callback: (...parms: any[]) => void): number =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return window.setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!window.cancelAnimationFrame)\n{\n window.cancelAnimationFrame = (id: number): void => clearTimeout(id);\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x): number\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value): boolean\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","import './Promise';\nimport './Object.assign';\nimport './requestAnimationFrame';\nimport './Math.sign';\nimport './Number.isInteger';\n\nif (!window.ArrayBuffer)\n{\n (window as any).ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n (window as any).Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n (window as any).Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n (window as any).Uint16Array = Array;\n}\n\nif (!window.Uint8Array)\n{\n (window as any).Uint8Array = Array;\n}\n\nif (!window.Int32Array)\n{\n (window as any).Int32Array = Array;\n}\n","const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n","// The ESM/CJS versions of ismobilejs only\n// exports the function for executing\n// designed for Node-only environments\nimport isMobileCall from 'ismobilejs';\n\nconst isMobile = isMobileCall(window.navigator);\n\nexport { isMobile };\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\n\nexport interface IRenderOptions {\n view: HTMLCanvasElement;\n antialias: boolean;\n autoDensity: boolean;\n transparent: boolean;\n backgroundColor: number;\n clearBeforeRender: boolean;\n preserveDrawingBuffer: boolean;\n width: number;\n height: number;\n legacy: boolean;\n}\n\nexport interface ISettings {\n MIPMAP_TEXTURES: number;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: number;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: number;\n SCALE_MODE: number;\n PRECISION_VERTEX: string;\n PRECISION_FRAGMENT: string;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: number;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV {\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE {\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS {\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nexport enum BLEND_MODES {\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nexport enum DRAW_MODES {\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nexport enum FORMATS {\n RGBA = 6408,\n RGB = 6407,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nexport enum TARGETS {\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nexport enum TYPES {\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n FLOAT = 5126,\n HALF_FLOAT = 36193,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES {\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES {\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nexport enum MIPMAP_MODES {\n OFF,\n POW2,\n ON,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES {\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2,\n}\n\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES {\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES {\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nexport enum PRECISION {\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nexport enum MASK_TYPES {\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY {\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nexport { settings };\n","let saidHello = false;\nconst VERSION = '__VERSION__';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n window.console.log(...args);\n }\n else if (window.console)\n {\n window.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean|undefined;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string' && string[0] === '#')\n {\n string = string.substr(1);\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array|number[],\n alpha: number,\n out: Float32Array,\n premultiply: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array|Uint32Array = null): Uint16Array|Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(array: ITypedArray): 'Float32Array'|'Uint32Array'|'Int32Array'|'Uint16Array'|'Uint8Array'|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array|Uint32Array|Int32Array|Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1|0|1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n public canvas: HTMLCanvasElement;\n\n public context: CanvasRenderingContext2D;\n\n public resolution: number;\n\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution: number)\n {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n resize(width: number, height: number): void\n {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n }\n\n /**\n * Destroys this canvas.\n *\n */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = val;\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = val;\n }\n}\n","interface Inset {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri {\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import * as _url from 'url';\n\nlet tempAnchor: HTMLAnchorElement|undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = window.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\nexport enum SHAPES {\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n","import { SHAPES } from '../const';\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nexport class Rectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.RECT;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get left(): number\n {\n return this.x;\n }\n\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get top(): number\n {\n return this.y;\n }\n\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Circle\n{\n public x: number;\n public y: number;\n public radius: number;\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ellipse\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n}\n","import { SHAPES } from '../const';\nimport type { IPoint } from '../IPoint';\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nexport class Polygon\n{\n public points: number[];\n public closeStroke: boolean;\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPoint[]|number[]);\n constructor(...points: IPoint[]|number[]);\n /**\n * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPoint[]|number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPoint).x, (flat[i] as IPoint).y);\n }\n\n flat = p;\n }\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = flat as number[];\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public radius: number;\n public readonly type: SHAPES.RREC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))\n {\n return true;\n }\n let dx = x - (this.x + this.radius);\n let dy = y - (this.y + this.radius);\n const radius2 = this.radius * this.radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class Point implements IPoint\n{\n public x: number;\n public y: number;\n\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class ObservablePoint implements IPoint\n{\n public cb: (this: T) => any;\n public scope: any;\n _x: number;\n _y: number;\n\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Matrix\n{\n public a: number;\n public b: number;\n public c: number;\n public d: number;\n public tx: number;\n public ty: number;\n\n public array: Float32Array|null = null;\n\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x - How much to translate x by\n * @param {number} y - How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x - The amount to scale horizontally\n * @param {number} y - The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n public worldTransform: Matrix;\n public localTransform: Matrix;\n public position: ObservablePoint;\n public scale: ObservablePoint;\n public pivot: ObservablePoint;\n public skew: ObservablePoint;\n public _parentID: number;\n _worldID: number;\n\n protected _rotation: number;\n protected _cx: number;\n protected _sx: number;\n protected _cy: number;\n protected _sy: number;\n protected _localID: number;\n protected _currentLocalID: number;\n\n constructor()\n {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n\n /**\n * Called when a value changes.\n *\n * @protected\n */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n /**\n * Updates the local transformation matrix.\n */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nexport class Bounds\n{\n public minX: number;\n public minY: number;\n public maxX: number;\n public maxY: number;\n public rect: Rectangle;\n public updateID: number;\n\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { DEG_TO_RAD, Matrix, Point, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Container } from './Container';\nimport { Bounds } from './Bounds';\n\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions {\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends GlobalMixins.DisplayObject, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should b e extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n public parent: DisplayObject;\n public worldAlpha: number;\n public transform: Transform;\n public alpha: number;\n public visible: boolean;\n public renderable: boolean;\n public filterArea: Rectangle;\n public filters: Filter[];\n public isSprite: boolean;\n public isMask: boolean;\n public _lastSortedIndex: number;\n public _mask: Container|MaskData;\n public _bounds: Bounds;\n public _localBounds: Bounds;\n\n protected _zIndex: number;\n protected _enabledFilters: Filter[];\n protected _boundsID: number;\n protected _boundsRect: Rectangle;\n protected _localBoundsRect: Rectangle;\n protected _destroyed: boolean;\n\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n this._bounds = new Bounds();\n\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n this._localBounds = null;\n\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n this._boundsID = 0;\n\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._boundsRect = null;\n\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n /**\n * Recalculates the bounds of the display object.\n */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal

(position: IPointData, from: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n destroy(_options?: IDestroyOptions|boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.removeAllListeners();\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this._mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.DisplayObject} current parent\n */\n enableTempParent(): DisplayObject\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param {PIXI.DisplayObject} cacheParent actual parent of element\n */\n disableTempParent(cacheParent: DisplayObject): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: ObservablePoint)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: ObservablePoint)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: ObservablePoint)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: ObservablePoint)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get mask(): Container|MaskData|null\n {\n return this._mask;\n }\n\n set mask(value: Container|MaskData|null)\n {\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n }\n}\n\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport { Rectangle } from '@pixi/math';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n public readonly children: DisplayObject[];\n public sortableChildren: boolean;\n public sortDirty: boolean;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n protected onChildrenChange(_length: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: T, index: number): T\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child: DisplayObject, child2: DisplayObject): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child: DisplayObject): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child: DisplayObject, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index: number): DisplayObject\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index: number): DisplayObject\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): DisplayObject[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).maskObject || child._mask) as Container;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n renderer.batch.flush();\n\n const filters = this.filters;\n const mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].render(renderer);\n }\n\n renderer.batch.flush();\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @function containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget {\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: true;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement {\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n","import { DisplayObject } from '@pixi/display';\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { accessibleTarget } from './accessibleTarget';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Container } from '@pixi/display';\nimport type { Renderer, AbstractRenderer } from '@pixi/core';\nimport type { IAccessibleHTMLElement } from './accessibleTarget';\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nexport class AccessibilityManager\n{\n public debug: boolean;\n public renderer: AbstractRenderer|Renderer;\n\n private _isActive: boolean;\n private _isMobileAccessibility: boolean;\n private _hookDiv: HTMLElement;\n private div: HTMLElement;\n private pool: IAccessibleHTMLElement[];\n private renderId: number;\n private children: DisplayObject[];\n private androidUpdateCount: number;\n private androidUpdateFrequency: number;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer|Renderer)\n {\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n this._isActive = false;\n\n this._isMobileAccessibility = false;\n\n /**\n * count to throttle div updates on android devices\n * @type number\n * @private\n */\n this.androidUpdateCount = 0;\n\n /**\n * the frequency to update the div elements ()\n * @private\n */\n this.androidUpdateFrequency = 500; // 2fps\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isActive(): boolean\n {\n return this._isActive;\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility(): boolean\n {\n return this._isMobileAccessibility;\n }\n\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n private createTouchHook(): void\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessability for this content';\n\n hookDiv.addEventListener('focus', () =>\n {\n this._isMobileAccessibility = true;\n this.activate();\n this.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n private destroyTouchHook(): void\n {\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n private activate(): void\n {\n if (this._isActive)\n {\n return;\n }\n\n this._isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).on('postrender', this.update, this);\n\n if ((this.renderer as AbstractRenderer).view.parentNode)\n {\n (this.renderer as AbstractRenderer).view.parentNode.appendChild(this.div);\n }\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n private deactivate(): void\n {\n if (!this._isActive || this._isMobileAccessibility)\n {\n return;\n }\n\n this._isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n private updateAccessibleObjects(displayObject: Container): void\n {\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i] as Container);\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n private update(): void\n {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n const now = performance.now();\n\n if (isMobile.android.device && now < this.androidUpdateCount)\n {\n return;\n }\n\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n\n if (!(this.renderer as Renderer).renderingToScreen)\n {\n return;\n }\n\n // update children...\n if (this.renderer._lastObjectRendered)\n {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered as Container);\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const rect = (this.renderer as AbstractRenderer).view.getBoundingClientRect();\n\n const resolution = this.renderer.resolution;\n\n const sx = (rect.width / (this.renderer as AbstractRenderer).width) * resolution;\n const sy = (rect.height / (this.renderer as AbstractRenderer).height) * resolution;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${(this.renderer as AbstractRenderer).width}px`;\n div.style.height = `${(this.renderer as AbstractRenderer).height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea as Rectangle;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) this.updateDebugHTML(div);\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n public updateDebugHTML(div: IAccessibleHTMLElement): void\n {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n public capHitArea(hitArea: Rectangle): void\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n if (hitArea.x + hitArea.width > (this.renderer as AbstractRenderer).width)\n {\n hitArea.width = (this.renderer as AbstractRenderer).width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > (this.renderer as AbstractRenderer).height)\n {\n hitArea.height = (this.renderer as AbstractRenderer).height - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n private addChild(displayObject: T): void\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) this.updateDebugHTML(div);\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n private _onClick(e: MouseEvent): void\n {\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'click', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'pointertap', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'tap', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n private _onFocus(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'assertive');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'mouseover', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n private _onFocusOut(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'polite');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent((e.target as any).displayObject, 'mouseout', interactionManager.eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n private _onKeyDown(e: KeyboardEvent): void\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n private _onMouseMove(e: MouseEvent): void\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n public destroy(): void\n {\n this.destroyTouchHook();\n this.div = null;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY {\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n public priority: number;\n public next: TickerListener;\n public previous: TickerListener;\n\n private fn: TickerCallback;\n private context: T;\n private once: boolean;\n private _destroyed: boolean;\n\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n static _shared: Ticker;\n static _system: Ticker;\n\n public autoStart: boolean;\n public deltaTime: number;\n public deltaMS: number;\n public elapsedMS: number;\n public lastTime: number;\n public speed: number;\n public started: boolean;\n\n private _head: TickerListener;\n private _requestId: number;\n private _maxElapsedMS: number;\n private _minElapsedMS: number;\n private _protected: boolean;\n private _lastFrame: number;\n private _tick: (time: number) => any;\n\n constructor()\n {\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / settings.TARGET_FPMS;\n\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n add(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n addOnce(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n remove(fn: TickerCallback, context: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { IApplicationOptions } from '@pixi/app';\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n","import { Point, IPointData } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\n\nexport type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionData\n{\n public global: Point;\n public target: DisplayObject;\n public originalEvent: InteractivePointerEvent;\n public identifier: number;\n public isPrimary: boolean;\n public button: number;\n public buttons: number;\n public width: number;\n public height: number;\n public tiltX: number;\n public tiltY: number;\n public pointerType: string;\n public pressure = 0;\n public rotationAngle = 0;\n public twist = 0;\n public tangentialPressure = 0;\n\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId(): number\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n public getLocalPosition

(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P\n {\n return displayObject.worldTransform.applyInverse

(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n public copyEvent(event: Touch | InteractivePointerEvent): void\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n const buttons = 'buttons' in event && event.buttons;\n\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n public reset(): void\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","import type { DisplayObject } from '@pixi/display';\nimport type { InteractionData } from './InteractionData';\n\nexport type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionEvent\n{\n public stopped: boolean;\n public stopsPropagatingAt: DisplayObject;\n public stopPropagationHint: boolean;\n public target: DisplayObject;\n public currentTarget: DisplayObject;\n public type: string;\n public data: InteractionData;\n\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n public stopPropagation(): void\n {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n }\n\n /**\n * Resets the event.\n */\n public reset(): void\n {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","export interface InteractionTrackingFlags\n{\n OVER: number;\n LEFT_DOWN: number;\n RIGHT_DOWN: number;\n NONE: number;\n}\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class InteractionTrackingData\n{\n public static FLAGS: Readonly = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n\n private readonly _pointerId: number;\n private _flags: number;\n\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n constructor(pointerId: number)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n private _doSet(flag: number, yn: boolean): void\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get pointerId(): number\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get flags(): number\n {\n return this._flags;\n }\n\n set flags(flags: number)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get none(): boolean\n {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get over(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n }\n\n set over(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get rightDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n set rightDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get leftDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n }\n\n set leftDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n }\n}\n","import { Point } from '@pixi/math';\n\nimport type { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport type { Container, DisplayObject } from '@pixi/display';\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TreeSearch\n{\n private readonly _tempPoint: Point;\n\n constructor()\n {\n this._tempPoint = new Point();\n }\n\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n public recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean, interactive?: boolean\n ): boolean\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!((displayObject._mask as any).containsPoint && (displayObject._mask as any).containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && (displayObject as Container).children)\n {\n const children = (displayObject as Container).children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && (displayObject as any).containsPoint)\n {\n if ((displayObject as any).containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n public findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n }\n}\n","import type { InteractionTrackingData } from './InteractionTrackingData';\n\nexport type Cursor = 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ns-resize'\n | 'ew-resize'\n | 'nesw-resize'\n | 'col-resize'\n | 'nwse-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out'\n | 'grab'\n | 'grabbing';\n\nexport interface IHitArea {\n contains(x: number, y: number): boolean;\n}\n\nexport interface InteractiveTarget {\n interactive: boolean;\n interactiveChildren: boolean;\n hitArea: IHitArea;\n cursor: Cursor | string;\n buttonMode: boolean;\n trackedPointers: {[x: number]: InteractionTrackingData};\n _trackedPointers: {[x: number]: InteractionTrackingData};\n}\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nexport const interactiveTarget: InteractiveTarget = {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode(): boolean\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value: boolean)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n","import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject, TemporaryDisplayObject } from '@pixi/display';\nimport { InteractionData, InteractivePointerEvent } from './InteractionData';\nimport { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport { InteractionTrackingData } from './InteractionTrackingData';\nimport { TreeSearch } from './TreeSearch';\nimport { EventEmitter } from '@pixi/utils';\nimport { interactiveTarget } from './interactiveTarget';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { Point, IPointData } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\nDisplayObject.mixin(interactiveTarget);\n\nconst MOUSE_POINTER_ID = 1;\n\n// Mock interface for hitTestEvent - only used inside hitTest()\ninterface TestInteractionEvent\n{\n target: DisplayObject;\n data: {global: Point};\n}\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent: TestInteractionEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\nexport interface InteractionManagerOptions {\n autoPreventDefault?: boolean;\n interactionFrequency?: number;\n useSystemTicker?: boolean;\n}\n\nexport interface DelayedEvent {\n displayObject: DisplayObject;\n eventString: string;\n eventData: InteractionEvent;\n}\n\ninterface CrossCSSStyleDeclaration extends CSSStyleDeclaration\n{\n msContentZooming: string;\n msTouchAction: string;\n}\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class InteractionManager extends EventEmitter\n{\n public readonly activeInteractionData: { [key: number]: InteractionData };\n public readonly supportsTouchEvents: boolean;\n public readonly supportsPointerEvents: boolean;\n public interactionDataPool: InteractionData[];\n public cursor: string;\n public delayedEvents: DelayedEvent[];\n public search: TreeSearch;\n public renderer: AbstractRenderer;\n public autoPreventDefault: boolean;\n public interactionFrequency: number;\n public mouse: InteractionData;\n public eventData: InteractionEvent;\n public moveWhenInside: boolean;\n public cursorStyles: Dict void) | CSSStyleDeclaration>;\n public currentCursorMode: string;\n public resolution: number;\n\n protected interactionDOMElement: HTMLElement;\n protected eventsAdded: boolean;\n protected tickerAdded: boolean;\n protected mouseOverRenderer: boolean;\n\n private _useSystemTicker: boolean;\n private _deltaTime: number;\n private _didMove: boolean;\n private _tempDisplayObject: DisplayObject;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n constructor(renderer: AbstractRenderer, options: InteractionManagerOptions)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n this.tickerAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObject = new TemporaryDisplayObject();\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get useSystemTicker(): boolean\n {\n return this._useSystemTicker;\n }\n set useSystemTicker(useSystemTicker: boolean)\n {\n this._useSystemTicker = useSystemTicker;\n\n if (useSystemTicker)\n {\n this.addTickerListener();\n }\n else\n {\n this.removeTickerListener();\n }\n }\n\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get lastObjectRendered(): DisplayObject\n {\n return this.renderer._lastObjectRendered || this._tempDisplayObject;\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n public hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent as InteractionEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n public setTargetElement(element: HTMLElement, resolution = 1): void\n {\n this.removeTickerListener();\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n\n this.addTickerListener();\n }\n\n /**\n * Add the ticker listener\n *\n * @private\n */\n private addTickerListener(): void\n {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker)\n {\n return;\n }\n\n Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n\n this.tickerAdded = true;\n }\n\n /**\n * Remove the ticker listener\n *\n * @private\n */\n private removeTickerListener(): void\n {\n if (!this.tickerAdded)\n {\n return;\n }\n\n Ticker.system.remove(this.tickerUpdate, this);\n\n this.tickerAdded = false;\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n private addEvents(): void\n {\n if (this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n private removeEvents(): void\n {\n if (!this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n public tickerUpdate(deltaTime: number): void\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n this.update();\n }\n\n /**\n * Updates the state of interactive objects.\n */\n public update(): void\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove)\n {\n this._didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent as PointerEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n public setCursorMode(mode: string): void\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n private dispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if ((displayObject as any)[eventString])\n {\n (displayObject as any)[eventString](eventData);\n }\n }\n }\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n private delayDispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n this.delayedEvents.push({ displayObject, eventString, eventData });\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n public mapPositionToPoint(point: IPointData, x: number, y: number): void\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * ((this.interactionDOMElement as any).width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * ((this.interactionDOMElement as any).height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n public processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n const hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n const delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n const delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (let i = 0; i < delayedLen; i++)\n {\n const { displayObject, eventString, eventData } = delayedEvents[i];\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject, eventString, eventData);\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n private onPointerDown(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && (events[0] as any).isNormalized)\n {\n const cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerDown(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n private onPointerComplete(originalEvent: InteractivePointerEvent, cancelled: boolean, func: InteractionCallback): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerCancel(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n private processPointerCancel(interactionEvent: InteractionEvent, displayObject: DisplayObject): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerUp(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerUp(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n private onPointerMove(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this._didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerMove(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n private onPointerOut(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerOverOut(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n private onPointerOver(originalEvent: InteractivePointerEvent): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n private getInteractionDataForPointerId(event: PointerEvent): InteractionData\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n private releaseInteractionDataForPointerId(pointerId: number): void\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n private configureInteractionEventForDOMEvent(interactionEvent: InteractionEvent, pointerEvent: PointerEvent,\n interactionData: InteractionData\n ): InteractionEvent\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n (pointerEvent as any).globalX = interactionData.global.x;\n (pointerEvent as any).globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n private normalizeToPointerData(event: InteractivePointerEvent): PointerEvent[]\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i] as PixiTouch;\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n const tempEvent = event as PixiPointerEvent;\n\n if (typeof tempEvent.isPrimary === 'undefined') tempEvent.isPrimary = true;\n if (typeof tempEvent.width === 'undefined') tempEvent.width = 1;\n if (typeof tempEvent.height === 'undefined') tempEvent.height = 1;\n if (typeof tempEvent.tiltX === 'undefined') tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === 'undefined') tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === 'undefined') tempEvent.pointerType = 'mouse';\n if (typeof tempEvent.pointerId === 'undefined') tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === 'undefined') tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === 'undefined') tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === 'undefined') tempEvent.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n\n normalizedEvents.push(tempEvent);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents as PointerEvent[];\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n public destroy(): void\n {\n this.removeEvents();\n\n this.removeTickerListener();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n }\n}\n\ninterface PixiPointerEvent extends PointerEvent\n{\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n isNormalized: boolean;\n}\n\ninterface PixiTouch extends Touch\n{\n button: number;\n buttons: number;\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n layerX: number;\n layerY: number;\n offsetX: number;\n offsetY: number;\n isNormalized: boolean;\n}\n","/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param {string} name - the function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /**\n * Remove all references, don't use after this.\n */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n","import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type{ ISize } from '@pixi/math';\nimport type{ ICubeResourceOptions } from './CubeResource';\nimport type{ ISVGResourceOptions } from './SVGResource';\nimport type{ IVideoResourceOptions } from './VideoResource';\n\n/**\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/**\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n | ICubeResourceOptions\n | IImageResourceOptions\n | ISVGResourceOptions\n | IVideoResourceOptions\n | IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: any): Resource;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: IAutoDetectOptions): Resource\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i];\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nexport abstract class Resource\n{\n public destroyed: boolean;\n public internal: boolean;\n protected _width: number;\n protected _height: number;\n protected onResize: Runner;\n protected onUpdate: Runner;\n protected onError: Runner;\n /**\n * @param {number} [width=0] - Width of the resource\n * @param {number} [height=0] - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new Runner('setRealSize');\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new Runner('update');\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param {number} width - X dimension\n * @param {number} height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /**\n * Has been updated trigger event\n */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BufferResource extends Resource\n{\n data: Float32Array|Uint8Array|Uint32Array;\n\n /**\n * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer\n * @param {object} options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array|Uint8Array|Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /**\n * Destroy and don't use after this\n * @override\n */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array|Uint8Array|Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap;\n\nexport interface IBaseTextureOptions {\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n resourceOptions?: any;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nexport class BaseTexture extends EventEmitter\n{\n public width: number;\n public height: number;\n public resolution: number;\n public alphaMode?: ALPHA_MODES;\n public mipmap?: MIPMAP_MODES;\n public anisotropicLevel?: number;\n public scaleMode?: SCALE_MODES;\n public wrapMode?: WRAP_MODES;\n public format?: FORMATS;\n public type?: TYPES;\n public target?: TARGETS;\n\n public readonly uid: number;\n touched: number;\n isPowerOfTwo: boolean;\n\n _glTextures: { [key: number]: GLTexture };\n dirtyId: number;\n dirtyStyleId: number;\n public cacheId: string;\n public valid: boolean;\n textureCacheIds: Array;\n public destroyed: boolean;\n public resource: Resource;\n _batchEnabled: number;\n _batchLocation: number;\n parentTextureArray: BaseTexture;\n\n constructor(resource: Resource | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = width || 0;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = height || 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n\n /**\n * How the texture wraps\n * @member {number}\n */\n this.wrapMode = wrapMode || settings.WRAP_MODE;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n this.format = format || FORMATS.RGBA;\n\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n this.type = type || TYPES.UNSIGNED_BYTE;\n\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n this.target = target || TARGETS.TEXTURE_2D;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {number}\n * @protected\n */\n this.uid = uid();\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n this.touched = 0;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n this._glTextures = {};\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n this.dirtyStyleId = 0;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n this.cacheId = null;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n this.valid = width > 0 && height > 0;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n this.textureCacheIds = [];\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n this.destroyed = false;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n this.resource = null;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchEnabled = 0;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchLocation = 0;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realWidth(): number\n {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n }\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realHeight(): number\n {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n }\n\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width - Visual width\n * @param {number} height - Visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setSize(width: number, height: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n setResource(resource: Resource): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource|string, options: IBaseTextureOptions,\n strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture|null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport { ISize } from '@pixi/math';\nimport { autoDetectResource, IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {object} [options] Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n readonly length: number;\n items: Array;\n itemDirtyIds: Array;\n private _load: Promise;\n\n baseTexture: BaseTexture;\n\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n /**\n * Collection of partial baseTextures that correspond to resources\n * @member {Array}\n * @readonly\n */\n this.items = [];\n\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n this.length = length;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Bound baseTexture, there can only be one\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n }\n\n /**\n * used from ArrayResource and CubeResource constructors\n * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param {object} [options] - detect options for resources\n * @protected\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.AbstractMultiResource} Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n constructor(source: number|Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n texture.format,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n texture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BaseImageResource extends Resource\n{\n public source: ImageSource;\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n this.source = source;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement|HTMLVideoElement, url: string, crossorigin: boolean|string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas|HTMLCanvasElement\n {\n const { OffscreenCanvas } = window;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Constructor options for CubeResource\n */\nexport interface ICubeResourceOptions extends ISize\n{\n autoLoad?: boolean;\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n linkBaseTexture: boolean;\n\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself\n * @member {boolean}\n * @protected\n */\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {object} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n autoLoad?: boolean;\n createBitmap?: boolean;\n crossorigin?: boolean|string;\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nexport class ImageResource extends BaseImageResource\n{\n url: string;\n private _load: Promise;\n private _process: Promise;\n preserveBitmap: boolean;\n createBitmap: boolean;\n alphaMode: ALPHA_MODES;\n bitmap: ImageBitmap;\n /**\n * @param {HTMLImageElement|string} source - image source or URL\n * @param {object} [options]\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement|string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n /**\n * URL of the image source\n * @member {string}\n */\n this.url = source.src;\n\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n this._process = null;\n\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n this.preserveBitmap = false;\n\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n this.bitmap = null;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap] - whether process image into bitmap\n * @returns {Promise}\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n this._process = (window.createImageBitmap as any)(source,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {string|HTMLImageElement} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string|HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean|string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\nexport class SVGResource extends BaseImageResource\n{\n public readonly svg: string;\n public readonly scale: number;\n readonly _overrideWidth: number;\n readonly _overrideHeight: number;\n private _resolve: () => void;\n private _load: Promise;\n private _crossorigin?: boolean|string;\n\n constructor(sourceBase64: string, options: ISVGResourceOptions)\n {\n options = options || {};\n\n super(document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n this.svg = sourceBase64;\n\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n this.scale = options.scale || 1;\n\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideWidth = options.width;\n\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideHeight = options.height;\n\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n this._resolve = null;\n\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n this._crossorigin = options.crossorigin;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if ((/^\\\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using regexp.\n *\n * @method\n * @param {string} svgString - a serialized svg element\n * @return {PIXI.ISize} image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && (/^data:image\\/svg\\+xml(;(charset=utf8|utf8))?;base64/).test(source))\n // source is SVG inline\n || (typeof source === 'string' && source.indexOf(']*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean|string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nexport class VideoResource extends BaseImageResource\n{\n protected _autoUpdate: boolean;\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n protected autoPlay: boolean;\n private _load: Promise;\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n constructor(source?: HTMLVideoElement|Array|string, options?: IVideoResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = true;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = options.autoPlay !== false;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n *\n * @private\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState === 3 || source.readyState === 4;\n }\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\n static TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @constant\n * @member {object}\n * @static\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {ImageBitmap} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\n/**\n * Collection of base resource types supported by PixiJS.\n *\n * Resources are used by {@link PIXI.BaseTexture} to handle different media types\n * such as images, video, SVG graphics, etc. In most use-cases, you should not\n * instantiate the resources directly. The easy thing is to use\n * {@link PIXI.BaseTexture.from}.\n * @example\n * const baseTexture = PIXI.BaseTexture.from('path/to/image.jpg');\n * @namespace PIXI.resources\n */\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import type { Renderer } from './Renderer';\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nexport class System\n{\n // public because of Filter usage,\n // protected because usually renderer it already known by those who use the system\n renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n destroy(): void\n {\n (this as any).renderer = null;\n }\n}\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0\n renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n public width: number;\n public height: number;\n public multisample: MSAA_QUALITY;\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.ceil(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.ceil(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(renderTexture, myContainer);\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable depth on the frame buffer\n */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable stencil on the frame buffer\n */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n maskStack: Array;\n filterStack: Array;\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated.\n */\n constructor(options: IBaseTextureOptions)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n super(null, options);\n\n const { width, height } = options || {};\n\n // Set defaults\n this.mipmap = 0;\n this.width = Math.ceil(width) || 100;\n this.height = Math.ceil(height) || 100;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)\n .addColorTexture(0, this);\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /**\n * Destroys this texture.\n */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n public x0: number;\n public y0: number;\n public x1: number;\n public y1: number;\n public x2: number;\n public y2: number;\n public x3: number;\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { IPointData } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string|BaseTexture|ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class Texture extends EventEmitter\n{\n public baseTexture: BaseTexture;\n public orig: Rectangle;\n public trim: Rectangle;\n public valid: boolean;\n public noFrame: boolean;\n public defaultAnchor: Point;\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n _updateID: number;\n _frame: Rectangle;\n _uvs: TextureUvs;\n textureCacheIds: Array;\n\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n this._uvs = DEFAULT_UVS;\n\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const resource = this.baseTexture as any;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n clone(): Texture\n {\n return new Texture(this.baseTexture,\n this.frame.clone(),\n this.orig.clone(),\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource, options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture)\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url The remote URL to load.\n * @param {object} [options] Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n static fromURL(url: string, options?: IBaseTextureOptions): Promise\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource as ImageResource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n static fromLoader(source: HTMLImageElement|HTMLCanvasElement, imageUrl: string, name: string): Texture\n {\n const resource = new ImageResource(source as any);\n\n resource.url = imageUrl;\n\n const baseTexture = new BaseTexture(resource, {\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n });\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n static removeFromCache(texture: string|Texture): Texture|null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.orig.height;\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n static readonly EMPTY: Texture;\n static readonly WHITE: Texture;\n}\n\nfunction createWhiteTexture(): Texture\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public filterFrame: Rectangle|null;\n public filterPoolKey: string|number|null;\n legacyRenderer: any;\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n // support for legacy..\n let _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n const width = arguments[1];\n const height = arguments[2];\n const scaleMode = arguments[3];\n const resolution = arguments[4];\n\n // we have an old render texture..\n console.warn(`Please use RenderTexture.create(${width}, ${height}) instead of the ctor directly.`);\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width,\n height,\n scaleMode,\n resolution,\n });\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n super(baseRenderTexture, frame);\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n this.filterFrame = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @member {PIXI.Framebuffer}\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return (this.baseTexture as BaseRenderTexture).framebuffer;\n }\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n resize(width: number, height: number, resizeBaseTexture = true): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n (this.baseTexture as BaseRenderTexture).resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n static create(options: IBaseTextureOptions): RenderTexture\n {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n public enableFullScreen: boolean;\n texturePool: {[x in string|number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n /**\n * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth - width of texture in pixels\n * @param {number} realHeight - height of texture in pixels\n * @returns {RenderTexture}\n */\n createTexture(realWidth: number, realHeight: number): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n let key: number|string = RenderTexturePool.SCREEN_KEY;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input: RenderTexture, resolution: number): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] - destroy all stored textures\n */\n clear(destroyTextures: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n const screenKey = RenderTexturePool.SCREEN_KEY;\n const textures = this.texturePool[screenKey];\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\n static SCREEN_KEY = 'screen';\n}\n","import type { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n /**\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data)\n */\n constructor(buffer: number, size = 0, normalized = false, type = 5126, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /**\n * Destroys the Attribute.\n */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n *\n * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nexport class Buffer\n{\n public data: ITypedArray;\n public index: boolean;\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param {boolean} [_static=true] - `true` for static buffer\n * @param {boolean} [index=false] - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n\n this._updateID = 0;\n\n this.index = index;\n\n this.static = _static;\n\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer): void\n {\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the buffer\n */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import type { ITypedArray } from '../Buffer';\n\nexport function getBufferType(array: ITypedArray): string|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from './utils/getBufferType';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n public instanced: boolean;\n public instanceCount: number;\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n refCount: number;\n /**\n * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional.\n * @param {object} [attributes] - of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param {String} id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start] - How far into the array to start reading values (used for interleaving data)\n * @param {boolean} [instance=false] - Instancing flag\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer|Float32Array|Uint32Array|Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * returns the requested attribute\n *\n * @param {String} id - the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * returns the requested buffer\n *\n * @param {String} id - the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.index = true;\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the geometry.\n */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n\n return geometry;\n }\n\n /**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries - array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n vertices: Float32Array;\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nexport class UniformGroup\n{\n public readonly uniforms: Dict;\n public readonly group: boolean;\n public id: number;\n syncUniforms: Dict;\n dirtyId: number;\n static: boolean;\n\n /**\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n * @param {boolean} [_static] - Uniforms wont be changed after creation\n */\n constructor(uniforms: Dict, _static?: boolean)\n {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n }\n\n update(): void\n {\n this.dirtyId++;\n }\n\n add(name: string, uniforms: Dict, _static: boolean): void\n {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n }\n\n static from(uniforms: Dict, _static: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static);\n }\n}\n","import { Rectangle } from '@pixi/math';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n target: IFilterTarget;\n legacy: boolean;\n resolution: number;\n sourceFrame: Rectangle;\n destinationFrame: Rectangle;\n filters: Array;\n\n constructor()\n {\n this.renderTexture = null;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new Rectangle();\n\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n }\n\n /**\n * clears the state\n * @private\n */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { System } from '../System';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\nimport { FilterState } from './FilterState';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class FilterSystem extends System\n{\n public readonly defaultFilterStack: Array;\n public statePool: Array;\n public texturePool: RenderTexturePool;\n public forceClear: boolean;\n public useMaxPadding: boolean;\n protected quad: Quad;\n protected quadUv: QuadUv;\n protected activeState: FilterState;\n protected globalUniforms: UniformGroup;\n private tempRect: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n this.defaultFilterStack = [{}] as any;\n\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n this.texturePool = new RenderTexturePool();\n\n this.texturePool.setScreenSize(renderer.view);\n\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n this.statePool = [];\n\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n this.quad = new Quad();\n\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n this.quadUv = new QuadUv();\n\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n this.tempRect = new Rectangle();\n\n /**\n * Active state\n * @member {object}\n */\n this.activeState = {} as any;\n\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n this.globalUniforms = new UniformGroup({\n outputFrame: this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n /**\n * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}\n * @member {boolean}\n */\n this.forceClear = false;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @member {boolean}\n * @default false\n */\n this.useMaxPadding = false;\n }\n\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n\n let resolution = filters[0].resolution;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n let legacy = filters[0].legacy;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || filter.legacy;\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n\n state.legacy = legacy;\n\n state.target = target;\n\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n if (autoFit)\n {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.renderTexture.clear();\n }\n\n /**\n * Pops off the filter and applies it.\n *\n */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n if (state.renderTexture.framebuffer.multisample > 1)\n {\n this.renderer.framebuffer.blit();\n }\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode = CLEAR_MODES.CLEAR): void\n {\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else\n {\n this.renderer.renderTexture.bind(filterTexture);\n }\n\n // TODO: remove in next major version\n if (typeof clearMode === 'boolean')\n {\n clearMode = clearMode ? CLEAR_MODES.CLEAR : CLEAR_MODES.BLEND;\n // get deprecation function from utils\n deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option');\n }\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && this.forceClear))\n {\n this.renderer.renderTexture.clear();\n }\n }\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /**\n * Destroys this Filter System.\n */\n destroy(): void\n {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input?: RenderTexture, resolution?: number): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /**\n * Empties the texture pool.\n */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n}\n","import type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nexport class ObjectRenderer\n{\n protected renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n flush(): void\n {\n // flush!\n }\n\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { System } from '../System';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class BatchSystem extends System\n{\n public readonly emptyRenderer: ObjectRenderer;\n public currentRenderer: ObjectRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(renderer);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Reset the system to an empty renderer\n */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param {PIXI.BaseTexture[]} - arr copy destination\n * @param {number} maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray - textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures\n * @param {number} batchId - marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { System } from '../System';\nimport { settings } from '../settings';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict {\n uint32Indices: boolean;\n}\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ContextSystem extends System\n{\n public webGLVersion: number;\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n /* eslint-disable camelcase */\n extensions:\n {\n drawBuffers?: WEBGL_draw_buffers;\n depthTexture?: OES_texture_float;\n loseContext?: WEBGL_lose_context;\n vertexArrayObject?: OES_vertex_array_object;\n anisotropicFiltering?: EXT_texture_filter_anisotropic;\n uint32ElementIndex?: OES_element_index_uint;\n floatTexture?: OES_texture_float;\n floatTextureLinear?: OES_texture_float_linear;\n textureHalfFloat?: OES_texture_half_float;\n textureHalfFloatLinear?: OES_texture_half_float_linear;\n colorBufferFloat?: WEBGL_color_buffer_float;\n };\n /* eslint-enable camelcase */\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n this.webGLVersion = 1;\n\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n this.extensions = {};\n\n /**\n * Features supported by current context\n * @member {object}\n * @private\n * @readonly\n * @property {boolean} uint32Indices - Supports of 32-bit indices buffer\n */\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl - new webgl context\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n }\n\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n event.preventDefault();\n }\n\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n public framebuffer: WebGLFramebuffer;\n public stencil: WebGLRenderbuffer;\n public multisample: MSAA_QUALITY;\n public msaaBuffer: WebGLRenderbuffer;\n public blitFramebuffer: Framebuffer;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = 0;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = 0;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = 0;\n\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class FramebufferSystem extends System\n{\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n for (let i = 0; i < colorTextures.length; i++)\n {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n updateFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1)\n {\n fbo.msaaBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n if (i === 0 && fbo.multisample > 1)\n {\n continue;\n }\n\n const texture = framebuffer.colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n }\n\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))\n {\n fbo.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture)\n { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (fbo.multisample <= 1)\n {\n return;\n }\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]);\n }\n framebuffer = fbo.blitFramebuffer;\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height,\n destPixels.x, destPixels.y, destPixels.width, destPixels.height,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n framebuffer.enableStencil();\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { System } from '../System';\nimport { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Buffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class GeometrySystem extends System\n{\n public hasVao: boolean;\n public hasInstance: boolean;\n public canUseUInt32ElementIndex: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n readonly managedGeometries: {[key: number]: Geometry};\n readonly managedBuffers: {[key: number]: Buffer};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this._activeGeometry = null;\n this._activeVao = null;\n\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n this.hasVao = true;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n this.hasInstance = true;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n this.canUseUInt32ElementIndex = false;\n\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedGeometries = {};\n\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedBuffers = {};\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry - instance of geometry to bind\n * @param {PIXI.Shader} [shader] - instance of shader to use vao for\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /**\n * Reset and unbind any active VAO and geometry\n */\n reset(): void\n {\n this.unbind();\n }\n\n /**\n * Update buffers\n * @protected\n */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n const { gl } = this;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n\n if (buffer._updateID !== glBuffer.updateID)\n {\n glBuffer.updateID = buffer._updateID;\n\n // TODO can cache this on buffer! maybe added a getter / setter?\n const type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n\n this._boundBuffer = glBuffer;\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n }\n\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry - to get signature from\n * @param {PIXI.Program} program - to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers\n */\n protected initGeometryVao(geometry: Geometry, program: Program, incRefCount = true): WebGLVertexArrayObject\n {\n this.checkCompatibility(geometry, program);\n\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n if (!buffer._glBuffers[CONTEXT_UID])\n {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeBuffer(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n let all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (let i = 0; i < all.length; i++)\n {\n this.disposeBuffer(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /**\n * Unbind/reset everything\n * @protected\n */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\n\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nexport class MaskData\n{\n public type: MASK_TYPES;\n public autoDetect: boolean;\n public maskObject: IMaskTarget;\n public pooled: boolean;\n public isMaskData: true;\n _stencilCounter: number;\n _scissorCounter: number;\n _scissorRect: Rectangle;\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = MASK_TYPES.NONE;\n\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n }\n\n /**\n * resets the mask data after popMask()\n */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n }\n\n /**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param src {string} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nexport function compileProgram(gl: WebGLRenderingContextBase, vertexSrc: string, fragmentSrc: string,\n attributeLocations?: Dict): WebGLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n let program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations)\n {\n for (const i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS))\n {\n console.warn(vertexSrc);\n console.error(gl.getShaderInfoLog(glVertShader));\n }\n\n if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS))\n {\n console.warn(fragmentSrc);\n console.error(gl.getShaderInfoLog(glFragShader));\n }\n\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nexport function defaultValue(type: string, size: number): number|Float32Array|Int32Array|boolean|boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = document.createElement('canvas');\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext);\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: string;\n\nexport function getMaxFragmentPrecision(): string\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: string, maxSupportedPrecision: string): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.shader\n * @param type {String}\n * @return {Number}\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any): boolean =>\n // eslint-disable-next-line max-len\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray,\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }`,\n\n vec2: `\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i].group)\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv[\"${i}\"], syncData);\n `);\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cv = ud[\"${i}\"].value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /**\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n defaultValue,\n compileProgram,\n mapSize,\n mapType,\n getTestContext,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n type: string;\n size: number;\n isArray: RegExpMatchArray;\n value: any;\n}\n\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n public vertexSrc: string;\n public fragmentSrc: string;\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n attributeData: { [key: string]: IAttributeData};\n uniformData: {[key: string]: IUniformData};\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name] - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\n protected extractData(vertexSrc: string, fragmentSrc: string): void\n {\n const gl = getTestContext();\n\n if (gl)\n {\n const program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n\n gl.deleteProgram(program);\n }\n else\n {\n this.uniformData = {};\n this.attributeData = {};\n }\n }\n\n /**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\n protected getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n {\n const attributes: {[key: string]: IAttributeData} = {};\n const attributesArray: Array = [];\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n const type = mapType(gl, attribData.type);\n\n /*eslint-disable */\n const data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n\n attributesArray.sort((a, b) => (a.name > b.name) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < attributesArray.length; i++)\n {\n attributesArray[i].location = i;\n }\n\n return attributes;\n }\n\n /**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\n private getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n {\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = uniformData.name.match(/\\[.*?\\]$/);\n const type = mapType(gl, uniformData.type);\n\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray:isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n\n return uniforms;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nexport class Shader\n{\n public program: Program;\n public uniformGroup: UniformGroup;\n /**\n * @param {PIXI.Program} [program] - The program the shader will use.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms: Dict)\n {\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (const i in program.uniformData)\n {\n if (this.uniformGroup.uniforms[i] instanceof Array)\n {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { State } from '../state/State';\nimport { settings } from '@pixi/settings';\nimport defaultVertex from './defaultFilter.vert';\nimport defaultFragment from './defaultFilter.frag';\n\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterSystem } from './FilterSystem';\nimport type { FilterState } from './FilterState';\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class Filter extends Shader\n{\n public padding: number;\n public resolution: number;\n public enabled: boolean;\n public autoFit: boolean;\n public legacy: boolean;\n state: State;\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n this.legacy = !!this.program.attributeData.aTextureCoord;\n\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n this.state = new State();\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * Used for caching shader IDs\n *\n * @static\n * @type {object}\n * @protected\n */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n public mapCoord: Matrix;\n public clampOffset: number;\n public clampMargin: number;\n readonly uClampFrame: Float32Array;\n readonly uClampOffset: Float32Array;\n _textureID: number;\n _updateID: number;\n _texture: Texture;\n isSimple: boolean;\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport { Matrix, Point } from '@pixi/math';\nimport { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n maskMatrix: Matrix;\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n constructor(sprite: IMaskTarget)\n {\n const maskMatrix = new Matrix();\n\n super(vertex, fragment);\n\n sprite.renderable = false;\n\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n this.maskSprite = sprite;\n\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n this.maskMatrix = maskMatrix;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this.maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { System } from '../System';\nimport { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class MaskSystem extends System\n{\n public enableScissor: boolean;\n protected readonly alphaMaskPool: Array;\n protected alphaMaskIndex: number;\n private readonly maskDataPool: Array;\n private maskStack: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n this.enableScissor = false;\n\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n this.alphaMaskPool = [];\n\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n this.maskDataPool = [];\n\n this.maskStack = [];\n\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData|IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n\n return;\n }\n maskData.type = MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect())\n {\n const matrix = maskObject.worldTransform;\n\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n\n let rotX = Math.atan2(matrix.b, matrix.a);\n let rotXY = Math.atan2(matrix.d, matrix.c);\n\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n\n if (rotX === 0 && rotXY === 9000)\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n popSpriteMask(): void\n {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n }\n}\n","import { System } from '../System';\n\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class AbstractMaskSystem extends System\n{\n protected maskStack: Array;\n protected glConst: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n this.glConst = 0;\n }\n\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /**\n * Destroys the mask stack.\n *\n */\n destroy(): void\n {\n super.destroy();\n\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n maskObject.renderable = true;\n\n const prevData = maskData._scissorRect;\n const bounds = maskObject.getBounds(true);\n const { gl } = this.renderer;\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n bounds.fit(prevData);\n }\n else\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n }\n\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n pop(): void\n {\n const { gl } = this.renderer;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n const rt = this.renderer.renderTexture.current;\n const { transform, sourceFrame, destinationFrame } = this.renderer.projection;\n const resolution = rt ? rt.resolution : this.renderer.resolution;\n let x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n let y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n const width = rect.width * resolution;\n const height = rect.height * resolution;\n\n if (transform)\n {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt)\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n\n this.renderer.gl.scissor(x, y, width, height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n _getBitwiseMask(): number\n {\n return (1 << this.getStackLength()) - 1;\n }\n}\n","import { System } from '../System';\nimport { Matrix } from '@pixi/math';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nexport class ProjectionSystem extends System\n{\n public destinationFrame: Rectangle;\n public sourceFrame: Rectangle;\n public defaultFrame: Rectangle;\n public projectionMatrix: Matrix;\n public transform: Matrix;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = null;\n\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.defaultFrame = null;\n\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle).\n *\n * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this.\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { BUFFER_BITS } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n// Temporary rectangle for passing the framebuffer viewport\nconst viewportFrame = new Rectangle();\n\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class RenderTextureSystem extends System\n{\n public clearColor: number[];\n public defaultMaskStack: Array;\n public current: RenderTexture;\n public readonly sourceFrame: Rectangle;\n public readonly destinationFrame: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n this.clearColor = renderer._backgroundColorRgba;\n\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n this.defaultMaskStack = [];\n\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n this.current = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture\n *\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n * @return {PIXI.Renderer} Returns itself.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /**\n * Resets renderTexture state\n */\n reset(): void\n {\n this.bind(null);\n }\n}\n","import type { Dict } from '@pixi/utils';\n\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nexport class GLProgram\n{\n public program: WebGLProgram;\n public uniformData: Dict;\n public uniformGroups: Dict;\n /**\n * Makes a new Pixi program\n *\n * @param program {WebGLProgram} webgl program\n * @param uniformData {Object} uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n }\n\n /**\n * Destroys this program\n */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n }\n}\n","import { System } from '../System';\nimport { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported, defaultValue, compileProgram } from './utils';\n\nimport type { IGLUniformData } from './GLProgram';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// defualt sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class ShaderSystem extends System\n{\n protected gl: IRenderingContext;\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n private cache: Dict;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n this.cache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n *\n * syncs uniforms on the group\n * @param {*} group - the uniform group to sync\n * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getglProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])\n {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n /* eslint-enable @typescript-eslint/explicit-module-boundary-types */\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData);\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group - the uniform group to get signature of\n * @param {Object} uniformData - uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n private getSignature(group: UniformGroup, uniformData: Dict): string\n {\n const uniforms = group.uniforms;\n\n const strings = [];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n getglProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader - the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n generateShader(shader: Shader): GLProgram\n {\n const gl = this.gl;\n\n const program = shader.program;\n\n const attribMap: Dict = {};\n\n for (const i in program.attributeData)\n {\n attribMap[i] = program.attributeData[i].location;\n }\n\n const shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(shaderProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(shaderProgram, uniformData);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Destroys this System and removes all its textures\n */\n destroy(): void\n {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { System } from '../System';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StateSystem extends System\n{\n public stateId: number;\n public polygonOffset: number;\n public blendMode: BLEND_MODES;\n protected _blendEq: boolean;\n protected gl: IRenderingContext;\n protected blendModes: number[][];\n protected readonly map: Array<(value: boolean) => void>;\n protected readonly checks: Array<(system: this, state: State) => void>;\n protected defaultState: State;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = null;\n\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n this.stateId = 0;\n\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n this.polygonOffset = 0;\n\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n this.blendMode = BLEND_MODES.NONE;\n\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n this._blendEq = false;\n\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n this.map = [];\n\n // map functions for when we set state..\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n this.checks = [];\n\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func - the checking function to add or remove\n * @param {boolean} value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n}\n","import { System } from '../System';\nimport { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture {\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class TextureGCSystem extends System\n{\n public count: number;\n public checkCount: number;\n public maxIdle: number;\n public checkCountMax: number;\n public mode: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n}\n","/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLTexture\n{\n public texture: WebGLTexture;\n public width: number;\n public height: number;\n public mipmap: boolean;\n public wrapMode: number;\n public type: number;\n public internalFormat: number;\n dirtyId: number;\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n }\n}\n","import { System } from '../System';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES } from '@pixi/constants';\n\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class TextureSystem extends System\n{\n public boundTextures: BaseTexture[];\n public managedTextures: Array;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected webGLVersion: number;\n protected unknownTexture: BaseTexture;\n protected _unknownBoundTextures: boolean;\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n bind(texture: Texture|BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n if (texture)\n {\n texture = texture.castToBaseTexture();\n\n if (!texture || texture.parentTextureArray)\n {\n // cannot bind partial texture\n // TODO: report a warning\n return;\n }\n\n if (texture.valid)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2)\n {\n return;\n }\n const gl = this.renderer.gl;\n\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === TYPES.HALF_FLOAT)\n {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA16F;\n }\n }\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture|Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n}\n","import { hex2string, hex2rgb, deprecation, EventEmitter } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { DisplayObject } from '@pixi/display';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Container } from '@pixi/display';\n\nconst tempMatrix = new Matrix();\n\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n width?: number;\n height?: number;\n view?: HTMLCanvasElement;\n transparent?: boolean | 'notMultiplied';\n autoDensity?: boolean;\n antialias?: boolean;\n resolution?: number;\n preserveDrawingBuffer?: boolean;\n clearBeforeRender?: boolean;\n backgroundColor?: number;\n powerPreference?: WebGLPowerPreference;\n context?: IRenderingContext;\n}\n\ninterface IRendererOptionsLegacy extends IRendererOptions\n{\n autoResize?: boolean;\n roundPixels?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly transparent: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: DisplayObject;\n\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n // Deprecation notice for renderer roundPixels option\n if ((options as IRendererOptionsLegacy).roundPixels)\n {\n settings.ROUND_PIXELS = (options as IRendererOptionsLegacy).roundPixels;\n deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n this.autoDensity = options.autoDensity || (options as IRendererOptionsLegacy).autoResize || false;\n // autoResize is deprecated, provides fallback support\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n generateTexture(displayObject: DisplayObject,\n scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture\n {\n region = region || (displayObject as Container).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width | 0,\n height: region.height | 0,\n scaleMode,\n resolution,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n }\n\n abstract render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\n\nimport type { IRendererOptions, IRendererPlugins } from './AbstractRenderer';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { DisplayObject } from '@pixi/display';\nimport type { System } from './System';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Extract } from '@pixi/extract';\n\nexport interface IRendererPluginConstructor {\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin {\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class Renderer extends AbstractRenderer\n{\n public gl: IRenderingContext;\n public globalUniforms: UniformGroup;\n public CONTEXT_UID: number;\n public renderingToScreen: boolean;\n public extract: Extract;\n // systems\n public mask: MaskSystem;\n public context: ContextSystem;\n public state: StateSystem;\n public shader: ShaderSystem;\n public texture: TextureSystem;\n public geometry: GeometrySystem;\n public framebuffer: FramebufferSystem;\n public scissor: ScissorSystem;\n public stencil: StencilSystem;\n public projection: ProjectionSystem;\n public textureGC: TextureGCSystem;\n public filter: FilterSystem;\n public renderTexture: RenderTextureSystem;\n public batch: BatchSystem;\n\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @static\n * @private\n */\n static create(options: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n * @public\n */\n constructor(options? : IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n // TODO legacy!\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n addSystem(ClassRef: { new(renderer: Renderer): T}, name: string): this\n {\n if (!name)\n {\n name = ClassRef.name;\n }\n\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n this.runners.resize.emit(screenWidth, screenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /**\n * Clear the frame buffer\n */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.Renderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n */\n\n static __plugins: IRendererPlugins;\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n }\n}\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n public elements: BaseTexture[];\n public ids: number[];\n public count: number;\n\n constructor()\n {\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n public rawBinaryData: ArrayBuffer;\n public uint32View: Uint32Array;\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n constructor(size: number)\n {\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n */\nexport interface IBatchableElement {\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public size: number;\n public MAX_TEXTURES: number;\n\n protected shaderGenerator: BatchShaderGenerator;\n protected geometryClass: typeof BatchGeometry;\n protected vertexSize: number;\n protected _vertexCount: number;\n protected _indexCount: number;\n protected _bufferedElements: Array;\n protected _bufferedTextures: Array;\n protected _bufferSize: number;\n protected _shader: Shader;\n protected _flushId: number;\n protected _aBuffers: Array;\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n private _packedGeometries: Array;\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n this.shaderGenerator = null;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n this.geometryClass = null;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n this.vertexSize = null;\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._vertexCount = 0;\n\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._indexCount = 0;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n this._bufferedElements = [];\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n this._bufferedTextures = [];\n\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n this._bufferSize = 0;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n this._shader = null;\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n this._packedGeometries = [];\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n this._packedGeometryPoolSize = 2;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n this._flushId = 0;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n this._aBuffers = {} as any;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n this._iBuffers = {} as any;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /**\n * Renders the content _now_ and empties the current batch.\n */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /**\n * Starts a new sprite batch.\n */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /**\n * Stops and flushes the current batch.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n public vertexSrc: string;\n public fragTemplate: string;\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n /**\n * @param {string} vertexSrc - Vertex shader\n * @param {string} fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n _buffer: Buffer;\n _indexBuffer: Buffer;\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._buffer = new Buffer(null, _static, false);\n\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @static\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n","import { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer, IRendererOptionsAuto, AbstractRenderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IApplicationPlugin {\n init: (...params: any[]) => any;\n destroy: (...params: any[]) => any;\n}\n\nexport interface IApplicationOptions extends IRendererOptionsAuto {\n autoStart?: boolean;\n sharedTicker?: boolean;\n sharedLoader?: boolean;\n resizeTo?: Window | HTMLElement;\n resizeThrottle?: number;\n}\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport class Application\n{\n public static _plugins: IApplicationPlugin[];\n\n public stage: Container;\n public renderer: Renderer|AbstractRenderer;\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n constructor(options?: IApplicationOptions)\n {\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n // install plugins here\n Application._plugins.forEach((plugin) =>\n {\n plugin.init.call(this, options);\n });\n }\n\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\n static registerPlugin(plugin: IApplicationPlugin): void\n {\n Application._plugins.push(plugin);\n }\n\n /**\n * Render the current stage.\n */\n public render(): void\n {\n // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject\n // This can be fixed when CanvasRenderer is converted.\n this.renderer.render(this.stage as any);\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view(): HTMLCanvasElement\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen(): Rectangle\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n public destroy(removeView?: boolean, stageOptions?: IDestroyOptions|boolean): void\n {\n // Destroy plugins in the opposite order\n // which they were constructed\n const plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach((plugin) =>\n {\n plugin.destroy.call(this);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n }\n}\n\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n","import type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Renderer } from '@pixi/core';\nimport type { IApplicationOptions } from './Application';\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nexport class ResizePlugin\n{\n public static resizeTo: Window|HTMLElement;\n public static resize: () => void;\n public static renderer: Renderer|CanvasRenderer;\n public static queueResize: () => void;\n private static _resizeId: number;\n private static _resizeTo: Window|HTMLElement;\n private static cancelResize: () => void;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo',\n {\n set(dom: Window|HTMLElement)\n {\n window.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom)\n {\n window.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * Resize is throttled, so it's\n * safe to call this multiple times per frame and it'll\n * only be called once.\n * @method PIXI.Application#queueResize\n */\n this.queueResize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n this.cancelResize();\n\n // // Throttle resize events per raf\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n\n /**\n * Cancel the resize queue.\n * @method PIXI.Application#cancelResize\n * @private\n */\n this.cancelResize = (): void =>\n {\n if (this._resizeId)\n {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n * @method PIXI.Application#resize\n */\n this.resize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n // clear queue resize\n this.cancelResize();\n\n let width: number;\n let height: number;\n\n // Resize to the window\n if (this._resizeTo === window)\n {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n // Resize to other HTML entities\n else\n {\n const { clientWidth, clientHeight } = this._resizeTo as HTMLElement;\n\n width = clientWidth;\n height = clientHeight;\n }\n\n this.renderer.resize(width, height);\n };\n\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n static destroy(): void\n {\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n","import { Application } from './Application';\nimport { ResizePlugin } from './ResizePlugin';\n\nApplication.registerPlugin(ResizePlugin);\n\nexport * from './Application';\n","import { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { RenderTexture } from '@pixi/core';\n\nimport type { Renderer, IRendererPlugin } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\n\nconst TEMP_RECT = new Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nexport class Extract implements IRendererPlugin\n{\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.Extract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n let canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n const target = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n\n target.context.scale(1, -1);\n\n // we can't render to itself because we should be empty before render.\n target.context.drawImage(canvasBuffer.canvas, 0, -height);\n\n canvasBuffer.destroy();\n canvasBuffer = target;\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8Array\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\n static arrayPostDivide(\n pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray\n ): void\n {\n for (let i = 0; i < pixels.length; i += 4)\n {\n const alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n }\n}\n","'use strict'\n\nfunction parseURI (str, opts) {\n if (!str) return undefined\n\n opts = opts || {}\n\n var o = {\n key: [\n 'source',\n 'protocol',\n 'authority',\n 'userInfo',\n 'user',\n 'password',\n 'host',\n 'port',\n 'relative',\n 'path',\n 'directory',\n 'file',\n 'query',\n 'anchor'\n ],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n\nmodule.exports = parseURI\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() { /* empty */ }\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\nexport function eachSeries(array, iterator, callback, deferNext) {\n let i = 0;\n const len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(() => {\n iterator(array[i++], next);\n }, 1);\n }\n else {\n iterator(array[i++], next);\n }\n })();\n}\n\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\nexport function queue(worker, concurrency) {\n if (concurrency == null) { // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n }\n else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n let workers = 0;\n const q = {\n _tasks: [],\n concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push(data, callback) {\n _insert(data, false, callback);\n },\n kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift(data, callback) {\n _insert(data, true, callback);\n },\n process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n const task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length() {\n return q._tasks.length;\n },\n running() {\n return workers;\n },\n idle() {\n return q._tasks.length + workers === 0;\n },\n pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false;\n\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n },\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') { // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) { // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(() => q.drain(), 1);\n\n return;\n }\n\n const item = {\n data,\n callback: typeof callback === 'function' ? callback : _noop,\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n }\n else {\n q._tasks.push(item);\n }\n\n setTimeout(() => q.process(), 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) { // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= (q.concurrency - q.buffer)) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n","// a simple in-memory cache for resources\nconst cache = {};\n\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function caching(resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(() => (cache[this.url] = this.data));\n }\n\n next();\n}\n","import parseUri from 'parse-uri';\nimport Signal from 'mini-signals';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nconst useXdr = !!(window.XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\nlet tempAnchor = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop() { /* empty */ }\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\nclass Resource {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n constructor(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.url = url;\n\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.extension = this._getExtension();\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n this.timeout = options.timeout || 0;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n this.metadata = options.metadata || {};\n\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n this.error = null;\n\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n this.children = [];\n\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n this.type = Resource.TYPE.UNKNOWN;\n\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n this.progressChunk = 0;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._dequeue = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._onLoadBinding = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n this._elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n get isDataUrl() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n get isComplete() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n get isLoading() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n\n /**\n * Marks the resource as complete.\n *\n */\n complete() {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr) {\n this.xhr.abort();\n }\n else if (this.xdr) {\n this.xdr.abort();\n }\n else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n }\n // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb) {\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n }\n else {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n _setFlag(flag, value) {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /**\n * Finalizes the load.\n *\n * @private\n */\n _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url)) {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i) {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n _createSource(type, url, mime) {\n if (!mime) {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n _onError(event) {\n this.abort(`Failed to load element using: ${event.target.nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n _onTimeout() {\n this.abort(`Load timed out.`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnError() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnTimeout() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnAbort() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n _xhrOnLoad() {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n }\n else {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n const protocol = url.protocol ? `${url.protocol}:` : '';\n\n // if cross origin\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n _getExtension() {\n let url = this.url;\n let ext = '';\n\n if (this.isDataUrl) {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: (1 << 0),\n COMPLETE: (1 << 1),\n LOADING: (1 << 2),\n};\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6,\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4,\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n /** Blob */\n BLOB: 'blob',\n /** Document */\n DOCUMENT: 'document',\n /** Object */\n JSON: 'json',\n /** String */\n TEXT: 'text',\n};\n\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO,\n};\n\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n};\n\n// We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nexport { Resource };\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input) {\n let output = '';\n let inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { Resource } from '../Resource';\nimport { encodeBinary } from '../encodeBinary';\n\nconst Url = window.URL || window.webkitURL;\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function parsing(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () => {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () => {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import Signal from 'mini-signals';\nimport parseUri from 'parse-uri';\nimport * as async from './async';\nimport { Resource } from './Resource';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\nclass Loader {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10) {\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n this.loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n this.defaultQueryString = '';\n\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n this._resourcesParsing = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n this.resources = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n this.onError = new Signal();\n\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n this.onLoad = new Signal();\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n // Add default before middleware\n for (let i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n }\n\n // Add default after middleware\n for (let i = 0; i < Loader._defaultAfterMiddleware.length; ++i) {\n this.use(Loader._defaultAfterMiddleware[i]);\n }\n }\n\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (let i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading) {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i) {\n if (!parent.children[i].isComplete) {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i) {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources) {\n const res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n this._onComplete();\n }\n else {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n get concurrency() {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n set concurrency(concurrency) {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _prepareUrl(url) {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n ) {\n result = `${this.baseUrl}/${url}`;\n }\n else {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString) {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += `&${this.defaultQueryString}`;\n }\n else {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n _loadResource(resource, dequeue) {\n resource._dequeue = dequeue;\n\n // run before middleware\n async.eachSeries(\n this._beforeMiddleware,\n (fn, next) => {\n fn.call(this, resource, () => {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () => {\n if (resource.isComplete) {\n this._onLoad(resource);\n }\n else {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /**\n * Called once loading has started.\n *\n * @private\n */\n _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n _onLoad(resource) {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n async.eachSeries(\n this._afterMiddleware,\n (fn, next) => {\n fn.call(this, resource, next);\n },\n () => {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error) {\n this.onError.dispatch(resource.error, this, resource);\n }\n else {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0) {\n this._onComplete();\n }\n },\n true\n );\n }\n}\n\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultBeforeMiddleware = [];\n\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultAfterMiddleware = [];\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\nexport { Loader };\n\n","import { Resource } from 'resource-loader';\n\nimport type { Spritesheet } from '@pixi/spritesheet';\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, Resource.IMetadata {\n imageMetadata?: any;\n}\nexport interface ILoaderResource extends GlobalMixins.ILoaderResource, Resource\n{\n texture?: Texture;\n spritesheet?: Spritesheet;\n\n // required for Spritesheet\n textures?: Dict;\n\n // required specific type for Spritesheet\n metadata: IResourceMetadata;\n}\n\n// Mix constructor and typeof Resource , otherwise we can't access to statics field\ntype TLoaderResource = { new(...args: any[]): ILoaderResource } & typeof Resource;\n\n/**\n* Reference to **{@link https://github.com/englercj/resource-loader\n* resource-loader}**'s Resource class.\n* @see http://englercj.github.io/resource-loader/Resource.html\n* @class LoaderResource\n* @memberof PIXI\n*/\nexport const LoaderResource: TLoaderResource = Resource;\n","import { Resource } from 'resource-loader';\nimport { Texture } from '@pixi/core';\n\nimport type { ILoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class TextureLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n public static use(resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n }\n}\n","import { Loader as ResourceLoader, middleware } from 'resource-loader';\nimport { TextureLoader } from './TextureLoader';\n\nimport type { Resource } from 'resource-loader';\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nexport class Loader extends ResourceLoader\n{\n /**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\n private static _plugins: Array = [];\n private static _shared: Loader;\n private _protected: boolean;\n\n constructor(baseUrl?: string, concurrency?: number)\n {\n super(baseUrl, concurrency);\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n }\n\n /**\n * Destroy the loader, removes references.\n * @memberof PIXI.Loader#\n * @method destroy\n * @public\n */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n }\n}\n\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: middleware.parsing });\n\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n\nexport interface ILoaderPlugin {\n add?(): void;\n pre?(resource: Resource, next?: (...args: any[]) => void): void;\n use?(resource: Resource, next?: (...args: any[]) => void): void;\n}\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef {object} ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {object} ICallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalCallback\n * @param {function} callback - Callback function\n * @param {object} [context] - Context\n * @returns {ICallbackID} - CallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalDetach\n * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef ILoaderSignal\n * @property {ISignalCallback} add - Register callback\n * @property {ISignalCallback} once - Register oneshot callback\n * @property {ISignalDetach} detach - Detach specific callback by ID\n */\n\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when the loader begins to loading process.\n * @member {PIXI.Loader.ILoaderSignal} onStart\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded or errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onProgress\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onError\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded resource.\n * @member {PIXI.Loader.ILoaderSignal} onLoad\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when completely loaded all resources.\n * @member {PIXI.Loader.ILoaderSignal} onComplete\n */\n","import { Loader } from './Loader';\n\nimport type { IApplicationOptions } from '@pixi/app';\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n public static loader: Loader;\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n static init(options?: IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { hex2rgb } from '@pixi/utils';\n\nimport type { BaseTexture, Renderer } from '@pixi/core';\nimport type { ParticleBuffer } from './ParticleBuffer';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IParticleProperties {\n vertices?: boolean;\n position?: boolean;\n rotation?: boolean;\n uvs?: boolean;\n tint?: boolean;\n alpha?: boolean;\n scale?: boolean;\n}\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class ParticleContainer extends Container\n{\n public readonly blendMode: BLEND_MODES;\n public autoResize: boolean;\n public roundPixels: boolean;\n public baseTexture: BaseTexture;\n public tintRgb: Float32Array;\n\n _maxSize: number;\n _buffers: ParticleBuffer[];\n _batchSize: number;\n _properties: boolean[];\n _bufferUpdateIDs: number[];\n _updateID: number;\n private _tint: number;\n\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] - If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n constructor(maxSize = 1500, properties: IParticleProperties, batchSize = 16384, autoResize = false)\n {\n super();\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n const maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {Array}\n * @private\n */\n this._buffers = null;\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n public setProperties(properties: IParticleProperties): void\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform(): void\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n }\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n public render(renderer: Renderer): void\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = (this.children[0] as any)._texture.baseTexture;\n if (!this.baseTexture.valid)\n {\n this.baseTexture.once('update', () => this.onChildrenChange(0));\n }\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n }\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n protected onChildrenChange(smallestChildIndex: number): void\n {\n const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n }\n\n public dispose(): void\n {\n if (this._buffers)\n {\n for (let i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n\n this._buffers = null;\n }\n }\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.dispose();\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n }\n}\n","import { createIndicesForQuads } from '@pixi/utils';\nimport { Geometry, Buffer } from '@pixi/core';\nimport { TYPES } from '@pixi/constants';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { IParticleRendererProperty } from './ParticleRenderer';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class ParticleBuffer\n{\n public geometry: Geometry;\n public staticStride: number;\n public staticBuffer: Buffer;\n public staticData: Float32Array;\n public staticDataUint32: Uint32Array;\n public dynamicStride: number;\n public dynamicBuffer: Buffer;\n public dynamicData: Float32Array;\n public dynamicDataUint32: Uint32Array;\n public _updateID: number;\n\n indexBuffer: Buffer;\n private size: number;\n private dynamicProperties: IParticleRendererProperty[];\n private staticProperties: IParticleRendererProperty[];\n\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(properties: IParticleRendererProperty[], dynamicPropertyFlags: boolean[], size: number)\n {\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n private initBuffers(): void\n {\n const geometry = this.geometry;\n\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.dynamicBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.staticBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n }\n\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n destroy(): void\n {\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { ObjectRenderer, Shader, State } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { ParticleBuffer } from './ParticleBuffer';\nimport fragment from './particles.frag';\nimport vertex from './particles.vert';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { ParticleContainer } from './ParticleContainer';\nimport type { Renderer } from '@pixi/core';\n\nexport interface IParticleRendererProperty {\n attributeName: string;\n size: number;\n type?: TYPES;\n uploadFunction: (...params: any[]) => any;\n offset: number;\n}\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nexport class ParticleRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public shader: Shader;\n public tempMatrix: Matrix;\n public properties: IParticleRendererProperty[];\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n\n this.shader = Shader.from(vertex, fragment, {});\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n public render(container: ParticleContainer): void\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n const baseTexture = (children[0] as any)._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n private generateBuffers(container: ParticleContainer): ParticleBuffer[]\n {\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n private _generateOneMoreBuffer(container: ParticleContainer): ParticleBuffer\n {\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadVertices(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadPosition(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadRotation(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadUvs(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = (children[startIndex + i] as any)._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadTint(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n const alpha = sprite.alpha;\n\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied\n ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n */\n public destroy(): void\n {\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n }\n}\n","/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n *\n * @name LINE_JOIN\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet\n * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @property {string} ROUND - 'round': add an arc at the joint\n */\nexport enum LINE_JOIN {\n MITER = 'miter',\n BEVEL = 'bevel',\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n *\n * @name LINE_CAP\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @property {string} ROUND - 'round': add semicircle at ends\n * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end)\n */\nexport enum LINE_CAP {\n BUTT = 'butt',\n ROUND = 'round',\n SQUARE = 'square'\n}\n\nexport interface IGraphicsCurvesSettings {\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nexport const GRAPHICS_CURVES: IGraphicsCurvesSettings = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n","import { Texture } from '@pixi/core';\nimport type { Matrix } from '@pixi/math';\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform aplpied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n public matrix: Matrix = null;\n\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /**\n * Reset\n */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /**\n * Destroy and don't use after this\n */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n","import { earcut } from '@pixi/utils';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Polygon } from '@pixi/math';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n","// for type only\nimport { SHAPES } from '@pixi/math';\n\nimport type { Circle, Ellipse } from '@pixi/math';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildCircle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape as Circle;\n const points = graphicsData.points;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n const ellipseData = graphicsData.shape as Ellipse;\n\n width = ellipseData.width;\n height = ellipseData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n let totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n\n totalSegs /= 2.3;\n\n const seg = (Math.PI * 2) / totalSegs;\n\n for (let i = 0; i < totalSegs - 0.5; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(points[0], points[1]);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n let vertPos = verts.length / 2;\n const center = vertPos;\n\n const circle = (graphicsData.shape) as Circle;\n const matrix = graphicsData.matrix;\n const x = circle.x;\n const y = circle.y;\n\n // Push center (special point)\n verts.push(\n graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x,\n graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n\n for (let i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n","import type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n","import { earcut } from '@pixi/utils';\n\n// for type only\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { RoundedRectangle } from '@pixi/math';\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1: number, n2: number, perc: number): number\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number,\n out: Array = []): Array\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n const rrectData = graphicsData.shape as RoundedRectangle;\n const points = graphicsData.points;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n // Don't allow negative radius or greater than half the smallest width\n const radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n\n points.length = 0;\n\n // No radius, do a simple rectangle\n if (!radius)\n {\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n }\n else\n {\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n }\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n const vecPos = verts.length / 2;\n\n const triangles = earcut(points, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = points.length; i < j; i++)\n {\n verts.push(points[i], points[++i]);\n }\n },\n};\n","import { Point, SHAPES } from '@pixi/math';\n\nimport type { Polygon } from '@pixi/math';\nimport type { GraphicsData } from '../GraphicsData';\nimport type { GraphicsGeometry } from '../GraphicsGeometry';\nimport { LINE_JOIN, LINE_CAP } from '../const';\nimport { GRAPHICS_CURVES } from '../const';\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(\n x: number,\n y: number,\n nx: number,\n ny: number,\n innerWeight: number,\n outerWeight: number,\n clockwise: boolean, /* rotation for square (true at left end, false at right end) */\n verts: Array\n): number\n{\n const ix = x - (nx * innerWeight);\n const iy = y - (ny * innerWeight);\n const ox = x + (nx * outerWeight);\n const oy = y + (ny * outerWeight);\n\n /* Rotate nx,ny for extension vector */\n let exx; let\n eyy;\n\n if (clockwise)\n {\n exx = ny;\n eyy = -nx;\n }\n else\n {\n exx = -ny;\n eyy = nx;\n }\n\n /* [i|0]x,y extended at cap */\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n\n return 2;\n}\n\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(\n cx: number,\n cy: number,\n sx: number,\n sy: number,\n ex: number,\n ey: number,\n verts: Array,\n clockwise: boolean, /* if not cap, then clockwise is turn of joint, otherwise rotation from angle0 to angle1 */\n): number\n{\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n\n if (clockwise && angle0 < angle1)\n {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1)\n {\n angle1 += Math.PI * 2;\n }\n\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n\n const radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n const segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n const angleInc = angleDiff / segCount;\n\n startAngle += angleInc;\n\n if (clockwise)\n {\n verts.push(cx, cy);\n verts.push(sx, sy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n }\n\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else\n {\n verts.push(sx, sy);\n verts.push(cx, cy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n\n return segCount * 2;\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n const shape = graphicsData.shape as Polygon;\n let points = graphicsData.points || shape.points.slice();\n const eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n const style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = graphicsGeometry.points;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n\n // Max. inner and outer width\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n\n /* Line segments of interest where (x1,y1) forms the corner. */\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n let perpx = -(y0 - y1);\n let perpy = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = style.alignment;// 0.5;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x0 - (perpx * (innerWeight - outerWeight) * 0.5),\n y0 - (perpy * (innerWeight - outerWeight) * 0.5),\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight),\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight),\n verts,\n true,\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n\n // Push first point (below & above vertices)\n verts.push(\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight));\n verts.push(\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight));\n\n for (let i = 1; i < length - 1; ++i)\n {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n\n /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n const cross = (dy0 * dx1) - (dy1 * dx0);\n const clockwise = (cross < 0);\n\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1)\n {\n verts.push(\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight));\n verts.push(\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight));\n\n continue;\n }\n\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n const c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n const c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n const px = ((dx0 * c2) - (dx1 * c1)) / cross;\n const py = ((dy1 * c1) - (dy0 * c2)) / cross;\n const pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n\n /* Inner miter point */\n const imx = x1 + ((px - x1) * innerWeight);\n const imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n const omx = x1 - ((px - x1) * outerWeight);\n const omy = y1 - ((py - y1) * outerWeight);\n\n /* Is the inside miter point too far away, creating a spike? */\n const smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n const insideMiterOk = pdist <= smallerInsideDiagonalSq;\n\n if (insideMiterOk)\n {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n if (clockwise) /* rotating at inner angle */\n {\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));// first segment's outer vertex\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));// second segment's outer vertex\n }\n else /* rotating at outer angle */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));// first segment's inner vertex\n verts.push(omx, omy);// outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));// second segment's outer vertex\n verts.push(omx, omy);// outer miter point\n }\n\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 4;\n\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 4;\n\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else\n {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n // Nothing needed\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 2;\n }\n else /* arc is inside */\n {\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 2;\n }\n }\n else\n {\n if (clockwise)\n {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else\n {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x1 - (perpx * (innerWeight - outerWeight) * 0.5),\n y1 - (perpy * (innerWeight - outerWeight) * 0.5),\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight),\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight),\n verts,\n false\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n\n const indices = graphicsGeometry.indices;\n const eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n\n // indices.push(indexStart);\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i)\n {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2)\n {\n continue;\n }\n\n indices.push(i, i + 1, i + 2);\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n let i = 0;\n\n const shape = graphicsData.shape as Polygon;\n const points = graphicsData.points || shape.points;\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) return;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n const length = points.length / 2;\n\n const startIndex = verts.length / 2;\n let currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nexport function buildLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n","import { Polygon, PI_2 } from '@pixi/math';\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI.graphicsUtils\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nexport class Star extends Polygon\n{\n constructor(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0)\n {\n innerRadius = innerRadius || radius / 2;\n\n const startAngle = (-1 * Math.PI / 2) + rotation;\n const len = points * 2;\n const delta = PI_2 / len;\n const polygon = [];\n\n for (let i = 0; i < len; i++)\n {\n const r = i % 2 ? innerRadius : radius;\n const angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n super(polygon);\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\nimport { PI_2 } from '@pixi/math';\n\ninterface IArcLikeShape {\n cx: number;\n cy: number;\n radius: number;\n startAngle: number;\n endAngle: number;\n anticlockwise: boolean;\n}\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nexport class ArcUtils\n{\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array): IArcLikeShape\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius,\n startAngle,\n endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n }\n\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n static arc(_startX: number, _startY: number, cx: number, cy: number, radius: number,\n startAngle: number, endAngle: number, _anticlockwise: boolean, points: Array): void\n {\n const sweep = endAngle - startAngle;\n const n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n const theta = (sweep) / (n * 2);\n const theta2 = theta * 2;\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n const segMinus = n - 1;\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n const angle = ((theta) + startAngle + (theta2 * real));\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n }\n /* eslint-enable max-len */\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n","import type { LineStyle } from '../styles/LineStyle';\nimport type { FillStyle } from '../styles/FillStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n","/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\nimport { buildPoly } from './buildPoly';\nexport { buildPoly };\n\nimport { buildCircle } from './buildCircle';\nexport { buildCircle };\n\nimport { buildRectangle } from './buildRectangle';\nexport { buildRectangle };\n\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\nexport { buildRoundedRectangle };\n\nexport * from './buildLine';\nexport * from './Star';\nexport * from './ArcUtils';\nexport * from './BezierUtils';\nexport * from './QuadraticUtils';\nexport * from './BatchPart';\n\n// for type only\nimport { BatchPart } from './BatchPart';\nimport { SHAPES } from '@pixi/math';\nimport { BatchDrawCall } from '@pixi/core';\nimport { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nexport const BATCH_POOL: Array = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array = [];\n","import type { Matrix, SHAPES, IShape } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n shape: IShape;\n lineStyle: LineStyle;\n fillStyle: FillStyle;\n matrix: Matrix;\n type: SHAPES;\n points: number[];\n holes: Array;\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /**\n * Destroys the Graphics data.\n *\n */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n","import {\n buildLine,\n buildPoly,\n BatchPart,\n FILL_COMMANDS,\n BATCH_POOL,\n DRAW_CALL_POOL,\n} from './utils';\n\nimport {\n BatchGeometry,\n BatchDrawCall,\n BatchTextureArray,\n BaseTexture,\n Texture,\n} from '@pixi/core';\n\nimport { DRAW_MODES, WRAP_MODES } from '@pixi/constants';\nimport { SHAPES, Point, Matrix } from '@pixi/math';\nimport { GraphicsData } from './GraphicsData';\nimport { premultiplyTint } from '@pixi/utils';\nimport { Bounds } from '@pixi/display';\n\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * @description Complex shape type\n * @todo Move to Math shapes\n */\ntype IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nconst tmpPoint = new Point();\nconst tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nexport class GraphicsGeometry extends BatchGeometry\n{\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\n public static BATCHABLE_SIZE = 100;\n\n public closePointEps: number;\n public boundsPadding: number;\n\n uvsFloat32: Float32Array = null;\n indicesUint16: Uint16Array | Uint32Array = null;\n batchable: boolean;\n points: Array;\n colors: Array;\n uvs: Array;\n indices: Array;\n textureIds: Array;\n graphicsData: Array;\n drawCalls: Array;\n batchDirty: number;\n batches: Array;\n\n protected dirty: number;\n protected cacheDirty: number;\n protected clearDirty: number;\n protected shapeIndex: number;\n protected _bounds: Bounds;\n protected boundsDirty: number;\n\n constructor()\n {\n super();\n\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n this.points = [];\n\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n this.colors = [];\n\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n this.uvs = [];\n\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n this.indices = [];\n\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n this.textureIds = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n this.graphicsData = [];\n\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n this.dirty = 0;\n\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n this.batchDirty = -1;\n\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n this.cacheDirty = -1;\n\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n this.clearDirty = 0;\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n this.drawCalls = [];\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n * @protected\n */\n this.batches = [];\n\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n this.shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n this.boundsDirty = -1;\n\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n this.boundsPadding = 0;\n\n this.batchable = false;\n\n this.indicesUint16 = null;\n\n this.uvsFloat32 = null;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n this.closePointEps = 1e-4;\n }\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n public get bounds(): Bounds\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n }\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n protected invalidate(): void\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batchPart = this.batches[i];\n\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n\n this.batches.length = 0;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n public clear(): GraphicsGeometry\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawShape(\n shape: IShape,\n fillStyle: FillStyle = null,\n lineStyle: LineStyle = null,\n matrix: Matrix = null): GraphicsGeometry\n {\n const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawHole(shape: IShape, matrix: Matrix = null): GraphicsGeometry\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n const data = new GraphicsData(shape, null, null, matrix);\n\n const lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n public destroy(): void\n {\n super.destroy();\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n }\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n public containsPoint(point: IPointData): boolean\n {\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n let hitHole = false;\n\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices\n */\n updateBatches(allow32Indices?: boolean): void\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n const uvs = this.uvs;\n const graphicsData = this.graphicsData;\n\n let batchPart: BatchPart = null;\n\n let currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (let i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n const data = graphicsData[i];\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n const command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (let j = 0; j < 2; j++)\n {\n const style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) continue;\n\n const nextTexture = style.texture.baseTexture;\n const index = this.indices.length;\n const attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n const size = (this.points.length / 2) - attribIndex;\n\n if (size === 0) continue;\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n\n const index = this.indices.length;\n const attrib = this.points.length / 2;\n\n if (batchPart)\n {\n batchPart.end(index, attrib);\n }\n\n if (this.batches.length === 0)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length)\n {\n this.indicesUint16.set(this.indices);\n }\n else\n {\n const need32\n = attrib > 0xffff && allow32Indices;\n\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n }\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n protected _compareStyles(styleA: FillStyle | LineStyle, styleB: FillStyle | LineStyle): boolean\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!(styleA as LineStyle).native !== !!(styleB as LineStyle).native)\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n protected validateBatching(): boolean\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (let i = 0, l = this.graphicsData.length; i < l; i++)\n {\n const data = this.graphicsData[i];\n const fill = data.fillStyle;\n const line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) return false;\n if (line && !line.texture.baseTexture.valid) return false;\n }\n\n return true;\n }\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n protected packBatches(): void\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n const batches = this.batches;\n\n for (let i = 0, l = batches.length; i < l; i++)\n {\n const batch = batches[i];\n\n for (let j = 0; j < batch.size; j++)\n {\n const index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n }\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n protected isBatchable(): boolean\n {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2)\n {\n return false;\n }\n\n const batches = this.batches;\n\n for (let i = 0; i < batches.length; i++)\n {\n if ((batches[i].style as LineStyle).native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n }\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n protected buildDrawCalls(): void\n {\n let TICK = ++BaseTexture._globalBatch;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n let currentGroup: BatchDrawCall = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n let textureCount = 0;\n let currentTexture = null;\n let textureId = 0;\n let native = false;\n let drawMode = DRAW_MODES.TRIANGLES;\n\n let index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (let i = 0; i < this.batches.length; i++)\n {\n const data = this.batches[i];\n\n // TODO add some full on MAX_TEXTURE CODE..\n const MAX_TEXTURES = 8;\n\n // Forced cast for checking `native` without errors\n const style = data.style as LineStyle;\n\n const nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1;// touch;\n\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize);\n this.addTextureIds(textureIds, textureId, data.attribSize);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n }\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n protected packAttributes(): void\n {\n const verts = this.points;\n const uvs = this.uvs;\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n const glPoints = new ArrayBuffer(verts.length * 3 * 4);\n const f32 = new Float32Array(glPoints);\n const u32 = new Uint32Array(glPoints);\n\n let p = 0;\n\n for (let i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n }\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processFill(data: GraphicsData): void\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n const command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n }\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processLine(data: GraphicsData): void\n {\n buildLine(data, this);\n\n for (let i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n }\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n protected processHoles(holes: Array): void\n {\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n const command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n }\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n protected calculateBounds(): void\n {\n const bounds = this._bounds;\n const sequenceBounds = tmpBounds;\n let curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const shape = data.shape;\n const type = data.type;\n const lineStyle = data.lineStyle;\n const nextMatrix = data.matrix || Matrix.IDENTITY;\n let lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n const alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n const rect = shape as Rectangle | RoundedRectangle;\n\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n const circle = shape as Circle;\n\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y,\n circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n const ellipse = shape as Ellipse;\n\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y,\n ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else\n {\n const poly = shape as Polygon;\n // adding directly to the bounds\n\n bounds.addVerticesMatrix(curMatrix, (poly.points as any), 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n }\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n protected transformPoints(points: Array, matrix: Matrix): void\n {\n for (let i = 0; i < points.length / 2; i++)\n {\n const x = points[(i * 2)];\n const y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n }\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n */\n protected addColors(colors: Array, color: number, alpha: number, size: number): void\n {\n // TODO use the premultiply bits Ivan added\n const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n const rgba = premultiplyTint(rgb, alpha);\n\n while (size-- > 0)\n {\n colors.push(rgba);\n }\n }\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n */\n protected addTextureIds(textureIds: Array, id: number, size: number): void\n {\n while (size-- > 0)\n {\n textureIds.push(id);\n }\n }\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n protected addUvs(\n verts: Array,\n uvs: Array,\n texture: Texture,\n start: number, size:\n number, matrix:\n Matrix = null): void\n {\n let index = 0;\n const uvsStart = uvs.length;\n const frame = texture.frame;\n\n while (index < size)\n {\n let x = verts[(start + index) * 2];\n let y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n const nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n const baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n }\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n protected adjustUvs(uvs: Array, texture: Texture, start: number, size: number): void\n {\n const baseTexture = texture.baseTexture;\n const eps = 1e-6;\n const finish = start + (size * 2);\n const frame = texture.frame;\n const scaleX = frame.width / baseTexture.width;\n const scaleY = frame.height / baseTexture.height;\n let offsetX = frame.x / frame.width;\n let offsetY = frame.y / frame.height;\n let minX = Math.floor(uvs[start] + eps);\n let minY = Math.floor(uvs[start + 1] + eps);\n\n for (let i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (let i = start; i < finish; i += 2)\n {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n }\n}\n","import { FillStyle } from './FillStyle';\nimport { LINE_JOIN, LINE_CAP } from '../const';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nexport class LineStyle extends FillStyle\n{\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n public width = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n public alignment = 0.5;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n public native = false;\n\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /**\n * Miter limit.\n *\n * @member {number}\n * @default 10\n */\n public miterLimit = 10;\n\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /**\n * Reset the line style to default.\n */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n }\n}\n","import {\n Circle,\n Ellipse,\n PI_2,\n Point,\n Polygon,\n Rectangle,\n RoundedRectangle,\n Matrix,\n SHAPES,\n} from '@pixi/math';\n\nimport { Texture, UniformGroup, State, Renderer, BatchDrawCall } from '@pixi/core';\nimport { BezierUtils, QuadraticUtils, ArcUtils, Star } from './utils';\nimport { hex2rgb, deprecation } from '@pixi/utils';\nimport { GraphicsGeometry } from './GraphicsGeometry';\nimport { FillStyle } from './styles/FillStyle';\nimport { LineStyle } from './styles/LineStyle';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { Shader } from '@pixi/core';\n\nimport type { IShape, IPointData } from '@pixi/math';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { LINE_JOIN, LINE_CAP } from './const';\n\n/**\n * Batch element computed from Graphics geometry\n */\nexport interface IGraphicsBatchElement {\n vertexData: Float32Array;\n blendMode: BLEND_MODES;\n indices: Uint16Array | Uint32Array;\n uvs: Float32Array;\n alpha: number;\n worldAlpha: number;\n _batchRGB: number[];\n _tintRGB: number;\n _texture: Texture;\n}\n\nexport interface IFillStyleOptions {\n color?: number;\n alpha?: number;\n texture?: Texture;\n matrix?: Matrix;\n}\n\nexport interface ILineStyleOptions extends IFillStyleOptions {\n width?: number;\n alignment?: number;\n native?: boolean;\n cap?: LINE_CAP;\n join?: LINE_JOIN;\n miterLimit?: number;\n}\n\nconst temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nconst DEFAULT_SHADERS: {[key: string]: Shader} = {};\n\nexport interface Graphics extends GlobalMixins.Graphics, Container {}\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Graphics extends Container\n{\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\n\n static _TEMP_POINT = new Point();\n\n public shader: Shader;\n public pluginName: string;\n\n protected currentPath: Polygon;\n protected batches: Array;\n protected batchTint: number;\n protected batchDirty: number;\n protected vertexData: Float32Array;\n\n protected _fillStyle: FillStyle;\n protected _lineStyle: LineStyle;\n protected _matrix: Matrix;\n protected _holeMode: boolean;\n protected _transformID: number;\n protected _tint: number;\n\n private state: State;\n private _geometry: GraphicsGeometry;\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n public get geometry(): GraphicsGeometry\n {\n return this._geometry;\n }\n\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n constructor(geometry: GraphicsGeometry = null)\n {\n super();\n\n this._geometry = geometry || new GraphicsGeometry();\n this._geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n this.state = State.for2d();\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n this._fillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n this._lineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n this._matrix = null;\n\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n this._holeMode = false;\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n this.currentPath = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n this.batches = [];\n\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchTint = -1;\n\n /**\n * Update dirty for limiting calculating batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchDirty = -1;\n\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n this.vertexData = null;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n this._transformID = -1;\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n public clone(): Graphics\n {\n this.finishPoly();\n\n return new Graphics(this._geometry);\n }\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n public set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n public get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n this._tint = value;\n }\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n public get fill(): FillStyle\n {\n return this._fillStyle;\n }\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n public get line(): LineStyle\n {\n return this._lineStyle;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(options: ILineStyleOptions = null): this\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n // eslint-disable-next-line\n const args = arguments;\n\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n\n return this.lineTextureStyle(options);\n }\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTextureStyle(options: ILineStyleOptions): this\n {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number')\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n\n // eslint-disable-next-line\n const [width, texture, color, alpha, matrix, alignment, native] = arguments as any;\n\n options = { width, texture, color, alpha, matrix, alignment, native };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Start a polygon object internally\n * @protected\n */\n protected startPoly(): void\n {\n if (this.currentPath)\n {\n const points = this.currentPath.points;\n const len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n }\n\n /**\n * Finish the polygon object.\n * @protected\n */\n finishPoly(): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public moveTo(x: number, y: number): this\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTo(x: number, y: number): this\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n const points = this.currentPath.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n }\n\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n protected _initCurve(x = 0, y = 0): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n const points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this\n {\n this._initCurve(x1, y1);\n\n const points = this.currentPath.points;\n\n const result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n const { cx, cy, radius, startAngle, endAngle, anticlockwise } = result;\n\n this.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise = false): this\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n const eps = this._geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tessellation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public beginFill(color = 0, alpha = 1): this\n {\n return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });\n }\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginTextureFill(options: IFillStyleOptions): this\n {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof Texture)\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n\n // eslint-disable-next-line\n const [texture, color, alpha, matrix] = arguments as any;\n\n options = { texture, color, alpha, matrix };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options) as IFillStyleOptions;\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public endFill(): this\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n }\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRect(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n }\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawCircle(x: number, y: number, radius: number): this\n {\n return this.drawShape(new Circle(x, y, radius));\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawEllipse(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n }\n\n public drawPolygon(...path: Array | Array): this\n public drawPolygon(path: Array | Array | Polygon): this\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawPolygon(...path: any[]): this\n {\n let points: Array | Array;\n let closeStroke = true;// !!this._fillStyle;\n\n const poly = path[0] as Polygon;\n\n // check if data has points..\n if (poly.points)\n {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else\n if (Array.isArray(path[0]))\n {\n points = path[0];\n }\n else\n {\n points = path;\n }\n\n const shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawShape(shape: IShape): this\n {\n if (!this._holeMode)\n {\n this._geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this._geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n }\n\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0): this\n {\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation) as Polygon);\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public clear(): this\n {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n public isFastRect(): boolean\n {\n const data = this._geometry.graphicsData;\n\n return data.length === 1\n && data[0].shape.type === SHAPES.RECT\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n const hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n\n geometry.updateBatches(hasuint32);\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n }\n\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n protected _populateBatches(): void\n {\n const geometry = this._geometry;\n const blendMode = this.blendMode;\n const len = geometry.batches.length;\n\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (let i = 0; i < len; i++)\n {\n const gI = geometry.batches[i];\n const color = gI.style.color;\n const vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n const batch = {\n vertexData,\n blendMode,\n indices,\n uvs,\n _batchRGB: hex2rgb(color) as Array,\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n }\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderBatched(renderer: Renderer): void\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (let i = 0, l = this.batches.length; i < l; i++)\n {\n const batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n }\n\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderDirect(renderer: Renderer): void\n {\n const shader = this._resolveDirectShader(renderer);\n\n const geometry = this._geometry;\n const tint = this.tint;\n const worldAlpha = this.worldAlpha;\n const uniforms = shader.uniforms;\n const drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (let i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n }\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void\n {\n const { texArray, type, size, start } = drawCall;\n const groupTextureCount = texArray.count;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(texArray.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n }\n\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _resolveDirectShader(renderer: Renderer): Shader\n {\n let shader = this.shader;\n\n const pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n const MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n const sampleValues = new Int32Array(MAX_TEXTURES);\n\n for (let i = 0; i < MAX_TEXTURES; i++)\n {\n sampleValues[i] = i;\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n const program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n }\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n }\n\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n protected calculateTints(): void\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n const tintRGB = hex2rgb(this.tint, temp);\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batch = this.batches[i];\n\n const batchTint = batch._batchRGB;\n\n const r = (tintRGB[0] * batchTint[0]) * 255;\n const g = (tintRGB[1] * batchTint[1]) * 255;\n const b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n const color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n }\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n protected calculateVertices(): void\n {\n const wtID = this.transform._worldID;\n\n if (this._transformID === wtID)\n {\n return;\n }\n\n this._transformID = wtID;\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const data = this._geometry.points;// batch.vertexDataOriginal;\n const vertexData = this.vertexData;\n\n let count = 0;\n\n for (let i = 0; i < data.length; i += 2)\n {\n const x = data[i];\n const y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n public closePath(): this\n {\n const currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n\n return this;\n }\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n public setMatrix(matrix: Matrix): this\n {\n this._matrix = matrix;\n\n return this;\n }\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n public beginHole(): this\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n }\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n public endHole(): this\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n super.destroy(options);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource|Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n public pluginName: string;\n\n _width: number;\n _height: number;\n _texture: Texture;\n _textureID: number;\n _cachedTint: number;\n protected _textureTrimmedID: number;\n protected uvs: Float32Array;\n protected _anchor: ObservablePoint;\n protected vertexData: Float32Array;\n\n private vertexTrimmedData: Float32Array;\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n private _tint: number;\n\n // Internal-only properties\n _tintRGB: number;\n\n /**\n * @param {PIXI.Texture} [texture] - The texture for this sprite.\n */\n constructor(texture: Texture)\n {\n super();\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 16777215\n */\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n static from(source: SpriteSource, options: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport enum TEXT_GRADIENT {\n LINEAR_VERTICAL = 0,\n LINEAR_HORIZONTAL = 1\n}\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from './const';\nimport { hex2string } from '@pixi/utils';\n\nexport type TextStyleAlign = 'left'|'center'|'right';\nexport type TextStyleFill = string|string[]|number|number[]|CanvasGradient|CanvasPattern;\nexport type TextStyleFontStyle = 'normal'|'italic'|'oblique';\nexport type TextStyleFontVariant = 'normal'|'small-caps';\nexport type TextStyleFontWeight = 'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900';\nexport type TextStyleLineJoin = 'miter'|'round'|'bevel';\nexport type TextStyleTextBaseline = 'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom';\nexport type TextStyleWhiteSpace = 'normal'|'pre'|'pre-line';\n\nexport interface ITextStyle {\n align: TextStyleAlign;\n breakWords: boolean;\n dropShadow: boolean;\n dropShadowAlpha: number;\n dropShadowAngle: number;\n dropShadowBlur: number;\n dropShadowColor: string|number;\n dropShadowDistance: number;\n fill: TextStyleFill;\n fillGradientType: TEXT_GRADIENT;\n fillGradientStops: number[];\n fontFamily: string | string[];\n fontSize: number | string;\n fontStyle: TextStyleFontStyle;\n fontVariant: TextStyleFontVariant;\n fontWeight: TextStyleFontWeight;\n letterSpacing: number;\n lineHeight: number;\n lineJoin: TextStyleLineJoin;\n miterLimit: number;\n padding: number;\n stroke: string|number;\n strokeThickness: number;\n textBaseline: TextStyleTextBaseline;\n trim: boolean;\n whiteSpace: TextStyleWhiteSpace;\n wordWrap: boolean;\n wordWrapWidth: number;\n leading: number;\n}\n\nconst defaultStyle: ITextStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nexport class TextStyle implements ITextStyle\n{\n public styleID: number;\n\n protected _align: TextStyleAlign;\n protected _breakWords: boolean;\n protected _dropShadow: boolean;\n protected _dropShadowAlpha: number;\n protected _dropShadowAngle: number;\n protected _dropShadowBlur: number;\n protected _dropShadowColor: string|number;\n protected _dropShadowDistance: number;\n protected _fill: TextStyleFill;\n protected _fillGradientType: TEXT_GRADIENT;\n protected _fillGradientStops: number[];\n protected _fontFamily: string|string[];\n protected _fontSize: number|string;\n protected _fontStyle: TextStyleFontStyle;\n protected _fontVariant: TextStyleFontVariant;\n protected _fontWeight: TextStyleFontWeight;\n protected _letterSpacing: number;\n protected _lineHeight: number;\n protected _lineJoin: TextStyleLineJoin;\n protected _miterLimit: number;\n protected _padding: number;\n protected _stroke: string|number;\n protected _strokeThickness: number;\n protected _textBaseline: TextStyleTextBaseline;\n protected _trim: boolean;\n protected _whiteSpace: TextStyleWhiteSpace;\n protected _wordWrap: boolean;\n protected _wordWrapWidth: number;\n protected _leading: number;\n\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style: Partial)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n const clonedProperties: Partial = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n public reset(): void\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align(): TextStyleAlign\n {\n return this._align;\n }\n set align(align: TextStyleAlign)\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get breakWords(): boolean\n {\n return this._breakWords;\n }\n set breakWords(breakWords: boolean)\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get dropShadow(): boolean\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow: boolean)\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get dropShadowAlpha(): number\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha: number)\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get dropShadowAngle(): number\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle: number)\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get dropShadowBlur(): number\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur: number)\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get dropShadowColor(): number | string\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor: number | string)\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get dropShadowDistance(): number\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance: number)\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill(): TextStyleFill\n {\n return this._fill;\n }\n set fill(fill: TextStyleFill)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n const outputColor = getColor(fill as any);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get fillGradientType(): TEXT_GRADIENT\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType: TEXT_GRADIENT)\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get fillGradientStops(): number[]\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops: number[])\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get fontFamily(): string | string[]\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily: string | string[])\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get fontSize(): number | string\n {\n return this._fontSize;\n }\n set fontSize(fontSize: number | string)\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle(): TextStyleFontStyle\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle: TextStyleFontStyle)\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant(): TextStyleFontVariant\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant: TextStyleFontVariant)\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight(): TextStyleFontWeight\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight: TextStyleFontWeight)\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing: number)\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get lineHeight(): number\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight: number)\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /**\n * The space between lines\n *\n * @member {number}\n */\n get leading(): number\n {\n return this._leading;\n }\n set leading(leading: number)\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin(): TextStyleLineJoin\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin: TextStyleLineJoin)\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get miterLimit(): number\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit: number)\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get padding(): number\n {\n return this._padding;\n }\n set padding(padding: number)\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get stroke(): string | number\n {\n return this._stroke;\n }\n set stroke(stroke: string | number)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get strokeThickness(): number\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness: number)\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline(): TextStyleTextBaseline\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline: TextStyleTextBaseline)\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get trim(): boolean\n {\n return this._trim;\n }\n set trim(trim: boolean)\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace(): TextStyleWhiteSpace\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace: TextStyleWhiteSpace)\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get wordWrap(): boolean\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap: boolean)\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get wordWrapWidth(): number\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth: number)\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n public toFontString(): string\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies: string|string[] = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n (fontFamilies as string[])[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${(fontFamilies as string[]).join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {string|number} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color: string|number): string\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if (typeof color === 'string')\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {string|number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color: (string|number)[]): string[];\nfunction getColor(color: string|number): string;\nfunction getColor(color: string|number|(string|number)[]): string|string[]\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color as string[];\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 - First array to compare\n * @param {Array} array2 - Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1: T[], array2: T[]): boolean\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target - Target object to copy properties into\n * @param {Object} source - Source object for the properties to copy\n * @param {string} propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target: Record, source: Record, propertyObj: Record): void {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import { TextStyle, TextStyleWhiteSpace } from './TextStyle';\n\ninterface IFontMetrics {\n ascent: number;\n descent: number;\n fontSize: number;\n}\n\ntype CharacterWidthCache = { [key: string]: number };\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nexport class TextMetrics\n{\n public text: string;\n public style: TextStyle;\n public width: number;\n public height: number;\n public lines: string[];\n public lineWidths: number[];\n public lineHeight: number;\n public maxLineWidth: number;\n public fontProperties: IFontMetrics;\n\n public static METRICS_STRING: string;\n public static BASELINE_SYMBOL: string;\n public static BASELINE_MULTIPLIER: number;\n\n // TODO: These should be protected but they're initialized outside of the class.\n public static _canvas: HTMLCanvasElement|OffscreenCanvas;\n public static _context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D;\n public static _fonts: { [font: string]: IFontMetrics };\n public static _newlines: number[];\n public static _breakingSpaces: number[];\n\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[],\n lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics)\n {\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n public static measureText(text: string, style: TextStyle, wordWrap: boolean, canvas = TextMetrics._canvas): TextMetrics\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize as number;\n fontProperties.ascent = style.fontSize as number;\n }\n\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n private static wordWrap(text: string, style: TextStyle, canvas = TextMetrics._canvas): string\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache: CharacterWidthCache = Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = TextMetrics.wordWrapSplit(token);\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n private static addLine(line: string, newLine = true): string\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key - The key\n * @param {number} letterSpacing - The letter spacing\n * @param {object} cache - The cache\n * @param {CanvasRenderingContext2D} context - The canvas context\n * @return {number} The from cache.\n */\n private static getFromCache(key: string, letterSpacing: number, cache: CharacterWidthCache,\n context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D): number\n {\n let width = cache[key];\n\n if (typeof width !== 'number')\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace - The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n private static collapseSpaces(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace - The white space\n * @return {boolean} should collapse\n */\n private static collapseNewlines(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text - The text\n * @return {string} trimmed string\n */\n private static trimRight(text: string): string\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if newline, False otherwise.\n */\n private static isNewline(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n private static isBreakingSpace(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text - The text\n * @return {string[]} A tokenized array\n */\n private static tokenize(text: string): string[]\n {\n const tokens: string[] = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param {string} token - The token\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakWords(_token: string, breakWords: boolean): boolean\n {\n return breakWords;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param {string} char - The character\n * @param {string} nextChar - The next character\n * @param {string} token - The token/word the characters are from\n * @param {number} index - The index in the token of the char\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number,\n _breakWords: boolean): boolean\n {\n return true;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param {string} token - The token to split\n * @return {string[]} The characters of the token\n */\n static wordWrapSplit(token: string): string[]\n {\n return token.split('');\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\n public static measureFont(font: string): IFontMetrics\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties: IFontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n public static clearMetrics(font = ''): void\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nconst canvas = ((): HTMLCanvasElement|OffscreenCanvas =>\n{\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext('2d');\n\n if (context && context.measureText)\n {\n return c;\n }\n\n return document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n","/* eslint max-depth: [2, 8] */\nimport { Sprite } from '@pixi/sprite';\nimport { Texture } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { Rectangle } from '@pixi/math';\nimport { sign, trimCanvas, hex2rgb, string2hex } from '@pixi/utils';\nimport { TEXT_GRADIENT } from './const';\nimport { TextStyle } from './TextStyle';\nimport { TextMetrics } from './TextMetrics';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Renderer } from '@pixi/core';\nimport type { ITextStyle } from './TextStyle';\n\nconst defaultDestroyOptions: IDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class Text extends Sprite\n{\n public canvas: HTMLCanvasElement;\n public context: CanvasRenderingContext2D;\n public localStyleID: number;\n public dirty: boolean;\n\n _resolution: number;\n _autoResolution: boolean;\n protected _text: string;\n protected _font: string;\n protected _style: TextStyle;\n protected _styleListener: () => void;\n private _ownCanvas: boolean;\n\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n constructor(text: string, style: Partial|TextStyle, canvas: HTMLCanvasElement)\n {\n let ownCanvas = false;\n\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n ownCanvas = true;\n }\n\n canvas.width = 3;\n canvas.height = 3;\n\n const texture = Texture.from(canvas);\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n super(texture);\n\n /**\n * Keep track if this Text object created it's own canvas\n * element (`true`) or uses the constructor argument (`false`).\n * Used to workaround a GC issues with Safari < 13 when\n * destroying Text. See `destroy` for more info.\n *\n * @member {boolean}\n * @private\n */\n this._ownCanvas = ownCanvas;\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n this._resolution = settings.RESOLUTION;\n this._autoResolution = true;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n /**\n * Renders text to its canvas, and updates its texture.\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n *\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n public updateText(respectDirty: boolean): void\n {\n const style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n const context = this.context;\n const measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n const width = measured.width;\n const height = measured.height;\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n\n context.scale(this._resolution, this._resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n let linePositionX: number;\n let linePositionY: number;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n const passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (let i = 0; i < passesCount; ++i)\n {\n const isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n const dsOffsetShadow = dsOffsetText * this._resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines, measured);\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n context.strokeStyle = style.stroke as string;\n\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n\n this.updateTexture();\n }\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n private drawLetterSpacing(text: string, x: number, y: number, isStroke = false): void\n {\n const style = this._style;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n let currentPosition = x;\n\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n const stringArray = Array.from ? Array.from(text) : text.split('');\n let previousWidth = this.context.measureText(text).width;\n let currentWidth = 0;\n\n for (let i = 0; i < stringArray.length; ++i)\n {\n const currentChar = stringArray[i];\n\n if (isStroke)\n {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n private updateTexture(): void\n {\n const canvas = this.canvas;\n\n if (this._style.trim)\n {\n const trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n const texture = this._texture;\n const style = this._style;\n const padding = style.trim ? 0 : style.padding;\n const baseTexture = texture.baseTexture;\n\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n\n // Recursively updates transform of all objects from the root to this one\n this._recursivePostUpdateTransform();\n\n this.dirty = false;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super._render(renderer);\n }\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n this.updateText(true);\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n }\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n private _generateFillStyle(style: TextStyle, lines: string[], metrics: TextMetrics): string|CanvasGradient|CanvasPattern\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n }\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n super.destroy(options);\n\n // set canvas width and height to 0 to workaround memory leak in Safari < 13\n // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12\n if (this._ownCanvas)\n {\n this.canvas.height = this.canvas.width = 0;\n }\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n }\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get style(): TextStyle|Partial\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle\n // since the setter creates the TextStyle. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n return this._style;\n }\n\n set style(style: TextStyle|Partial)\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n }\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get text(): string\n {\n return this._text;\n }\n\n set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._autoResolution = false;\n\n if (this._resolution === value)\n {\n return;\n }\n\n this._resolution = value;\n this.dirty = true;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\nexport { settings };\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class CountLimiter\n{\n public maxItemsPerFrame: number;\n public itemsLeft: number;\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame: number)\n {\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return this.itemsLeft-- > 0;\n }\n}\n","import { Texture, BaseTexture } from '@pixi/core';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\nimport { CountLimiter } from './CountLimiter';\n\nimport type { AbstractRenderer } from '@pixi/core';\n\ninterface IArrowFunction {\n (): void;\n}\ninterface IUploadHook {\n (helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean;\n}\n\ninterface IFindHook {\n (item: any, queue: Array): boolean;\n}\n\nexport interface IDisplayObjectExtended extends DisplayObject {\n _textures?: Array;\n _texture?: Texture;\n style?: TextStyle;\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\n\nfunction findMultipleBaseTextures(item: IDisplayObjectExtended, queue: Array): boolean\n{\n let result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item: Texture, queue: Array): boolean\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n const texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item._texture && item._texture instanceof Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof TextStyle)\n {\n const font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item: TextStyle, queue: Array): boolean\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI\n */\nexport class BasePrepare\n{\n private limiter: CountLimiter;\n protected renderer: AbstractRenderer;\n protected uploadHookHelper: any;\n protected queue: Array;\n public addHooks: Array;\n public uploadHooks: Array;\n public completes: Array;\n public ticking: boolean;\n private delayedTick: IArrowFunction;\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer)\n {\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {object}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = (): void =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item: IDisplayObjectExtended | IUploadHook | IFindHook | (() => void), done: () => void): void\n {\n if (typeof item === 'function')\n {\n done = item as () => void;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item as IDisplayObjectExtended | IUploadHook | IFindHook);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick(): void\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems(): void\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {this} Instance of plugin for chaining.\n */\n registerFindHook(addHook: IFindHook): this\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {this} Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook: IUploadHook): this\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {this} Instance of plugin for chaining.\n */\n add(item: IDisplayObjectExtended | IUploadHook | IFindHook): this\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy(): void\n {\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { BasePrepare, IDisplayObjectExtended } from './BasePrepare';\n\nimport type { AbstractRenderer, Renderer } from '@pixi/core';\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])\n {\n (renderer as Renderer).texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n const { geometry } = item;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n const { batches } = geometry;\n\n // upload all textures found in styles\n for (let i = 0; i < batches.length; i++)\n {\n const { texture } = batches[i].style;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n (renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class Prepare extends BasePrepare\n{\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n public maxMilliseconds: number;\n public frameStart: number;\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n constructor(maxMilliseconds: number)\n {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { getResolutionOfUrl } from '@pixi/utils';\nimport type { Dict } from '@pixi/utils';\nimport type { resources } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n */\nexport interface ISpritesheetFrameData {\n frame: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n w: number;\n h: number;\n };\n spriteSourceSize?: {\n x: number;\n y: number;\n };\n anchor?: IPointData;\n}\n\n/**\n * Atlas format.\n */\nexport interface ISpritesheetData {\n frames: Dict;\n animations?: Dict;\n meta: {\n scale: string;\n };\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nexport class Spritesheet\n{\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n static readonly BATCH_SIZE = 1000;\n\n public baseTexture: BaseTexture;\n public textures: Dict;\n public animations: Dict;\n public data: ISpritesheetData;\n public resolution: number;\n\n private _texture: Texture;\n private _frames: Dict;\n private _frameKeys: string[];\n private _batchIndex: number;\n private _callback: (textures: Dict) => void;\n\n /**\n * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(texture: BaseTexture | Texture, data: ISpritesheetData, resolutionFilename: string = null)\n {\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n * @type {PIXI.Texture}\n * @private\n */\n this._texture = texture instanceof Texture ? texture : null;\n\n /**\n * Reference to ths source texture.\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n const resource = this.baseTexture.resource as resources.ImageResource;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n private _updateResolution(resolutionFilename: string = null): number\n {\n const { scale } = this.data.meta;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n public parse(callback: () => void): void\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n private _processFrames(initialFrameIndex: number): void\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /**\n * Parse animations config\n *\n * @private\n */\n private _processAnimations(): void\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++)\n {\n const frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /**\n * The parse has completed.\n *\n * @private\n */\n private _parseComplete(): void\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n private _nextBatch(): void\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n public destroy(destroyBase = false): void\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this._texture?.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n }\n}\n","import { url } from '@pixi/utils';\nimport { Spritesheet } from './Spritesheet';\nimport { LoaderResource } from '@pixi/loaders';\nimport type { Loader, ILoaderResource } from '@pixi/loaders';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class SpritesheetLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(resource: ILoaderResource, next: (...args: unknown[]) => void): void\n {\n // because this is middleware, it execute in loader context. `this` = loader\n const loader = (this as any) as Loader;\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res: ILoaderResource)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n }\n\n /**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\n static getResourcePath(resource: ILoaderResource, baseUrl: string): string\n {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n }\n}\n","import { Texture, TextureMatrix } from '@pixi/core';\nimport { Point, Rectangle, Transform } from '@pixi/math';\nimport { Sprite } from '@pixi/sprite';\nimport { deprecation } from '@pixi/utils';\nimport type { Renderer, IBaseTextureOptions, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPoint, IPointData, ISize, ObservablePoint } from '@pixi/math';\n\nconst tempPoint = new Point();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface TilingSprite extends GlobalMixins.TilingSprite {}\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class TilingSprite extends Sprite\n{\n public tileTransform: Transform;\n public uvMatrix: TextureMatrix;\n public uvRespectAnchor: boolean;\n\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n constructor(texture: Texture, width = 100, height = 100)\n {\n super(texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n this.tileTransform = new Transform();\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = this.texture.uvMatrix || new TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get clampMargin(): number\n {\n return this.uvMatrix.clampMargin;\n }\n\n set clampMargin(value: number)\n {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n }\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tileScale(): ObservablePoint\n {\n return this.tileTransform.scale;\n }\n\n set tileScale(value: ObservablePoint)\n {\n this.tileTransform.scale.copyFrom(value as IPoint);\n }\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tilePosition(): ObservablePoint\n {\n return this.tileTransform.position;\n }\n\n set tilePosition(value: ObservablePoint)\n {\n this.tileTransform.position.copyFrom(value as IPoint);\n }\n\n /**\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n if (this.uvMatrix)\n {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n // tweak our texture temporarily..\n const texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const minX = this._width * -this._anchor._x;\n const minY = this._height * -this._anchor._y;\n const maxX = this._width * (1 - this._anchor._x);\n const maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.IPointData} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._width;\n const height = this._height;\n const x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n const y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.tileTransform = null;\n this.uvMatrix = null;\n }\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {number} options.width - required width of the tiling sprite\n * @param {number} options.height - required height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n static from(source: TextureSource, options: ISize & IBaseTextureOptions): TilingSprite\n {\n // Deprecated\n if (typeof options === 'number')\n {\n deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args');\n // eslint-disable-next-line prefer-rest-params\n options = { width: options, height: arguments[2] } as ISize;\n }\n\n return new TilingSprite(\n Texture.from(source, options),\n options.width,\n options.height\n );\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n }\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n }\n}\n","import { ObjectRenderer, Shader, State, QuadUv } from '@pixi/core';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\n\nimport vertex from './tilingSprite.vert';\nimport fragment from './tilingSprite.frag';\nimport fragmentSimple from './tilingSprite_simple.frag';\n\nimport type { Renderer } from '@pixi/core';\nimport type { TilingSprite } from './TilingSprite';\n\nconst tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class TilingSpriteRenderer extends ObjectRenderer\n{\n public shader: Shader;\n public simpleShader: Shader;\n public quad: QuadUv;\n public readonly state: State;\n\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n const uniforms = { globals: this.renderer.globalUniforms };\n\n this.shader = Shader.from(vertex, fragment, uniforms);\n\n this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);\n\n this.quad = new QuadUv();\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n *\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n public render(ts: TilingSprite): void\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.invalidate();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvMatrix;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode as any);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n\n this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode as any);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n","import type { TextureMatrix, Buffer } from '@pixi/core';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nexport class MeshBatchUvs\n{\n public readonly data: Float32Array;\n public uvBuffer: Buffer;\n public uvMatrix: TextureMatrix;\n\n private _bufferUpdateId: number;\n private _textureUpdateId: number;\n\n // Internal-only properties\n _updateID: number;\n\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n constructor(uvBuffer: Buffer, uvMatrix: TextureMatrix)\n {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n }\n\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n public update(forceUpdate?: boolean): void\n {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID\n )\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n const data = this.uvBuffer.data as Float32Array;\n\n if (!this.data || this.data.length !== data.length)\n {\n (this.data as any) = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n }\n}\n","import { State } from '@pixi/core';\nimport { Point, Polygon } from '@pixi/math';\nimport { BLEND_MODES, DRAW_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { MeshBatchUvs } from './MeshBatchUvs';\nimport { MeshMaterial } from './MeshMaterial';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Texture, Renderer, Geometry, Buffer } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst tempPolygon = new Polygon();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Mesh extends GlobalMixins.Mesh {}\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Mesh extends Container\n{\n public readonly geometry: Geometry;\n public shader: MeshMaterial;\n public state: State;\n public drawMode: DRAW_MODES;\n public start: number;\n public size: number;\n\n private vertexData: Float32Array;\n private vertexDirty: number;\n private _transformID: number;\n private _roundPixels: boolean;\n private batchUvs: MeshBatchUvs;\n\n // Internal-only properties\n uvs: Float32Array;\n indices: Uint16Array;\n _tintRGB: number;\n _texture: Texture;\n\n /**\n * @param {PIXI.Geometry} geometry - the geometry the mesh will use\n * @param {PIXI.MeshMaterial} shader - the shader the mesh will use\n * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts\n */\n constructor(geometry: Geometry, shader: MeshMaterial, state?: State, drawMode = DRAW_MODES.TRIANGLES)\n {\n super();\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n this.geometry = geometry;\n\n geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n this.shader = shader;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = state || State.for2d();\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n this.drawMode = drawMode;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n this.start = 0;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n this.size = 0;\n\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n this.uvs = null;\n\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n this.indices = null;\n\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n this.vertexData = new Float32Array(1);\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n this.vertexDirty = 0;\n\n this._transformID = -1;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n this.batchUvs = null;\n }\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get uvBuffer(): Buffer\n {\n return this.geometry.buffers[1];\n }\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get verticesBuffer(): Buffer\n {\n return this.geometry.buffers[0];\n }\n\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.MeshMaterial}\n */\n set material(value: MeshMaterial)\n {\n this.shader = value;\n }\n\n get material(): MeshMaterial\n {\n return this.shader;\n }\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this.shader.tint;\n }\n\n set tint(value: number)\n {\n this.shader.tint = value;\n }\n\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n set texture(value: Texture)\n {\n this.shader.texture = value;\n }\n\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _render(renderer: Renderer): void\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n const vertices = this.geometry.buffers[0].data;\n\n // TODO benchmark check for attribute size..\n if (\n this.shader.batchable\n && this.drawMode === DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2\n )\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n }\n\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderDefault(renderer: Renderer): void\n {\n const shader = this.shader;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n if (shader.program.uniformData.translationMatrix)\n {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n }\n\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderToBatch(renderer: Renderer): void\n {\n const geometry = this.geometry;\n\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data as Uint16Array;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n\n const pluginName = this.material.pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n }\n\n /**\n * Updates vertexData field based on transform and vertices\n */\n public calculateVertices(): void\n {\n const geometry = this.geometry;\n const vertices = geometry.buffers[0].data;\n\n if ((geometry as any).vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const vertexData = this.vertexData;\n\n for (let i = 0; i < vertexData.length / 2; i++)\n {\n const x = vertices[(i * 2)];\n const y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n\n this.vertexDirty = (geometry as any).vertexDirtyId;\n }\n\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n public calculateUvs(): void\n {\n const geomUvs = this.geometry.buffers[1];\n\n if (!this.shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data as Float32Array;\n }\n }\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n const points = tempPolygon.points;\n const indices = this.geometry.getIndex().data;\n const len = indices.length;\n const step = this.drawMode === 4 ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n (this as any).geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n }\n\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\n public static BATCHABLE_SIZE = 100;\n}\n\n","import { Program, Shader, TextureMatrix } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba } from '@pixi/utils';\nimport fragment from './shader/mesh.frag';\nimport vertex from './shader/mesh.vert';\n\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IMeshMaterialOptions {\n alpha?: number;\n tint?: number;\n pluginName?: string;\n program?: Program;\n uniforms?: Dict;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MeshMaterial extends GlobalMixins.MeshMaterial {}\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class MeshMaterial extends Shader\n{\n public readonly uvMatrix: TextureMatrix;\n\n public batchable: boolean;\n public pluginName: string;\n\n // Internal-only properties\n _tintRGB: number;\n\n private _colorDirty: boolean;\n private _alpha: number;\n private _tint: number;\n\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n constructor(uSampler: Texture, options?: IMeshMaterialOptions)\n {\n const uniforms = {\n uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n super(options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.uniforms.uSampler;\n }\n set texture(value: Texture)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n }\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set alpha(value: number)\n {\n if (value === this._alpha) return;\n\n this._alpha = value;\n this._colorDirty = true;\n }\n get alpha(): number\n {\n return this._alpha;\n }\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set tint(value: number)\n {\n if (value === this._tint) return;\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n }\n get tint(): number\n {\n return this._tint;\n }\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n public update(): void\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n const baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(\n this._tint, this._alpha, this.uniforms.uColor, (baseTexture.alphaMode as unknown as boolean)\n );\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Buffer, Geometry } from '@pixi/core';\n\nimport type { IArrayBuffer } from '@pixi/core';\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class MeshGeometry extends Geometry\n{\n // Internal-only properties\n _updateId: number;\n\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n constructor(vertices?: IArrayBuffer, uvs?: IArrayBuffer, index?: IArrayBuffer)\n {\n super();\n\n const verticesBuffer = new Buffer(vertices);\n const uvsBuffer = new Buffer(uvs, true);\n const indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get vertexDirtyId(): number\n {\n return this.buffers[0]._updateID;\n }\n}\n","/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n public info: IBitmapFontDataInfo[];\n public common: IBitmapFontDataCommon[];\n public page: IBitmapFontDataPage[];\n public char: IBitmapFontDataChar[];\n public kerning: IBitmapFontDataKerning[];\n\n constructor()\n {\n /**\n * @member {PIXI.IBitmapFontDataInfo[]}\n * @readOnly\n */\n this.info = [];\n\n /**\n * @member {PIXI.IBitmapFontDataCommon[]}\n * @readOnly\n */\n this.common = [];\n\n /**\n * @member {PIXI.IBitmapFontDataPage[]}\n * @readOnly\n */\n this.page = [];\n\n /**\n * @member {PIXI.IBitmapFontDataChar[]}\n * @readOnly\n */\n this.char = [];\n\n /**\n * @member {PIXI.IBitmapFontDataKerning[]}\n * @readOnly\n */\n this.kerning = [];\n }\n}\n\nexport interface IBitmapFontDataInfo {\n face: string;\n size: number;\n}\n\nexport interface IBitmapFontDataCommon {\n lineHeight: number;\n}\n\nexport interface IBitmapFontDataPage {\n id: number;\n file: string;\n}\n\nexport interface IBitmapFontDataChar {\n id: number;\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n xoffset: number;\n yoffset: number;\n xadvance: number;\n}\n\nexport interface IBitmapFontDataKerning {\n first: number;\n second: number;\n amount: number;\n}\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataInfo\n * @property {string} face\n * @property {number} size\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataCommon\n * @property {number} lineHeight\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataPage\n * @property {number} id\n * @property {string} file\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataChar\n * @property {string} id\n * @property {number} page\n * @property {number} x\n * @property {number} y\n * @property {number} width\n * @property {number} height\n * @property {number} xoffset\n * @property {number} yoffset\n * @property {number} xadvance\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataKerning\n * @property {number} first\n * @property {number} second\n * @property {number} amount\n */\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * Internal data format used to convert to BitmapFontData.\n * @private\n */\ninterface IBitmapFontRawData {\n info: {\n face: string;\n size: string;\n }[];\n common: { lineHeight: string }[];\n page: {\n id: string;\n file: string;\n }[];\n chars: {\n count: number;\n }[];\n char: {\n id: string;\n page: string;\n x: string;\n y: string;\n width: string;\n height: string;\n xoffset: string;\n yoffset: string;\n xadvance: string;\n }[];\n kernings?: {\n count: number;\n }[];\n kerning?: {\n first: string;\n second: string;\n amount: string;\n }[];\n}\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @class\n * @private\n */\nexport class TextFormat\n{\n /**\n * Check if resource refers to txt font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n }\n\n /**\n * Convert text font data to a javascript object.\n *\n * @static\n * @private\n * @param {string} txt - Raw string data to be converted\n * @return {PIXI.BitmapFontData} Parsed font data\n */\n static parse(txt: string): BitmapFontData\n {\n // Retrieve data item\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData: IBitmapFontRawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n };\n\n for (const i in items)\n {\n // Extract item name\n const name = items[i].match(/^[a-z]+/gm)[0] as keyof BitmapFontData;\n\n // Extract item attribute list as string ex.: \"width=10\"\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n\n // Convert attribute list into an object\n const itemData: any = {};\n\n for (const i in attributeList)\n {\n // Split key-value pairs\n const split = attributeList[i].split('=');\n const key = split[0];\n\n // Remove eventual quotes from value\n const strValue = split[1].replace(/\"/gm, '');\n\n // Try to convert value into float\n const floatValue = parseFloat(strValue);\n\n // Use string value case float value is NaN\n const value = isNaN(floatValue) ? strValue : floatValue;\n\n itemData[key] = value;\n }\n\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n\n const font = new BitmapFontData();\n\n rawData.info.forEach((info) => font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }));\n\n rawData.common.forEach((common) => font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }));\n\n rawData.page.forEach((page) => font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }));\n\n rawData.char.forEach((char) => font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }));\n\n rawData.kerning.forEach((kerning) => font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }));\n\n return font;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLFormat\n{\n /**\n * Check if resource refers to xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n }\n\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {XMLDocument} xml\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xml: XMLDocument): BitmapFontData\n {\n const data = new BitmapFontData();\n const info = xml.getElementsByTagName('info');\n const common = xml.getElementsByTagName('common');\n const page = xml.getElementsByTagName('page');\n const char = xml.getElementsByTagName('char');\n const kerning = xml.getElementsByTagName('kerning');\n\n for (let i = 0; i < info.length; i++)\n {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n\n for (let i = 0; i < common.length; i++)\n {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n\n for (let i = 0; i < page.length; i++)\n {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n\n for (let i = 0; i < char.length; i++)\n {\n const letter = char[i];\n\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n\n for (let i = 0; i < kerning.length; i++)\n {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n\n return data;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\nimport { XMLFormat } from './XMLFormat';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n if (typeof data === 'string' && data.indexOf('') > -1)\n {\n const xml = new self.DOMParser().parseFromString(data, 'text/xml');\n\n return XMLFormat.test(xml);\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {string} xmlTxt\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n const xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml');\n\n return XMLFormat.parse(xml);\n }\n}\n","import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nexport function autoDetectFormat(data: unknown): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n","import { TextStyle, TextMetrics, TEXT_GRADIENT } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nexport function generateFillStyle(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n style: TextStyle,\n resolution: number,\n lines: string[],\n metrics: TextMetrics\n): string|CanvasGradient|CanvasPattern\n{\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n}\n","import { generateFillStyle } from './generateFillStyle';\nimport { hex2rgb, string2hex } from '@pixi/utils';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n if (style.dropShadow)\n {\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n","/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...item.split(''));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n","import { getResolutionOfUrl } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { TextStyle, TextMetrics } from '@pixi/text';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFontData } from './BitmapFontData';\nimport { resolveCharacters, drawGlyph } from './utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITextStyle } from '@pixi/text';\n\nexport interface IBitmapFontCharacter\n{\n xOffset: number;\n yOffset: number;\n xAdvance: number;\n texture: Texture;\n page: number;\n kerning: Dict;\n}\n\nexport interface IBitmapFontOptions\n{\n chars?: string | (string | string[])[];\n resolution?: number;\n padding?: number;\n textureWidth?: number;\n textureHeight?: number;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFont\n{\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n public static readonly ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n public static readonly NUMERIC = [['0', '9']];\n\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @readonly\n * @static\n * @member {string[][]}\n */\n public static readonly ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n\n /**\n * This character set consists of all the ASCII table.\n * @readonly\n * @static\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n public static readonly ASCII = [[' ', '~']];\n\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @readonly\n * @static\n * @member {PIXI.IBitmapFontOptions}\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC\n */\n public static readonly defaultOptions: IBitmapFontOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n\n /**\n * Collection of available/installed fonts.\n *\n * @readonly\n * @static\n * @member {Object.}\n */\n public static readonly available: Dict = {};\n public readonly font: string;\n public readonly size: number;\n public readonly lineHeight: number;\n public readonly chars: Dict;\n public readonly pageTextures: Dict;\n\n /**\n * @param {PIXI.BitmapFontData} data\n * @param {PIXI.Texture[]|Object.} textures\n */\n constructor(data: BitmapFontData, textures: Texture[]|Dict)\n {\n const [info] = data.info;\n const [common] = data.common;\n const [page] = data.page;\n const res = getResolutionOfUrl(page.file);\n const pageTextures: Dict = {};\n\n /**\n * The name of the font face.\n *\n * @member {string}\n * @readonly\n */\n this.font = info.face;\n\n /**\n * The size of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.size = info.size;\n\n /**\n * The line-height of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.lineHeight = common.lineHeight / res;\n\n /**\n * The map of characters by character code.\n *\n * @member {object}\n * @readonly\n */\n this.chars = {};\n\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n *\n * @member {object}\n * @readonly\n * @private\n */\n this.pageTextures = pageTextures;\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < data.page.length; i++)\n {\n const { id, file } = data.page[i];\n\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n }\n\n // parse letters\n for (let i = 0; i < data.char.length; i++)\n {\n const { id, page } = data.char[i];\n let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];\n\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n\n const rect = new Rectangle(\n x + (pageTextures[page].frame.x / res),\n y + (pageTextures[page].frame.y / res),\n width,\n height\n );\n\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new Texture(\n pageTextures[page].baseTexture,\n rect\n ),\n page,\n };\n }\n\n // parse kernings\n for (let i = 0; i < data.kerning.length; i++)\n {\n let { first, second, amount } = data.kerning[i];\n\n first /= res;\n second /= res;\n amount /= res;\n\n if (this.chars[second])\n {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n\n /**\n * Remove references to created glyph textures.\n */\n public destroy(): void\n {\n for (const id in this.chars)\n {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n\n for (const id in this.pageTextures)\n {\n this.pageTextures[id].destroy(true);\n this.pageTextures[id] = null;\n }\n\n // Set readonly null.\n (this as any).chars = null;\n (this as any).pageTextures = null;\n }\n\n /**\n * Register a new bitmap font.\n *\n * @static\n * @param {XMLDocument|string|PIXI.BitmapFontData} data - The\n * characters map that could be provided as xml or raw string.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]}\n * textures - List of textures for each page.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n public static install(\n data: string|XMLDocument|BitmapFontData,\n textures: Texture|Texture[]|Dict\n ): BitmapFont\n {\n let fontData;\n\n if (data instanceof BitmapFontData)\n {\n fontData = data;\n }\n else\n {\n const format = autoDetectFormat(data);\n\n if (!format)\n {\n throw new Error('Unrecognized data format for font.');\n }\n\n fontData = format.parse(data as any);\n }\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n const font = new BitmapFont(fontData, textures);\n\n BitmapFont.available[font.font] = font;\n\n return font;\n }\n\n /**\n * Remove bitmap font by name.\n *\n * @static\n * @param {string} name\n */\n public static uninstall(name: string): void\n {\n const font = BitmapFont.available[name];\n\n if (!font)\n {\n throw new Error(`No font found named '${name}'`);\n }\n\n font.destroy();\n delete BitmapFont.available[name];\n }\n\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param {string} name - The name of the custom font to use with BitmapText.\n * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont.\n * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return {PIXI.BitmapFont} Font generated by style options.\n * @static\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n public static from(name: string, textStyle?: TextStyle | Partial, options?: IBitmapFontOptions): BitmapFont\n {\n if (!name)\n {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n\n const {\n chars,\n padding,\n resolution,\n textureWidth,\n textureHeight } = Object.assign(\n {}, BitmapFont.defaultOptions, options);\n\n const charsList = resolveCharacters(chars);\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const lineWidth = textureWidth;\n const fontData = new BitmapFontData();\n\n fontData.info[0] = {\n face: style.fontFamily as string,\n size: style.fontSize as number,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize as number,\n };\n\n let positionX = 0;\n let positionY = 0;\n\n let canvas;\n let context;\n let baseTexture;\n let maxCharHeight = 0;\n const baseTextures = [];\n const textures: Texture[] = [];\n\n for (let i = 0; i < charsList.length; i++)\n {\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n\n context = canvas.getContext('2d');\n baseTexture = new BaseTexture(canvas, { resolution });\n\n baseTextures.push(baseTexture);\n textures.push(new Texture(baseTexture));\n\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n\n // Measure glyph dimensions\n const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);\n const width = metrics.width;\n const height = Math.ceil(metrics.height);\n\n // This is ugly - but italics are given more space so they don't overlap\n const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution))\n {\n if (positionY === 0)\n {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is `\n + `too small for ${style.fontSize}px fonts`);\n }\n\n --i;\n\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth)\n {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n\n // Unique (numeric) ID mapping to this glyph\n const id = metrics.text.charCodeAt(0);\n\n // Create a texture holding just the glyph\n fontData.char.push({\n id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n\n const font = new BitmapFont(fontData, textures);\n\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined)\n {\n BitmapFont.uninstall(name);\n }\n\n BitmapFont.available[name] = font;\n\n return font;\n }\n}\n\n/**\n * @memberof PIXI\n * @interface IBitmapFontOptions\n * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate\n * @property {number} [resolution=1] - the resolution for rendering\n * @property {number} [padding=4] - the padding between glyphs in the atlas\n * @property {number} [textureWidth=512] - the width of the texture atlas\n * @property {number} [textureHeight=512] - the height of the texture atlas\n */\n\n","import { ObservablePoint, Point } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { removeItems, deprecation } from '@pixi/utils';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Rectangle } from '@pixi/math';\nimport { Texture } from '@pixi/core';\nimport type { IBitmapTextStyle } from './BitmapTextStyle';\nimport type { TextStyleAlign } from '@pixi/text';\nimport type { BitmapFontData } from './BitmapFontData';\nimport { Container } from '@pixi/display';\nimport type { IDestroyOptions } from '@pixi/display';\n\ninterface PageMeshData {\n index: number;\n indexCount: number;\n vertexCount: number;\n uvsCount: number;\n total: number;\n mesh: Mesh;\n vertices?: Float32Array;\n uvs?: Float32Array;\n indices?: Uint16Array;\n}\ninterface CharRenderData {\n texture: Texture;\n line: number;\n charCode: number;\n position: Point;\n}\n\nconst pageMeshDataPool: PageMeshData[] = [];\nconst charRenderDataPool: CharRenderData[] = [];\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class BitmapText extends Container\n{\n public static styleDefaults: Partial = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n public dirty: boolean;\n protected _textWidth: number;\n protected _textHeight: number;\n protected _text: string;\n protected _maxWidth: number;\n protected _maxLineHeight: number;\n protected _letterSpacing: number;\n protected _anchor: ObservablePoint;\n protected _fontName: string;\n protected _fontSize: number;\n protected _align: TextStyleAlign;\n protected _activePagesMeshData: PageMeshData[];\n protected _tint = 0xFFFFFF;\n protected _roundPixels: boolean;\n private _textureCache: Record;\n\n /**\n * @param {string} text - A string that you would like the text to display.\n * @param {object} style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n constructor(text: string, style: Partial = {})\n {\n super();\n\n if (style.font)\n {\n deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.');\n\n this._upgradeStyle(style);\n }\n\n // Apply the defaults\n const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(\n {}, BitmapText.styleDefaults, style);\n\n if (!BitmapFont.available[fontName])\n {\n throw new Error(`Missing BitmapFont \"${fontName}\"`);\n }\n\n /**\n * Collection of page mesh data.\n *\n * @member {object}\n * @private\n */\n this._activePagesMeshData = [];\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the current text align.\n *\n * @member {string}\n * @private\n */\n this._align = align;\n\n /**\n * Private tracker for the current tint.\n *\n * @member {number}\n * @private\n */\n this._tint = tint;\n\n /**\n * Private tracker for the current font name.\n *\n * @member {string}\n * @private\n */\n this._fontName = fontName;\n\n /**\n * Private tracker for the current font size.\n *\n * @member {number}\n * @private\n */\n this._fontSize = fontSize || BitmapFont.available[fontName].size;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = maxWidth;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = letterSpacing;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint((): void => { this.dirty = true; }, this, 0, 0);\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Set to `true` if the BitmapText needs to be redrawn.\n *\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * Cached char texture is destroyed when BitmapText is destroyed\n * @member {Record}\n * @private\n */\n this._textureCache = {};\n }\n\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n public updateText(): void\n {\n const data = BitmapFont.available[this._fontName];\n const scale = this._fontSize / data.size;\n const pos = new Point();\n const chars: CharRenderData[] = [];\n const lineWidths = [];\n const text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n const textLength = text.length;\n const maxWidth = this._maxWidth * data.size / this._fontSize;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n\n for (let i = 0; i < textLength; i++)\n {\n const charCode = text.charCodeAt(i);\n const char = text.charAt(i);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n const charRenderData = charRenderDataPool.pop() || {\n texture: Texture.EMPTY,\n line: 0,\n charCode: 0,\n position: new Point(),\n };\n\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n\n chars.push(charRenderData);\n\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n const lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n\n const pagesMeshData: Record = {};\n\n const newPagesMeshData: PageMeshData[] = [];\n\n const activePagesMeshData = this._activePagesMeshData;\n\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const texture = chars[i].texture;\n const baseTextureUid = texture.baseTexture.uid;\n\n if (!pagesMeshData[baseTextureUid])\n {\n let pageMeshData = pageMeshDataPool.pop();\n\n if (!pageMeshData)\n {\n const geometry = new MeshGeometry();\n const material = new MeshMaterial(Texture.EMPTY);\n\n const mesh = new Mesh(geometry, material);\n\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n\n // TODO need to get page texture here somehow..\n const { _textureCache } = this;\n\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n\n pageMeshData.mesh.tint = this._tint;\n\n newPagesMeshData.push(pageMeshData);\n\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n\n pagesMeshData[baseTextureUid].total++;\n }\n\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1)\n {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (let i = 0; i < newPagesMeshData.length; i++)\n {\n if (newPagesMeshData[i].mesh.parent !== this)\n {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n const total = pageMeshData.total;\n\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else\n {\n const total = pageMeshData.total;\n const vertices = pageMeshData.vertices;\n\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (let i = total * 4 * 2; i < vertices.length; i++)\n {\n vertices[i] = 0;\n }\n }\n\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const char = chars[i];\n let offset = char.position.x + lineAlignOffsets[char.line];\n\n if (this._roundPixels)\n {\n offset = Math.round(offset);\n }\n\n const xPos = offset * scale;\n const yPos = char.position.y * scale;\n const texture = char.texture;\n\n const pageMesh = pagesMeshData[texture.baseTexture.uid];\n\n const textureFrame = texture.frame;\n const textureUvs = texture._uvs;\n\n const index = pageMesh.index++;\n\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n let vertexCount = 0;\n\n const anchorOffsetX = this._textWidth * this.anchor.x;\n const anchorOffsetY = this._textHeight * this.anchor.y;\n\n for (let i = 0; i < pageMeshData.total; i++)\n {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n\n this._maxLineHeight = maxLineHeight * scale;\n\n const vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n const textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n const indexBuffer = pageMeshData.mesh.geometry.getIndex();\n\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n\n for (let i = 0; i < chars.length; i++)\n {\n charRenderDataPool.push(chars[i]);\n }\n }\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n updateTransform(): void\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n public getLocalBounds(): Rectangle\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n protected validate(): void\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n * @default 0xffffff\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n if (this._tint === value) return;\n\n this._tint = value;\n\n for (let i = 0; i < this._activePagesMeshData.length; i++)\n {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n }\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n public get align(): TextStyleAlign\n {\n return this._align;\n }\n\n public set align(value: TextStyleAlign)\n {\n if (this._align !== value)\n {\n this._align = value;\n this.dirty = true;\n }\n }\n\n /**\n * The name of the BitmapFont.\n *\n * @member {string}\n */\n public get fontName(): string\n {\n return this._fontName;\n }\n\n public set fontName(value: string)\n {\n if (!BitmapFont.available[value])\n {\n throw new Error(`Missing BitmapFont \"${value}\"`);\n }\n\n if (this._fontName !== value)\n {\n this._fontName = value;\n this.dirty = true;\n }\n }\n\n /**\n * The size of the font to display.\n *\n * @member {number}\n */\n public get fontSize(): number\n {\n return this._fontSize;\n }\n\n public set fontSize(value: number)\n {\n if (this._fontSize !== value)\n {\n this._fontSize = value;\n this.dirty = true;\n }\n }\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n public get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n public set anchor(value: ObservablePoint)\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n }\n\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n public get text(): string\n {\n return this._text;\n }\n\n public set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n public get maxWidth(): number\n {\n return this._maxWidth;\n }\n\n public set maxWidth(value: number)\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n public get maxLineHeight(): number\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textWidth(): number\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n public get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n\n public set letterSpacing(value: number)\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n public get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n public set roundPixels(value: boolean)\n {\n if (value !== this._roundPixels)\n {\n this._roundPixels = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textHeight(): number\n {\n this.validate();\n\n return this._textHeight;\n }\n\n /**\n * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties.\n *\n * @private\n * @deprecated since 5.3.0\n */\n _upgradeStyle(style: Partial): void\n {\n if (typeof style.font === 'string')\n {\n const valueSplit = style.font.split(' ');\n\n style.fontName = valueSplit.length === 1\n ? valueSplit[0]\n : valueSplit.slice(1).join(' ');\n\n if (valueSplit.length >= 2)\n {\n style.fontSize = parseInt(valueSplit[0], 10);\n }\n }\n else\n {\n style.fontName = style.font.name;\n style.fontSize = typeof style.font.size === 'number'\n ? style.font.size\n : parseInt(style.font.size, 10);\n }\n }\n\n destroy(options?: boolean | IDestroyOptions): void\n {\n const { _textureCache } = this;\n\n for (const id in _textureCache)\n {\n const texture = _textureCache[id];\n\n texture.destroy();\n delete _textureCache[id];\n }\n\n this._textureCache = null;\n\n super.destroy(options);\n }\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @deprecated since 5.3.0\n * @see PIXI.BitmapFont.install\n * @static\n */\n static registerFont(data: string|XMLDocument|BitmapFontData, textures: Texture|Texture[]|Dict): BitmapFont\n {\n deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install');\n\n return BitmapFont.install(data, textures);\n }\n\n /**\n * Get the list of installed fonts.\n *\n * @see PIXI.BitmapFont.available\n * @deprecated since 5.3.0\n * @static\n * @readonly\n * @member {Object.}\n */\n static get fonts(): Dict\n {\n deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available');\n\n return BitmapFont.available;\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { ILoaderResource } from '@pixi/loaders';\nimport type { Dict } from '@pixi/utils';\nimport type { Loader } from '@pixi/loaders';\nimport type { Texture } from '@pixi/core';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class BitmapFontLoader\n{\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n public static add(): void\n {\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(this: Loader, resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n const format = autoDetectFormat(resource.data);\n\n // Resource was not recognised as any of the expected font data format\n if (!format)\n {\n next();\n\n return;\n }\n\n const baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n const data = format.parse(resource.data);\n const textures: Dict = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page: ILoaderResource): void =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === data.page.length)\n {\n resource.bitmapFont = BitmapFont.install(data, textures);\n next();\n }\n };\n\n for (let i = 0; i < data.page.length; ++i)\n {\n const pageFile = data.page[i].file;\n const url = baseUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource: ILoaderResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n }\n\n /**\n * Get folder path from a resource\n * @private\n * @param {PIXI.Loader} loader\n * @param {PIXI.LoaderResource} resource\n * @return {string}\n */\n private static getBaseUrl(loader: Loader, resource: ILoaderResource): string\n {\n let resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (resUrl === '.')\n {\n resUrl = '';\n }\n\n if (loader.baseUrl && resUrl)\n {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/')\n {\n resUrl += '/';\n }\n }\n }\n\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/')\n {\n resUrl += '/';\n }\n\n return resUrl;\n }\n\n /**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url - Path to get directory for\n */\n private static dirname(url: string): string\n {\n const dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n }\n}\n","import { Filter, defaultVertex } from '@pixi/core';\nimport fragment from './alpha.frag';\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class AlphaFilter extends Filter\n{\n /**\n * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n","const vertTemplate = `\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }`;\n\nexport function generateBlurVertSource(kernelSize: number, x: boolean): string\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n\n return vertSource;\n}\n","interface IGAUSSIAN_VALUES {\n [x: number]: number[];\n}\nconst GAUSSIAN_VALUES: IGAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport function generateBlurFragSource(kernelSize: number): string\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value: number;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value].toString());\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n\n return fragSource;\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { generateBlurVertSource } from './generateBlurVertSource';\nimport { generateBlurFragSource } from './generateBlurFragSource';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilterPass extends Filter\n{\n public horizontal: boolean;\n public strength: number;\n public passes: number;\n\n private _quality: number;\n\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(horizontal: boolean, strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n const vertSrc = generateBlurVertSource(kernelSize, horizontal);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution;\n\n this._quality = 0;\n\n this.quality = quality;\n\n this.blur = strength;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else\n {\n const renderTarget = filterManager.getFilterTexture();\n const renderer = filterManager.renderer;\n\n let flip = input;\n let flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n\n for (let i = 1; i < this.passes - 1; i++)\n {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n\n this.uniforms.uSampler = flop;\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n }\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur(): number\n {\n return this.strength;\n }\n\n set blur(value: number)\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality(): number\n {\n return this._quality;\n }\n\n set quality(value: number)\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { BlurFilterPass } from './BlurFilterPass';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilter extends Filter\n{\n public blurXFilter: BlurFilterPass;\n public blurYFilter: BlurFilterPass;\n\n private _repeatEdgePixels: boolean;\n\n /**\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n super();\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution;\n this.quality = quality;\n this.blur = strength;\n\n this.repeatEdgePixels = false;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n apply(filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const xStrength = Math.abs(this.blurXFilter.strength);\n const yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n const renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n }\n\n protected updatePadding(): void\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get blur(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value: number)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get quality(): number\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value: number)\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get blurX(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value: number)\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get blurY(): number\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value: number)\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.blurYFilter.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blurYFilter.blendMode = value;\n }\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {boolean}\n * @default false\n */\n get repeatEdgePixels(): boolean\n {\n return this._repeatEdgePixels;\n }\n\n set repeatEdgePixels(value: boolean)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './colorMatrix.frag';\n\nimport type { ArrayFixed } from '@pixi/utils';\n\nexport type ColorMatrix = ArrayFixed;\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class ColorMatrixFilter extends Filter\n{\n public grayscale: (scale: number, multiply: boolean) => void;\n\n constructor()\n {\n const uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n super(defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n private _loadMatrix(matrix: ColorMatrix, multiply = false): void\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix) as any;\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n private _multiply(out: ColorMatrix, a: ColorMatrix, b: ColorMatrix): ColorMatrix\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n private _colorMatrix(matrix: ColorMatrix): ColorMatrix\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m as any;\n }\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public brightness(b: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public greyscale(scale: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public blackAndWhite(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public hue(rotation: number, multiply: boolean): void\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix: ColorMatrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public contrast(amount: number, multiply: boolean): void\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix: ColorMatrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public saturate(amount = 0, multiply?: boolean): void\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix: ColorMatrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n public desaturate(): void // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public negative(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public sepia(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public technicolor(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public polaroid(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public toBGR(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public kodachrome(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public browni(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public vintage(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {number} lightColor - Tone values, example: `0xFFE580`\n * @param {number} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean): void\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix: ColorMatrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public night(intensity: number, multiply: boolean): void\n {\n intensity = intensity || 0.1;\n\n const matrix: ColorMatrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public predator(amount: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public lsd(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n public reset(): void\n {\n const matrix: ColorMatrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix(): ColorMatrix\n {\n return this.uniforms.m;\n }\n\n set matrix(value: ColorMatrix)\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\nimport fragment from './displacement.frag';\nimport vertex from './displacement.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { RenderTexture, systems, Texture, ISpriteMaskTarget } from '@pixi/core';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class DisplacementFilter extends Filter\n{\n public maskSprite: ISpriteMaskTarget;\n public maskMatrix: Matrix;\n public scale: Point;\n\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} [scale] - The scale of the displacement\n */\n constructor(sprite: ISpriteMaskTarget, scale: number)\n {\n const maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n super(vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - clearMode.\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n const wt = this.maskSprite.worldTransform;\n const lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n const lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n }\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get map(): Texture\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value: Texture)\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport vertex from './fxaa.vert';\nimport fragment from './fxaa.frag';\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nexport class FXAAFilter extends Filter\n{\n constructor()\n {\n // TODO - needs work\n super(vertex, fragment);\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './noise.frag';\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class NoiseFilter extends Filter\n{\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get noise(): number\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value: number)\n {\n this.uniforms.uNoise = value;\n }\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get seed(): number\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value: number)\n {\n this.uniforms.uSeed = value;\n }\n}\n","import { Texture, BaseTexture, RenderTexture, Renderer, MaskData } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Container, DisplayObject, IDestroyOptions } from '@pixi/display';\nimport { IPointData, Matrix, Rectangle } from '@pixi/math';\nimport { uid } from '@pixi/utils';\nimport { settings } from '@pixi/settings';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\n\nconst _tempMatrix = new Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = null;\n\n// figured there's no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nexport class CacheData\n{\n public textureCacheId: string;\n public originalRender: (renderer: Renderer) => void;\n public originalRenderCanvas: (renderer: CanvasRenderer) => void;\n public originalCalculateBounds: () => void;\n public originalGetLocalBounds: (rect?: Rectangle) => Rectangle;\n public originalUpdateTransform: () => void;\n public originalDestroy: (options?: IDestroyOptions|boolean) => void;\n public originalMask: Container|MaskData;\n public originalFilterArea: Rectangle;\n public originalContainsPoint: (point: IPointData) => boolean;\n public sprite: Sprite;\n\n constructor()\n {\n this.textureCacheId = null;\n\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.originalContainsPoint = null;\n this.sprite = null;\n }\n}\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get(): CacheData\n {\n return this._cacheAsBitmap;\n },\n set(value: CacheData): void\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n let data: CacheData;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCached = function _renderCached(renderer: Renderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._render(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer: Renderer): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n const bounds = (this as Container).getLocalBounds(null, true).clone();\n\n // add some padding!\n if (this.filters)\n {\n const padding = this.filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n const cachedRenderTexture = renderer.renderTexture.current;\n const cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();\n const cachedProjectionTransform = renderer.projection.transform;\n\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);\n\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);\n\n // renderer.filterManager.filterStack = stack;\n\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.enableTempParent();\n this.updateTransform();\n this.disableTempParent(null);\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(\n renderer: CanvasRenderer\n): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n const bounds = (this as Container).getLocalBounds(null, true);\n\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n const cachedRenderTarget = renderer.context;\n const cachedProjectionTransform = (renderer as any)._projTransform;\n\n bounds.ceil(settings.RESOLUTION);\n\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n this.transform.localTransform.copyTo(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n (renderer as any)._projTransform = cachedProjectionTransform;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = (renderer as any)._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds(): void\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n (this._cacheData.sprite as any)._calculateBounds();\n this._bounds.updateID = (this as any)._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds(): Rectangle\n{\n return this._cacheData.sprite.getLocalBounds(null);\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject(): void\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options: IDestroyOptions|boolean): void\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n","import { DisplayObject, Container } from '@pixi/display';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\nDisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container.\n *\n * Recursive searches are done in a preorder traversal.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\nContainer.prototype.getChildByName = function getChildByName(name: string, deep?: boolean): DisplayObject\n{\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n if (deep)\n {\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n const child = (this.children[i] as Container);\n\n if (!child.getChildByName)\n {\n continue;\n }\n\n const target = (this.children[i] as Container).getChildByName(name, true);\n\n if (target)\n {\n return target;\n }\n }\n }\n\n return null;\n};\n","import { DisplayObject } from '@pixi/display';\nimport { Point } from '@pixi/math';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\nDisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point: Point = new Point(), skipUpdate = false): Point\n{\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","import { MeshGeometry } from '@pixi/mesh';\n\nexport class PlaneGeometry extends MeshGeometry\n{\n public segWidth: number;\n public segHeight: number;\n public width: number;\n public height: number;\n\n constructor(width = 100, height = 100, segWidth = 10, segHeight = 10)\n {\n super();\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n build(): void\n {\n const total = this.segWidth * this.segHeight;\n const verts = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.segWidth - 1;\n const segmentsY = this.segHeight - 1;\n\n const sizeX = (this.width) / segmentsX;\n const sizeY = (this.height) / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.segWidth);\n const y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.segWidth) + xpos;\n const value2 = (ypos * this.segWidth) + xpos + 1;\n const value3 = ((ypos + 1) * this.segWidth) + xpos;\n const value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nexport class RopeGeometry extends MeshGeometry\n{\n public points: IPoint[];\n public readonly textureScale: number;\n _width: number;\n\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n constructor(width = 200, points: IPoint[], textureScale = 0)\n {\n super(new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this._width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n private build(): void\n {\n const points = this.points;\n\n if (!points) return;\n\n const vertexBuffer = this.getBuffer('aVertexPosition');\n const uvBuffer = this.getBuffer('aTextureCoord');\n const indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n const uvs = uvBuffer.data;\n const indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n let amount = 0;\n let prev = points[0];\n const textureWidth = this._width * this.textureScale;\n const total = points.length; // - 1;\n\n for (let i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n const index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n const dx = prev.x - points[i].x;\n const dy = prev.y - points[i].y;\n const distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n let indexCount = 0;\n\n for (let i = 0; i < total - 1; i++)\n {\n const index = i * 2;\n\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n public updateVertices(): void\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n const vertices = this.buffers[0].data;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n }\n\n public update(): void\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n }\n}\n","import { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { RopeGeometry } from './geometry/RopeGeometry';\n\nimport type { Texture, Renderer } from '@pixi/core';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimpleRope extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be streched instead.\n */\n constructor(texture: Texture, points: IPoint[], textureScale = 0)\n {\n const ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n const meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n super(ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n _render(renderer: Renderer): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.shader.texture.height)\n {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { PlaneGeometry } from './geometry/PlaneGeometry';\n\nimport type{ Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimplePlane extends Mesh\n{\n protected _textureID: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the SimplePlane.\n * @param {number} verticesX - The number of vertices in the x-axis\n * @param {number} verticesY - The number of vertices in the y-axis\n */\n constructor(texture: Texture, verticesX: number, verticesY: number)\n {\n const planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n const meshMaterial = new MeshMaterial(Texture.WHITE);\n\n super(planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n\n const geometry: PlaneGeometry = this.geometry as any;\n\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n\n geometry.build();\n }\n\n set texture(value: Texture)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n }\n\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n _render(renderer: Renderer): void\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n super._render(renderer);\n }\n\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.shader.texture.off('update', this.textureUpdated, this);\n super.destroy(options);\n }\n}\n","import { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { Texture } from '@pixi/core';\n\nimport type { ITypedArray, IArrayBuffer, Renderer } from '@pixi/core';\nimport type { DRAW_MODES } from '@pixi/constants';\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nexport class SimpleMesh extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(\n texture = Texture.EMPTY,\n vertices?: IArrayBuffer,\n uvs?: IArrayBuffer,\n indices?: IArrayBuffer,\n drawMode?: DRAW_MODES\n )\n {\n const geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n const meshMaterial = new MeshMaterial(texture);\n\n super(geometry, meshMaterial, null, drawMode);\n\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n _render(renderer: Renderer): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SimplePlane } from './SimplePlane';\n\nimport type { ITypedArray } from '@pixi/core';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface NineSlicePlane extends GlobalMixins.NineSlicePlane {}\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *

\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nexport class NineSlicePlane extends SimplePlane\n{\n private _origWidth: number;\n private _origHeight: number;\n _leftWidth: number;\n _rightWidth: number;\n _topHeight: number;\n _bottomHeight: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n constructor(\n texture: Texture,\n leftWidth = DEFAULT_BORDER_SIZE,\n topHeight = DEFAULT_BORDER_SIZE,\n rightWidth = DEFAULT_BORDER_SIZE,\n bottomHeight = DEFAULT_BORDER_SIZE\n )\n {\n super(Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n this._leftWidth = leftWidth;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n this._rightWidth = rightWidth;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n this._topHeight = topHeight;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n this._bottomHeight = bottomHeight;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n }\n\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n /**\n * Updates the horizontal vertices.\n *\n */\n public updateHorizontalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /**\n * Updates the vertical vertices.\n *\n */\n public updateVerticalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return {number} Smaller number of vertical and horizontal scale.\n * @private\n */\n private _getMinScale(): number\n {\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this._width > w ? 1.0 : this._width / w;\n\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this._height > h ? 1.0 : this._height / h;\n\n const scale = Math.min(scaleW, scaleH);\n\n return scale;\n }\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n this._refresh();\n }\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n this._refresh();\n }\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get leftWidth(): number\n {\n return this._leftWidth;\n }\n\n set leftWidth(value: number)\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get rightWidth(): number\n {\n return this._rightWidth;\n }\n\n set rightWidth(value: number)\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get topHeight(): number\n {\n return this._topHeight;\n }\n\n set topHeight(value: number)\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get bottomHeight(): number\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value: number)\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n private _refresh(): void\n {\n const texture = this.texture;\n\n const uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class AnimatedSprite extends Sprite\n{\n public animationSpeed: number;\n public loop: boolean;\n public updateAnchor: boolean;\n public onComplete: () => void;\n public onFrameChange: (currentFrame: number) => void;\n public onLoop: () => void;\n\n private _playing: boolean;\n private _textures: Texture[];\n private _durations: number[];\n private _autoUpdate: boolean;\n private _isConnectedToTicker: boolean;\n private _currentTime: number;\n private _previousFrame: number;\n\n /**\n * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n constructor(textures: Texture[]|FrameObject[], autoUpdate = true)\n {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n this._textures = null;\n\n /**\n * @type {number[]}\n * @private\n */\n this._durations = null;\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n this._playing = false;\n\n /**\n * The texture index that was displayed last time\n *\n * @member {number}\n * @private\n */\n this._previousFrame = null;\n\n this.textures = textures;\n }\n\n /**\n * Stops the AnimatedSprite.\n *\n */\n public stop(): void\n {\n if (!this._playing)\n {\n return;\n }\n\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Plays the AnimatedSprite.\n *\n */\n public play(): void\n {\n if (this._playing)\n {\n return;\n }\n\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n public gotoAndStop(frameNumber: number): void\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n public gotoAndPlay(frameNumber: number): void\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @param {number} deltaTime - Time since last tick.\n */\n update(deltaTime: number): void\n {\n if (!this._playing)\n {\n return;\n }\n\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n private updateTexture(): void\n {\n const currentFrame = this.currentFrame;\n\n if (this._previousFrame === currentFrame)\n {\n return;\n }\n\n this._previousFrame = currentFrame;\n\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.stop();\n super.destroy(options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames.\n */\n public static fromFrames(frames: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n public static fromImages(images: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get totalFrames(): number\n {\n return this._textures.length;\n }\n\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]}\n */\n get textures(): Texture[]|FrameObject[]\n {\n return this._textures;\n }\n\n set textures(value: Texture[]|FrameObject[])\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value as Texture[];\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push((value[i] as FrameObject).texture);\n this._durations.push((value[i] as FrameObject).time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n get currentFrame(): number\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n get playing(): boolean\n {\n return this._playing;\n }\n\n /**\n * Whether to use PIXI.Ticker.shared to auto update animation time\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\nexport interface FrameObject {\n texture: Texture;\n time: number;\n}\n\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n","import { deprecation } from '@pixi/utils';\nimport type {\n systems,\n resources,\n Renderer,\n ImageSource,\n BaseTexture,\n RenderTexture,\n Texture,\n State,\n AbstractRenderer } from '@pixi/core';\nimport type { DisplayObject, Container } from '@pixi/display';\nimport type { TilingSprite } from '@pixi/sprite-tiling';\nimport type {\n Point,\n ObservablePoint,\n IPoint,\n Rectangle,\n Transform,\n groupD8,\n Matrix } from '@pixi/math';\nimport type { InteractionManager, InteractionData, InteractionEvent } from '@pixi/interaction';\nimport type { AccessibilityManager } from '@pixi/accessibility';\nimport type { Ticker } from '@pixi/ticker';\nimport type { Graphics, GraphicsData } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\nimport type { BitmapText, BitmapFontLoader } from '@pixi/text-bitmap';\nimport type { CanvasRenderTarget } from '@pixi/utils';\nimport type { Loader, LoaderResource } from '@pixi/loaders';\nimport type { BasePrepare, Prepare } from '@pixi/prepare';\nimport type { Extract } from '@pixi/extract';\nimport type { AnimatedSprite } from '@pixi/sprite-animated';\nimport type { Mesh } from '@pixi/mesh';\nimport type { ParticleContainer } from '@pixi/particles';\nimport type { SpritesheetLoader } from '@pixi/spritesheet';\nimport type {\n SimpleRope,\n NineSlicePlane,\n SimpleMesh,\n SimplePlane } from '@pixi/mesh-extras';\n\nconst v5 = '5.0.0';\n\n// Canvas deprecations needs to get moved\n// to the legacy package, but for now, we'll\n// ad this reminder\ntype $FixLegacy = any;\n\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useDeprecated(this: any): void\n{\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const PIXI = this;\n\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get(): RegExp\n {\n deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get(): {[name: string]: number}\n {\n deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get(): typeof Renderer\n {\n deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n\n return PIXI.Renderer;\n },\n },\n\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get(): CanvasRenderTarget\n {\n deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get(): Loader\n {\n deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n\n return PIXI.Loader.shared;\n },\n },\n\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get(): systems.FilterSystem\n {\n deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n\n return PIXI.systems.FilterSystem;\n },\n },\n\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get(): $FixLegacy\n {\n deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n\n return PIXI.canvasUtils;\n },\n },\n\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get(): typeof groupD8\n {\n deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n\n return PIXI.groupD8;\n },\n },\n });\n\n /**\n * @namespace PIXI.accessibility\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.accessibility = {};\n\n Object.defineProperties(PIXI.accessibility, {\n /**\n * @class PIXI.accessibility.AccessibilityManager\n * @deprecated since 5.3.0\n * @see PIXI.AccessibilityManager\n */\n AccessibilityManager: {\n get(): typeof AccessibilityManager\n {\n deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager');\n\n return PIXI.AccessibilityManager;\n },\n },\n });\n\n /**\n * @namespace PIXI.interaction\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.interaction = {};\n\n Object.defineProperties(PIXI.interaction, {\n /**\n * @class PIXI.interaction.InteractionManager\n * @deprecated since 5.3.0\n * @see PIXI.InteractionManager\n */\n InteractionManager: {\n get(): typeof InteractionManager\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager');\n\n return PIXI.InteractionManager;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionData\n * @deprecated since 5.3.0\n * @see PIXI.InteractionData\n */\n InteractionData: {\n get(): typeof InteractionData\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData');\n\n return PIXI.InteractionData;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionEvent\n * @deprecated since 5.3.0\n * @see PIXI.InteractionEvent\n */\n InteractionEvent: {\n get(): typeof InteractionEvent\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent');\n\n return PIXI.InteractionEvent;\n },\n },\n });\n\n /**\n * @namespace PIXI.prepare\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.prepare = {};\n\n Object.defineProperties(PIXI.prepare, {\n /**\n * @class PIXI.prepare.BasePrepare\n * @deprecated since 5.2.1\n * @see PIXI.BasePrepare\n */\n BasePrepare: {\n get(): typeof BasePrepare\n {\n deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare');\n\n return PIXI.BasePrepare;\n },\n },\n /**\n * @class PIXI.prepare.Prepare\n * @deprecated since 5.2.1\n * @see PIXI.Prepare\n */\n Prepare: {\n get(): typeof Prepare\n {\n deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n },\n /**\n * @class PIXI.prepare.CanvasPrepare\n * @deprecated since 5.2.1\n * @see PIXI.CanvasPrepare\n */\n CanvasPrepare: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare');\n\n return PIXI.CanvasPrepare;\n },\n },\n });\n\n /**\n * @namespace PIXI.extract\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.extract = {};\n\n Object.defineProperties(PIXI.extract, {\n /**\n * @class PIXI.extract.Extract\n * @deprecated since 5.2.1\n * @see PIXI.Extract\n */\n Extract: {\n get(): typeof Extract\n {\n deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n },\n /**\n * @class PIXI.extract.CanvasExtract\n * @deprecated since 5.2.1\n * @see PIXI.CanvasExtract\n */\n CanvasExtract: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract');\n\n return PIXI.CanvasExtract;\n },\n },\n });\n\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get(): typeof TilingSprite\n {\n deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get(): typeof AnimatedSprite\n {\n deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get(): typeof BitmapText\n {\n deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n\n return PIXI.BitmapText;\n },\n },\n });\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromFrame\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromFrame = function fromFrame(frameId: string, width: number, height: number): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from');\n\n return PIXI.TilingSprite.from(frameId, { width, height });\n };\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromImage\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromImage = function fromImage(\n imageId: string,\n width: number,\n height: number,\n options: any = {}): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from');\n\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object')\n {\n options = {\n // eslint-disable-next-line prefer-rest-params\n scaleMode: arguments[4],\n resourceOptions: {\n // eslint-disable-next-line prefer-rest-params\n crossorigin: arguments[3],\n },\n };\n }\n\n options.width = width;\n options.height = height;\n\n return PIXI.TilingSprite.from(imageId, options);\n };\n\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get(): typeof resources.SVGResource.getSize\n {\n deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n\n return PIXI.resources.SVGResource.getSize;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get(): typeof SimpleMesh\n {\n deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get(): typeof NineSlicePlane\n {\n deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get(): typeof SimplePlane\n {\n deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get(): typeof SimpleRope\n {\n deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get(): typeof Mesh\n {\n deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n\n return PIXI.MeshRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get(): typeof ParticleContainer\n {\n deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n\n return PIXI.ParticleRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get(): typeof Ticker\n {\n deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get(): Ticker\n {\n deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n\n return PIXI.Ticker.shared;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get(): typeof Loader\n {\n deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get(): typeof LoaderResource\n {\n deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get(): typeof BitmapFontLoader.use\n {\n deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get(): void\n {\n deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed');\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get(): typeof SpritesheetLoader.use\n {\n deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get(): typeof SpritesheetLoader.getResourcePath\n {\n deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware: any): typeof Loader\n {\n deprecation(v5,\n 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'\n );\n\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n\n // convenience for converting event name to signal name\n const eventToSignal = (event: any): string =>\n `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n\n Object.assign(PIXI.Loader.prototype,\n {\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#on\n * @deprecated since 5.0.0\n */\n on(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#on is completely deprecated, use PIXI.Loader#${signal}.add`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#once\n * @deprecated since 5.0.0\n */\n once(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#once is completely deprecated, use PIXI.Loader#${signal}.once`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#off\n * @deprecated since 5.0.0\n */\n off(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#off is completely deprecated, use PIXI.Loader#${signal}.detach`);\n },\n });\n\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get(): typeof Extract\n {\n deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n });\n\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get(): typeof Prepare\n {\n deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n });\n\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n\n this._render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(this: DisplayObject, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n\n this.renderAdvanced(renderer);\n };\n\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get(): number\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n\n return 0;\n },\n set(): void\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n\n const { BaseTexture: BaseTextureAny } = PIXI;\n\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTextureAny.prototype.loadSource = function loadSource(image: string | HTMLImageElement): void\n {\n deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n\n const resource = PIXI.resources.autoDetectResource(image);\n\n resource.internal = true;\n\n this.setResource(resource);\n this.update();\n };\n\n let baseTextureIdDeprecation = false;\n\n Object.defineProperties(BaseTextureAny.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get(): boolean\n {\n deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resources.ImageResource#url\n */\n imageUrl: {\n get(this: BaseTexture): string\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n return (this.resource as resources.ImageResource)?.url;\n },\n\n set(this: BaseTexture, imageUrl: string): void\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n if (this.resource)\n {\n (this.resource as resources.ImageResource).url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get(this: BaseTexture): ImageSource\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n\n return (this.resource as resources.BaseImageResource).source;\n },\n set(this: BaseTexture, source: ImageSource): void\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n\n if (this.resource)\n {\n (this.resource as resources.BaseImageResource).source = source;\n }\n },\n },\n\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get(this: BaseTexture): boolean\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: BaseTexture, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get(this: BaseTexture): number\n {\n if (!baseTextureIdDeprecation)\n {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n\n return this._batchLocation;\n },\n set(this: BaseTexture, value: number): void\n {\n this._batchLocation = value;\n },\n },\n });\n\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromImage = function fromImage(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromCanvas = function fromCanvas(canvas: HTMLCanvasElement, scaleMode: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n\n return BaseTextureAny.from(canvas, { scaleMode });\n };\n\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromSVG = function fromSVG(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get(this: resources.ImageResource): boolean\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: resources.ImageResource, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(this: Point, p: IPoint): Point\n {\n deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(this: ObservablePoint, p: IPoint): ObservablePoint\n {\n deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(this: Rectangle, p: Rectangle): Rectangle\n {\n deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(this: Matrix, p: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n\n return this.copyTo(p);\n };\n\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(this: systems.StateSystem, s: State): void\n {\n deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n\n return this.set(s);\n };\n\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget(this: systems.FilterSystem, _clear: boolean, resolution: number)\n {\n deprecation(v5,\n 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'\n );\n\n return this.getFilterTexture(null, resolution);\n },\n\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget(this: systems.FilterSystem, renderTexture: any)\n {\n deprecation(v5,\n 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture'\n );\n\n this.returnFilterTexture(renderTexture);\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: any)\n {\n deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n\n const mappedMatrix = outputMatrix.identity();\n const { sourceFrame, destinationFrame } = this.activeState;\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n\n return mappedMatrix;\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n\n const { sourceFrame, destinationFrame } = this.activeState;\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n\n const translateScaleX = (destinationFrame.width / sourceFrame.width);\n const translateScaleY = (destinationFrame.height / sourceFrame.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n },\n });\n\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.size property has been removed');\n\n return this._frame;\n },\n },\n });\n\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurXFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(true, strength, quality, resolution, kernelSize);\n }\n }\n\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurYFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(false, strength, quality, resolution, kernelSize);\n }\n }\n\n Object.assign(PIXI.filters, {\n BlurXFilter,\n BlurYFilter,\n });\n\n const {\n Sprite: SpriteAny,\n Texture: TextureAny,\n Graphics: GraphicsAny } = PIXI;\n\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!GraphicsAny.prototype.generateCanvasTexture)\n {\n GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture(): void\n {\n deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(GraphicsAny.prototype, 'graphicsData', {\n get(this: Graphics): GraphicsData[]\n {\n deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n\n return this.geometry.graphicsData;\n },\n });\n\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Sprite\n {\n deprecation(v5, `PIXI.Sprite.${name} method is deprecated, use PIXI.Sprite.from`);\n\n return SpriteAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame');\n\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Texture\n {\n deprecation(v5, `PIXI.Texture.${name} method is deprecated, use PIXI.Texture.from`);\n\n return TextureAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromImage = textureFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame');\n\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get(this: AbstractRenderer): boolean\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n return this.autoDensity;\n },\n set(this: any, value: boolean): void\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n this.autoDensity = value;\n },\n });\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get(this: Renderer)\n {\n deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n\n return this.texture;\n },\n });\n\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n\n /**\n * @memberof PIXI.BitmapText\n * @member {object} font\n * @deprecated since 5.3.0\n */\n Object.defineProperty(PIXI.BitmapText.prototype, 'font', {\n get(this: BitmapText): any\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n return {\n name: this._fontName,\n size: this._fontSize,\n tint: this._tint,\n align: this._align,\n };\n },\n set(this: BitmapText, value: any)\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n if (!value)\n {\n return;\n }\n\n const style: any = { font: value };\n\n this._upgradeStyle(style);\n\n style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size;\n\n this._fontName = style.fontName;\n this._fontSize = style.fontSize;\n\n this.dirty = true;\n },\n });\n}\n","import '@pixi/polyfill';\n\nimport * as utils from '@pixi/utils';\nimport { AccessibilityManager } from '@pixi/accessibility';\nimport { InteractionManager } from '@pixi/interaction';\nimport { Application } from '@pixi/app';\nimport { Renderer, BatchRenderer } from '@pixi/core';\nimport { Extract } from '@pixi/extract';\nimport { Loader, AppLoaderPlugin } from '@pixi/loaders';\nimport { ParticleRenderer } from '@pixi/particles';\nimport { Prepare } from '@pixi/prepare';\nimport { SpritesheetLoader } from '@pixi/spritesheet';\nimport { TilingSpriteRenderer } from '@pixi/sprite-tiling';\nimport { BitmapFontLoader } from '@pixi/text-bitmap';\nimport { TickerPlugin } from '@pixi/ticker';\nimport { AlphaFilter } from '@pixi/filter-alpha';\nimport { BlurFilter, BlurFilterPass } from '@pixi/filter-blur';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { DisplacementFilter } from '@pixi/filter-displacement';\nimport { FXAAFilter } from '@pixi/filter-fxaa';\nimport { NoiseFilter } from '@pixi/filter-noise';\nimport '@pixi/mixin-cache-as-bitmap';\nimport '@pixi/mixin-get-child-by-name';\nimport '@pixi/mixin-get-global-position';\n\n// Export deprecations so Rollup can call it\n// in the footer after global is defined\n// other module must call this manually\nimport { useDeprecated } from './useDeprecated';\n\n// Install renderer plugins\nRenderer.registerPlugin('accessibility', AccessibilityManager);\nRenderer.registerPlugin('extract', Extract);\nRenderer.registerPlugin('interaction', InteractionManager);\nRenderer.registerPlugin('particle', ParticleRenderer);\nRenderer.registerPlugin('prepare', Prepare);\nRenderer.registerPlugin('batch', BatchRenderer);\nRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n\nLoader.registerPlugin(BitmapFontLoader);\nLoader.registerPlugin(SpritesheetLoader);\n\nApplication.registerPlugin(TickerPlugin);\nApplication.registerPlugin(AppLoaderPlugin);\n\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nexport const VERSION = '__VERSION__';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nexport const filters = {\n AlphaFilter,\n BlurFilter,\n BlurFilterPass,\n ColorMatrixFilter,\n DisplacementFilter,\n FXAAFilter,\n NoiseFilter,\n};\n\n// Export ES for those importing specifically by name,\nexport * from '@pixi/accessibility';\nexport * from '@pixi/app';\nexport * from '@pixi/constants';\nexport * from '@pixi/core';\nexport * from '@pixi/display';\nexport * from '@pixi/extract';\nexport * from '@pixi/graphics';\nexport * from '@pixi/loaders';\nexport * from '@pixi/interaction';\nexport * from '@pixi/math';\nexport * from '@pixi/mesh';\nexport * from '@pixi/mesh-extras';\nexport * from '@pixi/particles';\nexport * from '@pixi/prepare';\nexport * from '@pixi/runner';\nexport * from '@pixi/sprite';\nexport * from '@pixi/spritesheet';\nexport * from '@pixi/sprite-animated';\nexport * from '@pixi/sprite-tiling';\nexport * from '@pixi/text';\nexport * from '@pixi/text-bitmap';\nexport * from '@pixi/ticker';\nexport * from '@pixi/settings';\nexport {\n utils,\n useDeprecated,\n};\n","import { SHAPES } from '@pixi/math';\n\nimport type { CanvasRenderer } from '../CanvasRenderer';\nimport type { Graphics } from '@pixi/graphics';\nimport type { MaskData } from '@pixi/core';\nimport type { Container } from '@pixi/display';\n\n/**\n * A set of functions used to handle masking.\n *\n * Sprite masking is not supported on the CanvasRenderer.\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasMaskManager\n{\n private renderer: CanvasRenderer;\n private _foundShapes: Array;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n\n this._foundShapes = [];\n }\n\n /**\n * This method adds it to the current stack of masks.\n *\n * @param {PIXI.MaskData | PIXI.Graphics} maskData - the maskData that will be pushed\n */\n pushMask(maskData: MaskData | Graphics): void\n {\n const renderer = this.renderer;\n const maskObject = ((maskData as MaskData).maskObject || maskData) as Container;\n\n renderer.context.save();\n\n // TODO support sprite alpha masks??\n // lots of effort required. If demand is great enough..\n\n const foundShapes = this._foundShapes;\n\n this.recursiveFindShapes(maskObject, foundShapes);\n if (foundShapes.length > 0)\n {\n const { context } = renderer;\n\n context.beginPath();\n\n for (let i = 0; i < foundShapes.length; i++)\n {\n const shape = foundShapes[i];\n const transform = shape.transform.worldTransform;\n\n this.renderer.setContextTransform(transform);\n\n this.renderGraphicsShape(shape);\n }\n\n foundShapes.length = 0;\n context.clip();\n }\n }\n\n /**\n * Renders all PIXI.Graphics shapes in a subtree.\n *\n * @param {PIXI.Container} container - container to scan.\n * @param {PIXI.Graphics[]} out - where to put found shapes\n */\n recursiveFindShapes(container: Container, out: Array): void\n {\n if ((container as Graphics).geometry && (container as Graphics).geometry.graphicsData)\n {\n out.push(container as Graphics);\n }\n\n const { children } = container;\n\n if (children)\n {\n for (let i = 0; i < children.length; i++)\n {\n this.recursiveFindShapes(children[i] as Container, out);\n }\n }\n }\n\n /**\n * Renders a PIXI.Graphics shape.\n *\n * @param {PIXI.Graphics} graphics - The object to render.\n */\n renderGraphicsShape(graphics: Graphics): void\n {\n graphics.finishPoly();\n\n const context = this.renderer.context;\n const graphicsData = graphics.geometry.graphicsData;\n const len = graphicsData.length;\n\n if (len === 0)\n {\n return;\n }\n\n for (let i = 0; i < len; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n\n if (shape.type === SHAPES.POLY)\n {\n const points = shape.points;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 1; j < points.length / 2; j++)\n {\n context.lineTo(points[j * 2], points[(j * 2) + 1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1])\n {\n context.closePath();\n }\n }\n else if (shape.type === SHAPES.RECT)\n {\n context.rect(shape.x, shape.y, shape.width, shape.height);\n context.closePath();\n }\n else if (shape.type === SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n }\n else if (shape.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n }\n else if (shape.type === SHAPES.RREC)\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n }\n }\n }\n\n /**\n * Restores the current drawing context to the state it was before the mask was applied.\n *\n * @param {PIXI.CanvasRenderer} renderer - The renderer context to use.\n */\n popMask(renderer: CanvasRenderer): void\n {\n renderer.context.restore();\n renderer.invalidateBlendMode();\n }\n\n /**\n * Destroys this canvas mask manager.\n *\n */\n public destroy(): void\n {\n /* empty */\n }\n}\n","/**\n * Creates a little colored canvas\n *\n * @ignore\n * @param {string} color - The color to make the canvas\n * @return {canvas} a small canvas element\n */\nfunction createColoredCanvas(color: string): HTMLCanvasElement\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = color;\n context.fillRect(0, 0, 6, 1);\n\n return canvas;\n}\n\n/**\n * Checks whether the Canvas BlendModes are supported by the current browser\n *\n * @private\n * @return {boolean} whether they are supported\n */\nexport function canUseNewCanvasBlendModes(): boolean\n{\n if (typeof document === 'undefined')\n {\n return false;\n }\n\n const magenta = createColoredCanvas('#ff00ff');\n const yellow = createColoredCanvas('#ffff00');\n\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.globalCompositeOperation = 'multiply';\n context.drawImage(magenta, 0, 0);\n context.drawImage(yellow, 2, 0);\n\n const imageData = context.getImageData(2, 0, 1, 1);\n\n if (!imageData)\n {\n return false;\n }\n\n const data = imageData.data;\n\n return (data[0] === 255 && data[1] === 0 && data[2] === 0);\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { canUseNewCanvasBlendModes } from './canUseNewCanvasBlendModes';\n\n/**\n * Maps blend combinations to Canvas.\n *\n * @memberof PIXI\n * @function mapCanvasBlendModesToPixi\n * @private\n * @param {string[]} [array=[]] - The array to output into.\n * @return {string[]} Mapped modes.\n */\nexport function mapCanvasBlendModesToPixi(array: string[] = []): string[]\n{\n if (canUseNewCanvasBlendModes())\n {\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'multiply';\n array[BLEND_MODES.SCREEN] = 'screen';\n array[BLEND_MODES.OVERLAY] = 'overlay';\n array[BLEND_MODES.DARKEN] = 'darken';\n array[BLEND_MODES.LIGHTEN] = 'lighten';\n array[BLEND_MODES.COLOR_DODGE] = 'color-dodge';\n array[BLEND_MODES.COLOR_BURN] = 'color-burn';\n array[BLEND_MODES.HARD_LIGHT] = 'hard-light';\n array[BLEND_MODES.SOFT_LIGHT] = 'soft-light';\n array[BLEND_MODES.DIFFERENCE] = 'difference';\n array[BLEND_MODES.EXCLUSION] = 'exclusion';\n array[BLEND_MODES.HUE] = 'hue';\n array[BLEND_MODES.SATURATION] = 'saturate';\n array[BLEND_MODES.COLOR] = 'color';\n array[BLEND_MODES.LUMINOSITY] = 'luminosity';\n }\n else\n {\n // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'source-over';\n array[BLEND_MODES.SCREEN] = 'source-over';\n array[BLEND_MODES.OVERLAY] = 'source-over';\n array[BLEND_MODES.DARKEN] = 'source-over';\n array[BLEND_MODES.LIGHTEN] = 'source-over';\n array[BLEND_MODES.COLOR_DODGE] = 'source-over';\n array[BLEND_MODES.COLOR_BURN] = 'source-over';\n array[BLEND_MODES.HARD_LIGHT] = 'source-over';\n array[BLEND_MODES.SOFT_LIGHT] = 'source-over';\n array[BLEND_MODES.DIFFERENCE] = 'source-over';\n array[BLEND_MODES.EXCLUSION] = 'source-over';\n array[BLEND_MODES.HUE] = 'source-over';\n array[BLEND_MODES.SATURATION] = 'source-over';\n array[BLEND_MODES.COLOR] = 'source-over';\n array[BLEND_MODES.LUMINOSITY] = 'source-over';\n }\n // not-premultiplied, only for webgl\n array[BLEND_MODES.NORMAL_NPM] = array[BLEND_MODES.NORMAL];\n array[BLEND_MODES.ADD_NPM] = array[BLEND_MODES.ADD];\n array[BLEND_MODES.SCREEN_NPM] = array[BLEND_MODES.SCREEN];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = 'source-in';\n array[BLEND_MODES.SRC_OUT] = 'source-out';\n array[BLEND_MODES.SRC_ATOP] = 'source-atop';\n array[BLEND_MODES.DST_OVER] = 'destination-over';\n array[BLEND_MODES.DST_IN] = 'destination-in';\n array[BLEND_MODES.DST_OUT] = 'destination-out';\n array[BLEND_MODES.DST_ATOP] = 'destination-atop';\n array[BLEND_MODES.XOR] = 'xor';\n\n // SUBTRACT from flash, does not exist in canvas\n array[BLEND_MODES.SUBTRACT] = 'source-over';\n\n return array;\n}\n","import { AbstractRenderer, resources } from '@pixi/core';\nimport { CanvasRenderTarget, sayHello, rgb2hex, hex2string } from '@pixi/utils';\nimport { CanvasMaskManager } from './utils/CanvasMaskManager';\nimport { mapCanvasBlendModesToPixi } from './utils/mapCanvasBlendModesToPixi';\nimport { RENDERER_TYPE, SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { Matrix } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type {\n IRendererOptions, IRendererPlugin,\n IRendererPlugins,\n RenderTexture,\n BaseRenderTexture,\n} from '@pixi/core';\n\nconst tempMatrix = new Matrix();\n\nexport interface ICanvasRendererPluginConstructor {\n new (renderer: CanvasRenderer, options?: any): IRendererPlugin;\n}\n\nexport interface ICanvasRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * Different browsers support different smoothing property names\n * this is the list of all platform props.\n */\ntype SmoothingEnabledProperties =\n 'imageSmoothingEnabled' |\n 'webkitImageSmoothingEnabled' |\n 'mozImageSmoothingEnabled' |\n 'oImageSmoothingEnabled' |\n 'msImageSmoothingEnabled';\n\n/**\n * Renderering context for all browsers. This includes platform-specific\n * properties that are not included in the spec for CanvasRenderingContext2D\n */\nexport interface CrossPlatformCanvasRenderingContext2D extends CanvasRenderingContext2D\n{\n webkitImageSmoothingEnabled: boolean;\n mozImageSmoothingEnabled: boolean;\n oImageSmoothingEnabled: boolean;\n msImageSmoothingEnabled: boolean;\n}\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas.\n *\n * This renderer should be used for browsers that do not support WebGL.\n * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class CanvasRenderer extends AbstractRenderer\n{\n public readonly rootContext: CrossPlatformCanvasRenderingContext2D;\n public context: CrossPlatformCanvasRenderingContext2D;\n public refresh: boolean;\n public maskManager: CanvasMaskManager;\n public smoothProperty: SmoothingEnabledProperties;\n public readonly blendModes: string[];\n public renderingToScreen: boolean;\n\n private _activeBlendMode: BLEND_MODES;\n private _projTransform: Matrix;\n\n _outerBlend: boolean;\n\n /**\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.CANVAS, options);\n\n /**\n * The root canvas 2d context that everything is drawn with.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.rootContext = this.view.getContext('2d', { alpha: this.transparent }) as\n CrossPlatformCanvasRenderingContext2D;\n\n /**\n * The currently active canvas 2d context (could change with renderTextures)\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.rootContext;\n\n /**\n * Boolean flag controlling canvas refresh.\n *\n * @member {boolean}\n */\n this.refresh = true;\n\n /**\n * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.\n *\n * @member {PIXI.CanvasMaskManager}\n */\n this.maskManager = new CanvasMaskManager(this);\n\n /**\n * The canvas property used to set the canvas smoothing property.\n *\n * @member {string}\n */\n this.smoothProperty = 'imageSmoothingEnabled';\n\n if (!this.rootContext.imageSmoothingEnabled)\n {\n const rc = this.rootContext;\n\n if (rc.webkitImageSmoothingEnabled)\n {\n this.smoothProperty = 'webkitImageSmoothingEnabled';\n }\n else if (rc.mozImageSmoothingEnabled)\n {\n this.smoothProperty = 'mozImageSmoothingEnabled';\n }\n else if (rc.oImageSmoothingEnabled)\n {\n this.smoothProperty = 'oImageSmoothingEnabled';\n }\n else if (rc.msImageSmoothingEnabled)\n {\n this.smoothProperty = 'msImageSmoothingEnabled';\n }\n }\n\n this.initPlugins(CanvasRenderer.__plugins);\n\n /**\n * Tracks the blend modes useful for this renderer.\n *\n * @member {object}\n */\n this.blendModes = mapCanvasBlendModesToPixi();\n this._activeBlendMode = null;\n this._outerBlend = false;\n\n /**\n * Projection transform, passed in render() stored here\n * @type {null}\n * @private\n */\n this._projTransform = null;\n\n this.renderingToScreen = false;\n\n sayHello('Canvas');\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.CanvasRenderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.CanvasRenderer#prerender\n */\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Renders the object to this canvas view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered\n * @param {PIXI.RenderTexture} [renderTexture] - A render texture to be rendered to.\n * If unset, it will render to the root context.\n * @param {boolean} [clear=this.clearBeforeRender] - Whether to clear the canvas before drawing\n * @param {PIXI.Matrix} [transform] - A transformation to be applied\n * @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform\n */\n public render(displayObject: DisplayObject, renderTexture?: RenderTexture | BaseRenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n if (!this.view)\n {\n return;\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.emit('prerender');\n\n const rootResolution = this.resolution;\n\n if (renderTexture)\n {\n renderTexture = renderTexture.castToBaseTexture() as BaseRenderTexture;\n\n if (!renderTexture._canvasRenderTarget)\n {\n renderTexture._canvasRenderTarget = new CanvasRenderTarget(\n renderTexture.width,\n renderTexture.height,\n renderTexture.resolution\n );\n renderTexture.resource = new resources.CanvasResource(renderTexture._canvasRenderTarget.canvas);\n renderTexture.valid = true;\n }\n\n this.context = renderTexture._canvasRenderTarget.context as CrossPlatformCanvasRenderingContext2D;\n this.resolution = renderTexture._canvasRenderTarget.resolution;\n }\n else\n {\n this.context = this.rootContext;\n }\n\n const context = this.context;\n\n this._projTransform = transform || null;\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n }\n\n context.save();\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.globalAlpha = 1;\n this._activeBlendMode = BLEND_MODES.NORMAL;\n this._outerBlend = false;\n context.globalCompositeOperation = this.blendModes[BLEND_MODES.NORMAL];\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n if (this.renderingToScreen)\n {\n if (this.transparent)\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n else\n {\n context.fillStyle = this._backgroundColorString;\n context.fillRect(0, 0, this.width, this.height);\n }\n }\n else\n {\n renderTexture = (renderTexture as BaseRenderTexture);\n renderTexture._canvasRenderTarget.clear();\n\n const clearColor = renderTexture.clearColor;\n\n if (clearColor[3] > 0)\n {\n context.fillStyle = hex2string(rgb2hex(clearColor));\n context.fillRect(0, 0, renderTexture.realWidth, renderTexture.realHeight);\n }\n }\n }\n\n // TODO RENDER TARGET STUFF HERE..\n const tempContext = this.context;\n\n this.context = context;\n displayObject.renderCanvas(this);\n this.context = tempContext;\n\n context.restore();\n\n this.resolution = rootResolution;\n this._projTransform = null;\n\n this.emit('postrender');\n }\n\n /**\n * sets matrix of context\n * called only from render() methods\n * takes care about resolution\n * @param {PIXI.Matrix} transform - world matrix of current element\n * @param {boolean} [roundPixels] - whether to round (tx,ty) coords\n * @param {number} [localResolution] - If specified, used instead of `renderer.resolution` for local scaling\n */\n setContextTransform(transform: Matrix, roundPixels?: boolean, localResolution?: number): void\n {\n let mat = transform;\n const proj = this._projTransform;\n const resolution = this.resolution;\n\n localResolution = localResolution || resolution;\n\n if (proj)\n {\n mat = tempMatrix;\n mat.copyFrom(transform);\n mat.prepend(proj);\n }\n\n if (roundPixels)\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n (mat.tx * resolution) | 0,\n (mat.ty * resolution) | 0\n );\n }\n else\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n mat.tx * resolution,\n mat.ty * resolution\n );\n }\n }\n\n /**\n * Clear the canvas of renderer.\n *\n * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent.\n */\n public clear(clearColor: string): void\n {\n const context = this.context;\n\n clearColor = clearColor || this._backgroundColorString;\n\n if (!this.transparent && clearColor)\n {\n context.fillStyle = clearColor;\n context.fillRect(0, 0, this.width, this.height);\n }\n else\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n }\n\n /**\n * Sets the blend mode of the renderer.\n *\n * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values.\n * @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite.\n * Pass `true` only if you are ready to use them.\n */\n setBlendMode(blendMode: BLEND_MODES, readyForOuterBlend?: boolean): void\n {\n const outerBlend = blendMode === BLEND_MODES.SRC_IN\n || blendMode === BLEND_MODES.SRC_OUT\n || blendMode === BLEND_MODES.DST_IN\n || blendMode === BLEND_MODES.DST_ATOP;\n\n if (!readyForOuterBlend && outerBlend)\n {\n blendMode = BLEND_MODES.NORMAL;\n }\n\n if (this._activeBlendMode === blendMode)\n {\n return;\n }\n\n this._activeBlendMode = blendMode;\n this._outerBlend = outerBlend;\n this.context.globalCompositeOperation = this.blendModes[blendMode];\n }\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n public destroy(removeView?: boolean): void\n {\n // call the base destroy\n super.destroy(removeView);\n\n this.context = null;\n\n this.refresh = true;\n\n this.maskManager.destroy();\n this.maskManager = null;\n\n this.smoothProperty = null;\n }\n\n /**\n * Resizes the canvas view to the specified width and height.\n *\n * @extends PIXI.AbstractRenderer#resize\n *\n * @param {number} screenWidth - the new width of the screen\n * @param {number} screenHeight - the new height of the screen\n */\n public resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n // reset the scale mode.. oddly this seems to be reset when the canvas is resized.\n // surely a browser bug?? Let PixiJS fix that for you..\n if (this.smoothProperty)\n {\n this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === SCALE_MODES.LINEAR);\n }\n }\n\n /**\n * Checks if blend mode has changed.\n */\n invalidateBlendMode(): void\n {\n this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation);\n }\n\n static __plugins: IRendererPlugins;\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.CanvasRenderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.CanvasExtract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.CanvasPrepare} prepare Pre-render display objects.\n */\n\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: ICanvasRendererPluginConstructor): void\n {\n CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};\n CanvasRenderer.__plugins[pluginName] = ctor;\n }\n}\n","import { hex2rgb, rgb2hex } from '@pixi/utils';\nimport { canUseNewCanvasBlendModes } from './utils/canUseNewCanvasBlendModes';\n\nimport type { Texture } from '@pixi/core';\n\n/**\n * Utility methods for Sprite/Texture tinting.\n *\n * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture,\n * so be aware of the performance implications.\n *\n * @namespace PIXI.canvasUtils\n * @memberof PIXI\n */\nexport const canvasUtils = {\n canvas: null as HTMLCanvasElement,\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Sprite} sprite - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedCanvas: (sprite: { texture: Texture }, color: number): HTMLCanvasElement | HTMLImageElement =>\n {\n const texture = sprite.texture;\n\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.tintCache = texture.tintCache || {};\n\n const cachedCanvas = texture.tintCache[stringColor];\n\n let canvas: HTMLCanvasElement;\n\n if (cachedCanvas)\n {\n if (cachedCanvas.tintId === texture._updateID)\n {\n return texture.tintCache[stringColor];\n }\n\n canvas = texture.tintCache[stringColor] as HTMLCanvasElement;\n }\n else\n {\n canvas = document.createElement('canvas');\n }\n\n canvasUtils.tintMethod(texture, color, canvas);\n\n canvas.tintId = texture._updateID;\n\n if (canvasUtils.convertTintToImage)\n {\n // is this better?\n const tintImage = new Image();\n\n tintImage.src = (canvas as HTMLCanvasElement).toDataURL();\n\n texture.tintCache[stringColor] = tintImage;\n }\n else\n {\n texture.tintCache[stringColor] = canvas;\n }\n\n return canvas;\n },\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedPattern: (texture: Texture, color: number): CanvasPattern =>\n {\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.patternCache = texture.patternCache || {};\n\n let pattern = texture.patternCache[stringColor];\n\n if (pattern && pattern.tintId === texture._updateID)\n {\n return pattern;\n }\n if (!canvasUtils.canvas)\n {\n canvasUtils.canvas = document.createElement('canvas');\n }\n canvasUtils.tintMethod(texture, color, canvasUtils.canvas);\n pattern = canvasUtils.canvas.getContext('2d').createPattern(canvasUtils.canvas, 'repeat');\n pattern.tintId = texture._updateID;\n texture.patternCache[stringColor] = pattern;\n\n return pattern;\n },\n\n /**\n * Tint a texture using the 'multiply' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithMultiply: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'multiply';\n\n const source = texture.baseTexture.getDrawableSource();\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n context.globalCompositeOperation = 'destination-atop';\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n },\n\n /**\n * Tint a texture using the 'overlay' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithOverlay: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'destination-atop';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n // context.globalCompositeOperation = 'copy';\n context.restore();\n },\n\n /**\n * Tint a texture pixel per pixel.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithPerPixel: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n\n const rgbValues = hex2rgb(color);\n const r = rgbValues[0];\n const g = rgbValues[1];\n const b = rgbValues[2];\n\n const pixelData = context.getImageData(0, 0, crop.width, crop.height);\n\n const pixels = pixelData.data;\n\n for (let i = 0; i < pixels.length; i += 4)\n {\n pixels[i + 0] *= r;\n pixels[i + 1] *= g;\n pixels[i + 2] *= b;\n }\n\n context.putImageData(pixelData, 0, 0);\n },\n\n /**\n * Rounds the specified color according to the canvasUtils.cacheStepsPerColorChannel.\n *\n * @memberof PIXI.canvasUtils\n * @param {number} color - the color to round, should be a hex color\n * @return {number} The rounded color.\n */\n roundColor: (color: number): number =>\n {\n const step = canvasUtils.cacheStepsPerColorChannel;\n\n const rgbValues = hex2rgb(color);\n\n rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step);\n rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step);\n rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step);\n\n return rgb2hex(rgbValues);\n },\n\n /**\n * Number of steps which will be used as a cap when rounding colors.\n *\n * @memberof PIXI.canvasUtils\n * @type {number}\n */\n cacheStepsPerColorChannel: 8,\n\n /**\n * Tint cache boolean flag.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n convertTintToImage: false,\n\n /**\n * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n canUseMultiply: canUseNewCanvasBlendModes(),\n\n /**\n * The tinting method that will be used.\n *\n * @memberof PIXI.canvasUtils\n * @type {Function}\n */\n tintMethod: null as (texture: Texture, color: number, canvas: HTMLCanvasElement) => void,\n};\n\ncanvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel;\n","import { Renderer } from '@pixi/core';\nimport { CanvasRenderer } from './CanvasRenderer';\n\nimport type { AbstractRenderer, IRendererOptionsAuto } from '@pixi/core';\n\n// Reference to Renderer.create static function\nconst parentCreate = Renderer.create;\n\n/**\n * Override the Renderer.create to fallback to use CanvasRenderer.\n * Also supports forceCanvas option with Application or autoDetectRenderer.\n * @private\n */\nRenderer.create = function create(options: IRendererOptionsAuto): AbstractRenderer\n{\n const forceCanvas = options && options.forceCanvas;\n\n if (!forceCanvas)\n {\n try\n {\n return parentCreate(options);\n }\n catch (err)\n {\n // swallow WebGL-unsupported error\n }\n }\n\n return new CanvasRenderer(options);\n};\n","import { BaseTexture, BaseRenderTexture, Texture } from '@pixi/core';\n\n/**\n * Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable\n * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package.\n * @method getDrawableSource\n * @memberof PIXI.BaseTexture#\n * @return {PIXI.ICanvasImageSource} Source to render with CanvasRenderer\n */\nBaseTexture.prototype.getDrawableSource = function getDrawableSource(): CanvasImageSource\n{\n const resource = this.resource as any;\n\n return resource ? (resource.bitmap || resource.source) : null;\n};\n\n/**\n * A reference to the canvas render target (we only need one as this can be shared across renderers)\n *\n * @protected\n * @member {PIXI.utils.CanvasRenderTarget} _canvasRenderTarget\n * @memberof PIXI.BaseRenderTexture#\n */\n\nBaseRenderTexture.prototype._canvasRenderTarget = null;\n\nTexture.prototype.patternCache = null;\n\nTexture.prototype.tintCache = null;\n","import { DRAW_MODES } from '@pixi/constants';\nimport { canvasUtils } from '@pixi/canvas-renderer';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Mesh } from '@pixi/mesh';\n\n/**\n * Renderer dedicated to meshes.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasMeshRenderer\n{\n public renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The renderer this downport works for\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the Mesh\n *\n * @param {PIXI.Mesh} mesh - the Mesh to render\n */\n public render(mesh: Mesh): void\n {\n const renderer = this.renderer;\n const transform = mesh.worldTransform;\n\n renderer.context.globalAlpha = mesh.worldAlpha;\n renderer.setBlendMode(mesh.blendMode);\n renderer.setContextTransform(transform, mesh.roundPixels);\n\n if (mesh.drawMode !== DRAW_MODES.TRIANGLES)\n {\n this._renderTriangleMesh(mesh);\n }\n else\n {\n this._renderTriangles(mesh);\n }\n }\n\n /**\n * Draws the object in Triangle Mesh mode\n *\n * @private\n * @param {PIXI.Mesh} mesh - the Mesh to render\n */\n private _renderTriangleMesh(mesh: Mesh): void\n {\n // draw triangles!!\n const length = mesh.geometry.buffers[0].data.length;\n\n for (let i = 0; i < length - 2; i++)\n {\n // draw some triangles!\n const index = i * 2;\n\n this._renderDrawTriangle(mesh, index, (index + 2), (index + 4));\n }\n }\n\n /**\n * Draws the object in triangle mode using canvas\n *\n * @private\n * @param {PIXI.Mesh} mesh - the current mesh\n */\n private _renderTriangles(mesh: Mesh): void\n {\n // draw triangles!!\n const indices = mesh.geometry.getIndex().data;\n const length = indices.length;\n\n for (let i = 0; i < length; i += 3)\n {\n // draw some triangles!\n const index0 = indices[i] * 2;\n const index1 = indices[i + 1] * 2;\n const index2 = indices[i + 2] * 2;\n\n this._renderDrawTriangle(mesh, index0, index1, index2);\n }\n }\n\n /**\n * Draws one of the triangles that from the Mesh\n *\n * @private\n * @param {PIXI.Mesh} mesh - the current mesh\n * @param {number} index0 - the index of the first vertex\n * @param {number} index1 - the index of the second vertex\n * @param {number} index2 - the index of the third vertex\n */\n private _renderDrawTriangle(mesh: Mesh, index0: number, index1: number, index2: number): void\n {\n const context = this.renderer.context;\n const vertices = mesh.geometry.buffers[0].data;\n const { uvs, texture } = mesh;\n\n if (!texture.valid)\n {\n return;\n }\n const isTinted = mesh.tint !== 0xFFFFFF;\n const base = texture.baseTexture;\n const textureWidth = base.width;\n const textureHeight = base.height;\n\n if (isTinted)\n {\n if (mesh._cachedTint !== mesh.tint)\n {\n mesh._cachedTint = mesh.tint;\n mesh._tintedCanvas = canvasUtils.getTintedCanvas(mesh, mesh.tint) as HTMLCanvasElement;\n }\n }\n\n const textureSource = isTinted ? mesh._tintedCanvas : base.getDrawableSource();\n\n const u0 = uvs[index0] * base.width;\n const u1 = uvs[index1] * base.width;\n const u2 = uvs[index2] * base.width;\n const v0 = uvs[index0 + 1] * base.height;\n const v1 = uvs[index1 + 1] * base.height;\n const v2 = uvs[index2 + 1] * base.height;\n\n let x0 = vertices[index0];\n let x1 = vertices[index1];\n let x2 = vertices[index2];\n let y0 = vertices[index0 + 1];\n let y1 = vertices[index1 + 1];\n let y2 = vertices[index2 + 1];\n\n const canvasPadding = mesh.canvasPadding / this.renderer.resolution;\n\n if (canvasPadding > 0)\n {\n const paddingX = canvasPadding / Math.abs(mesh.worldTransform.a);\n const paddingY = canvasPadding / Math.abs(mesh.worldTransform.d);\n const centerX = (x0 + x1 + x2) / 3;\n const centerY = (y0 + y1 + y2) / 3;\n\n let normX = x0 - centerX;\n let normY = y0 - centerY;\n\n let dist = Math.sqrt((normX * normX) + (normY * normY));\n\n x0 = centerX + ((normX / dist) * (dist + paddingX));\n y0 = centerY + ((normY / dist) * (dist + paddingY));\n\n //\n\n normX = x1 - centerX;\n normY = y1 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x1 = centerX + ((normX / dist) * (dist + paddingX));\n y1 = centerY + ((normY / dist) * (dist + paddingY));\n\n normX = x2 - centerX;\n normY = y2 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x2 = centerX + ((normX / dist) * (dist + paddingX));\n y2 = centerY + ((normY / dist) * (dist + paddingY));\n }\n\n context.save();\n context.beginPath();\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n\n context.closePath();\n\n context.clip();\n\n // Compute matrix transform\n const delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2);\n const deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2);\n const deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2);\n const deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2);\n const deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2);\n const deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2);\n const deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2);\n\n context.transform(\n deltaA / delta,\n deltaD / delta,\n deltaB / delta,\n deltaE / delta,\n deltaC / delta,\n deltaF / delta\n );\n\n context.drawImage(\n textureSource,\n 0,\n 0,\n textureWidth * base.resolution,\n textureHeight * base.resolution,\n 0,\n 0,\n textureWidth,\n textureHeight\n );\n\n context.restore();\n this.renderer.invalidateBlendMode();\n }\n\n /**\n * Renders a flat Mesh\n *\n * @private\n * @param {PIXI.Mesh} mesh - The Mesh to render\n */\n renderMeshFlat(mesh: Mesh): void\n {\n const context = this.renderer.context;\n const vertices = mesh.geometry.getBuffer('aVertexPosition').data;\n const length = vertices.length / 2;\n\n // this.count++;\n\n context.beginPath();\n\n for (let i = 1; i < length - 2; ++i)\n {\n // draw some triangles!\n const index = i * 2;\n\n const x0 = vertices[index];\n const y0 = vertices[index + 1];\n\n const x1 = vertices[index + 2];\n const y1 = vertices[index + 3];\n\n const x2 = vertices[index + 4];\n const y2 = vertices[index + 5];\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n }\n\n context.fillStyle = '#FF0000';\n context.fill();\n context.closePath();\n }\n\n /**\n * destroy the the renderer.\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default `canvasPadding` for canvas-based Mesh rendering.\n *\n * @see PIXI.Mesh2d#canvasPadding\n * @static\n * @name MESH_CANVAS_PADDING\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\nsettings.MESH_CANVAS_PADDING = 0;\n\nexport { settings };\n","import { MeshMaterial } from '@pixi/mesh';\n\nimport type { Mesh } from '@pixi/mesh';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the mesh using the Canvas renderer\n *\n * @protected\n * @method render\n * @memberof PIXI.MeshMaterial#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n * @param {PIXI.Mesh} mesh - Mesh to render.\n */\nMeshMaterial.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer, mesh: Mesh): void\n{\n renderer.plugins.mesh.render(mesh);\n};\n","import { canvasUtils } from '@pixi/canvas-renderer';\nimport { NineSlicePlane } from '@pixi/mesh-extras';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.NineSlicePlane#\n * @member {number} _cachedTint\n * @protected\n */\nNineSlicePlane.prototype._cachedTint = 0xFFFFFF;\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.NineSlicePlane#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nNineSlicePlane.prototype._tintedCanvas = null;\n\n/**\n * Temporary storage for canvas source coords\n * @memberof PIXI.NineSlicePlane#\n * @member {number[]} _canvasUvs\n * @private\n */\nNineSlicePlane.prototype._canvasUvs = null;\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.NineSlicePlane#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with.\n */\nNineSlicePlane.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n const context = renderer.context;\n const transform = this.worldTransform;\n const isTinted = this.tint !== 0xFFFFFF;\n const texture = this.texture;\n\n if (!texture.valid)\n {\n return;\n }\n\n // Work out tinting\n if (isTinted)\n {\n if (this._cachedTint !== this.tint)\n {\n // Tint has changed, need to update the tinted texture and use that instead\n\n this._cachedTint = this.tint;\n\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint) as HTMLCanvasElement;\n }\n }\n\n const textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas;\n\n if (!this._canvasUvs)\n {\n this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n const vertices = this.vertices;\n const uvs = this._canvasUvs;\n const u0 = isTinted ? 0 : texture.frame.x;\n const v0 = isTinted ? 0 : texture.frame.y;\n const u1 = u0 + texture.frame.width;\n const v1 = v0 + texture.frame.height;\n\n uvs[0] = u0;\n uvs[1] = u0 + this._leftWidth;\n uvs[2] = u1 - this._rightWidth;\n uvs[3] = u1;\n uvs[4] = v0;\n uvs[5] = v0 + this._topHeight;\n uvs[6] = v1 - this._bottomHeight;\n uvs[7] = v1;\n\n for (let i = 0; i < 8; i++)\n {\n uvs[i] *= texture.baseTexture.resolution;\n }\n\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n renderer.setContextTransform(transform, this.roundPixels);\n\n for (let row = 0; row < 3; row++)\n {\n for (let col = 0; col < 3; col++)\n {\n const ind = (col * 2) + (row * 8);\n const sw = Math.max(1, uvs[col + 1] - uvs[col]);\n const sh = Math.max(1, uvs[row + 5] - uvs[row + 4]);\n const dw = Math.max(1, vertices[ind + 10] - vertices[ind]);\n const dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]);\n\n context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh,\n vertices[ind], vertices[ind + 1], dw, dh);\n }\n }\n};\n","import { Mesh } from '@pixi/mesh';\nimport { settings } from './settings';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\nlet warned = false;\n\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.Mesh#\n * @member {number} _cachedTint\n * @protected\n */\nMesh.prototype._cachedTint = 0xFFFFFF;\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.Mesh#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nMesh.prototype._tintedCanvas = null;\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nMesh.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n if (this.material._renderCanvas)\n {\n this.material._renderCanvas(renderer, this);\n }\n else if (!warned)\n {\n warned = true;\n if (window.console)\n {\n console.warn('Mesh with custom shaders are not supported in CanvasRenderer.');\n }\n }\n};\n\n// IMPORTANT: Please do NOT use this as a precedent to use `settings` after the object is created\n// this was merely created to completely decouple canvas from the base Mesh class and we are\n// unable to add `canvasPadding` in the constructor anymore, as the case was for PixiJS v4.\n\n/**\n * Internal variable for `canvasPadding`.\n *\n * @private\n * @memberof PIXI.Mesh\n * @member {number}\n * @default null\n */\nMesh.prototype._canvasPadding = null;\n\n/**\n * Triangles in canvas mode are automatically antialiased, use this value to force triangles\n * to overlap a bit with each other. To set the global default, set {@link PIXI.settings.MESH_CANVAS_PADDING}\n *\n * @see PIXI.settings.MESH_CANVAS_PADDING\n * @member {number} canvasPadding\n * @memberof PIXI.SimpleMesh#\n * @default 0\n */\nObject.defineProperty(Mesh.prototype, 'canvasPadding', {\n get()\n {\n return this._canvasPadding !== null ? this._canvasPadding : settings.MESH_CANVAS_PADDING;\n },\n set(value)\n {\n this._canvasPadding = value;\n },\n});\n","import { SimpleMesh } from '@pixi/mesh-extras';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleMesh.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n if (this.shader.update)\n {\n this.shader.update();\n }\n\n this.calculateUvs();\n\n this.material._renderCanvas(renderer, this);\n};\n","import { SimpleRope } from '@pixi/mesh-extras';\n\nimport type { RopeGeometry } from '@pixi/mesh-extras';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleRope.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.autoUpdate\n || (this.geometry as RopeGeometry)._width !== this.shader.texture.height)\n {\n (this.geometry as RopeGeometry)._width = this.shader.texture.height;\n (this.geometry as RopeGeometry).update();\n }\n\n if (this.shader.update)\n {\n this.shader.update();\n }\n\n this.calculateUvs();\n\n this.material._renderCanvas(renderer, this);\n};\n","import { Texture } from '@pixi/core';\nimport { SHAPES, Matrix } from '@pixi/math';\nimport { canvasUtils } from '@pixi/canvas-renderer';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { FillStyle, Graphics } from '@pixi/graphics';\nimport type { Polygon, Rectangle, Circle, Ellipse, RoundedRectangle } from '@pixi/math';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they\n * now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasGraphicsRenderer:\n * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching graphics objects.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasGraphicsRenderer\n{\n public renderer: CanvasRenderer;\n private _svgMatrix: DOMMatrix|boolean;\n private _tempMatrix: Matrix;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The current PIXI renderer.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n this._svgMatrix = null;\n this._tempMatrix = new Matrix();\n }\n\n /**\n * calculates fill/stroke style for canvas\n *\n * @private\n * @param {PIXI.FillStyle} style\n * @param {number} tint\n * @returns {string|CanvasPattern}\n */\n private _calcCanvasStyle(style: FillStyle, tint: number): string|CanvasPattern\n {\n let res;\n\n if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture)\n {\n if (style.texture.valid)\n {\n res = canvasUtils.getTintedPattern(style.texture, tint);\n this.setPatternTransform(res, style.matrix || Matrix.IDENTITY);\n }\n else\n {\n res = '#808080';\n }\n }\n else\n {\n res = `#${(`00000${(tint | 0).toString(16)}`).substr(-6)}`;\n }\n\n return res;\n }\n\n /**\n * Renders a Graphics object to a canvas.\n *\n * @param {PIXI.Graphics} graphics - the actual graphics object to render\n */\n public render(graphics: Graphics): void\n {\n const renderer = this.renderer;\n const context = renderer.context;\n const worldAlpha = graphics.worldAlpha;\n const transform = graphics.transform.worldTransform;\n\n renderer.setContextTransform(transform);\n renderer.setBlendMode(graphics.blendMode);\n\n const graphicsData = graphics.geometry.graphicsData;\n\n let contextFillStyle;\n let contextStrokeStyle;\n\n const tintR = ((graphics.tint >> 16) & 0xFF) / 255;\n const tintG = ((graphics.tint >> 8) & 0xFF) / 255;\n const tintB = (graphics.tint & 0xFF) / 255;\n\n for (let i = 0; i < graphicsData.length; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n\n const fillColor = data.fillStyle.color | 0;\n const lineColor = data.lineStyle.color | 0;\n\n if (data.matrix)\n {\n renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));\n }\n\n if (fillStyle.visible)\n {\n const fillTint = (\n (((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((fillColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextFillStyle = this._calcCanvasStyle(fillStyle, fillTint);\n }\n if (lineStyle.visible)\n {\n const lineTint = (\n (((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((lineColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextStrokeStyle = this._calcCanvasStyle(lineStyle, lineTint);\n }\n\n context.lineWidth = lineStyle.width;\n context.lineCap = lineStyle.cap;\n context.lineJoin = lineStyle.join;\n context.miterLimit = lineStyle.miterLimit;\n\n if (data.type === SHAPES.POLY)\n {\n context.beginPath();\n\n const tempShape = shape as Polygon;\n let points = tempShape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n let px;\n let py;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n\n if (tempShape.closeStroke)\n {\n context.closePath();\n }\n\n if (holes.length > 0)\n {\n outerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n outerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = (holes[k].shape as Polygon).points;\n\n if (!points)\n {\n continue;\n }\n\n innerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n innerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n if (innerArea * outerArea < 0)\n {\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n context.moveTo(points[points.length - 2], points[points.length - 1]);\n\n for (let j = points.length - 4; j >= 0; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n\n if ((holes[k].shape as Polygon).closeStroke)\n {\n context.closePath();\n }\n }\n }\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RECT)\n {\n const tempShape = shape as Rectangle;\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fillRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.strokeRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);\n }\n }\n else if (data.type === SHAPES.CIRC)\n {\n const tempShape = shape as Circle;\n\n // TODO - need to be Undefined!\n context.beginPath();\n context.arc(tempShape.x, tempShape.y, tempShape.radius, 0, 2 * Math.PI);\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const tempShape = shape as Ellipse;\n\n const w = tempShape.width * 2;\n const h = tempShape.height * 2;\n\n const x = tempShape.x - (w / 2);\n const y = tempShape.y - (h / 2);\n\n context.beginPath();\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RREC)\n {\n const tempShape = shape as RoundedRectangle;\n\n const rx = tempShape.x;\n const ry = tempShape.y;\n const width = tempShape.width;\n const height = tempShape.height;\n let radius = tempShape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.beginPath();\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n }\n }\n\n public setPatternTransform(pattern: CanvasPattern, matrix: Matrix): void\n {\n if (this._svgMatrix === false)\n {\n return;\n }\n if (!this._svgMatrix)\n {\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\n if (svg && svg.createSVGMatrix)\n {\n this._svgMatrix = svg.createSVGMatrix();\n }\n if (!this._svgMatrix || !pattern.setTransform)\n {\n this._svgMatrix = false;\n\n return;\n }\n }\n\n (this._svgMatrix as DOMMatrix).a = matrix.a;\n (this._svgMatrix as DOMMatrix).b = matrix.b;\n (this._svgMatrix as DOMMatrix).c = matrix.c;\n (this._svgMatrix as DOMMatrix).d = matrix.d;\n (this._svgMatrix as DOMMatrix).e = matrix.tx;\n (this._svgMatrix as DOMMatrix).f = matrix.ty;\n pattern.setTransform((this._svgMatrix as DOMMatrix).inverse());\n }\n /**\n * destroy graphics object\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n this._svgMatrix = null;\n this._tempMatrix = null;\n }\n}\n","import { Graphics } from '@pixi/graphics';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport { RenderTexture, Texture } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nlet canvasRenderer: CanvasRenderer;\nconst tempMatrix = new Matrix();\n\n/**\n * Generates a canvas texture. Only available with **pixi.js-legacy** bundle\n * or the **@pixi/canvas-graphics** package.\n * @method generateCanvasTexture\n * @memberof PIXI.Graphics#\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution of the texture.\n * @return {PIXI.Texture} The new texture.\n */\nGraphics.prototype.generateCanvasTexture = function generateCanvasTexture(scaleMode: SCALE_MODES, resolution = 1): Texture\n{\n const bounds = this.getLocalBounds();\n\n const canvasBuffer = RenderTexture.create({\n width: bounds.width,\n height: bounds.height,\n scaleMode,\n resolution,\n });\n\n if (!canvasRenderer)\n {\n canvasRenderer = new CanvasRenderer();\n }\n\n this.transform.updateLocalTransform();\n this.transform.localTransform.copyTo(tempMatrix);\n\n tempMatrix.invert();\n\n tempMatrix.tx -= bounds.x;\n tempMatrix.ty -= bounds.y;\n\n canvasRenderer.render(this, canvasBuffer, true, tempMatrix);\n\n const texture = Texture.from((canvasBuffer.baseTexture as BaseRenderTexture)._canvasRenderTarget.canvas, {\n scaleMode,\n });\n\n texture.baseTexture.setResolution(resolution);\n\n return texture;\n};\n\nGraphics.prototype.cachedGraphicsData = [];\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Graphics#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nGraphics.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.isMask === true)\n {\n return;\n }\n\n this.finishPoly();\n renderer.plugins.graphics.render(this);\n};\n","import { SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { Matrix, groupD8 } from '@pixi/math';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Sprite } from '@pixi/sprite';\n\nconst canvasRenderWorldTransform = new Matrix();\n\n/**\n * Types that can be passed to drawImage\n * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource\n * @memberof PIXI\n */\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasSpriteRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasSpriteRenderer\n{\n protected renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer -The renderer sprite this batch works for.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the sprite object.\n *\n * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch\n */\n render(sprite: Sprite): void\n {\n const texture = sprite._texture;\n const renderer = this.renderer;\n const context = renderer.context;\n\n const width = texture._frame.width;\n const height = texture._frame.height;\n\n let wt = sprite.transform.worldTransform;\n let dx = 0;\n let dy = 0;\n\n const source = texture.baseTexture.getDrawableSource();\n\n if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.valid || !source)\n {\n return;\n }\n\n if (!texture.valid)\n {\n return;\n }\n\n renderer.setBlendMode(sprite.blendMode, true);\n\n renderer.context.globalAlpha = sprite.worldAlpha;\n\n // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture\n const smoothingEnabled = texture.baseTexture.scaleMode === SCALE_MODES.LINEAR;\n\n if (renderer.smoothProperty\n && renderer.context[renderer.smoothProperty] !== smoothingEnabled)\n {\n context[renderer.smoothProperty] = smoothingEnabled;\n }\n\n if (texture.trim)\n {\n dx = (texture.trim.width / 2) + texture.trim.x - (sprite.anchor.x * texture.orig.width);\n dy = (texture.trim.height / 2) + texture.trim.y - (sprite.anchor.y * texture.orig.height);\n }\n else\n {\n dx = (0.5 - sprite.anchor.x) * texture.orig.width;\n dy = (0.5 - sprite.anchor.y) * texture.orig.height;\n }\n\n if (texture.rotate)\n {\n wt.copyTo(canvasRenderWorldTransform);\n wt = canvasRenderWorldTransform;\n groupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy);\n // the anchor has already been applied above, so lets set it to zero\n dx = 0;\n dy = 0;\n }\n\n dx -= width / 2;\n dy -= height / 2;\n\n renderer.setContextTransform(wt, sprite.roundPixels, 1);\n // Allow for pixel rounding\n if (sprite.roundPixels)\n {\n dx = dx | 0;\n dy = dy | 0;\n }\n\n const resolution = texture.baseTexture.resolution;\n const outerBlend = renderer._outerBlend;\n\n if (outerBlend)\n {\n context.save();\n context.beginPath();\n context.rect(\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n context.clip();\n }\n\n if (sprite.tint !== 0xFFFFFF)\n {\n if (sprite._cachedTint !== sprite.tint || sprite._tintedCanvas.tintId !== sprite._texture._updateID)\n {\n sprite._cachedTint = sprite.tint;\n\n // TODO clean up caching - how to clean up the caches?\n sprite._tintedCanvas = canvasUtils.getTintedCanvas(sprite, sprite.tint);\n }\n\n context.drawImage(\n sprite._tintedCanvas,\n 0,\n 0,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n else\n {\n context.drawImage(\n source,\n texture._frame.x * resolution,\n texture._frame.y * resolution,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n\n if (outerBlend)\n {\n context.restore();\n }\n // just in case, leaking outer blend here will be catastrophic!\n renderer.setBlendMode(BLEND_MODES.NORMAL);\n }\n\n /**\n * destroy the sprite object.\n *\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.Sprite#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nSprite.prototype._tintedCanvas = null;\n\n/**\n* Renders the object using the Canvas renderer\n*\n* @private\n* @method _renderCanvas\n* @memberof PIXI.Sprite#\n* @param {PIXI.CanvasRenderer} renderer - The renderer\n*/\nSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n renderer.plugins.sprite.render(this);\n};\n","import { RenderTexture } from '@pixi/core';\nimport { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport { deprecation } from '@pixi/utils';\nimport type { DisplayObject } from '@pixi/display';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nconst TEMP_RECT = new Rectangle();\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasExtract\n{\n public renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `CanvasExtract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n const canvasBuffer = new CanvasRenderTarget(width, height, 1);\n const canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8ClampedArray\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n }\n\n return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n }\n}\n\n/**\n * @name PIXI.CanvasRenderer#extract\n * @type {PIXI.CanvasExtract}\n * @see PIXI.CanvasRenderer#plugins\n * @deprecated since 5.3.0\n */\nObject.defineProperty(CanvasRenderer.prototype, 'extract',\n {\n get()\n {\n deprecation('v5.3.0', 'CanvasRenderer#extract is deprecated, use CanvasRenderer#plugins.extract');\n\n return this.plugins.extract;\n },\n }\n);\n\n","import { BaseTexture } from '@pixi/core';\nimport { BasePrepare } from '@pixi/prepare';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { IDisplayObjectExtended } from '@pixi/prepare';\n\nconst CANVAS_START_SIZE = 16;\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {*} prepare - Instance of CanvasPrepare\n * @param {*} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(prepare: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n const tempPrepare = prepare as CanvasPrepare;\n\n if (item instanceof BaseTexture)\n {\n const image = (item as any).source;\n\n // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.\n // So if the width or height is equal to zero then use the canvas size\n // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.\n const imageWidth = image.width === 0 ? tempPrepare.canvas.width : Math.min(tempPrepare.canvas.width, image.width);\n const imageHeight = image.height === 0 ? tempPrepare.canvas.height\n : Math.min(tempPrepare.canvas.height, image.height);\n\n // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU\n // A smaller draw can be faster.\n tempPrepare.ctx.drawImage(\n image, 0, 0, imageWidth, imageHeight, 0, 0,\n tempPrepare.canvas.width, tempPrepare.canvas.height\n );\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing\n * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class CanvasPrepare extends BasePrepare\n{\n /** @internal */\n canvas: HTMLCanvasElement;\n /** @internal */\n ctx: CanvasRenderingContext2D;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this;\n\n /**\n * An offline canvas to render textures to\n * @type {HTMLCanvasElement}\n * @private\n */\n this.canvas = document.createElement('canvas');\n this.canvas.width = CANVAS_START_SIZE;\n this.canvas.height = CANVAS_START_SIZE;\n\n /**\n * The context to the canvas\n * @type {CanvasRenderingContext2D}\n * @private\n */\n this.ctx = this.canvas.getContext('2d');\n\n // Add textures to upload\n this.registerUploadHook(uploadBaseTextures);\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n public destroy(): void\n {\n super.destroy();\n this.ctx = null;\n this.canvas = null;\n }\n}\n","import { TilingSprite } from '@pixi/sprite-tiling';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasRenderTarget } from '@pixi/utils';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @function _renderCanvas\n * @memberof PIXI.TilingSprite#\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nTilingSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n const texture = this._texture;\n\n if (!texture.baseTexture.valid)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n const baseTexture = texture.baseTexture;\n const source = baseTexture.getDrawableSource();\n const baseTextureResolution = baseTexture.resolution;\n const modX = ((this.tilePosition.x / this.tileScale.x) % texture._frame.width) * baseTextureResolution;\n const modY = ((this.tilePosition.y / this.tileScale.y) % texture._frame.height) * baseTextureResolution;\n\n // create a nice shiny pattern!\n if (this._textureID !== this._texture._updateID || this._cachedTint !== this.tint)\n {\n this._textureID = this._texture._updateID;\n // cut an object from a spritesheet..\n const tempCanvas = new CanvasRenderTarget(texture._frame.width,\n texture._frame.height,\n baseTextureResolution);\n\n // Tint the tiling sprite\n if (this.tint !== 0xFFFFFF)\n {\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint) as HTMLCanvasElement;\n tempCanvas.context.drawImage(this._tintedCanvas, 0, 0);\n }\n else\n {\n tempCanvas.context.drawImage(source,\n -texture._frame.x * baseTextureResolution, -texture._frame.y * baseTextureResolution);\n }\n this._cachedTint = this.tint;\n this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat');\n }\n\n // set context state..\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n renderer.setContextTransform(transform);\n\n // fill the pattern!\n context.fillStyle = this._canvasPattern;\n\n // TODO - this should be rolled into the setTransform above..\n context.scale(this.tileScale.x / baseTextureResolution, this.tileScale.y / baseTextureResolution);\n\n const anchorX = this.anchor.x * -this._width;\n const anchorY = this.anchor.y * -this._height;\n\n if (this.uvRespectAnchor)\n {\n context.translate(modX, modY);\n\n context.fillRect(-modX + anchorX, -modY + anchorY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n else\n {\n context.translate(modX + anchorX, modY + anchorY);\n\n context.fillRect(-modX, -modY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n};\n","import { ParticleContainer } from '@pixi/particles';\nimport type { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.ParticleContainer#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nParticleContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n let isRotated = true;\n\n let positionX = 0;\n let positionY = 0;\n\n let finalWidth = 0;\n let finalHeight = 0;\n\n renderer.setBlendMode(this.blendMode);\n\n context.globalAlpha = this.worldAlpha;\n\n this.displayObjectUpdateTransform();\n\n for (let i = 0; i < this.children.length; ++i)\n {\n const child = this.children[i] as Sprite;\n\n if (!child.visible)\n {\n continue;\n }\n\n if (!child._texture.valid)\n {\n continue;\n }\n\n const frame = child._texture.frame;\n\n context.globalAlpha = this.worldAlpha * child.alpha;\n\n if (child.rotation % (Math.PI * 2) === 0)\n {\n // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call\n if (isRotated)\n {\n renderer.setContextTransform(transform, false, 1);\n isRotated = false;\n }\n\n positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5;\n positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5;\n\n finalWidth = frame.width * child.scale.x;\n finalHeight = frame.height * child.scale.y;\n }\n else\n {\n if (!isRotated)\n {\n isRotated = true;\n }\n\n child.displayObjectUpdateTransform();\n\n const childTransform = child.worldTransform;\n\n renderer.setContextTransform(childTransform, this.roundPixels, 1);\n\n positionX = ((child.anchor.x) * (-frame.width)) + 0.5;\n positionY = ((child.anchor.y) * (-frame.height)) + 0.5;\n\n finalWidth = frame.width;\n finalHeight = frame.height;\n }\n\n const resolution = child._texture.baseTexture.resolution;\n\n context.drawImage(\n child._texture.baseTexture.getDrawableSource(),\n frame.x * resolution,\n frame.y * resolution,\n frame.width * resolution,\n frame.height * resolution,\n positionX * renderer.resolution,\n positionY * renderer.resolution,\n finalWidth * renderer.resolution,\n finalHeight * renderer.resolution\n );\n }\n};\n","import { Container } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { MaskData } from '@pixi/core';\n\n/**\n * To be overridden by the subclass\n * @method _renderCanvas\n * @memberof PIXI.Container#\n * @protected\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype._renderCanvas = function _renderCanvas(_renderer: CanvasRenderer): void\n{\n // this is where content itself gets rendered...\n};\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n // if not visible or the alpha is 0 then no need to render this\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this._mask as MaskData);\n }\n\n this._renderCanvas(renderer);\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderCanvas(renderer);\n }\n\n if (this._mask)\n {\n renderer.maskManager.popMask(renderer);\n }\n};\n","import { DisplayObject } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nDisplayObject.prototype.renderCanvas = function renderCanvas(_renderer: CanvasRenderer): void\n{\n // OVERWRITE;\n};\n","import { Text } from '@pixi/text';\nimport { Sprite } from '@pixi/sprite';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Text#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nText.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n Sprite.prototype._renderCanvas.call(this, renderer);\n};\n","import { AccessibilityManager, InteractionManager } from 'pixi.js';\nimport { CanvasRenderer, canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasMeshRenderer } from '@pixi/canvas-mesh';\nimport { CanvasGraphicsRenderer } from '@pixi/canvas-graphics';\nimport { CanvasSpriteRenderer } from '@pixi/canvas-sprite';\nimport { CanvasExtract } from '@pixi/canvas-extract';\nimport { CanvasPrepare } from '@pixi/canvas-prepare';\nimport '@pixi/canvas-sprite-tiling';\nimport '@pixi/canvas-particles';\nimport '@pixi/canvas-display';\nimport '@pixi/canvas-text';\n\nCanvasRenderer.registerPlugin('accessibility', AccessibilityManager);\nCanvasRenderer.registerPlugin('extract', CanvasExtract);\nCanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer);\nCanvasRenderer.registerPlugin('interaction', InteractionManager);\nCanvasRenderer.registerPlugin('mesh', CanvasMeshRenderer);\nCanvasRenderer.registerPlugin('prepare', CanvasPrepare);\nCanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer);\n\n// Export ES for those importing specifically by name,\n// e.g., `import {autoDetectRenderer} from 'pixi.js-legacy'`\nexport * from 'pixi.js';\nexport {\n CanvasRenderer,\n CanvasGraphicsRenderer,\n CanvasMeshRenderer,\n CanvasSpriteRenderer,\n CanvasExtract,\n CanvasPrepare,\n canvasUtils,\n};\n"],"names":["define","global","this","arguments","Polyfill","isMobile","isMobileCall","hasOwnProperty","require$$0","require$$1","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","sign","_url.parse","SHAPES","EventEmitter","UPDATE_PRIORITY","extendStatics","__extends","getBufferType","map","interleaveTypedArrays","UID","byteSizeMap","defaultVertex","defaultFragment","BLEND","OFFSET","CULLING","DEPTH_TEST","WINDING","_noop","eachSeries","array","iterator","callback","deferNext","i","len","length","next","err","setTimeout","onlyOnce","fn","onceWrapper","Error","callFn","apply","queue","worker","concurrency","workers","q","_tasks","saturated","unsaturated","buffer","empty","drain","error","started","paused","push","data","_insert","kill","unshift","process","task","shift","_next","running","idle","pause","resume","w","insertAtFront","item","cache","caching","resource","url","complete","onComplete","once","useXdr","window","XDomainRequest","XMLHttpRequest","tempAnchor","STATUS_NONE","STATUS_OK","STATUS_EMPTY","STATUS_IE_BUG_EMPTY","STATUS_TYPE_OK","Resource","setExtensionLoadType","extname","loadType","setExtMap","_loadTypeMap","setExtensionXhrType","xhrType","_xhrTypeMap","name","options","_flags","_setFlag","STATUS_FLAGS","DATA_URL","indexOf","extension","_getExtension","crossOrigin","timeout","_determineLoadType","metadata","xhr","children","type","TYPE","UNKNOWN","progressChunk","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","bind","_boundOnError","_onError","_boundOnProgress","_onProgress","_boundOnTimeout","_onTimeout","_boundXhrOnError","_xhrOnError","_boundXhrOnTimeout","_xhrOnTimeout","_boundXhrOnAbort","_xhrOnAbort","_boundXhrOnLoad","_xhrOnLoad","onStart","Signal","onProgress","onAfterMiddleware","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","isLoading","isComplete","LOADING","dispatch","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","_loadXdr","_loadXhr","_hasFlag","flag","value","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","COMPLETE","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","Array","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","mime","source","event","target","nodeName","lengthComputable","loaded","total","reqType","status","statusText","text","responseText","BUFFER","statusType","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parseUri","strictMode","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","substring","queryStart","hashStart","index","Math","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","NONE","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","val","toString","replace","_keyStr","encodeBinary","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","paddingBytes","charAt","Url","URL","webkitURL","parsing","Blob","getResponseHeader","createObjectURL","blob","revokeObjectURL","MAX_PROGRESS","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","d","_loadResource","_queue","async","resources","onError","onLoad","_defaultBeforeMiddleware","pre","_defaultAfterMiddleware","use","add","key","parentResource","_prepareUrl","parent","incompleteChildren","fullChunk","eachChunk","reset","k","res","detach","_onStart","_onComplete","numTasks","chunk","parsedUrl","result","path","hash","exec","substr","dequeue","call","_onLoad","splice","LoaderPreStatic","LoaderUseStatic","ResourceLoader","middleware","vertex","fragment","L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EAGrF,CAAC;;;;;;;;;;;;;;;;;;CCCF,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,QAAwB;KAE1E,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,UAAU,EACpE;SACI,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC;SACvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;MACrB;KAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAEtB,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;EACvD,CAAC;;CCZF,cAAc,CAAC,cAAc,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;CACrE,cAAc,CAAC,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;CACxD,cAAc,CAAC,cAAc,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC;CAClE,cAAc,CAAC,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;CACjE,cAAc,CAAC,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC1D,cAAc,CAAC,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;CACxD,cAAc,CAAC,cAAc,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/www/js/libs/pixi-legacy.min.js b/www/js/libs/pixi-legacy.min.js deleted file mode 100644 index f445af5..0000000 --- a/www/js/libs/pixi-legacy.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * pixi.js-legacy - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * pixi.js-legacy is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ -var PIXI=function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e){return t(e={exports:{}},e.exports),e.exports}var i=r(function(t,r){!function(t){var e=t.Promise,i=e&&"resolve"in e&&"reject"in e&&"all"in e&&"race"in e&&function(){var t;return new e(function(e){t=e}),"function"==typeof t}();r?(r.Promise=i?e:T,r.Polyfill=T):i||(t.Promise=T);var n="pending",o="sealed",s="fulfilled",a="rejected",h=function(){};function u(t){return"[object Array]"===Object.prototype.toString.call(t)}var l,c="undefined"!=typeof setImmediate?setImmediate:setTimeout,d=[];function p(){for(var t=0;t0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),window.ArrayBuffer||(window.ArrayBuffer=Array),window.Float32Array||(window.Float32Array=Array),window.Uint32Array||(window.Uint32Array=Array),window.Uint16Array||(window.Uint16Array=Array),window.Uint8Array||(window.Uint8Array=Array),window.Int32Array||(window.Int32Array=Array);var f=/iPhone/i,m=/iPod/i,v=/iPad/i,g=/\biOS-universal(?:.+)Mac\b/i,y=/\bAndroid(?:.+)Mobile\b/i,_=/Android/i,x=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,b=/Silk/i,E=/Windows Phone/i,T=/\bWindows(?:.+)ARM\b/i,S=/BlackBerry/i,w=/BB10/i,P=/Opera Mini/i,I=/\b(CriOS|Chrome)(?:.+)Mobile/i,A=/Mobile(?:.+)Firefox\b/i,O=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};var M=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=e.userAgent,i=r.split("[FBAN");void 0!==i[1]&&(r=i[0]),void 0!==(i=r.split("Twitter"))[1]&&(r=i[0]);var n=function(t){return function(e){return e.test(t)}}(r),o={apple:{phone:n(f)&&!n(E),ipod:n(m),tablet:!n(f)&&(n(v)||O(e))&&!n(E),universal:n(g),device:(n(f)||n(m)||n(v)||n(g)||O(e))&&!n(E)},amazon:{phone:n(x),tablet:!n(x)&&n(b),device:n(x)||n(b)},android:{phone:!n(E)&&n(x)||!n(E)&&n(y),tablet:!n(E)&&!n(x)&&!n(y)&&(n(b)||n(_)),device:!n(E)&&(n(x)||n(b)||n(y)||n(_))||n(/\bokhttp\b/i)},windows:{phone:n(E),tablet:n(T),device:n(E)||n(T)},other:{blackberry:n(S),blackberry10:n(w),opera:n(P),firefox:n(A),chrome:n(I),device:n(S)||n(w)||n(P)||n(A)||n(I)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}(window.navigator);var D={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(M.tablet||M.phone){var r;M.apple.device&&(r=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(r[1],10)<11&&(e=!1),M.android.device&&(r=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(r[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:M.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!M.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},C=r(function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,o||t,s),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,s=new Array(o);n80*r){i=o=t[0],n=s=t[1];for(var f=r;fo&&(o=a),h>s&&(s=h);u=0!==(u=Math.max(o-i,s-n))?1/u:0}return U(d,p,r,i,n,u),p}function F(t,e,r,i,n){var o,s;if(n===st(t,e,r,i)>0)for(o=e;o=e;o-=i)s=it(o,t[o],t[o+1],s);return s&&J(s,s.next)&&(nt(s),s=s.next),s}function B(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!J(i,i.next)&&0!==Z(i.prev,i,i.next))i=i.next;else{if(nt(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function U(t,e,r,i,n,o,s){if(t){!s&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=V(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,s,a,h,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,i=r,a=0,e=0;e0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(s>1)}(n)}(t,i,n,o);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?X(t,i,n,o):k(t))e.push(a.i/r),e.push(t.i/r),e.push(h.i/r),nt(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?U(t=j(B(t),e,r),e,r,i,n,o,2):2===s&&H(t,e,r,i,n,o):U(B(t),e,r,i,n,o,1);break}}}function k(t){var e=t.prev,r=t,i=t.next;if(Z(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(q(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&Z(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function X(t,e,r,i){var n=t.prev,o=t,s=t.next;if(Z(n,o,s)>=0)return!1;for(var a=n.xo.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,l=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,c=V(a,h,e,r,i),d=V(u,l,e,r,i),p=t.prevZ,f=t.nextZ;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Z(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Z(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function j(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!J(n,o)&&Q(n,i,i.next,o)&&et(n,o)&&et(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),nt(i),nt(i.next),i=t=o),i=i.next}while(i!==t);return B(i)}function H(t,e,r,i,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&K(s,a)){var h=rt(s,a);return s=B(s,s.next),h=B(h,h.next),U(s,e,r,i,n,o),void U(h,e,r,i,n,o)}a=a.next}s=s.next}while(s!==t)}function G(t,e){return t.x-e.x}function Y(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x=i.x&&i.x>=l&&n!==i.x&&q(or.x||i.x===r.x&&z(r,i)))&&(r=i,d=h)),i=i.next}while(i!==u);return r}(t,e)){var r=rt(e,t);B(e,e.next),B(r,r.next)}}function z(t,e){return Z(t.prev,t,e.prev)<0&&Z(e.next,t,t.next)<0}function V(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function W(t){var e=t,r=t;do{(e.x=0&&(t-s)*(i-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(n-s)*(i-a)>=0}function K(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Q(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(et(t,e)&&et(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(Z(t.prev,t,e.prev)||Z(t,e.prev,e))||J(t,e)&&Z(t.prev,t,t.next)>0&&Z(e.prev,e,e.next)>0)}function Z(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function J(t,e){return t.x===e.x&&t.y===e.y}function Q(t,e,r,i){var n=tt(Z(t,e,r)),o=tt(Z(t,e,i)),s=tt(Z(r,i,t)),a=tt(Z(r,i,e));return n!==o&&s!==a||(!(0!==n||!$(t,r,e))||(!(0!==o||!$(t,i,e))||(!(0!==s||!$(r,t,i))||!(0!==a||!$(r,e,i)))))}function $(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function tt(t){return t>0?1:t<0?-1:0}function et(t,e){return Z(t.prev,t,t.next)<0?Z(t,e,t.next)>=0&&Z(t,t.prev,e)>=0:Z(t,e,t.prev)<0||Z(t,t.next,e)<0}function rt(t,e){var r=new ot(t.i,t.x,t.y),i=new ot(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function it(t,e,r,i){var n=new ot(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function nt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ot(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function st(t,e,r,i){for(var n=0,o=e,s=r-i;o0&&(i+=t[n-1].length,r.holes.push(i))}return r},R.default=L;var at=r(function(t,r){!function(i){var n=r&&!r.nodeType&&r,o=t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,h,u=2147483647,l=36,c=1,d=26,p=38,f=700,m=72,v=128,g="-",y=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-c,T=Math.floor,S=String.fromCharCode;function w(t){throw RangeError(b[t])}function P(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function I(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+P((t=t.replace(x,".")).split("."),e).join(".")}function A(t){for(var e,r,i=[],n=0,o=t.length;n=55296&&e<=56319&&n65535&&(e+=S((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=S(t)}).join("")}function M(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function D(t,e,r){var i=0;for(t=r?T(t/f):t>>1,t+=T(t/e);t>E*d>>1;i+=l)t=T(t/E);return T(i+(E+1)*t/(t+p))}function C(t){var e,r,i,n,o,s,a,h,p,f,y,_=[],x=t.length,b=0,E=v,S=m;for((r=t.lastIndexOf(g))<0&&(r=0),i=0;i=128&&w("not-basic"),_.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=x&&w("invalid-input"),((h=(y=t.charCodeAt(n++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:l)>=l||h>T((u-b)/s))&&w("overflow"),b+=h*s,!(h<(p=a<=S?c:a>=S+d?d:a-S));a+=l)s>T(u/(f=l-p))&&w("overflow"),s*=f;S=D(b-o,e=_.length+1,0==o),T(b/e)>u-E&&w("overflow"),E+=T(b/e),b%=e,_.splice(b++,0,E)}return O(_)}function R(t){var e,r,i,n,o,s,a,h,p,f,y,_,x,b,E,P=[];for(_=(t=A(t)).length,e=v,r=0,o=m,s=0;s<_;++s)(y=t[s])<128&&P.push(S(y));for(i=n=P.length,n&&P.push(g);i<_;){for(a=u,s=0;s<_;++s)(y=t[s])>=e&&yT((u-r)/(x=i+1))&&w("overflow"),r+=(a-e)*x,e=a,s=0;s<_;++s)if((y=t[s])u&&w("overflow"),y==e){for(h=r,p=l;!(h<(f=p<=o?c:p>=o+d?d:p-o));p+=l)E=h-f,b=l-f,P.push(S(M(f+E%b,0))),h=T(E/b);P.push(S(M(h,0))),o=D(r,x,i==n),r=0,++i}++r,++e}return P.join("")}if(a={version:"1.3.2",ucs2:{decode:A,encode:O},decode:C,encode:R,toASCII:function(t){return I(t,function(t){return _.test(t)?"xn--"+R(t):t})},toUnicode:function(t){return I(t,function(t){return y.test(t)?C(t.slice(4).toLowerCase()):t})}},n&&o)if(t.exports==n)o.exports=a;else for(h in a)a.hasOwnProperty(h)&&(n[h]=a[h]);else i.punycode=a}(e)}),ht={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}};ht.isString,ht.isObject,ht.isNull,ht.isNullOrUndefined;function ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var lt=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if("string"!=typeof t||0===t.length)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var h=0;h=0?(u=p.substr(0,f),l=p.substr(f+1)):(u=p,l=""),c=decodeURIComponent(u),d=decodeURIComponent(l),ut(n,c)?Array.isArray(n[c])?n[c].push(d):n[c]=[n[c],d]:n[c]=d}return n},ct=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},dt=function(t,e,r,i){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map(function(i){var n=encodeURIComponent(ct(i))+r;return Array.isArray(t[i])?t[i].map(function(t){return n+encodeURIComponent(ct(t))}).join(e):n+encodeURIComponent(ct(t[i]))}).join(e):i?encodeURIComponent(ct(i))+r+encodeURIComponent(ct(t)):""},pt=r(function(t,e){e.decode=e.parse=lt,e.encode=e.stringify=dt}),ft=(pt.decode,pt.parse,pt.encode,pt.stringify,Ct),mt=function(t,e){return Ct(t,!1,!0).resolve(e)},vt=function(t,e){if(!t)return e;return Ct(t,!1,!0).resolveObject(e)},gt=function(t){ht.isString(t)&&(t=Ct(t));if(!(t instanceof _t))return _t.prototype.format.call(t);return t.format()},yt=_t;function _t(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var xt=/^([a-z0-9.+-]+:)/i,bt=/:[0-9]*$/,Et=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Tt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),St=["'"].concat(Tt),wt=["%","/","?",";","#"].concat(St),Pt=["/","?","#"],It=/^[+a-z0-9A-Z_-]{0,63}$/,At=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ot={javascript:!0,"javascript:":!0},Mt={javascript:!0,"javascript:":!0},Dt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ct(t,e,r){if(t&&ht.isObject(t)&&t instanceof _t)return t;var i=new _t;return i.parse(t,e,r),i}_t.prototype.parse=function(t,e,r){if(!ht.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=-1!==i&&i127?x+="x":x+=_[b];if(!x.match(It)){var T=g.slice(0,f),S=g.slice(f+1),w=_.match(At);w&&(T.push(w[1]),S.unshift(w[2])),S.length&&(s="/"+S.join(".")+s),this.hostname=T.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=at.toASCII(this.hostname));var P=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+P,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Ot[u])for(f=0,y=St.length;f0)&&r.host.split("@"))&&(r.auth=w.shift(),r.host=r.hostname=w.shift());return r.search=t.search,r.query=t.query,ht.isNull(r.pathname)&&ht.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===b||".."===b)||""===b,T=0,S=_.length;S>=0;S--)"."===(b=_[S])?_.splice(S,1):".."===b?(_.splice(S,1),T++):T&&(_.splice(S,1),T--);if(!g&&!y)for(;T--;T)_.unshift("..");!g||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var w,P=""===_[0]||_[0]&&"/"===_[0].charAt(0);x&&(r.hostname=r.host=P?"":_.length?_.shift():"",(w=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=w.shift(),r.host=r.hostname=w.shift()));return(g=g||r.host&&_.length)&&!P&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),ht.isNull(r.pathname)&&ht.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},_t.prototype.parseHost=function(){var t=this.host,e=bt.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var Rt={parse:ft,resolve:mt,resolveObject:vt,format:gt,Url:yt};!function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(t.ENV||(t.ENV={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(t.RENDERER_TYPE||(t.RENDERER_TYPE={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(t.BUFFER_BITS||(t.BUFFER_BITS={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(t.BLEND_MODES||(t.BLEND_MODES={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(t.DRAW_MODES||(t.DRAW_MODES={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(t.FORMATS||(t.FORMATS={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(t.TARGETS||(t.TARGETS={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.FLOAT=5126]="FLOAT",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(t.TYPES||(t.TYPES={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(t.SCALE_MODES||(t.SCALE_MODES={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(t.WRAP_MODES||(t.WRAP_MODES={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON"}(t.MIPMAP_MODES||(t.MIPMAP_MODES={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(t.ALPHA_MODES||(t.ALPHA_MODES={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(t.CLEAR_MODES||(t.CLEAR_MODES={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(t.GC_MODES||(t.GC_MODES={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(t.PRECISION||(t.PRECISION={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE"}(t.MASK_TYPES||(t.MASK_TYPES={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(t.MSAA_QUALITY||(t.MSAA_QUALITY={})),D.RETINA_PREFIX=/@([0-9\.]+)x/,D.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!0;var Lt,Nt=!1,Ft="5.3.8";function Bt(t){var e;if(!Nt){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var r=["\n %c %c %c PixiJS "+Ft+" - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=window.console).log.apply(e,r)}else window.console&&window.console.log("PixiJS "+Ft+" - "+t+" - http://www.pixijs.com/");Nt=!0}}function Ut(){return void 0===Lt&&(Lt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:D.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!window.WebGLRenderingContext)return!1;var e=document.createElement("canvas"),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!(!r||!r.getContextAttributes().stencil);if(r){var n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch(t){return!1}}()),Lt}function kt(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function Xt(t){var e=t.toString(16);return"#"+(e="000000".substr(0,6-e.length)+e)}function jt(t){return"string"==typeof t&&"#"===t[0]&&(t=t.substr(1)),parseInt(t,16)}function Ht(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}var Gt=function(){for(var e=[],r=[],i=0;i<32;i++)e[i]=i,r[i]=i;e[t.BLEND_MODES.NORMAL_NPM]=t.BLEND_MODES.NORMAL,e[t.BLEND_MODES.ADD_NPM]=t.BLEND_MODES.ADD,e[t.BLEND_MODES.SCREEN_NPM]=t.BLEND_MODES.SCREEN,r[t.BLEND_MODES.NORMAL]=t.BLEND_MODES.NORMAL_NPM,r[t.BLEND_MODES.ADD]=t.BLEND_MODES.ADD_NPM,r[t.BLEND_MODES.SCREEN]=t.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(r),n.push(e),n}();function Yt(t,e){return Gt[e?1:0][t]}function zt(t,e,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e):(r[0]=t[0],r[1]=t[1],r[2]=t[2]),r[3]=e,r}function Vt(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var r=t>>16&255,i=t>>8&255,n=255&t;return(255*e<<24)+((r=r*e+.5|0)<<16)+((i=i*e+.5|0)<<8)+(n=n*e+.5|0)}function Wt(t,e,r,i){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,(i||void 0===i)&&(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}function qt(t,e){void 0===e&&(e=null);var r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+r);for(var i=0,n=0;i>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function Qt(t){return!(t&t-1||!t)}function $t(t){var e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,e|=r=((t>>>=r)>15?1:0)<<2,(e|=r=((t>>>=r)>3?1:0)<<1)|(t>>>=r)>>1}function te(t,e,r){var i,n=t.length;if(!(e>=n||0===r)){var o=n-(r=e+r>n?n-e:r);for(i=e;i=this.x&&t=this.y&&ee!=u>e&&t<(e-a)/(u-a)*(h-s)+s&&(r=!r)}return r},e}(),Se=function(){function e(e,r,i,n,o){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=20),this.x=e,this.y=r,this.width=i,this.height=n,this.radius=o,this.type=t.SHAPES.RREC}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height,this.radius)},e.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(e>=this.y+this.radius&&e<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var r=t-(this.x+this.radius),i=e-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=t-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=e-(this.y+this.height-this.radius))*i<=n)return!0;if((r=t-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}(),we=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t}(),Pe=function(){function t(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this._x=r,this._y=i,this.cb=t,this.scope=e}return t.prototype.clone=function(e,r){return void 0===e&&(e=this.cb),void 0===r&&(r=this.scope),new t(e,r,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),Ie=function(){function t(t,e,r,i,n,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,r,i,n,o){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r},t.prototype.apply=function(t,e){e=e||new we;var r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new we;var r=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*r*i+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*n+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this},t.prototype.append=function(t){var e=this.a,r=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,r,i,n,o,s,a,h){return this.a=Math.cos(s+h)*n,this.b=Math.sin(s+h)*n,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var r=this.a,i=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,r=this.b,i=this.c,n=this.d,o=-Math.atan2(-i,n),s=Math.atan2(r,e),a=Math.abs(o+s);return a<1e-5||Math.abs(ge-a)<1e-5?(t.rotation=s,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=s),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx,t.position.y=this.ty,t},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,i=this.d,n=this.tx,o=t*i-e*r;return this.a=i/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),Ae=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Oe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Me=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],De=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ce=[],Re=[],Le=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];Ce.push(e);for(var r=0;r<16;r++)for(var i=Le(Ae[t]*Ae[r]+Me[t]*Oe[r]),n=Le(Oe[t]*Ae[r]+De[t]*Oe[r]),o=Le(Ae[t]*Me[r]+Me[t]*De[r]),s=Le(Oe[t]*Me[r]+De[t]*De[r]),a=0;a<16;a++)if(Ae[a]===i&&Oe[a]===n&&Me[a]===o&&De[a]===s){e.push(a);break}}for(t=0;t<16;t++){var h=new Ie;h.set(Ae[t],Oe[t],Me[t],De[t],0,0),Re.push(h)}}();var Ne={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return Ae[t]},uY:function(t){return Oe[t]},vX:function(t){return Me[t]},vY:function(t){return De[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return Ce[t][e]},sub:function(t,e){return Ce[t][Ne.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Ne.S:Ne.N:2*Math.abs(e)<=Math.abs(t)?t>0?Ne.E:Ne.W:e>0?t>0?Ne.SE:Ne.SW:t>0?Ne.NE:Ne.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=Re[Ne.inv(e)];n.tx=r,n.ty=i,t.append(n)}},Fe=function(){function t(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Pe(this.onChange,this,0,0),this.scale=new Pe(this.onChange,this,1,1),this.pivot=new Pe(this.onChange,this,0,0),this.skew=new Pe(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();D.SORTABLE_CHILDREN=!1;var Be=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?xe.EMPTY:((t=t||new xe(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addQuad=function(t){var e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=t[0],s=t[1];e=oi?o:i,n=s>n?s:n,e=(o=t[2])i?o:i,n=s>n?s:n,e=(o=t[4])i?o:i,n=s>n?s:n,e=(o=t[6])i?o:i,n=s>n?s:n,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},t.prototype.addFrame=function(t,e,r,i,n){this.addFrameMatrix(t.worldTransform,e,r,i,n)},t.prototype.addFrameMatrix=function(t,e,r,i,n){var o=t.a,s=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=o*e+a*r+u,v=s*e+h*r+l;c=mp?m:p,f=v>f?v:f,c=(m=o*i+a*r+u)p?m:p,f=v>f?v:f,c=(m=o*e+a*n+u)p?m:p,f=v>f?v:f,c=(m=o*i+a*n+u)p?m:p,f=v>f?v:f,this.minX=c,this.minY=d,this.maxX=p,this.maxY=f},t.prototype.addVertexData=function(t,e,r){for(var i=this.minX,n=this.minY,o=this.maxX,s=this.maxY,a=e;ao?h:o,s=u>s?u:s}this.minX=i,this.minY=n,this.maxX=o,this.maxY=s},t.prototype.addVertices=function(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)},t.prototype.addVerticesMatrix=function(t,e,r,i,n,o){void 0===n&&(n=0),void 0===o&&(o=n);for(var s=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,d=this.minX,p=this.minY,f=this.maxX,m=this.maxY,v=r;vi?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,r,i,n,o){t-=n,e-=o,r+=n,i+=o,this.minX=this.minXr?this.maxX:r,this.minY=this.minYi?this.maxY:i},t}(),Ue=function(t,e){return(Ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function ke(t,e){function r(){this.constructor=t}Ue(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Xe=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Fe,e.alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Be,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return ke(e,t),e.mixin=function(t){for(var r=Object.keys(t),i=0;i1)for(var i=0;ithis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(t);te(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,e=[],r=0;r1)for(var i=0;i0&&n<=e){r=this.children.splice(i,n);for(var o=0;o1&&this.children.sort(He),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t title : "+t.title+"
tabIndex: "+t.tabIndex},t.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0),t.x+t.width>this.renderer.width&&(t.width=this.renderer.width-t.x),t.y+t.height>this.renderer.height&&(t.height=this.renderer.height-t.y)},t.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width=Ve+"px",e.style.height=Ve+"px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Ke.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},t.prototype._onClick=function(t){var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"click",e.eventData),e.dispatchEvent(t.target.displayObject,"pointertap",e.eventData),e.dispatchEvent(t.target.displayObject,"tap",e.eventData)},t.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseover",e.eventData)},t.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseout",e.eventData)},t.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},t.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},t.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},t}();D.TARGET_FPMS=.06,(ze=t.UPDATE_PRIORITY||(t.UPDATE_PRIORITY={}))[ze.INTERACTION=50]="INTERACTION",ze[ze.HIGH=25]="HIGH",ze[ze.NORMAL=0]="NORMAL",ze[ze.LOW=-25]="LOW",ze[ze.UTILITY=-50]="UTILITY";var Je=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=0),void 0===i&&(i=!1),this.fn=t,this.context=e,this.priority=r,this.once=i,this.next=null,this.previous=null,this._destroyed=!1}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),Qe=function(){function e(){var t=this;this._head=new Je(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/D.TARGET_FPMS,this.elapsedMS=1/D.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Je(e,r,i))},e.prototype.addOnce=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Je(e,r,i,!0))},e.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(t,e){for(var r=this._head.next;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(e.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r=0;l--){var c=u[l],d=this.recursiveFindHit(t,c,r,i,a);if(d){if(!c.parent)continue;a=!1,d&&(t.target&&(i=!1),s=!0)}}return n&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),r&&r(t,e,!!s))),s},t.prototype.findHit=function(t,e,r,i){this.recursiveFindHit(t,e,r,i,!1)},t}(),or={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Xe.mixin(or);var sr=1,ar={target:null,data:{global:null}},hr=function(e){function r(t,r){var i=e.call(this)||this;return r=r||{},i.renderer=t,i.autoPreventDefault=void 0===r.autoPreventDefault||r.autoPreventDefault,i.interactionFrequency=r.interactionFrequency||10,i.mouse=new tr,i.mouse.identifier=sr,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[sr]=i.mouse,i.interactionDataPool=[],i.eventData=new rr,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!1,i.supportsTouchEvents="ontouchstart"in window,i.supportsPointerEvents=!!window.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new nr,i._tempDisplayObject=new je,i._useSystemTicker=void 0===r.useSystemTicker||r.useSystemTicker,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return function(t,e){function r(){this.constructor=t}er(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),Object.defineProperty(r.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),r.prototype.hitTest=function(t,e){return ar.target=null,ar.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(ar,e,null,!0),ar.target},r.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},r.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Qe.system.add(this.tickerUpdate,this,t.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},r.prototype.removeTickerListener=function(){this.tickerAdded&&(Qe.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},r.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0}},r.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1}},r.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime8)throw new Error("max arguments reached");var h=this.name,u=this.items;this._aliasCount++;for(var l=0,c=u.length;l0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(ur.prototype,{dispatch:{value:ur.prototype.emit},run:{value:ur.prototype.emit}}),D.PREFER_ENV=M.any?t.ENV.WEBGL:t.ENV.WEBGL2,D.STRICT_TEXTURE_CACHE=!1;var lr=[];function cr(t,e){if(!t)return null;var r="";if("string"==typeof t){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);i&&(r=i[1].toLowerCase())}for(var n=lr.length-1;n>=0;--n){var o=lr[n];if(o.test&&o.test(t,r))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var dr=function(t,e){return(dr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function pr(t,e){function r(){this.constructor=t}dr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var fr=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ur("setRealSize"),this.onUpdate=new ur("update"),this.onError=new ur("onError")}return t.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},t.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(t,e,r){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(t,e){return!1},t}(),mr=function(e){function r(t,r){var i=this,n=r||{},o=n.width,s=n.height;if(!o||!s)throw new Error("BufferResource width or height invalid");return(i=e.call(this,o,s)||this).data=t,i}return pr(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,i.internalFormat,r.width,r.height,0,r.format,i.type,this.data)),!0},r.prototype.dispose=function(){this.data=null},r.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},r}(fr),vr={scaleMode:t.SCALE_MODES.NEAREST,format:t.FORMATS.RGBA,alphaMode:t.ALPHA_MODES.NPM},gr=function(e){function r(r,i){void 0===r&&(r=null),void 0===i&&(i=null);var n=e.call(this)||this,o=(i=i||{}).alphaMode,s=i.mipmap,a=i.anisotropicLevel,h=i.scaleMode,u=i.width,l=i.height,c=i.wrapMode,d=i.format,p=i.type,f=i.target,m=i.resolution,v=i.resourceOptions;return!r||r instanceof fr||((r=cr(r,v)).internal=!0),n.width=u||0,n.height=l||0,n.resolution=m||D.RESOLUTION,n.mipmap=void 0!==s?s:D.MIPMAP_TEXTURES,n.anisotropicLevel=void 0!==a?a:D.ANISOTROPIC_LEVEL,n.wrapMode=c||D.WRAP_MODE,n.scaleMode=void 0!==h?h:D.SCALE_MODE,n.format=d||t.FORMATS.RGBA,n.type=p||t.TYPES.UNSIGNED_BYTE,n.target=f||t.TARGETS.TEXTURE_2D,n.alphaMode=void 0!==o?o:t.ALPHA_MODES.UNPACK,void 0!==i.premultiplyAlpha&&(n.premultiplyAlpha=i.premultiplyAlpha),n.uid=ie(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=u>0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(r),n}return pr(r,e),Object.defineProperty(r.prototype,"realWidth",{get:function(){return Math.ceil(this.width*this.resolution-1e-4)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"realHeight",{get:function(){return Math.ceil(this.height*this.resolution-1e-4)},enumerable:!1,configurable:!0}),r.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},r.prototype.setSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t,this.height=e,this._refreshPOT(),this.update(),this},r.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t/this.resolution,this.height=e/this.resolution,this._refreshPOT(),this.update(),this},r.prototype._refreshPOT=function(){this.isPowerOfTwo=Qt(this.realWidth)&&Qt(this.realHeight)},r.prototype.setResolution=function(t){var e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=this.width*e/t,this.height=this.height*e/t,this.emit("update",this)),this._refreshPOT(),this)},r.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},r.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},r.prototype.onError=function(t){this.emit("error",this,t)},r.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete he[this.cacheId],delete ae[this.cacheId],this.cacheId=null),this.dispose(),r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},r.prototype.dispose=function(){this.emit("dispose",this)},r.prototype.castToBaseTexture=function(){return this},r.from=function(t,e,i){void 0===i&&(i=D.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;n?o=t:(t._pixiId||(t._pixiId="pixiid_"+ie()),o=t._pixiId);var s=he[o];if(n&&i&&!s)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return s||((s=new r(t,e)).cacheId=o,r.addToCache(s,o)),s},r.fromBuffer=function(e,i,n,o){e=e||new Float32Array(i*n*4);var s=new mr(e,{width:i,height:n}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new r(s,Object.assign(vr,o||{width:i,height:n,type:a}))},r.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),he[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),he[e]=t)},r.removeFromCache=function(t){if("string"==typeof t){var e=he[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete he[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,r)}else e.target=t.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this},r.prototype.upload=function(t,e,i){for(var n=this.itemDirtyIds,o=0;o]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(xr),wr=function(t){function e(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];xr.crossOrigin(o,s,i.crossorigin);for(var a=0;a0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){var t=this.source;return 3===t.readyState||4===t.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Qe.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Qe.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&Qe.shared.remove(this.update,this);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Qe.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Qe.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,r){return t instanceof HTMLVideoElement||e.TYPES.indexOf(r)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(xr),Pr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return pr(e,t),e.test=function(t){return!!window.createImageBitmap&&t instanceof ImageBitmap},e}(xr);lr.push(Tr,Pr,br,wr,Sr,mr,Er,_r);var Ir={Resource:fr,BaseImageResource:xr,INSTALLED:lr,autoDetectResource:cr,AbstractMultiResource:yr,ArrayResource:_r,BufferResource:mr,CanvasResource:br,CubeResource:Er,ImageResource:Tr,SVGResource:Sr,VideoResource:wr,ImageBitmapResource:Pr},Ar=function(){function t(t){this.renderer=t}return t.prototype.destroy=function(){this.renderer=null},t}(),Or=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return pr(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,1===e.context.webGLVersion?n.DEPTH_COMPONENT:n.DEPTH_COMPONENT16,r.width,r.height,0,r.format,r.type,this.data)),!0},r}(mr),Mr=function(){function e(e,r){this.width=Math.ceil(e||100),this.height=Math.ceil(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ur("disposeFramebuffer"),this.multisample=t.MSAA_QUALITY.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,r){return void 0===e&&(e=0),this.colorTextures[e]=r||new gr(null,{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,mipmap:t.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new gr(new Or(null,{width:this.width,height:this.height}),{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:t.MIPMAP_MODES.OFF,format:t.FORMATS.DEPTH_COMPONENT,type:t.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(t,e){if(t=Math.ceil(t),e=Math.ceil(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&e.textureCacheIds.splice(r,1),delete ae[t],e}}else if(t&&t.textureCacheIds){for(var i=0;ithis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},e}(C);function Nr(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}Lr.EMPTY=new Lr(new gr),Nr(Lr.EMPTY),Nr(Lr.EMPTY.baseTexture),Lr.WHITE=function(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new Lr(new gr(new br(t)))}(),Nr(Lr.WHITE),Nr(Lr.WHITE.baseTexture);var Fr=function(t){function e(e,r){var i=this,n=null;if(!(e instanceof Dr)){var o=arguments[1],s=arguments[2],a=arguments[3],h=arguments[4];console.warn("Please use RenderTexture.create("+o+", "+s+") instead of the ctor directly."),n=arguments[0],r=null,e=new Dr({width:o,height:s,scaleMode:a,resolution:h})}return(i=t.call(this,e,r)||this).legacyRenderer=n,i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return pr(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,r){void 0===r&&(r=!0),t=Math.ceil(t),e=Math.ceil(e),this.valid=t>0&&e>0,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r&&this.baseTexture.resize(t,e),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){return"number"==typeof t&&(t={width:t,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new e(new Dr(t))},e}(Lr),Br=function(){function t(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(t,e){var r=new Dr(Object.assign({width:t,height:e,resolution:1},this.textureOptions));return new Fr(r)},t.prototype.getOptimalTexture=function(e,r,i){void 0===i&&(i=1);var n=t.SCREEN_KEY;e*=i,r*=i,this.enableFullScreen&&e===this._pixelsWidth&&r===this._pixelsHeight||(n=(65535&(e=Jt(e)))<<16|65535&(r=Jt(r))),this.texturePool[n]||(this.texturePool[n]=[]);var o=this.texturePool[n].pop();return o||(o=this.createTexture(e,r)),o.filterPoolKey=n,o.setResolution(i),o},t.prototype.getFilterTexture=function(t,e){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution);return r.filterFrame=t.filterFrame,r},t.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},t.prototype.returnFilterTexture=function(t){this.returnTexture(t)},t.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var i=0;i0&&e.height>0,i)for(var n=0;n1){for(var u=0;u1&&this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,r.renderTexture,u.renderTexture,t.CLEAR_MODES.BLEND,r),this.returnFilterTexture(r.renderTexture);else{var l=r.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,r.resolution);c.filterFrame=l.filterFrame;var d=0;for(d=0;d=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)},e.prototype.boundArray=function(t,e,r,i){for(var n=t.elements,o=t.ids,s=t.count,a=0,h=0;h=0&&l=t.ENV.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var t=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:t.getExtension("EXT_color_buffer_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear")})},r.prototype.handleContextLost=function(t){t.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(t){var e=t.getContextAttributes(),r="WebGL2RenderingContext"in window&&t instanceof window.WebGL2RenderingContext;r&&(this.webGLVersion=2),e.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(Ar),ii=function(){return function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=t.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null}}(),ni=new xe,oi=function(e){function r(t){var r=e.call(this,t)||this;return r.managedFramebuffers=[],r.unknownFramebuffer=new Mr(10,10),r.msaaSamples=null,r}return pr(r,e),r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new xe,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;D.PREFER_ENV===t.ENV.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=function(t){return r.drawBuffersWEBGL(t)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(t,e){var r=this.gl;if(t){var i=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==t.dirtyId&&(i.dirtyId=t.dirtyId,i.dirtyFormat!==t.dirtyFormat?(i.dirtyFormat=t.dirtyFormat,this.updateFramebuffer(t)):i.dirtySize!==t.dirtySize&&(i.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var n=0;n1&&(r.msaaBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.RGBA8,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,r.msaaBuffer));for(var n=[],o=0;o1)){var s=t.colorTextures[o],a=s.parentTextureArray||s;this.renderer.texture.bind(a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+o,s.target,a._glTextures[this.CONTEXT_UID].texture,0),n.push(e.COLOR_ATTACHMENT0+o)}if((n.length>1&&e.drawBuffers(n),t.depthTexture)&&this.writeDepthTexture){var h=t.depthTexture;this.renderer.texture.bind(h,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,0)}r.stencil||!t.stencil&&!t.depth||(r.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),t.depthTexture||e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r.stencil))},r.prototype.detectSamples=function(e){var r=this.msaaSamples,i=t.MSAA_QUALITY.NONE;if(e<=1||null===r)return i;for(var n=0;n=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.stencil&&i.deleteRenderbuffer(r.stencil))}},r.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=i.data.byteLength)e.bufferSubData(o,0,i.data);else{var s=i.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,e.bufferData(o,i.data,s)}}}},r.prototype.checkCompatibility=function(t,e){var r=t.attributes,i=e.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},r.prototype.getSignature=function(t,e){var r=t.attributes,i=e.attributeData,n=["g",t.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},r.prototype.initGeometryVao=function(t,e,r){void 0===r&&(r=!0),this.checkCompatibility(t,e);var i=this.gl,n=this.CONTEXT_UID,o=this.getSignature(t,e),s=t.glVertexArrayObjects[this.CONTEXT_UID],a=s[o];if(a)return s[e.id]=a,a;var h=t.buffers,u=t.attributes,l={},c={};for(var d in h)l[d]=0,c[d]=0;for(var d in u)!u[d].size&&e.attributeData[d]?u[d].size=e.attributeData[d].size:u[d].size||console.warn("PIXI Geometry attribute '"+d+"' size cannot be determined (likely the bound shader does not have the attribute)"),l[u[d].buffer]+=u[d].size*ai[u[d].type];for(var d in u){var p=u[d],f=p.size;void 0===p.stride&&(l[p.buffer]===f*ai[p.type]?p.stride=0:p.stride=l[p.buffer]),void 0===p.start&&(p.start=c[p.buffer],c[p.buffer]+=f*ai[p.type])}a=i.createVertexArray(),i.bindVertexArray(a);for(var m=0;m=t.ENV.WEBGL2&&(r=e.getContext("webgl2",{})),r||((r=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?r.getExtension("WEBGL_draw_buffers"):r=null),vi=r}return vi}function yi(e,r,i){if("precision"!==e.substring(0,9)){var n=r;return r===t.PRECISION.HIGH&&i!==t.PRECISION.HIGH&&(n=t.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==t.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var _i={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function xi(t){return _i[t]}var bi=null,Ei={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Ti(t,e){if(!bi){var r=Object.keys(Ei);bi={};for(var i=0;i0&&(e+="\nelse "),re.name?1:-1});for(o=0;o0?this._useCurrent():t.disable(t.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,r=this.renderer.projection,i=r.transform,n=r.sourceFrame,o=r.destinationFrame,s=e?e.resolution:this.renderer.resolution,a=(t.x-n.x)*s+o.x,h=(t.y-n.y)*s+o.y,u=t.width*s,l=t.height*s;i&&(a+=i.tx*s,h+=i.ty*s),e||(h=this.renderer.height-l-h),this.renderer.gl.scissor(a,h,u,l)},e}(Gi),zi=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=WebGLRenderingContext.STENCIL_TEST,r}return pr(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.enable(r.STENCIL_TEST)),t._stencilCounter++,r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.EQUAL,i,this._getBitwiseMask()),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clear(e.STENCIL_BUFFER_BIT),e.clearStencil(0)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e.prototype._getBitwiseMask=function(){return(1<>=1,r++;this.stateId=t.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(t.children[i])},r}(Ar),ln=function(){return function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121}}(),cn=function(e){function r(t){var r=e.call(this,t)||this;return r.boundTextures=[],r.currentLocation=-1,r.managedTextures=[],r._unknownBoundTextures=!1,r.unknownTexture=new gr,r}return pr(r,e),r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r=1:r.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?r.wrapMode=e.wrapMode:r.wrapMode=t.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===t.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST)},r}(Ar),dn={FilterSystem:Qr,BatchSystem:ti,ContextSystem:ri,FramebufferSystem:oi,GeometrySystem:hi,MaskSystem:Hi,ScissorSystem:Yi,StencilSystem:zi,ProjectionSystem:Vi,RenderTextureSystem:Zi,ShaderSystem:en,StateSystem:hn,TextureGCSystem:un,TextureSystem:cn},pn=new Ie,fn=function(e){function r(r,i){void 0===r&&(r=t.RENDERER_TYPE.UNKNOWN);var n=e.call(this)||this;return(i=Object.assign({},D.RENDER_OPTIONS,i)).roundPixels&&(D.ROUND_PIXELS=i.roundPixels,oe("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),n.options=i,n.type=r,n.screen=new xe(0,0,i.width,i.height),n.view=i.view||document.createElement("canvas"),n.resolution=i.resolution||D.RESOLUTION,n.transparent=i.transparent,n.autoDensity=i.autoDensity||i.autoResize||!1,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,0],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n._lastObjectRendered=null,n.plugins={},n}return pr(r,e),r.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(r.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),r.prototype.resize=function(t,e){this.screen.width=t,this.screen.height=e,this.view.width=t*this.resolution,this.view.height=e*this.resolution,this.autoDensity&&(this.view.style.width=t+"px",this.view.style.height=e+"px"),this.emit("resize",t,e)},r.prototype.generateTexture=function(t,e,r,i){0===(i=i||t.getLocalBounds(null,!0)).width&&(i.width=1),0===i.height&&(i.height=1);var n=Fr.create({width:0|i.width,height:0|i.height,scaleMode:e,resolution:r});return pn.tx=-i.x,pn.ty=-i.y,this.render(t,n,!1,pn,!!t.parent),n},r.prototype.destroy=function(e){for(var r in this.plugins)this.plugins[r].destroy(),this.plugins[r]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);this.plugins=null,this.type=t.RENDERER_TYPE.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(r.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=Xt(t),kt(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),r}(C),mn=function(e){function r(i){var n=e.call(this,t.RENDERER_TYPE.WEBGL,i)||this;return i=n.options,n.gl=null,n.CONTEXT_UID=0,n.runners={destroy:new ur("destroy"),contextChange:new ur("contextChange"),reset:new ur("reset"),update:new ur("update"),postrender:new ur("postrender"),prerender:new ur("prerender"),resize:new ur("resize")},n.globalUniforms=new Zr({projectionMatrix:new Ie},!0),n.addSystem(Hi,"mask").addSystem(ri,"context").addSystem(hn,"state").addSystem(en,"shader").addSystem(cn,"texture").addSystem(hi,"geometry").addSystem(oi,"framebuffer").addSystem(Yi,"scissor").addSystem(zi,"stencil").addSystem(Vi,"projection").addSystem(un,"textureGC").addSystem(Qr,"filter").addSystem(Zi,"renderTexture").addSystem(ti,"batch"),n.initPlugins(r.__plugins),i.context?n.context.initFromContext(i.context):n.context.initFromOptions({alpha:!!n.transparent,antialias:i.antialias,premultipliedAlpha:n.transparent&&"notMultiplied"!==n.transparent,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:n.options.powerPreference}),n.renderingToScreen=!0,Bt(2===n.context.webGLVersion?"WebGL 2":"WebGL 1"),n.resize(n.options.width,n.options.height),n}return pr(r,e),r.create=function(t){if(Ut())return new r(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},r.prototype.addSystem=function(t,e){e||(e=t.name);var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var i in this[e]=r,this.runners)this.runners[i].add(r);return this},r.prototype.render=function(t,e,r,i,n){if(this.renderingToScreen=!e,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=i,!this.context.isLost){if(e||(this._lastObjectRendered=t),!n){var o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}this.renderTexture.bind(e),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),e&&e.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},r.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(t,r)},r.prototype.reset=function(){return this.runners.reset.emit(),this},r.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},r.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},r.registerPlugin=function(t,e){r.__plugins=r.__plugins||{},r.__plugins[t]=e},r}(fn);function vn(t){return mn.create(t)}var gn="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",yn="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",_n=function(){return function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null}}(),xn=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;tthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},r.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,i=r._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++gr._globalBatch,h=0,u=i[0],l=0;n.copyBoundTextures(o,e);for(var c=0;c=e&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,c),l=c,u=i[++h],++a),d._batchEnabled=a,d.touched=s,u.elements[u.count++]=d)}u.count>0&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,this._bufferSize),++h,++a);for(c=0;c0&&(e+="\nelse "),r0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(window.DOMParser){var n=new DOMParser;this.data=n.parseFromString(r,"text/xml")}else{var o=document.createElement("div");o.innerHTML=r,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},e._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(window.origin!==window.location.origin)return"anonymous";e=e||window.location,Gn||(Gn=document.createElement("a")),Gn.href=t;var r=!(t=Rn(Gn.href,{strictMode:!0})).port&&""===e.port||t.port===e.port,i=t.protocol?t.protocol+":":"";return t.host===e.hostname&&r&&i===e.protocol?"":"anonymous"},e._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},e._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},e._getExtension=function(){var t=this.url,e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(i>-1?i:t.length,n>-1?n:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},e._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},jn(t,[{key:"isDataUrl",get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)}},{key:"isComplete",get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)}},{key:"isLoading",get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)}}]),t}();function Vn(t,e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=r)}function Wn(t){return t.toString().replace("object ","")}zn.STATUS_FLAGS={NONE:0,DATA_URL:1,COMPLETE:2,LOADING:4},zn.TYPE={UNKNOWN:0,JSON:1,XML:2,IMAGE:3,AUDIO:4,VIDEO:5,TEXT:6},zn.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},zn.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},zn._loadTypeMap={gif:zn.LOAD_TYPE.IMAGE,png:zn.LOAD_TYPE.IMAGE,bmp:zn.LOAD_TYPE.IMAGE,jpg:zn.LOAD_TYPE.IMAGE,jpeg:zn.LOAD_TYPE.IMAGE,tif:zn.LOAD_TYPE.IMAGE,tiff:zn.LOAD_TYPE.IMAGE,webp:zn.LOAD_TYPE.IMAGE,tga:zn.LOAD_TYPE.IMAGE,svg:zn.LOAD_TYPE.IMAGE,"svg+xml":zn.LOAD_TYPE.IMAGE,mp3:zn.LOAD_TYPE.AUDIO,ogg:zn.LOAD_TYPE.AUDIO,wav:zn.LOAD_TYPE.AUDIO,mp4:zn.LOAD_TYPE.VIDEO,webm:zn.LOAD_TYPE.VIDEO},zn._xhrTypeMap={xhtml:zn.XHR_RESPONSE_TYPE.DOCUMENT,html:zn.XHR_RESPONSE_TYPE.DOCUMENT,htm:zn.XHR_RESPONSE_TYPE.DOCUMENT,xml:zn.XHR_RESPONSE_TYPE.DOCUMENT,tmx:zn.XHR_RESPONSE_TYPE.DOCUMENT,svg:zn.XHR_RESPONSE_TYPE.DOCUMENT,tsx:zn.XHR_RESPONSE_TYPE.DOCUMENT,gif:zn.XHR_RESPONSE_TYPE.BLOB,png:zn.XHR_RESPONSE_TYPE.BLOB,bmp:zn.XHR_RESPONSE_TYPE.BLOB,jpg:zn.XHR_RESPONSE_TYPE.BLOB,jpeg:zn.XHR_RESPONSE_TYPE.BLOB,tif:zn.XHR_RESPONSE_TYPE.BLOB,tiff:zn.XHR_RESPONSE_TYPE.BLOB,webp:zn.XHR_RESPONSE_TYPE.BLOB,tga:zn.XHR_RESPONSE_TYPE.BLOB,json:zn.XHR_RESPONSE_TYPE.JSON,text:zn.XHR_RESPONSE_TYPE.TEXT,txt:zn.XHR_RESPONSE_TYPE.TEXT,ttf:zn.XHR_RESPONSE_TYPE.BUFFER,otf:zn.XHR_RESPONSE_TYPE.BUFFER},zn.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var qn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Kn=window.URL||window.webkitURL;var Zn={caching:function(t,e){var r=this;kn[t.url]?(t.data=kn[t.url],t.complete()):t.onComplete.once(function(){return kn[r.url]=r.data}),e()},parsing:function(t,e){if(t.data){if(t.xhr&&t.xhrType===zn.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var r=Kn.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=zn.TYPE.IMAGE,void(t.data.onload=function(){Kn.revokeObjectURL(r),t.data.onload=null,e()})}}else{var i=t.xhr.getResponseHeader("content-type");if(i&&0===i.indexOf("image"))return t.data=new Image,t.data.src="data:"+i+";base64,"+function(t){for(var e="",r=0;r>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(var s=0;s16384&&(n=16384),s._properties=[!1,!0,!1,!1,!1],s._maxSize=r,s._batchSize=n,s._buffers=null,s._bufferUpdateIDs=[],s._updateID=0,s.interactiveChildren=!1,s.blendMode=t.BLEND_MODES.NORMAL,s.autoResize=o,s.roundPixels=!0,s.baseTexture=null,s.setProperties(i),s._tint=0,s.tintRgb=new Float32Array(4),s.tint=16777215,s}return oo(r,e),r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(r.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,kt(t,this.tintRgb)},enumerable:!1,configurable:!0}),r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return e.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.lengthr&&!t.autoResize&&(o=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var a=e[0]._texture.baseTexture;this.state.blendMode=Yt(t.blendMode,a.alphaMode),n.state.set(this.state);var h=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=zt(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,a.alphaMode),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);for(var l=!1,c=0,d=0;ci&&(p=i),d>=s.length&&s.push(this._generateOneMoreBuffer(t));var f=s[d];f.uploadDynamic(e,c,p);var m=t._bufferUpdateIDs[d]||0;(l=l||f._updateID0,u=a.alpha,l=u<1&&h?Vt(a._tintRGB,u):a._tintRGB+(255*u<<24);i[o]=l,i[o+n]=l,i[o+2*n]=l,i[o+3*n]=l,o+=4*n}},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},r}($r);(so=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",so.BEVEL="bevel",so.ROUND="round",(ao=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",ao.ROUND="round",ao.SQUARE="square";var fo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var r=Math.ceil(t/this.maxLength);return rthis.maxSegments&&(r=this.maxSegments),r}},mo=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Lr.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Lr.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),vo=function(t,e){return(vo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function go(t,e){function r(){this.constructor=t}vo(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var yo={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,i=t.holes,n=e.points,o=e.indices;if(r.length>=6){for(var s=[],a=0;ac&&(c+=2*Math.PI);var d=l,p=c-l,f=Math.abs(p),m=Math.sqrt(h*h+u*u),v=1+(15*f*Math.sqrt(m)/Math.PI>>0),g=p/v;if(d+=g,a){s.push(t,e),s.push(r,i);for(var y=1,_=d;y_?(X?(p.push(V,W),p.push(E+P*R,T+I*R),p.push(V,W),p.push(E+A*R,T+O*R)):(p.push(E-P*C,T-I*C),p.push(q,K),p.push(E-A*C,T-O*C),p.push(q,K)),m+=2):s.join===t.LINE_JOIN.ROUND?X?(p.push(V,W),p.push(E+P*R,T+I*R),m+=wo(E,T,E+P*R,T+I*R,E+A*R,T+O*R,p,!0)+4,p.push(V,W),p.push(E+A*R,T+O*R)):(p.push(E-P*C,T-I*C),p.push(q,K),m+=wo(E,T,E-P*C,T-I*C,E-A*C,T-O*C,p,!1)+4,p.push(E-A*C,T-O*C),p.push(q,K)):(p.push(V,W),p.push(q,K)):(p.push(E-P*C,T-I*C),p.push(E+P*R,T+I*R),s.join===t.LINE_JOIN.BEVEL||z/y>_||(s.join===t.LINE_JOIN.ROUND?m+=X?wo(E,T,E+P*R,T+I*R,E+A*R,T+O*R,p,!0)+2:wo(E,T,E-P*C,T-I*C,E-A*C,T-O*C,p,!1)+2:(X?(p.push(q,K),p.push(q,K)):(p.push(V,W),p.push(V,W)),m+=2)),p.push(E-A*C,T-O*C),p.push(E+A*R,T+O*R),m+=2)}}x=n[2*(f-2)],b=n[2*(f-2)+1],E=n[2*(f-1)],P=-(b-(T=n[2*(f-1)+1])),I=x-E,P/=M=Math.sqrt(P*P+I*I),I/=M,P*=g,I*=g,p.push(E-P*C,T-I*C),p.push(E+P*R,T+I*R),u||(s.cap===t.LINE_CAP.ROUND?m+=wo(E-P*(C-R)*.5,T-I*(C-R)*.5,E-P*C,T-I*C,E+P*R,T+I*R,p,!1)+2:s.cap===t.LINE_CAP.SQUARE&&(m+=So(E,T,P,I,C,R,!1,p)));var J=r.indices,Q=fo.epsilon*fo.epsilon;for(L=v;Ll*a}},t.arc=function(t,e,r,i,n,o,s,a,h){for(var u=s-o,l=fo._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/ge)),c=u/(2*l),d=2*c,p=Math.cos(c),f=Math.sin(c),m=l-1,v=m%1/m,g=0;g<=m;++g){var y=c+o+d*(g+v*g),_=Math.cos(y),x=-Math.sin(y);h.push((p*_+f*x)*n+r,(p*-x+f*_)*n+i)}},t}(),Mo=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o,s,a){for(var h=0,u=0,l=0,c=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,_=t,x=e,b=1;b<=10;++b)g=_-(m=(f=(p=(d=1-(u=b/10))*d)*d)*t+3*p*u*r+3*d*(l=u*u)*n+(c=l*u)*s),y=x-(v=f*e+3*p*u*i+3*d*l*o+c*a),_=m,x=v,h+=Math.sqrt(g*g+y*y);return h},t.curveTo=function(e,r,i,n,o,s,a){var h=a[a.length-2],u=a[a.length-1];a.length-=2;var l=fo._segmentsCount(t.curveLength(h,u,e,r,i,n,o,s)),c=0,d=0,p=0,f=0,m=0;a.push(h,u);for(var v=1,g=0;v<=l;++v)p=(d=(c=1-(g=v/l))*c)*c,m=(f=g*g)*g,a.push(p*h+3*d*g*e+3*c*f*i+m*o,p*u+3*d*g*r+3*c*f*n+m*s)},t}(),Do=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o){var s=t-2*r+n,a=e-2*i+o,h=2*r-2*t,u=2*i-2*e,l=4*(s*s+a*a),c=4*(s*h+a*u),d=h*h+u*u,p=2*Math.sqrt(l+c+d),f=Math.sqrt(l),m=2*l*f,v=2*Math.sqrt(d),g=c/f;return(m*p+f*c*(p-v)+(4*d*l-c*c)*Math.log((2*f+g+p)/(g+v)))/(4*m)},t.curveTo=function(e,r,i,n,o){for(var s=o[o.length-2],a=o[o.length-1],h=fo._segmentsCount(t.curveLength(s,a,e,r,i,n)),u=0,l=0,c=1;c<=h;++c){var d=c/h;u=s+(e-s)*d,l=a+(r-a)*d,o.push(u+(e+(i-e)*d-u)*d,l+(r+(n-r)*d-l)*d)}},t}(),Co=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),Ro=((Io={})[t.SHAPES.POLY]=yo,Io[t.SHAPES.CIRC]=_o,Io[t.SHAPES.ELIP]=_o,Io[t.SHAPES.RECT]=xo,Io[t.SHAPES.RREC]=To,Io),Lo=[],No=[],Fo={buildPoly:yo,buildCircle:_o,buildRectangle:xo,buildRoundedRectangle:To,FILL_COMMANDS:Ro,BATCH_POOL:Lo,DRAW_CALL_POOL:No,buildLine:Po,Star:Ao,ArcUtils:Oo,BezierUtils:Mo,QuadraticUtils:Do,BatchPart:Co},Bo=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null),this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type,this.points=[],this.holes=[]}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Uo=new we,ko=new Be,Xo=function(e){function r(){var t=e.call(this)||this;return t.uvsFloat32=null,t.indicesUint16=null,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.dirty=0,t.batchDirty=-1,t.cacheDirty=-1,t.clearDirty=0,t.drawCalls=[],t.batches=[],t.shapeIndex=0,t._bounds=new Be,t.boundsDirty=-1,t.boundsPadding=0,t.batchable=!1,t.indicesUint16=null,t.uvsFloat32=null,t.closePointEps=1e-4,t}return go(r,e),Object.defineProperty(r.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),r.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},r.prototype.drawShape=function(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null);var n=new Bo(t,e,r,i);return this.graphicsData.push(n),this.dirty++,this},r.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var r=new Bo(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this},r.prototype.destroy=function(){e.prototype.destroy.call(this);for(var t=0;t0&&(o=(n=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s65535&&e;this.indicesUint16=y?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},r.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},r.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t131070)return!1;for(var t=this.batches,e=0;e0&&((o=No.pop())||((o=new _n).texArray=new xn),this.drawCalls.push(o)),o.start=c,o.size=0,o.texArray.count=0,o.type=l),f.touched=1,f._batchEnabled=e,f._batchLocation=s,f.wrapMode=10497,o.texArray.elements[o.texArray.count++]=f,s++)),o.size+=d.size,c+=d.size,h=f._batchLocation,this.addColors(i,p.color,p.alpha,d.attribSize),this.addTextureIds(n,h,d.attribSize)}gr._globalBatch=e,this.packAttributes()},r.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),o=new Float32Array(n),s=new Uint32Array(n),a=0,h=0;h>16)+(65280&e)+((255&e)<<16),r);i-- >0;)t.push(n)},r.prototype.addTextureIds=function(t,e,r){for(;r-- >0;)t.push(e)},r.prototype.addUvs=function(t,e,r,i,n,o){void 0===o&&(o=null);for(var s=0,a=e.length,h=r.frame;s0&&e.alpha>0;return l?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:l},e)):this._lineStyle.reset(),this},r.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Te,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Te,this.currentPath.closeStroke=!1},r.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},r.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},r.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var r=this.currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this},r.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},r.prototype.quadraticCurveTo=function(t,e,r,i){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Do.curveTo(t,e,r,i,n),this},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._initCurve(),Mo.curveTo(t,e,r,i,n,o,this.currentPath.points),this},r.prototype.arcTo=function(t,e,r,i,n){this._initCurve(t,e);var o=this.currentPath.points,s=Oo.curveTo(t,e,r,i,n,o);if(s){var a=s.cx,h=s.cy,u=s.radius,l=s.startAngle,c=s.endAngle,d=s.anticlockwise;this.arc(a,h,u,l,c,d)}return this},r.prototype.arc=function(t,e,r,i,n,o){if(void 0===o&&(o=!1),i===n)return this;if(!o&&n<=i?n+=ge:o&&i<=n&&(i+=ge),0===n-i)return this;var s=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var l=Math.abs(u[u.length-2]-s),c=Math.abs(u[u.length-1]-a);l0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this},r.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},r.prototype.drawRect=function(t,e,r,i){return this.drawShape(new xe(t,e,r,i))},r.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new Se(t,e,r,i,n))},r.prototype.drawCircle=function(t,e,r){return this.drawShape(new be(t,e,r))},r.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new Ee(t,e,r,i))},r.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],i=0;i>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(var a=0,h=s.length;a>16)+(65280&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,r=e.a,i=e.b,n=e.c,o=e.d,s=e.tx,a=e.ty,h=this._geometry.points,u=this.vertexData,l=0,c=0;c=i&&Wo.x=n&&Wo.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Lr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),r}(Ge),Zo=function(t,e){return(Zo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};(Vo=t.TEXT_GRADIENT||(t.TEXT_GRADIENT={}))[Vo.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",Vo[Vo.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL";var Jo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:t.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},Qo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],$o=function(){function t(t){this.styleID=0,this.reset(),rs(this,t,t)}return t.prototype.clone=function(){var e={};return rs(e,this,Jo),new t(e)},t.prototype.reset=function(){rs(this,Jo,Jo)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=es(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=es(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var r=0;r=0;r--){var i=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&Qo.indexOf(i)<0&&(i='"'+i+'"'),e[r]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function ts(t){return"number"==typeof t?Xt(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function es(t){if(Array.isArray(t)){for(var e=0;ef)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(g,r.breakWords))for(var b=t.wordWrapSplit(g),E=0;Ef&&(a+=t.addLine(s),p=!1,s="",o=0),s+=T,o+=I}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var A=v===m.length-1;a+=t.addLine(g,!A),p=!1,s="",o=0}else x+o>f&&(p=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(g)||p)&&(s+=g,o+=x)}return a+=t.addLine(s,!1)},t.addLine=function(e,r){return void 0===r&&(r=!0),e=t.trimRight(e),e=r?e+"\n":e},t.getFromCache=function(t,e,r,i){var n=r[t];if("number"!=typeof n){var o=t.length*e;n=i.measureText(t).width+o,r[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var r=e.length-1;r>=0;r--){var i=e[r];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var r=[],i="";if("string"!=typeof e)return r;for(var n=0;na;--d){for(m=0;m0},t}();function us(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var i=0;i=0;e--)this.add(t.children[e]);return this},e.prototype.destroy=function(){this.ticking&&Qe.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},e}();function gs(t,e){return e instanceof gr&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function ys(t,e){if(!(e instanceof Yo))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n=i&&Ps.x=n&&Ps.y>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;Wt(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(Li),Hs=function(e){function r(r,i,n){var o=e.call(this)||this,s=new Xr(r),a=new Xr(i,!0),h=new Xr(n,!0,!0);return o.addAttribute("aVertexPosition",s,2,!1,t.TYPES.FLOAT).addAttribute("aTextureCoord",a,2,!1,t.TYPES.FLOAT).addIndex(h),o._updateId=-1,o}return Ls(r,e),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(Vr),Gs=function(t,e){return(Gs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ys=function(){return function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]}}(),zs=function(){function t(){}return t.test=function(t){return"string"==typeof t&&0===t.indexOf("info face=")},t.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[]};for(var i in e){var n=e[i].match(/^[a-z]+/gm)[0],o=e[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(var a in o){var h=o[a].split("="),u=h[0],l=h[1].replace(/"/gm,""),c=parseFloat(l),d=isNaN(c)?l:c;s[u]=d}r[n].push(s)}var p=new Ys;return r.info.forEach(function(t){return p.info.push({face:t.face,size:parseInt(t.size,10)})}),r.common.forEach(function(t){return p.common.push({lineHeight:parseInt(t.lineHeight,10)})}),r.page.forEach(function(t){return p.page.push({id:parseInt(t.id,10),file:t.file})}),r.char.forEach(function(t){return p.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})}),r.kerning.forEach(function(t){return p.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})}),p},t}(),Vs=function(){function t(){}return t.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},t.parse=function(t){for(var e=new Ys,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),s=t.getElementsByTagName("kerning"),a=0;a")>-1){var e=(new self.DOMParser).parseFromString(t,"text/xml");return Vs.test(e)}return!1},t.parse=function(t){var e=(new window.DOMParser).parseFromString(t,"text/xml");return Vs.parse(e)},t}(),qs=[zs,Vs,Ws];function Ks(t){for(var e=0;e=u-S*a){if(0===y)throw new Error("[BitmapFont] textureHeight "+u+"px is too small for "+c.fontSize+"px fonts");--b,f=null,m=null,v=null,y=0,g=0,_=0}else if(_=Math.max(S+E.fontProperties.descent,_),w*a+g>=d)--b,y+=_*a,y=Math.ceil(y),g=0,_=0;else{Js(f,m,E,g,y,a,c);var P=E.text.charCodeAt(0);p.char.push({id:P,page:x.length-1,x:g/a,y:y/a,width:w,height:S,xoffset:0,yoffset:0,xadvance:Math.ceil(T-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),g+=(w+2*s)*a,g=Math.ceil(g)}}var I=new t(p,x);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=I,I},t.ALPHA=[["a","z"],["A","Z"]," "],t.NUMERIC=[["0","9"]],t.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],t.ASCII=[[" ","~"]],t.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:t.ALPHANUMERIC},t.available={},t}(),$s=[],ta=[],ea=function(t){function e(r,i){void 0===i&&(i={});var n=t.call(this)||this;n._tint=16777215,i.font&&(oe("5.3.0","PIXI.BitmapText constructor style.font property is deprecated."),n._upgradeStyle(i));var o=Object.assign({},e.styleDefaults,i),s=o.align,a=o.tint,h=o.maxWidth,u=o.letterSpacing,l=o.fontName,c=o.fontSize;if(!Qs.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=s,n._tint=a,n._fontName=l,n._fontSize=c||Qs.available[l].size,n._text=r,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Pe(function(){n.dirty=!0},n,0,0),n._roundPixels=D.ROUND_PIXELS,n.dirty=!0,n._textureCache={},n}return function(t,e){function r(){this.constructor=t}Gs(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.updateText=function(){for(var t,e=Qs.available[this._fontName],r=this._fontSize/e.size,i=new we,n=[],o=[],s=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",a=s.length,h=this._maxWidth*e.size/this._fontSize,u=null,l=0,c=0,d=0,p=-1,f=0,m=0,v=0,g=0;g0&&i.x>h&&(te(n,1+p-++m,1+g-p),g=p,p=-1,o.push(f),c=Math.max(c,f),d++,i.x=0,i.y+=e.lineHeight,u=null)}}else o.push(l),c=Math.max(c,l),++d,++m,i.x=0,i.y+=e.lineHeight,u=null}var E=s.charAt(s.length-1);"\r"!==E&&"\n"!==E&&(/(?:\s)/.test(E)&&(l=f),o.push(l),c=Math.max(c,l));var T=[];for(g=0;g<=d;g++){var S=0;"right"===this._align?S=c-o[g]:"center"===this._align&&(S=(c-o[g])/2),T.push(S)}var w=n.length,P={},I=[],A=this._activePagesMeshData;for(g=0;g6*R)||z.vertices.length<2*Us.BATCHABLE_SIZE)z.vertices=new Float32Array(8*R),z.uvs=new Float32Array(8*R),z.indices=new Uint16Array(6*R);else for(var L=z.total,N=z.vertices,F=4*L*2;F=2&&(t.fontSize=parseInt(e[0],10))}else t.fontName=t.font.name,t.fontSize="number"==typeof t.font.size?t.font.size:parseInt(t.font.size,10)},e.prototype.destroy=function(e){var r=this._textureCache;for(var i in r){r[i].destroy(),delete r[i]}this._textureCache=null,t.prototype.destroy.call(this,e)},e.registerFont=function(t,e){return oe("5.3.0","PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install"),Qs.install(t,e)},Object.defineProperty(e,"fonts",{get:function(){return oe("5.3.0","PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available"),Qs.available},enumerable:!1,configurable:!0}),e.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},e}(Ge),ra=function(){function t(){}return t.add=function(){$n.setExtensionXhrType("fnt",$n.XHR_RESPONSE_TYPE.TEXT)},t.use=function(e,r){var i=Ks(e.data);if(i)for(var n=t.getBaseUrl(this,e),o=i.parse(e.data),s={},a=function(t){s[t.metadata.pageFile]=t.texture,Object.keys(s).length===o.page.length&&(e.bitmapFont=Qs.install(o,s),r())},h=0;h=i&&(e=t-s-1),o+=a=a.replace("%value%",r[e].toString()),o+="\n"}return n=(n=n.replace("%blur%",o)).replace("%size%",t.toString())}(o);return(s=t.call(this,a,h)||this).horizontal=e,s.resolution=n,s._quality=0,s.quality=i,s.blur=r,s}return aa(e,t),e.prototype.apply=function(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{var n=t.getFilterTexture(),o=t.renderer,s=e,a=n;this.state.blend=!1,t.applyFilter(this,s,a,ba.CLEAR);for(var h=1;h>16&255)/255,s=(r>>8&255)/255,a=(255&r)/255,h=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,l=(255&i)/255,c=[.3,.59,.11,0,0,o,s,a,t=t||.2,0,h,u,l,e=e||.15,0,o-h,s-u,a-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Fi);Ca.prototype.grayscale=Ca.prototype.greyscale;var Ra=function(t,e){return(Ra=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var La="varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",Na="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n",Fa=function(t){function e(e,r){var i=this,n=new Ie;return e.renderable=!1,(i=t.call(this,Na,La,{mapSampler:e._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,i.maskMatrix=n,null==r&&(r=20),i.scale=new we(r,r),i}return function(t,e){function r(){this.constructor=t}Ra(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.apply=function(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),s=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==s&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/s,this.uniforms.rotation[3]=n.d/s),t.applyFilter(this,e,r,i)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e}(Fi),Ba=function(t,e){return(Ba=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ua="\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",ka='varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n',Xa=function(t){function e(){return t.call(this,Ua,ka)||this}return function(t,e){function r(){this.constructor=t}Ba(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Fi),ja=function(t,e){return(ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ha="precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",Ga=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random());var i=t.call(this,yn,Ha,{uNoise:0,uSeed:0})||this;return i.noise=e,i.seed=r,i}return function(t,e){function r(){this.constructor=t}ja(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e}(Fi),Ya=new Ie;Xe.prototype._cacheAsBitmap=!1,Xe.prototype._cacheData=null;var za=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(Xe.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new za),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),Xe.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Xe.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.alpha;this.alpha=1,t.batch.flush();var r=this.getLocalBounds(null,!0).clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(D.RESOLUTION);var n=t.renderTexture.current,o=t.renderTexture.sourceFrame.clone(),s=t.projection.transform,a=Fr.create({width:r.width,height:r.height}),h="cacheAsBitmap_"+ie();this._cacheData.textureCacheId=h,gr.addToCache(a.baseTexture,h),Lr.addToCache(a,h);var u=this.transform.localTransform.copyTo(Ya).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,a,!0,u,!1),t.projection.transform=s,t.renderTexture.bind(n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var l=new Ko(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-r.x/r.width,l.anchor.y=-r.y/r.height,l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)}},Xe.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Xe.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;var i=t.context,n=t._projTransform;e.ceil(D.RESOLUTION);var o=Fr.create({width:e.width,height:e.height}),s="cacheAsBitmap_"+ie();this._cacheData.textureCacheId=s,gr.addToCache(o.baseTexture,s),Lr.addToCache(o,s);var a=Ya;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,o,!0,a,!1),t.context=i,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var h=new Ko(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},Xe.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Xe.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Xe.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,gr.removeFromCache(this._cacheData.textureCacheId),Lr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Xe.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Xe.prototype.name=null,Ge.prototype.getChildByName=function(t,e){for(var r=0,i=this.children.length;r0){var d=a.x-t[l].x,p=a.y-t[l].y,f=Math.sqrt(d*d+p*p);a=t[l],s+=f/h}else s=l/(u-1);n[c]=s,n[c+1]=0,n[c+2]=s,n[c+3]=1}var m=0;for(l=0;l0?this.textureScale*this._width/2:this._width/2;i/=l,n/=l,i*=c,n*=c,o[u]=h.x+i,o[u+1]=h.y+n,o[u+2]=h.x-i,o[u+3]=h.y-n,r=h}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(Hs),Za=function(e){function r(r,i,n){void 0===n&&(n=0);var o=this,s=new Ka(r.height,i,n),a=new js(r);return n>0&&(r.baseTexture.wrapMode=t.WRAP_MODES.REPEAT),(o=e.call(this,s,a)||this).autoUpdate=!0,o}return Wa(r,e),r.prototype._render=function(t){var r=this.geometry;(this.autoUpdate||r._width!==this.shader.texture.height)&&(r._width=this.shader.texture.height,r.update()),e.prototype._render.call(this,t)},r}(Us),Ja=function(t){function e(e,r,i){var n=this,o=new qa(e.width,e.height,r,i),s=new js(Lr.WHITE);return(n=t.call(this,o,s)||this).texture=e,n}return Wa(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry;t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build()},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(Us),Qa=function(t){function e(e,r,i,n,o){void 0===e&&(e=Lr.EMPTY);var s=this,a=new Hs(r,i,n);a.getBuffer("aVertexPosition").static=!1;var h=new js(e);return(s=t.call(this,a,h,null,o)||this).autoUpdate=!0,s}return Wa(e,t),Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},e}(Us),$a=10,th=function(t){function e(e,r,i,n,o){void 0===r&&(r=$a),void 0===i&&(i=$a),void 0===n&&(n=$a),void 0===o&&(o=$a);var s=t.call(this,Lr.WHITE,4,4)||this;return s._origWidth=e.orig.width,s._origHeight=e.orig.height,s._width=s._origWidth,s._height=s._origHeight,s._leftWidth=r,s._rightWidth=n,s._topHeight=i,s._bottomHeight=o,s.texture=e,s}return Wa(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(e,i)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(Ja),eh=function(t,e){return(eh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var rh=function(e){function r(t,r){void 0===r&&(r=!0);var i=e.call(this,t[0]instanceof Lr?t[0]:t[0].texture)||this;return i._textures=null,i._durations=null,i._autoUpdate=r,i._isConnectedToTicker=!1,i.animationSpeed=1,i.loop=!0,i.updateAnchor=!1,i.onComplete=null,i.onFrameChange=null,i.onLoop=null,i._currentTime=0,i._playing=!1,i._previousFrame=null,i.textures=t,i}return function(t,e){function r(){this.constructor=t}eh(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Qe.shared.remove(this.update,this),this._isConnectedToTicker=!1))},r.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Qe.shared.add(this.update,this,t.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},r.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},r.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},r.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer&&this.onLoop()),this.updateTexture())}},r.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},r.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},r.fromFrames=function(t){for(var e=[],i=0;i0){var n=e.context;n.beginPath();for(var o=0;oS?S:T,r.moveTo(_,x+T),r.lineTo(_,x+E-T),r.quadraticCurveTo(_,x+E,_+T,x+E),r.lineTo(_+b-T,x+E),r.quadraticCurveTo(_+b,x+E,_+b,x+E-T),r.lineTo(_+b,x+T),r.quadraticCurveTo(_+b,x,_+b-T,x),r.lineTo(_+T,x),r.quadraticCurveTo(_,x,_,x+T),r.closePath()}}},e.prototype.popMask=function(t){t.context.restore(),t.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function uh(t){var e=document.createElement("canvas");e.width=6,e.height=1;var r=e.getContext("2d");return r.fillStyle=t,r.fillRect(0,0,6,1),e}function lh(){if("undefined"==typeof document)return!1;var t=uh("#ff00ff"),e=uh("#ffff00"),r=document.createElement("canvas");r.width=6,r.height=1;var i=r.getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(t,0,0),i.drawImage(e,2,0);var n=i.getImageData(2,0,1,1);if(!n)return!1;var o=n.data;return 255===o[0]&&0===o[1]&&0===o[2]}var ch=new Ie,dh=function(e){function r(i){var n,o=e.call(this,t.RENDERER_TYPE.CANVAS,i)||this;if(o.rootContext=o.view.getContext("2d",{alpha:o.transparent}),o.context=o.rootContext,o.refresh=!0,o.maskManager=new hh(o),o.smoothProperty="imageSmoothingEnabled",!o.rootContext.imageSmoothingEnabled){var s=o.rootContext;s.webkitImageSmoothingEnabled?o.smoothProperty="webkitImageSmoothingEnabled":s.mozImageSmoothingEnabled?o.smoothProperty="mozImageSmoothingEnabled":s.oImageSmoothingEnabled?o.smoothProperty="oImageSmoothingEnabled":s.msImageSmoothingEnabled&&(o.smoothProperty="msImageSmoothingEnabled")}return o.initPlugins(r.__plugins),o.blendModes=(void 0===n&&(n=[]),lh()?(n[t.BLEND_MODES.NORMAL]="source-over",n[t.BLEND_MODES.ADD]="lighter",n[t.BLEND_MODES.MULTIPLY]="multiply",n[t.BLEND_MODES.SCREEN]="screen",n[t.BLEND_MODES.OVERLAY]="overlay",n[t.BLEND_MODES.DARKEN]="darken",n[t.BLEND_MODES.LIGHTEN]="lighten",n[t.BLEND_MODES.COLOR_DODGE]="color-dodge",n[t.BLEND_MODES.COLOR_BURN]="color-burn",n[t.BLEND_MODES.HARD_LIGHT]="hard-light",n[t.BLEND_MODES.SOFT_LIGHT]="soft-light",n[t.BLEND_MODES.DIFFERENCE]="difference",n[t.BLEND_MODES.EXCLUSION]="exclusion",n[t.BLEND_MODES.HUE]="hue",n[t.BLEND_MODES.SATURATION]="saturate",n[t.BLEND_MODES.COLOR]="color",n[t.BLEND_MODES.LUMINOSITY]="luminosity"):(n[t.BLEND_MODES.NORMAL]="source-over",n[t.BLEND_MODES.ADD]="lighter",n[t.BLEND_MODES.MULTIPLY]="source-over",n[t.BLEND_MODES.SCREEN]="source-over",n[t.BLEND_MODES.OVERLAY]="source-over",n[t.BLEND_MODES.DARKEN]="source-over",n[t.BLEND_MODES.LIGHTEN]="source-over",n[t.BLEND_MODES.COLOR_DODGE]="source-over",n[t.BLEND_MODES.COLOR_BURN]="source-over",n[t.BLEND_MODES.HARD_LIGHT]="source-over",n[t.BLEND_MODES.SOFT_LIGHT]="source-over",n[t.BLEND_MODES.DIFFERENCE]="source-over",n[t.BLEND_MODES.EXCLUSION]="source-over",n[t.BLEND_MODES.HUE]="source-over",n[t.BLEND_MODES.SATURATION]="source-over",n[t.BLEND_MODES.COLOR]="source-over",n[t.BLEND_MODES.LUMINOSITY]="source-over"),n[t.BLEND_MODES.NORMAL_NPM]=n[t.BLEND_MODES.NORMAL],n[t.BLEND_MODES.ADD_NPM]=n[t.BLEND_MODES.ADD],n[t.BLEND_MODES.SCREEN_NPM]=n[t.BLEND_MODES.SCREEN],n[t.BLEND_MODES.SRC_IN]="source-in",n[t.BLEND_MODES.SRC_OUT]="source-out",n[t.BLEND_MODES.SRC_ATOP]="source-atop",n[t.BLEND_MODES.DST_OVER]="destination-over",n[t.BLEND_MODES.DST_IN]="destination-in",n[t.BLEND_MODES.DST_OUT]="destination-out",n[t.BLEND_MODES.DST_ATOP]="destination-atop",n[t.BLEND_MODES.XOR]="xor",n[t.BLEND_MODES.SUBTRACT]="source-over",n),o._activeBlendMode=null,o._outerBlend=!1,o._projTransform=null,o.renderingToScreen=!1,Bt("Canvas"),o.resize(o.options.width,o.options.height),o}return function(t,e){function r(){this.constructor=t}ah(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.render=function(e,r,i,n,o){if(this.view){this.renderingToScreen=!r,this.emit("prerender");var s=this.resolution;r?((r=r.castToBaseTexture())._canvasRenderTarget||(r._canvasRenderTarget=new ue(r.width,r.height,r.resolution),r.resource=new Ir.CanvasResource(r._canvasRenderTarget.canvas),r.valid=!0),this.context=r._canvasRenderTarget.context,this.resolution=r._canvasRenderTarget.resolution):this.context=this.rootContext;var a=this.context;if(this._projTransform=n||null,r||(this._lastObjectRendered=e),!o){var h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}if(a.save(),a.setTransform(1,0,0,1,0,0),a.globalAlpha=1,this._activeBlendMode=t.BLEND_MODES.NORMAL,this._outerBlend=!1,a.globalCompositeOperation=this.blendModes[t.BLEND_MODES.NORMAL],void 0!==i?i:this.clearBeforeRender)if(this.renderingToScreen)this.transparent?a.clearRect(0,0,this.width,this.height):(a.fillStyle=this._backgroundColorString,a.fillRect(0,0,this.width,this.height));else{(r=r)._canvasRenderTarget.clear();var u=r.clearColor;u[3]>0&&(a.fillStyle=Xt(Ht(u)),a.fillRect(0,0,r.realWidth,r.realHeight))}var l=this.context;this.context=a,e.renderCanvas(this),this.context=l,a.restore(),this.resolution=s,this._projTransform=null,this.emit("postrender")}},r.prototype.setContextTransform=function(t,e,r){var i=t,n=this._projTransform,o=this.resolution;r=r||o,n&&((i=ch).copyFrom(t),i.prepend(n)),e?this.context.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*o|0,i.ty*o|0):this.context.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*o,i.ty*o)},r.prototype.clear=function(t){var e=this.context;t=t||this._backgroundColorString,!this.transparent&&t?(e.fillStyle=t,e.fillRect(0,0,this.width,this.height)):e.clearRect(0,0,this.width,this.height)},r.prototype.setBlendMode=function(e,r){var i=e===t.BLEND_MODES.SRC_IN||e===t.BLEND_MODES.SRC_OUT||e===t.BLEND_MODES.DST_IN||e===t.BLEND_MODES.DST_ATOP;!r&&i&&(e=t.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=i,this.context.globalCompositeOperation=this.blendModes[e])},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},r.prototype.resize=function(r,i){e.prototype.resize.call(this,r,i),this.smoothProperty&&(this.rootContext[this.smoothProperty]=D.SCALE_MODE===t.SCALE_MODES.LINEAR)},r.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},r.registerPlugin=function(t,e){r.__plugins=r.__plugins||{},r.__plugins[t]=e},r}(fn),ph={canvas:null,getTintedCanvas:function(t,e){var r=t.texture,i="#"+("00000"+(0|(e=ph.roundColor(e))).toString(16)).substr(-6);r.tintCache=r.tintCache||{};var n,o=r.tintCache[i];if(o){if(o.tintId===r._updateID)return r.tintCache[i];n=r.tintCache[i]}else n=document.createElement("canvas");if(ph.tintMethod(r,e,n),n.tintId=r._updateID,ph.convertTintToImage){var s=new Image;s.src=n.toDataURL(),r.tintCache[i]=s}else r.tintCache[i]=n;return n},getTintedPattern:function(t,e){var r="#"+("00000"+(0|(e=ph.roundColor(e))).toString(16)).substr(-6);t.patternCache=t.patternCache||{};var i=t.patternCache[r];return i&&i.tintId===t._updateID?i:(ph.canvas||(ph.canvas=document.createElement("canvas")),ph.tintMethod(t,e,ph.canvas),(i=ph.canvas.getContext("2d").createPattern(ph.canvas,"repeat")).tintId=t._updateID,t.patternCache[r]=i,i)},tintWithMultiply:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.fillStyle="#"+("00000"+(0|e).toString(16)).substr(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply";var s=t.baseTexture.getDrawableSource();i.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithOverlay:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.fillStyle="#"+("00000"+(0|e).toString(16)).substr(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithPerPixel:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var s=kt(e),a=s[0],h=s[1],u=s[2],l=i.getImageData(0,0,n.width,n.height),c=l.data,d=0;d0){var P=w/Math.abs(t.worldTransform.a),I=w/Math.abs(t.worldTransform.d),A=(_+x+b)/3,O=(E+T+S)/3,M=_-A,D=E-O,C=Math.sqrt(M*M+D*D);_=A+M/C*(C+P),E=O+D/C*(C+I),D=T-O,x=A+(M=x-A)/(C=Math.sqrt(M*M+D*D))*(C+P),T=O+D/C*(C+I),D=S-O,b=A+(M=b-A)/(C=Math.sqrt(M*M+D*D))*(C+P),S=O+D/C*(C+I)}n.save(),n.beginPath(),n.moveTo(_,E),n.lineTo(x,T),n.lineTo(b,S),n.closePath(),n.clip();var R=p*g+v*m+f*y-g*m-v*f-p*y,L=_*g+v*b+x*y-g*b-v*x-_*y,N=p*x+_*m+f*b-x*m-_*f-p*b,F=p*g*b+v*x*m+_*f*y-_*g*m-v*f*b-p*x*y,B=E*g+v*S+T*y-g*S-v*T-E*y,U=p*T+E*m+f*S-T*m-E*f-p*S,k=p*g*S+v*T*m+E*f*y-E*g*m-v*f*S-p*T*y;n.transform(L/R,B/R,N/R,U/R,F/R,k/R),n.drawImage(d,0,0,l*u.resolution,c*u.resolution,0,0,l,c),n.restore(),this.renderer.invalidateBlendMode()}},e.prototype.renderMeshFlat=function(t){var e=this.renderer.context,r=t.geometry.getBuffer("aVertexPosition").data,i=r.length/2;e.beginPath();for(var n=1;n>16&255)/255,l=(e.tint>>8&255)/255,c=(255&e.tint)/255,d=0;d>16&255)/255*u*255<<16)+((g>>8&255)/255*l*255<<8)+(255&g)/255*c*255;s=this._calcCanvasStyle(m,_)}if(v.visible){var x=((y>>16&255)/255*u*255<<16)+((y>>8&255)/255*l*255<<8)+(255&y)/255*c*255;a=this._calcCanvasStyle(v,x)}if(i.lineWidth=v.width,i.lineCap=v.cap,i.lineJoin=v.join,i.miterLimit=v.miterLimit,p.type===t.SHAPES.POLY){i.beginPath();var b=(O=f).points,E=p.holes,T=void 0,S=void 0,w=void 0,P=void 0;i.moveTo(b[0],b[1]);for(var I=2;I0){T=0,w=b[0],P=b[1];for(I=2;I+2=0;I-=2)i.lineTo(b[I],b[I+1])}E[A].shape.closeStroke&&i.closePath()}}m.visible&&(i.globalAlpha=m.alpha*n,i.fillStyle=s,i.fill()),v.visible&&(i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke())}else if(p.type===t.SHAPES.RECT){var O=f;m.visible&&(i.globalAlpha=m.alpha*n,i.fillStyle=s,i.fillRect(O.x,O.y,O.width,O.height)),v.visible&&(i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.strokeRect(O.x,O.y,O.width,O.height))}else if(p.type===t.SHAPES.CIRC){O=f;i.beginPath(),i.arc(O.x,O.y,O.radius,0,2*Math.PI),i.closePath(),m.visible&&(i.globalAlpha=m.alpha*n,i.fillStyle=s,i.fill()),v.visible&&(i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke())}else if(p.type===t.SHAPES.ELIP){var M=2*(O=f).width,D=2*O.height,C=O.x-M/2,R=O.y-D/2;i.beginPath();var L=M/2*.5522848,N=D/2*.5522848,F=C+M,B=R+D,U=C+M/2,k=R+D/2;i.moveTo(C,k),i.bezierCurveTo(C,k-N,U-L,R,U,R),i.bezierCurveTo(U+L,R,F,k-N,F,k),i.bezierCurveTo(F,k+N,U+L,B,U,B),i.bezierCurveTo(U-L,B,C,k+N,C,k),i.closePath(),m.visible&&(i.globalAlpha=m.alpha*n,i.fillStyle=s,i.fill()),v.visible&&(i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke())}else if(p.type===t.SHAPES.RREC){var X=(O=f).x,j=O.y,H=O.width,G=O.height,Y=O.radius,z=Math.min(H,G)/2|0;Y=Y>z?z:Y,i.beginPath(),i.moveTo(X,j+Y),i.lineTo(X,j+G-Y),i.quadraticCurveTo(X,j+G,X+Y,j+G),i.lineTo(X+H-Y,j+G),i.quadraticCurveTo(X+H,j+G,X+H,j+G-Y),i.lineTo(X+H,j+Y),i.quadraticCurveTo(X+H,j,X+H-Y,j),i.lineTo(X+Y,j),i.quadraticCurveTo(X,j,X,j+Y),i.closePath(),m.visible&&(i.globalAlpha=m.alpha*n,i.fillStyle=s,i.fill()),v.visible&&(i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke())}}},e.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var r=document.createElementNS("http://www.w3.org/2000/svg","svg");if(r&&r.createSVGMatrix&&(this._svgMatrix=r.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},e.prototype.destroy=function(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null},e}(),_h=new Ie;Yo.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var r=this.getLocalBounds(),i=Fr.create({width:r.width,height:r.height,scaleMode:t,resolution:e});gh||(gh=new dh),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(_h),_h.invert(),_h.tx-=r.x,_h.ty-=r.y,gh.render(this,i,!0,_h);var n=Lr.from(i.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.setResolution(e),n},Yo.prototype.cachedGraphicsData=[],Yo.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))};var xh=new Ie,bh=function(){function e(t){this.renderer=t}return e.prototype.render=function(e){var r=e._texture,i=this.renderer,n=i.context,o=r._frame.width,s=r._frame.height,a=e.transform.worldTransform,h=0,u=0,l=r.baseTexture.getDrawableSource();if(!(r.orig.width<=0||r.orig.height<=0)&&r.valid&&l&&r.valid){i.setBlendMode(e.blendMode,!0),i.context.globalAlpha=e.worldAlpha;var c=r.baseTexture.scaleMode===t.SCALE_MODES.LINEAR;i.smoothProperty&&i.context[i.smoothProperty]!==c&&(n[i.smoothProperty]=c),r.trim?(h=r.trim.width/2+r.trim.x-e.anchor.x*r.orig.width,u=r.trim.height/2+r.trim.y-e.anchor.y*r.orig.height):(h=(.5-e.anchor.x)*r.orig.width,u=(.5-e.anchor.y)*r.orig.height),r.rotate&&(a.copyTo(xh),a=xh,Ne.matrixAppendRotationInv(a,r.rotate,h,u),h=0,u=0),h-=o/2,u-=s/2,i.setContextTransform(a,e.roundPixels,1),e.roundPixels&&(h|=0,u|=0);var d=r.baseTexture.resolution,p=i._outerBlend;p&&(n.save(),n.beginPath(),n.rect(h*i.resolution,u*i.resolution,o*i.resolution,s*i.resolution),n.clip()),16777215!==e.tint?(e._cachedTint===e.tint&&e._tintedCanvas.tintId===e._texture._updateID||(e._cachedTint=e.tint,e._tintedCanvas=ph.getTintedCanvas(e,e.tint)),n.drawImage(e._tintedCanvas,0,0,Math.floor(o*d),Math.floor(s*d),Math.floor(h*i.resolution),Math.floor(u*i.resolution),Math.floor(o*i.resolution),Math.floor(s*i.resolution))):n.drawImage(l,r._frame.x*d,r._frame.y*d,Math.floor(o*d),Math.floor(s*d),Math.floor(h*i.resolution),Math.floor(u*i.resolution),Math.floor(o*i.resolution),Math.floor(s*i.resolution)),p&&n.restore(),i.setBlendMode(t.BLEND_MODES.NORMAL)}},e.prototype.destroy=function(){this.renderer=null},e}();Ko.prototype._tintedCanvas=null,Ko.prototype._renderCanvas=function(t){t.plugins.sprite.render(this)};var Eh=new xe,Th=function(){function t(t){this.renderer=t}return t.prototype.image=function(t,e,r){var i=new Image;return i.src=this.base64(t,e,r),i},t.prototype.base64=function(t,e,r){return this.canvas(t).toDataURL(e,r)},t.prototype.canvas=function(t){var e,r,i,n,o=this.renderer;t&&(n=t instanceof Fr?t:o.generateTexture(t)),n?(e=n.baseTexture._canvasRenderTarget.context,r=n.baseTexture._canvasRenderTarget.resolution,i=n.frame):(e=o.rootContext,r=o.resolution,(i=Eh).width=this.renderer.width,i.height=this.renderer.height);var s=Math.floor(i.width*r+1e-4),a=Math.floor(i.height*r+1e-4),h=new ue(s,a,1),u=e.getImageData(i.x*r,i.y*r,s,a);return h.context.putImageData(u,0,0),h.canvas},t.prototype.pixels=function(t){var e,r,i,n,o=this.renderer;return t&&(n=t instanceof Fr?t:o.generateTexture(t)),n?(e=n.baseTexture._canvasRenderTarget.context,r=n.baseTexture._canvasRenderTarget.resolution,i=n.frame):(e=o.rootContext,(i=Eh).width=o.width,i.height=o.height),e.getImageData(0,0,i.width*r,i.height*r).data},t.prototype.destroy=function(){this.renderer=null},t}();Object.defineProperty(dh.prototype,"extract",{get:function(){return oe("v5.3.0","CanvasRenderer#extract is deprecated, use CanvasRenderer#plugins.extract"),this.plugins.extract}});var Sh=function(t,e){return(Sh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var wh=16;function Ph(t,e){var r=t;if(e instanceof gr){var i=e.source,n=0===i.width?r.canvas.width:Math.min(r.canvas.width,i.width),o=0===i.height?r.canvas.height:Math.min(r.canvas.height,i.height);return r.ctx.drawImage(i,0,0,n,o,0,0,r.canvas.width,r.canvas.height),!0}return!1}var Ih=function(t){function e(e){var r=t.call(this,e)||this;return r.uploadHookHelper=r,r.canvas=document.createElement("canvas"),r.canvas.width=wh,r.canvas.height=wh,r.ctx=r.canvas.getContext("2d"),r.registerUploadHook(Ph),r}return function(t,e){function r(){this.constructor=t}Sh(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.destroy=function(){t.prototype.destroy.call(this),this.ctx=null,this.canvas=null},e}(vs);return Is.prototype._renderCanvas=function(t){var e=this._texture;if(e.baseTexture.valid){var r=t.context,i=this.worldTransform,n=e.baseTexture,o=n.getDrawableSource(),s=n.resolution,a=this.tilePosition.x/this.tileScale.x%e._frame.width*s,h=this.tilePosition.y/this.tileScale.y%e._frame.height*s;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tint){this._textureID=this._texture._updateID;var u=new ue(e._frame.width,e._frame.height,s);16777215!==this.tint?(this._tintedCanvas=ph.getTintedCanvas(this,this.tint),u.context.drawImage(this._tintedCanvas,0,0)):u.context.drawImage(o,-e._frame.x*s,-e._frame.y*s),this._cachedTint=this.tint,this._canvasPattern=u.context.createPattern(u.canvas,"repeat")}r.globalAlpha=this.worldAlpha,t.setBlendMode(this.blendMode),t.setContextTransform(i),r.fillStyle=this._canvasPattern,r.scale(this.tileScale.x/s,this.tileScale.y/s);var l=this.anchor.x*-this._width,c=this.anchor.y*-this._height;this.uvRespectAnchor?(r.translate(a,h),r.fillRect(-a+l,-h+c,this._width/this.tileScale.x*s,this._height/this.tileScale.y*s)):(r.translate(a+l,h+c),r.fillRect(-a,-h,this._width/this.tileScale.x*s,this._height/this.tileScale.y*s))}},ho.prototype.renderCanvas=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable){var e=t.context,r=this.worldTransform,i=!0,n=0,o=0,s=0,a=0;t.setBlendMode(this.blendMode),e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var h=0;h Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n window.requestAnimationFrame = (window as any)[`${p}RequestAnimationFrame`];\n window.cancelAnimationFrame = (window as any)[`${p}CancelAnimationFrame`]\n || (window as any)[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!window.requestAnimationFrame)\n{\n window.requestAnimationFrame = (callback: (...parms: any[]) => void): number =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return window.setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!window.cancelAnimationFrame)\n{\n window.cancelAnimationFrame = (id: number): void => clearTimeout(id);\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x): number\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value): boolean\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","import './Promise';\nimport './Object.assign';\nimport './requestAnimationFrame';\nimport './Math.sign';\nimport './Number.isInteger';\n\nif (!window.ArrayBuffer)\n{\n (window as any).ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n (window as any).Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n (window as any).Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n (window as any).Uint16Array = Array;\n}\n\nif (!window.Uint8Array)\n{\n (window as any).Uint8Array = Array;\n}\n\nif (!window.Int32Array)\n{\n (window as any).Int32Array = Array;\n}\n","const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n","// The ESM/CJS versions of ismobilejs only\n// exports the function for executing\n// designed for Node-only environments\nimport isMobileCall from 'ismobilejs';\n\nconst isMobile = isMobileCall(window.navigator);\n\nexport { isMobile };\n","import { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\n\nexport interface IRenderOptions {\n view: HTMLCanvasElement;\n antialias: boolean;\n autoDensity: boolean;\n transparent: boolean;\n backgroundColor: number;\n clearBeforeRender: boolean;\n preserveDrawingBuffer: boolean;\n width: number;\n height: number;\n legacy: boolean;\n}\n\nexport interface ISettings {\n MIPMAP_TEXTURES: number;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: number;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: number;\n SCALE_MODE: number;\n PRECISION_VERTEX: string;\n PRECISION_FRAGMENT: string;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: number;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV {\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE {\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS {\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nexport enum BLEND_MODES {\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nexport enum DRAW_MODES {\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nexport enum FORMATS {\n RGBA = 6408,\n RGB = 6407,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nexport enum TARGETS {\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nexport enum TYPES {\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n FLOAT = 5126,\n HALF_FLOAT = 36193,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES {\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES {\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nexport enum MIPMAP_MODES {\n OFF,\n POW2,\n ON,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES {\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2,\n}\n\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES {\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES {\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nexport enum PRECISION {\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nexport enum MASK_TYPES {\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY {\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nexport { settings };\n","let saidHello = false;\nconst VERSION = '__VERSION__';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n window.console.log(...args);\n }\n else if (window.console)\n {\n window.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean|undefined;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string' && string[0] === '#')\n {\n string = string.substr(1);\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array|number[],\n alpha: number,\n out: Float32Array,\n premultiply: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array|Uint32Array = null): Uint16Array|Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(array: ITypedArray): 'Float32Array'|'Uint32Array'|'Int32Array'|'Uint16Array'|'Uint8Array'|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array|Uint32Array|Int32Array|Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1|0|1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n public canvas: HTMLCanvasElement;\n\n public context: CanvasRenderingContext2D;\n\n public resolution: number;\n\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution: number)\n {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n resize(width: number, height: number): void\n {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n }\n\n /**\n * Destroys this canvas.\n *\n */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = val;\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = val;\n }\n}\n","interface Inset {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import * as _url from 'url';\n\nlet tempAnchor: HTMLAnchorElement|undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = window.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\nexport enum SHAPES {\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri {\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { SHAPES } from '../const';\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nexport class Rectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.RECT;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get left(): number\n {\n return this.x;\n }\n\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get top(): number\n {\n return this.y;\n }\n\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Circle\n{\n public x: number;\n public y: number;\n public radius: number;\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ellipse\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n}\n","import { SHAPES } from '../const';\nimport type { IPoint } from '../IPoint';\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nexport class Polygon\n{\n public points: number[];\n public closeStroke: boolean;\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPoint[]|number[]);\n constructor(...points: IPoint[]|number[]);\n /**\n * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPoint[]|number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPoint).x, (flat[i] as IPoint).y);\n }\n\n flat = p;\n }\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = flat as number[];\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public radius: number;\n public readonly type: SHAPES.RREC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))\n {\n return true;\n }\n let dx = x - (this.x + this.radius);\n let dy = y - (this.y + this.radius);\n const radius2 = this.radius * this.radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class Point implements IPoint\n{\n public x: number;\n public y: number;\n\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class ObservablePoint implements IPoint\n{\n public cb: (this: T) => any;\n public scope: any;\n _x: number;\n _y: number;\n\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Matrix\n{\n public a: number;\n public b: number;\n public c: number;\n public d: number;\n public tx: number;\n public ty: number;\n\n public array: Float32Array|null = null;\n\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x - How much to translate x by\n * @param {number} y - How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x - The amount to scale horizontally\n * @param {number} y - The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n public worldTransform: Matrix;\n public localTransform: Matrix;\n public position: ObservablePoint;\n public scale: ObservablePoint;\n public pivot: ObservablePoint;\n public skew: ObservablePoint;\n public _parentID: number;\n _worldID: number;\n\n protected _rotation: number;\n protected _cx: number;\n protected _sx: number;\n protected _cy: number;\n protected _sy: number;\n protected _localID: number;\n protected _currentLocalID: number;\n\n constructor()\n {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n\n /**\n * Called when a value changes.\n *\n * @protected\n */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n /**\n * Updates the local transformation matrix.\n */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nexport class Bounds\n{\n public minX: number;\n public minY: number;\n public maxX: number;\n public maxY: number;\n public rect: Rectangle;\n public updateID: number;\n\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { DEG_TO_RAD, Matrix, Point, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Container } from './Container';\nimport { Bounds } from './Bounds';\n\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions {\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends GlobalMixins.DisplayObject, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should b e extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n public parent: DisplayObject;\n public worldAlpha: number;\n public transform: Transform;\n public alpha: number;\n public visible: boolean;\n public renderable: boolean;\n public filterArea: Rectangle;\n public filters: Filter[];\n public isSprite: boolean;\n public isMask: boolean;\n public _lastSortedIndex: number;\n public _mask: Container|MaskData;\n public _bounds: Bounds;\n public _localBounds: Bounds;\n\n protected _zIndex: number;\n protected _enabledFilters: Filter[];\n protected _boundsID: number;\n protected _boundsRect: Rectangle;\n protected _localBoundsRect: Rectangle;\n protected _destroyed: boolean;\n\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n this._bounds = new Bounds();\n\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n this._localBounds = null;\n\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n this._boundsID = 0;\n\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._boundsRect = null;\n\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n /**\n * Recalculates the bounds of the display object.\n */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal

(position: IPointData, from: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n destroy(_options?: IDestroyOptions|boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.removeAllListeners();\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this._mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.DisplayObject} current parent\n */\n enableTempParent(): DisplayObject\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param {PIXI.DisplayObject} cacheParent actual parent of element\n */\n disableTempParent(cacheParent: DisplayObject): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: ObservablePoint)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: ObservablePoint)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: ObservablePoint)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: ObservablePoint)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get mask(): Container|MaskData|null\n {\n return this._mask;\n }\n\n set mask(value: Container|MaskData|null)\n {\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n }\n}\n\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport { Rectangle } from '@pixi/math';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n public readonly children: DisplayObject[];\n public sortableChildren: boolean;\n public sortDirty: boolean;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n protected onChildrenChange(_length: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: T, index: number): T\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child: DisplayObject, child2: DisplayObject): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child: DisplayObject): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child: DisplayObject, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index: number): DisplayObject\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index: number): DisplayObject\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): DisplayObject[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).maskObject || child._mask) as Container;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n renderer.batch.flush();\n\n const filters = this.filters;\n const mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].render(renderer);\n }\n\n renderer.batch.flush();\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @function containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget {\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: true;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement {\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n","import { DisplayObject } from '@pixi/display';\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { accessibleTarget } from './accessibleTarget';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Container } from '@pixi/display';\nimport type { Renderer, AbstractRenderer } from '@pixi/core';\nimport type { IAccessibleHTMLElement } from './accessibleTarget';\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nexport class AccessibilityManager\n{\n public debug: boolean;\n public renderer: AbstractRenderer|Renderer;\n\n private _isActive: boolean;\n private _isMobileAccessibility: boolean;\n private _hookDiv: HTMLElement;\n private div: HTMLElement;\n private pool: IAccessibleHTMLElement[];\n private renderId: number;\n private children: DisplayObject[];\n private androidUpdateCount: number;\n private androidUpdateFrequency: number;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer|Renderer)\n {\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n this._isActive = false;\n\n this._isMobileAccessibility = false;\n\n /**\n * count to throttle div updates on android devices\n * @type number\n * @private\n */\n this.androidUpdateCount = 0;\n\n /**\n * the frequency to update the div elements ()\n * @private\n */\n this.androidUpdateFrequency = 500; // 2fps\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isActive(): boolean\n {\n return this._isActive;\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility(): boolean\n {\n return this._isMobileAccessibility;\n }\n\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n private createTouchHook(): void\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessability for this content';\n\n hookDiv.addEventListener('focus', () =>\n {\n this._isMobileAccessibility = true;\n this.activate();\n this.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n private destroyTouchHook(): void\n {\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n private activate(): void\n {\n if (this._isActive)\n {\n return;\n }\n\n this._isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).on('postrender', this.update, this);\n\n if ((this.renderer as AbstractRenderer).view.parentNode)\n {\n (this.renderer as AbstractRenderer).view.parentNode.appendChild(this.div);\n }\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n private deactivate(): void\n {\n if (!this._isActive || this._isMobileAccessibility)\n {\n return;\n }\n\n this._isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n private updateAccessibleObjects(displayObject: Container): void\n {\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i] as Container);\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n private update(): void\n {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n const now = performance.now();\n\n if (isMobile.android.device && now < this.androidUpdateCount)\n {\n return;\n }\n\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n\n if (!(this.renderer as Renderer).renderingToScreen)\n {\n return;\n }\n\n // update children...\n if (this.renderer._lastObjectRendered)\n {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered as Container);\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const rect = (this.renderer as AbstractRenderer).view.getBoundingClientRect();\n\n const resolution = this.renderer.resolution;\n\n const sx = (rect.width / (this.renderer as AbstractRenderer).width) * resolution;\n const sy = (rect.height / (this.renderer as AbstractRenderer).height) * resolution;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${(this.renderer as AbstractRenderer).width}px`;\n div.style.height = `${(this.renderer as AbstractRenderer).height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea as Rectangle;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) this.updateDebugHTML(div);\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n public updateDebugHTML(div: IAccessibleHTMLElement): void\n {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n public capHitArea(hitArea: Rectangle): void\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n if (hitArea.x + hitArea.width > (this.renderer as AbstractRenderer).width)\n {\n hitArea.width = (this.renderer as AbstractRenderer).width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > (this.renderer as AbstractRenderer).height)\n {\n hitArea.height = (this.renderer as AbstractRenderer).height - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n private addChild(displayObject: T): void\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) this.updateDebugHTML(div);\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n private _onClick(e: MouseEvent): void\n {\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'click', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'pointertap', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'tap', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n private _onFocus(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'assertive');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'mouseover', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n private _onFocusOut(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'polite');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent((e.target as any).displayObject, 'mouseout', interactionManager.eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n private _onKeyDown(e: KeyboardEvent): void\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n private _onMouseMove(e: MouseEvent): void\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n public destroy(): void\n {\n this.destroyTouchHook();\n this.div = null;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY {\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","import { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n public priority: number;\n public next: TickerListener;\n public previous: TickerListener;\n\n private fn: TickerCallback;\n private context: T;\n private once: boolean;\n private _destroyed: boolean;\n\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n static _shared: Ticker;\n static _system: Ticker;\n\n public autoStart: boolean;\n public deltaTime: number;\n public deltaMS: number;\n public elapsedMS: number;\n public lastTime: number;\n public speed: number;\n public started: boolean;\n\n private _head: TickerListener;\n private _requestId: number;\n private _maxElapsedMS: number;\n private _minElapsedMS: number;\n private _protected: boolean;\n private _lastFrame: number;\n private _tick: (time: number) => any;\n\n constructor()\n {\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / settings.TARGET_FPMS;\n\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n add(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n addOnce(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n remove(fn: TickerCallback, context: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { IApplicationOptions } from '@pixi/app';\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n","import { Point, IPointData } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\n\nexport type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionData\n{\n public global: Point;\n public target: DisplayObject;\n public originalEvent: InteractivePointerEvent;\n public identifier: number;\n public isPrimary: boolean;\n public button: number;\n public buttons: number;\n public width: number;\n public height: number;\n public tiltX: number;\n public tiltY: number;\n public pointerType: string;\n public pressure = 0;\n public rotationAngle = 0;\n public twist = 0;\n public tangentialPressure = 0;\n\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId(): number\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n public getLocalPosition

(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P\n {\n return displayObject.worldTransform.applyInverse

(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n public copyEvent(event: Touch | InteractivePointerEvent): void\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n const buttons = 'buttons' in event && event.buttons;\n\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n public reset(): void\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","import type { DisplayObject } from '@pixi/display';\nimport type { InteractionData } from './InteractionData';\n\nexport type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionEvent\n{\n public stopped: boolean;\n public stopsPropagatingAt: DisplayObject;\n public stopPropagationHint: boolean;\n public target: DisplayObject;\n public currentTarget: DisplayObject;\n public type: string;\n public data: InteractionData;\n\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n public stopPropagation(): void\n {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n }\n\n /**\n * Resets the event.\n */\n public reset(): void\n {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","export interface InteractionTrackingFlags\n{\n OVER: number;\n LEFT_DOWN: number;\n RIGHT_DOWN: number;\n NONE: number;\n}\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class InteractionTrackingData\n{\n public static FLAGS: Readonly = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n\n private readonly _pointerId: number;\n private _flags: number;\n\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n constructor(pointerId: number)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n private _doSet(flag: number, yn: boolean): void\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get pointerId(): number\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get flags(): number\n {\n return this._flags;\n }\n\n set flags(flags: number)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get none(): boolean\n {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get over(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n }\n\n set over(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get rightDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n set rightDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get leftDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n }\n\n set leftDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n }\n}\n","import { Point } from '@pixi/math';\n\nimport type { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport type { Container, DisplayObject } from '@pixi/display';\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TreeSearch\n{\n private readonly _tempPoint: Point;\n\n constructor()\n {\n this._tempPoint = new Point();\n }\n\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n public recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean, interactive?: boolean\n ): boolean\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!((displayObject._mask as any).containsPoint && (displayObject._mask as any).containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && (displayObject as Container).children)\n {\n const children = (displayObject as Container).children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && (displayObject as any).containsPoint)\n {\n if ((displayObject as any).containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n public findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n }\n}\n","import type { InteractionTrackingData } from './InteractionTrackingData';\n\nexport type Cursor = 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ns-resize'\n | 'ew-resize'\n | 'nesw-resize'\n | 'col-resize'\n | 'nwse-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out'\n | 'grab'\n | 'grabbing';\n\nexport interface IHitArea {\n contains(x: number, y: number): boolean;\n}\n\nexport interface InteractiveTarget {\n interactive: boolean;\n interactiveChildren: boolean;\n hitArea: IHitArea;\n cursor: Cursor | string;\n buttonMode: boolean;\n trackedPointers: {[x: number]: InteractionTrackingData};\n _trackedPointers: {[x: number]: InteractionTrackingData};\n}\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nexport const interactiveTarget: InteractiveTarget = {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode(): boolean\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value: boolean)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n","import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject, TemporaryDisplayObject } from '@pixi/display';\nimport { InteractionData, InteractivePointerEvent } from './InteractionData';\nimport { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport { InteractionTrackingData } from './InteractionTrackingData';\nimport { TreeSearch } from './TreeSearch';\nimport { EventEmitter } from '@pixi/utils';\nimport { interactiveTarget } from './interactiveTarget';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { Point, IPointData } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\nDisplayObject.mixin(interactiveTarget);\n\nconst MOUSE_POINTER_ID = 1;\n\n// Mock interface for hitTestEvent - only used inside hitTest()\ninterface TestInteractionEvent\n{\n target: DisplayObject;\n data: {global: Point};\n}\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent: TestInteractionEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\nexport interface InteractionManagerOptions {\n autoPreventDefault?: boolean;\n interactionFrequency?: number;\n useSystemTicker?: boolean;\n}\n\nexport interface DelayedEvent {\n displayObject: DisplayObject;\n eventString: string;\n eventData: InteractionEvent;\n}\n\ninterface CrossCSSStyleDeclaration extends CSSStyleDeclaration\n{\n msContentZooming: string;\n msTouchAction: string;\n}\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class InteractionManager extends EventEmitter\n{\n public readonly activeInteractionData: { [key: number]: InteractionData };\n public readonly supportsTouchEvents: boolean;\n public readonly supportsPointerEvents: boolean;\n public interactionDataPool: InteractionData[];\n public cursor: string;\n public delayedEvents: DelayedEvent[];\n public search: TreeSearch;\n public renderer: AbstractRenderer;\n public autoPreventDefault: boolean;\n public interactionFrequency: number;\n public mouse: InteractionData;\n public eventData: InteractionEvent;\n public moveWhenInside: boolean;\n public cursorStyles: Dict void) | CSSStyleDeclaration>;\n public currentCursorMode: string;\n public resolution: number;\n\n protected interactionDOMElement: HTMLElement;\n protected eventsAdded: boolean;\n protected tickerAdded: boolean;\n protected mouseOverRenderer: boolean;\n\n private _useSystemTicker: boolean;\n private _deltaTime: number;\n private _didMove: boolean;\n private _tempDisplayObject: DisplayObject;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n constructor(renderer: AbstractRenderer, options: InteractionManagerOptions)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n this.tickerAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObject = new TemporaryDisplayObject();\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get useSystemTicker(): boolean\n {\n return this._useSystemTicker;\n }\n set useSystemTicker(useSystemTicker: boolean)\n {\n this._useSystemTicker = useSystemTicker;\n\n if (useSystemTicker)\n {\n this.addTickerListener();\n }\n else\n {\n this.removeTickerListener();\n }\n }\n\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get lastObjectRendered(): DisplayObject\n {\n return this.renderer._lastObjectRendered || this._tempDisplayObject;\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n public hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent as InteractionEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n public setTargetElement(element: HTMLElement, resolution = 1): void\n {\n this.removeTickerListener();\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n\n this.addTickerListener();\n }\n\n /**\n * Add the ticker listener\n *\n * @private\n */\n private addTickerListener(): void\n {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker)\n {\n return;\n }\n\n Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n\n this.tickerAdded = true;\n }\n\n /**\n * Remove the ticker listener\n *\n * @private\n */\n private removeTickerListener(): void\n {\n if (!this.tickerAdded)\n {\n return;\n }\n\n Ticker.system.remove(this.tickerUpdate, this);\n\n this.tickerAdded = false;\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n private addEvents(): void\n {\n if (this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n private removeEvents(): void\n {\n if (!this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n public tickerUpdate(deltaTime: number): void\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n this.update();\n }\n\n /**\n * Updates the state of interactive objects.\n */\n public update(): void\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove)\n {\n this._didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent as PointerEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n public setCursorMode(mode: string): void\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n private dispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if ((displayObject as any)[eventString])\n {\n (displayObject as any)[eventString](eventData);\n }\n }\n }\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n private delayDispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n this.delayedEvents.push({ displayObject, eventString, eventData });\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n public mapPositionToPoint(point: IPointData, x: number, y: number): void\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * ((this.interactionDOMElement as any).width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * ((this.interactionDOMElement as any).height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n public processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n const hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n const delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n const delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (let i = 0; i < delayedLen; i++)\n {\n const { displayObject, eventString, eventData } = delayedEvents[i];\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject, eventString, eventData);\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n private onPointerDown(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && (events[0] as any).isNormalized)\n {\n const cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerDown(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n private onPointerComplete(originalEvent: InteractivePointerEvent, cancelled: boolean, func: InteractionCallback): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerCancel(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n private processPointerCancel(interactionEvent: InteractionEvent, displayObject: DisplayObject): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerUp(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerUp(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n private onPointerMove(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this._didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerMove(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n private onPointerOut(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerOverOut(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n private onPointerOver(originalEvent: InteractivePointerEvent): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n private getInteractionDataForPointerId(event: PointerEvent): InteractionData\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n private releaseInteractionDataForPointerId(pointerId: number): void\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n private configureInteractionEventForDOMEvent(interactionEvent: InteractionEvent, pointerEvent: PointerEvent,\n interactionData: InteractionData\n ): InteractionEvent\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n (pointerEvent as any).globalX = interactionData.global.x;\n (pointerEvent as any).globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n private normalizeToPointerData(event: InteractivePointerEvent): PointerEvent[]\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i] as PixiTouch;\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n const tempEvent = event as PixiPointerEvent;\n\n if (typeof tempEvent.isPrimary === 'undefined') tempEvent.isPrimary = true;\n if (typeof tempEvent.width === 'undefined') tempEvent.width = 1;\n if (typeof tempEvent.height === 'undefined') tempEvent.height = 1;\n if (typeof tempEvent.tiltX === 'undefined') tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === 'undefined') tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === 'undefined') tempEvent.pointerType = 'mouse';\n if (typeof tempEvent.pointerId === 'undefined') tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === 'undefined') tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === 'undefined') tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === 'undefined') tempEvent.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n\n normalizedEvents.push(tempEvent);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents as PointerEvent[];\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n public destroy(): void\n {\n this.removeEvents();\n\n this.removeTickerListener();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n }\n}\n\ninterface PixiPointerEvent extends PointerEvent\n{\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n isNormalized: boolean;\n}\n\ninterface PixiTouch extends Touch\n{\n button: number;\n buttons: number;\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n layerX: number;\n layerY: number;\n offsetX: number;\n offsetY: number;\n isNormalized: boolean;\n}\n","/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param {string} name - the function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /**\n * Remove all references, don't use after this.\n */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n","import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type{ ISize } from '@pixi/math';\nimport type{ ICubeResourceOptions } from './CubeResource';\nimport type{ ISVGResourceOptions } from './SVGResource';\nimport type{ IVideoResourceOptions } from './VideoResource';\n\n/**\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/**\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n | ICubeResourceOptions\n | IImageResourceOptions\n | ISVGResourceOptions\n | IVideoResourceOptions\n | IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: any): Resource;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: IAutoDetectOptions): Resource\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i];\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nexport abstract class Resource\n{\n public destroyed: boolean;\n public internal: boolean;\n protected _width: number;\n protected _height: number;\n protected onResize: Runner;\n protected onUpdate: Runner;\n protected onError: Runner;\n /**\n * @param {number} [width=0] - Width of the resource\n * @param {number} [height=0] - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new Runner('setRealSize');\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new Runner('update');\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param {number} width - X dimension\n * @param {number} height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /**\n * Has been updated trigger event\n */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BufferResource extends Resource\n{\n data: Float32Array|Uint8Array|Uint32Array;\n\n /**\n * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer\n * @param {object} options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array|Uint8Array|Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /**\n * Destroy and don't use after this\n * @override\n */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array|Uint8Array|Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap;\n\nexport interface IBaseTextureOptions {\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n resourceOptions?: any;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nexport class BaseTexture extends EventEmitter\n{\n public width: number;\n public height: number;\n public resolution: number;\n public alphaMode?: ALPHA_MODES;\n public mipmap?: MIPMAP_MODES;\n public anisotropicLevel?: number;\n public scaleMode?: SCALE_MODES;\n public wrapMode?: WRAP_MODES;\n public format?: FORMATS;\n public type?: TYPES;\n public target?: TARGETS;\n\n public readonly uid: number;\n touched: number;\n isPowerOfTwo: boolean;\n\n _glTextures: { [key: number]: GLTexture };\n dirtyId: number;\n dirtyStyleId: number;\n public cacheId: string;\n public valid: boolean;\n textureCacheIds: Array;\n public destroyed: boolean;\n public resource: Resource;\n _batchEnabled: number;\n _batchLocation: number;\n parentTextureArray: BaseTexture;\n\n constructor(resource: Resource | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = width || 0;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = height || 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n\n /**\n * How the texture wraps\n * @member {number}\n */\n this.wrapMode = wrapMode || settings.WRAP_MODE;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n this.format = format || FORMATS.RGBA;\n\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n this.type = type || TYPES.UNSIGNED_BYTE;\n\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n this.target = target || TARGETS.TEXTURE_2D;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {number}\n * @protected\n */\n this.uid = uid();\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n this.touched = 0;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n this._glTextures = {};\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n this.dirtyStyleId = 0;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n this.cacheId = null;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n this.valid = width > 0 && height > 0;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n this.textureCacheIds = [];\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n this.destroyed = false;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n this.resource = null;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchEnabled = 0;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchLocation = 0;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realWidth(): number\n {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n }\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realHeight(): number\n {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n }\n\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width - Visual width\n * @param {number} height - Visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setSize(width: number, height: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n setResource(resource: Resource): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource|string, options: IBaseTextureOptions,\n strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture|null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport { ISize } from '@pixi/math';\nimport { autoDetectResource, IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {object} [options] Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n readonly length: number;\n items: Array;\n itemDirtyIds: Array;\n private _load: Promise;\n\n baseTexture: BaseTexture;\n\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n /**\n * Collection of partial baseTextures that correspond to resources\n * @member {Array}\n * @readonly\n */\n this.items = [];\n\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n this.length = length;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Bound baseTexture, there can only be one\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n }\n\n /**\n * used from ArrayResource and CubeResource constructors\n * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param {object} [options] - detect options for resources\n * @protected\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.AbstractMultiResource} Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n constructor(source: number|Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n texture.format,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n texture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BaseImageResource extends Resource\n{\n public source: ImageSource;\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n this.source = source;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement|HTMLVideoElement, url: string, crossorigin: boolean|string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas|HTMLCanvasElement\n {\n const { OffscreenCanvas } = window;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Constructor options for CubeResource\n */\nexport interface ICubeResourceOptions extends ISize\n{\n autoLoad?: boolean;\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n linkBaseTexture: boolean;\n\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself\n * @member {boolean}\n * @protected\n */\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {object} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n autoLoad?: boolean;\n createBitmap?: boolean;\n crossorigin?: boolean|string;\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nexport class ImageResource extends BaseImageResource\n{\n url: string;\n private _load: Promise;\n private _process: Promise;\n preserveBitmap: boolean;\n createBitmap: boolean;\n alphaMode: ALPHA_MODES;\n bitmap: ImageBitmap;\n /**\n * @param {HTMLImageElement|string} source - image source or URL\n * @param {object} [options]\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement|string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n /**\n * URL of the image source\n * @member {string}\n */\n this.url = source.src;\n\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n this._process = null;\n\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n this.preserveBitmap = false;\n\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n this.bitmap = null;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap] - whether process image into bitmap\n * @returns {Promise}\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n this._process = (window.createImageBitmap as any)(source,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {string|HTMLImageElement} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string|HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean|string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\nexport class SVGResource extends BaseImageResource\n{\n public readonly svg: string;\n public readonly scale: number;\n readonly _overrideWidth: number;\n readonly _overrideHeight: number;\n private _resolve: () => void;\n private _load: Promise;\n private _crossorigin?: boolean|string;\n\n constructor(sourceBase64: string, options: ISVGResourceOptions)\n {\n options = options || {};\n\n super(document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n this.svg = sourceBase64;\n\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n this.scale = options.scale || 1;\n\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideWidth = options.width;\n\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideHeight = options.height;\n\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n this._resolve = null;\n\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n this._crossorigin = options.crossorigin;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if ((/^\\\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using regexp.\n *\n * @method\n * @param {string} svgString - a serialized svg element\n * @return {PIXI.ISize} image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && (/^data:image\\/svg\\+xml(;(charset=utf8|utf8))?;base64/).test(source))\n // source is SVG inline\n || (typeof source === 'string' && source.indexOf(']*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean|string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nexport class VideoResource extends BaseImageResource\n{\n protected _autoUpdate: boolean;\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n protected autoPlay: boolean;\n private _load: Promise;\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n constructor(source?: HTMLVideoElement|Array|string, options?: IVideoResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = true;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = options.autoPlay !== false;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n *\n * @private\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState === 3 || source.readyState === 4;\n }\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\n static TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @constant\n * @member {object}\n * @static\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {ImageBitmap} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\n/**\n * Collection of base resource types supported by PixiJS.\n *\n * Resources are used by {@link PIXI.BaseTexture} to handle different media types\n * such as images, video, SVG graphics, etc. In most use-cases, you should not\n * instantiate the resources directly. The easy thing is to use\n * {@link PIXI.BaseTexture.from}.\n * @example\n * const baseTexture = PIXI.BaseTexture.from('path/to/image.jpg');\n * @namespace PIXI.resources\n */\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import type { Renderer } from './Renderer';\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nexport class System\n{\n // public because of Filter usage,\n // protected because usually renderer it already known by those who use the system\n renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n destroy(): void\n {\n (this as any).renderer = null;\n }\n}\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0\n renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n public width: number;\n public height: number;\n public multisample: MSAA_QUALITY;\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.ceil(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.ceil(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(renderTexture, myContainer);\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable depth on the frame buffer\n */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable stencil on the frame buffer\n */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n maskStack: Array;\n filterStack: Array;\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated.\n */\n constructor(options: IBaseTextureOptions)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n super(null, options);\n\n const { width, height } = options || {};\n\n // Set defaults\n this.mipmap = 0;\n this.width = Math.ceil(width) || 100;\n this.height = Math.ceil(height) || 100;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)\n .addColorTexture(0, this);\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /**\n * Destroys this texture.\n */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n public x0: number;\n public y0: number;\n public x1: number;\n public y1: number;\n public x2: number;\n public y2: number;\n public x3: number;\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { IPointData } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string|BaseTexture|ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class Texture extends EventEmitter\n{\n public baseTexture: BaseTexture;\n public orig: Rectangle;\n public trim: Rectangle;\n public valid: boolean;\n public noFrame: boolean;\n public defaultAnchor: Point;\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n _updateID: number;\n _frame: Rectangle;\n _uvs: TextureUvs;\n textureCacheIds: Array;\n\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n this._uvs = DEFAULT_UVS;\n\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const resource = this.baseTexture as any;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n clone(): Texture\n {\n return new Texture(this.baseTexture,\n this.frame.clone(),\n this.orig.clone(),\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource, options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture)\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url The remote URL to load.\n * @param {object} [options] Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n static fromURL(url: string, options?: IBaseTextureOptions): Promise\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource as ImageResource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n static fromLoader(source: HTMLImageElement|HTMLCanvasElement, imageUrl: string, name: string): Texture\n {\n const resource = new ImageResource(source as any);\n\n resource.url = imageUrl;\n\n const baseTexture = new BaseTexture(resource, {\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n });\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n static removeFromCache(texture: string|Texture): Texture|null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.orig.height;\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n static readonly EMPTY: Texture;\n static readonly WHITE: Texture;\n}\n\nfunction createWhiteTexture(): Texture\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public filterFrame: Rectangle|null;\n public filterPoolKey: string|number|null;\n legacyRenderer: any;\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n // support for legacy..\n let _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n const width = arguments[1];\n const height = arguments[2];\n const scaleMode = arguments[3];\n const resolution = arguments[4];\n\n // we have an old render texture..\n console.warn(`Please use RenderTexture.create(${width}, ${height}) instead of the ctor directly.`);\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width,\n height,\n scaleMode,\n resolution,\n });\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n super(baseRenderTexture, frame);\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n this.filterFrame = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @member {PIXI.Framebuffer}\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return (this.baseTexture as BaseRenderTexture).framebuffer;\n }\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n resize(width: number, height: number, resizeBaseTexture = true): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n (this.baseTexture as BaseRenderTexture).resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n static create(options: IBaseTextureOptions): RenderTexture\n {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n public enableFullScreen: boolean;\n texturePool: {[x in string|number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n /**\n * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth - width of texture in pixels\n * @param {number} realHeight - height of texture in pixels\n * @returns {RenderTexture}\n */\n createTexture(realWidth: number, realHeight: number): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n let key: number|string = RenderTexturePool.SCREEN_KEY;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input: RenderTexture, resolution: number): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] - destroy all stored textures\n */\n clear(destroyTextures: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n const screenKey = RenderTexturePool.SCREEN_KEY;\n const textures = this.texturePool[screenKey];\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\n static SCREEN_KEY = 'screen';\n}\n","import type { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n /**\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data)\n */\n constructor(buffer: number, size = 0, normalized = false, type = 5126, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /**\n * Destroys the Attribute.\n */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n *\n * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nexport class Buffer\n{\n public data: ITypedArray;\n public index: boolean;\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param {boolean} [_static=true] - `true` for static buffer\n * @param {boolean} [index=false] - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n\n this._updateID = 0;\n\n this.index = index;\n\n this.static = _static;\n\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer): void\n {\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the buffer\n */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import type { ITypedArray } from '../Buffer';\n\nexport function getBufferType(array: ITypedArray): string|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from './utils/getBufferType';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n public instanced: boolean;\n public instanceCount: number;\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n refCount: number;\n /**\n * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional.\n * @param {object} [attributes] - of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param {String} id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start] - How far into the array to start reading values (used for interleaving data)\n * @param {boolean} [instance=false] - Instancing flag\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer|Float32Array|Uint32Array|Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * returns the requested attribute\n *\n * @param {String} id - the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * returns the requested buffer\n *\n * @param {String} id - the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.index = true;\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the geometry.\n */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n\n return geometry;\n }\n\n /**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries - array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n vertices: Float32Array;\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nexport class UniformGroup\n{\n public readonly uniforms: Dict;\n public readonly group: boolean;\n public id: number;\n syncUniforms: Dict;\n dirtyId: number;\n static: boolean;\n\n /**\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n * @param {boolean} [_static] - Uniforms wont be changed after creation\n */\n constructor(uniforms: Dict, _static?: boolean)\n {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n }\n\n update(): void\n {\n this.dirtyId++;\n }\n\n add(name: string, uniforms: Dict, _static: boolean): void\n {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n }\n\n static from(uniforms: Dict, _static: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static);\n }\n}\n","import { Rectangle } from '@pixi/math';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n target: IFilterTarget;\n legacy: boolean;\n resolution: number;\n sourceFrame: Rectangle;\n destinationFrame: Rectangle;\n filters: Array;\n\n constructor()\n {\n this.renderTexture = null;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new Rectangle();\n\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n }\n\n /**\n * clears the state\n * @private\n */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { System } from '../System';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\nimport { FilterState } from './FilterState';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class FilterSystem extends System\n{\n public readonly defaultFilterStack: Array;\n public statePool: Array;\n public texturePool: RenderTexturePool;\n public forceClear: boolean;\n public useMaxPadding: boolean;\n protected quad: Quad;\n protected quadUv: QuadUv;\n protected activeState: FilterState;\n protected globalUniforms: UniformGroup;\n private tempRect: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n this.defaultFilterStack = [{}] as any;\n\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n this.texturePool = new RenderTexturePool();\n\n this.texturePool.setScreenSize(renderer.view);\n\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n this.statePool = [];\n\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n this.quad = new Quad();\n\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n this.quadUv = new QuadUv();\n\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n this.tempRect = new Rectangle();\n\n /**\n * Active state\n * @member {object}\n */\n this.activeState = {} as any;\n\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n this.globalUniforms = new UniformGroup({\n outputFrame: this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n /**\n * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}\n * @member {boolean}\n */\n this.forceClear = false;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @member {boolean}\n * @default false\n */\n this.useMaxPadding = false;\n }\n\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n\n let resolution = filters[0].resolution;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n let legacy = filters[0].legacy;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || filter.legacy;\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n\n state.legacy = legacy;\n\n state.target = target;\n\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n if (autoFit)\n {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.renderTexture.clear();\n }\n\n /**\n * Pops off the filter and applies it.\n *\n */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n if (state.renderTexture.framebuffer.multisample > 1)\n {\n this.renderer.framebuffer.blit();\n }\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode = CLEAR_MODES.CLEAR): void\n {\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else\n {\n this.renderer.renderTexture.bind(filterTexture);\n }\n\n // TODO: remove in next major version\n if (typeof clearMode === 'boolean')\n {\n clearMode = clearMode ? CLEAR_MODES.CLEAR : CLEAR_MODES.BLEND;\n // get deprecation function from utils\n deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option');\n }\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && this.forceClear))\n {\n this.renderer.renderTexture.clear();\n }\n }\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /**\n * Destroys this Filter System.\n */\n destroy(): void\n {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input?: RenderTexture, resolution?: number): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /**\n * Empties the texture pool.\n */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n}\n","import type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nexport class ObjectRenderer\n{\n protected renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n flush(): void\n {\n // flush!\n }\n\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { System } from '../System';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class BatchSystem extends System\n{\n public readonly emptyRenderer: ObjectRenderer;\n public currentRenderer: ObjectRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(renderer);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Reset the system to an empty renderer\n */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param {PIXI.BaseTexture[]} - arr copy destination\n * @param {number} maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray - textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures\n * @param {number} batchId - marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { System } from '../System';\nimport { settings } from '../settings';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict {\n uint32Indices: boolean;\n}\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ContextSystem extends System\n{\n public webGLVersion: number;\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n /* eslint-disable camelcase */\n extensions:\n {\n drawBuffers?: WEBGL_draw_buffers;\n depthTexture?: OES_texture_float;\n loseContext?: WEBGL_lose_context;\n vertexArrayObject?: OES_vertex_array_object;\n anisotropicFiltering?: EXT_texture_filter_anisotropic;\n uint32ElementIndex?: OES_element_index_uint;\n floatTexture?: OES_texture_float;\n floatTextureLinear?: OES_texture_float_linear;\n textureHalfFloat?: OES_texture_half_float;\n textureHalfFloatLinear?: OES_texture_half_float_linear;\n colorBufferFloat?: WEBGL_color_buffer_float;\n };\n /* eslint-enable camelcase */\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n this.webGLVersion = 1;\n\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n this.extensions = {};\n\n /**\n * Features supported by current context\n * @member {object}\n * @private\n * @readonly\n * @property {boolean} uint32Indices - Supports of 32-bit indices buffer\n */\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl - new webgl context\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n }\n\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n event.preventDefault();\n }\n\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n public framebuffer: WebGLFramebuffer;\n public stencil: WebGLRenderbuffer;\n public multisample: MSAA_QUALITY;\n public msaaBuffer: WebGLRenderbuffer;\n public blitFramebuffer: Framebuffer;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = 0;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = 0;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = 0;\n\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class FramebufferSystem extends System\n{\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n for (let i = 0; i < colorTextures.length; i++)\n {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n updateFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1)\n {\n fbo.msaaBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n if (i === 0 && fbo.multisample > 1)\n {\n continue;\n }\n\n const texture = framebuffer.colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n }\n\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))\n {\n fbo.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture)\n { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (fbo.multisample <= 1)\n {\n return;\n }\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]);\n }\n framebuffer = fbo.blitFramebuffer;\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height,\n destPixels.x, destPixels.y, destPixels.width, destPixels.height,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n framebuffer.enableStencil();\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { System } from '../System';\nimport { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Buffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class GeometrySystem extends System\n{\n public hasVao: boolean;\n public hasInstance: boolean;\n public canUseUInt32ElementIndex: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n readonly managedGeometries: {[key: number]: Geometry};\n readonly managedBuffers: {[key: number]: Buffer};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this._activeGeometry = null;\n this._activeVao = null;\n\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n this.hasVao = true;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n this.hasInstance = true;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n this.canUseUInt32ElementIndex = false;\n\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedGeometries = {};\n\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedBuffers = {};\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry - instance of geometry to bind\n * @param {PIXI.Shader} [shader] - instance of shader to use vao for\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /**\n * Reset and unbind any active VAO and geometry\n */\n reset(): void\n {\n this.unbind();\n }\n\n /**\n * Update buffers\n * @protected\n */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n const { gl } = this;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n\n if (buffer._updateID !== glBuffer.updateID)\n {\n glBuffer.updateID = buffer._updateID;\n\n // TODO can cache this on buffer! maybe added a getter / setter?\n const type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n\n this._boundBuffer = glBuffer;\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n }\n\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry - to get signature from\n * @param {PIXI.Program} program - to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers\n */\n protected initGeometryVao(geometry: Geometry, program: Program, incRefCount = true): WebGLVertexArrayObject\n {\n this.checkCompatibility(geometry, program);\n\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n if (!buffer._glBuffers[CONTEXT_UID])\n {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeBuffer(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n let all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (let i = 0; i < all.length; i++)\n {\n this.disposeBuffer(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /**\n * Unbind/reset everything\n * @protected\n */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\n\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nexport class MaskData\n{\n public type: MASK_TYPES;\n public autoDetect: boolean;\n public maskObject: IMaskTarget;\n public pooled: boolean;\n public isMaskData: true;\n _stencilCounter: number;\n _scissorCounter: number;\n _scissorRect: Rectangle;\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = MASK_TYPES.NONE;\n\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n }\n\n /**\n * resets the mask data after popMask()\n */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n }\n\n /**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param src {string} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nexport function compileProgram(gl: WebGLRenderingContextBase, vertexSrc: string, fragmentSrc: string,\n attributeLocations?: Dict): WebGLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n let program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations)\n {\n for (const i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS))\n {\n console.warn(vertexSrc);\n console.error(gl.getShaderInfoLog(glVertShader));\n }\n\n if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS))\n {\n console.warn(fragmentSrc);\n console.error(gl.getShaderInfoLog(glFragShader));\n }\n\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nexport function defaultValue(type: string, size: number): number|Float32Array|Int32Array|boolean|boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = document.createElement('canvas');\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext);\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: string;\n\nexport function getMaxFragmentPrecision(): string\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: string, maxSupportedPrecision: string): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.shader\n * @param type {String}\n * @return {Number}\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any): boolean =>\n // eslint-disable-next-line max-len\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray,\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }`,\n\n vec2: `\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i].group)\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv[\"${i}\"], syncData);\n `);\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cv = ud[\"${i}\"].value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /**\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n defaultValue,\n compileProgram,\n mapSize,\n mapType,\n getTestContext,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n type: string;\n size: number;\n isArray: RegExpMatchArray;\n value: any;\n}\n\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n public vertexSrc: string;\n public fragmentSrc: string;\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n attributeData: { [key: string]: IAttributeData};\n uniformData: {[key: string]: IUniformData};\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name] - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\n protected extractData(vertexSrc: string, fragmentSrc: string): void\n {\n const gl = getTestContext();\n\n if (gl)\n {\n const program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n\n gl.deleteProgram(program);\n }\n else\n {\n this.uniformData = {};\n this.attributeData = {};\n }\n }\n\n /**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\n protected getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n {\n const attributes: {[key: string]: IAttributeData} = {};\n const attributesArray: Array = [];\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n const type = mapType(gl, attribData.type);\n\n /*eslint-disable */\n const data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n\n attributesArray.sort((a, b) => (a.name > b.name) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < attributesArray.length; i++)\n {\n attributesArray[i].location = i;\n }\n\n return attributes;\n }\n\n /**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\n private getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n {\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = uniformData.name.match(/\\[.*?\\]$/);\n const type = mapType(gl, uniformData.type);\n\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray:isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n\n return uniforms;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nexport class Shader\n{\n public program: Program;\n public uniformGroup: UniformGroup;\n /**\n * @param {PIXI.Program} [program] - The program the shader will use.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms: Dict)\n {\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (const i in program.uniformData)\n {\n if (this.uniformGroup.uniforms[i] instanceof Array)\n {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { State } from '../state/State';\nimport { settings } from '@pixi/settings';\nimport defaultVertex from './defaultFilter.vert';\nimport defaultFragment from './defaultFilter.frag';\n\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterSystem } from './FilterSystem';\nimport type { FilterState } from './FilterState';\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class Filter extends Shader\n{\n public padding: number;\n public resolution: number;\n public enabled: boolean;\n public autoFit: boolean;\n public legacy: boolean;\n state: State;\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n this.legacy = !!this.program.attributeData.aTextureCoord;\n\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n this.state = new State();\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * Used for caching shader IDs\n *\n * @static\n * @type {object}\n * @protected\n */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n public mapCoord: Matrix;\n public clampOffset: number;\n public clampMargin: number;\n readonly uClampFrame: Float32Array;\n readonly uClampOffset: Float32Array;\n _textureID: number;\n _updateID: number;\n _texture: Texture;\n isSimple: boolean;\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport { Matrix, Point } from '@pixi/math';\nimport { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n maskMatrix: Matrix;\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n constructor(sprite: IMaskTarget)\n {\n const maskMatrix = new Matrix();\n\n super(vertex, fragment);\n\n sprite.renderable = false;\n\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n this.maskSprite = sprite;\n\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n this.maskMatrix = maskMatrix;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this.maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { System } from '../System';\nimport { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class MaskSystem extends System\n{\n public enableScissor: boolean;\n protected readonly alphaMaskPool: Array;\n protected alphaMaskIndex: number;\n private readonly maskDataPool: Array;\n private maskStack: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n this.enableScissor = false;\n\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n this.alphaMaskPool = [];\n\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n this.maskDataPool = [];\n\n this.maskStack = [];\n\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData|IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n\n return;\n }\n maskData.type = MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect())\n {\n const matrix = maskObject.worldTransform;\n\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n\n let rotX = Math.atan2(matrix.b, matrix.a);\n let rotXY = Math.atan2(matrix.d, matrix.c);\n\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n\n if (rotX === 0 && rotXY === 9000)\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n popSpriteMask(): void\n {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n }\n}\n","import { System } from '../System';\n\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class AbstractMaskSystem extends System\n{\n protected maskStack: Array;\n protected glConst: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n this.glConst = 0;\n }\n\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /**\n * Destroys the mask stack.\n *\n */\n destroy(): void\n {\n super.destroy();\n\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n maskObject.renderable = true;\n\n const prevData = maskData._scissorRect;\n const bounds = maskObject.getBounds(true);\n const { gl } = this.renderer;\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n bounds.fit(prevData);\n }\n else\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n }\n\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n pop(): void\n {\n const { gl } = this.renderer;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n const rt = this.renderer.renderTexture.current;\n const { transform, sourceFrame, destinationFrame } = this.renderer.projection;\n const resolution = rt ? rt.resolution : this.renderer.resolution;\n let x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n let y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n const width = rect.width * resolution;\n const height = rect.height * resolution;\n\n if (transform)\n {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt)\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n\n this.renderer.gl.scissor(x, y, width, height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n _getBitwiseMask(): number\n {\n return (1 << this.getStackLength()) - 1;\n }\n}\n","import { System } from '../System';\nimport { Matrix } from '@pixi/math';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nexport class ProjectionSystem extends System\n{\n public destinationFrame: Rectangle;\n public sourceFrame: Rectangle;\n public defaultFrame: Rectangle;\n public projectionMatrix: Matrix;\n public transform: Matrix;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = null;\n\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.defaultFrame = null;\n\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle).\n *\n * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this.\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { BUFFER_BITS } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n// Temporary rectangle for passing the framebuffer viewport\nconst viewportFrame = new Rectangle();\n\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class RenderTextureSystem extends System\n{\n public clearColor: number[];\n public defaultMaskStack: Array;\n public current: RenderTexture;\n public readonly sourceFrame: Rectangle;\n public readonly destinationFrame: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n this.clearColor = renderer._backgroundColorRgba;\n\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n this.defaultMaskStack = [];\n\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n this.current = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture\n *\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n * @return {PIXI.Renderer} Returns itself.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /**\n * Resets renderTexture state\n */\n reset(): void\n {\n this.bind(null);\n }\n}\n","import type { Dict } from '@pixi/utils';\n\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nexport class GLProgram\n{\n public program: WebGLProgram;\n public uniformData: Dict;\n public uniformGroups: Dict;\n /**\n * Makes a new Pixi program\n *\n * @param program {WebGLProgram} webgl program\n * @param uniformData {Object} uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n }\n\n /**\n * Destroys this program\n */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n }\n}\n","import { System } from '../System';\nimport { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported, defaultValue, compileProgram } from './utils';\n\nimport type { IGLUniformData } from './GLProgram';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// defualt sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class ShaderSystem extends System\n{\n protected gl: IRenderingContext;\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n private cache: Dict;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n this.cache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n *\n * syncs uniforms on the group\n * @param {*} group - the uniform group to sync\n * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getglProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])\n {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n /* eslint-enable @typescript-eslint/explicit-module-boundary-types */\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData);\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group - the uniform group to get signature of\n * @param {Object} uniformData - uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n private getSignature(group: UniformGroup, uniformData: Dict): string\n {\n const uniforms = group.uniforms;\n\n const strings = [];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n getglProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader - the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n generateShader(shader: Shader): GLProgram\n {\n const gl = this.gl;\n\n const program = shader.program;\n\n const attribMap: Dict = {};\n\n for (const i in program.attributeData)\n {\n attribMap[i] = program.attributeData[i].location;\n }\n\n const shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(shaderProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(shaderProgram, uniformData);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Destroys this System and removes all its textures\n */\n destroy(): void\n {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { System } from '../System';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StateSystem extends System\n{\n public stateId: number;\n public polygonOffset: number;\n public blendMode: BLEND_MODES;\n protected _blendEq: boolean;\n protected gl: IRenderingContext;\n protected blendModes: number[][];\n protected readonly map: Array<(value: boolean) => void>;\n protected readonly checks: Array<(system: this, state: State) => void>;\n protected defaultState: State;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = null;\n\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n this.stateId = 0;\n\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n this.polygonOffset = 0;\n\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n this.blendMode = BLEND_MODES.NONE;\n\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n this._blendEq = false;\n\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n this.map = [];\n\n // map functions for when we set state..\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n this.checks = [];\n\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func - the checking function to add or remove\n * @param {boolean} value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { System } from '../System';\nimport { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture {\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class TextureGCSystem extends System\n{\n public count: number;\n public checkCount: number;\n public maxIdle: number;\n public checkCountMax: number;\n public mode: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n}\n","/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLTexture\n{\n public texture: WebGLTexture;\n public width: number;\n public height: number;\n public mipmap: boolean;\n public wrapMode: number;\n public type: number;\n public internalFormat: number;\n dirtyId: number;\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n }\n}\n","import { System } from '../System';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES } from '@pixi/constants';\n\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class TextureSystem extends System\n{\n public boundTextures: BaseTexture[];\n public managedTextures: Array;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected webGLVersion: number;\n protected unknownTexture: BaseTexture;\n protected _unknownBoundTextures: boolean;\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n bind(texture: Texture|BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n if (texture)\n {\n texture = texture.castToBaseTexture();\n\n if (!texture || texture.parentTextureArray)\n {\n // cannot bind partial texture\n // TODO: report a warning\n return;\n }\n\n if (texture.valid)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2)\n {\n return;\n }\n const gl = this.renderer.gl;\n\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === TYPES.HALF_FLOAT)\n {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA16F;\n }\n }\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture|Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n}\n","import { hex2string, hex2rgb, deprecation, EventEmitter } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { DisplayObject } from '@pixi/display';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Container } from '@pixi/display';\n\nconst tempMatrix = new Matrix();\n\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n width?: number;\n height?: number;\n view?: HTMLCanvasElement;\n transparent?: boolean | 'notMultiplied';\n autoDensity?: boolean;\n antialias?: boolean;\n resolution?: number;\n preserveDrawingBuffer?: boolean;\n clearBeforeRender?: boolean;\n backgroundColor?: number;\n powerPreference?: WebGLPowerPreference;\n context?: IRenderingContext;\n}\n\ninterface IRendererOptionsLegacy extends IRendererOptions\n{\n autoResize?: boolean;\n roundPixels?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly transparent: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: DisplayObject;\n\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n // Deprecation notice for renderer roundPixels option\n if ((options as IRendererOptionsLegacy).roundPixels)\n {\n settings.ROUND_PIXELS = (options as IRendererOptionsLegacy).roundPixels;\n deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n this.autoDensity = options.autoDensity || (options as IRendererOptionsLegacy).autoResize || false;\n // autoResize is deprecated, provides fallback support\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n generateTexture(displayObject: DisplayObject,\n scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture\n {\n region = region || (displayObject as Container).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width | 0,\n height: region.height | 0,\n scaleMode,\n resolution,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n }\n\n abstract render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\n\nimport type { IRendererOptions, IRendererPlugins } from './AbstractRenderer';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { DisplayObject } from '@pixi/display';\nimport type { System } from './System';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Extract } from '@pixi/extract';\n\nexport interface IRendererPluginConstructor {\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin {\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class Renderer extends AbstractRenderer\n{\n public gl: IRenderingContext;\n public globalUniforms: UniformGroup;\n public CONTEXT_UID: number;\n public renderingToScreen: boolean;\n public extract: Extract;\n // systems\n public mask: MaskSystem;\n public context: ContextSystem;\n public state: StateSystem;\n public shader: ShaderSystem;\n public texture: TextureSystem;\n public geometry: GeometrySystem;\n public framebuffer: FramebufferSystem;\n public scissor: ScissorSystem;\n public stencil: StencilSystem;\n public projection: ProjectionSystem;\n public textureGC: TextureGCSystem;\n public filter: FilterSystem;\n public renderTexture: RenderTextureSystem;\n public batch: BatchSystem;\n\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @static\n * @private\n */\n static create(options: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n * @public\n */\n constructor(options? : IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n // TODO legacy!\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n addSystem(ClassRef: { new(renderer: Renderer): T}, name: string): this\n {\n if (!name)\n {\n name = ClassRef.name;\n }\n\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n this.runners.resize.emit(screenWidth, screenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /**\n * Clear the frame buffer\n */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.Renderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n */\n\n static __plugins: IRendererPlugins;\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n }\n}\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n public elements: BaseTexture[];\n public ids: number[];\n public count: number;\n\n constructor()\n {\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n public rawBinaryData: ArrayBuffer;\n public uint32View: Uint32Array;\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n constructor(size: number)\n {\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n */\nexport interface IBatchableElement {\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public size: number;\n public MAX_TEXTURES: number;\n\n protected shaderGenerator: BatchShaderGenerator;\n protected geometryClass: typeof BatchGeometry;\n protected vertexSize: number;\n protected _vertexCount: number;\n protected _indexCount: number;\n protected _bufferedElements: Array;\n protected _bufferedTextures: Array;\n protected _bufferSize: number;\n protected _shader: Shader;\n protected _flushId: number;\n protected _aBuffers: Array;\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n private _packedGeometries: Array;\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n this.shaderGenerator = null;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n this.geometryClass = null;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n this.vertexSize = null;\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._vertexCount = 0;\n\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._indexCount = 0;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n this._bufferedElements = [];\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n this._bufferedTextures = [];\n\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n this._bufferSize = 0;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n this._shader = null;\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n this._packedGeometries = [];\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n this._packedGeometryPoolSize = 2;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n this._flushId = 0;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n this._aBuffers = {} as any;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n this._iBuffers = {} as any;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /**\n * Renders the content _now_ and empties the current batch.\n */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /**\n * Starts a new sprite batch.\n */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /**\n * Stops and flushes the current batch.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n public vertexSrc: string;\n public fragTemplate: string;\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n /**\n * @param {string} vertexSrc - Vertex shader\n * @param {string} fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n _buffer: Buffer;\n _indexBuffer: Buffer;\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._buffer = new Buffer(null, _static, false);\n\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @static\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n","import { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer, IRendererOptionsAuto, AbstractRenderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IApplicationPlugin {\n init: (...params: any[]) => any;\n destroy: (...params: any[]) => any;\n}\n\nexport interface IApplicationOptions extends IRendererOptionsAuto {\n autoStart?: boolean;\n sharedTicker?: boolean;\n sharedLoader?: boolean;\n resizeTo?: Window | HTMLElement;\n resizeThrottle?: number;\n}\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport class Application\n{\n public static _plugins: IApplicationPlugin[];\n\n public stage: Container;\n public renderer: Renderer|AbstractRenderer;\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n constructor(options?: IApplicationOptions)\n {\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n // install plugins here\n Application._plugins.forEach((plugin) =>\n {\n plugin.init.call(this, options);\n });\n }\n\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\n static registerPlugin(plugin: IApplicationPlugin): void\n {\n Application._plugins.push(plugin);\n }\n\n /**\n * Render the current stage.\n */\n public render(): void\n {\n // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject\n // This can be fixed when CanvasRenderer is converted.\n this.renderer.render(this.stage as any);\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view(): HTMLCanvasElement\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen(): Rectangle\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n public destroy(removeView?: boolean, stageOptions?: IDestroyOptions|boolean): void\n {\n // Destroy plugins in the opposite order\n // which they were constructed\n const plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach((plugin) =>\n {\n plugin.destroy.call(this);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n }\n}\n\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n","import type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Renderer } from '@pixi/core';\nimport type { IApplicationOptions } from './Application';\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nexport class ResizePlugin\n{\n public static resizeTo: Window|HTMLElement;\n public static resize: () => void;\n public static renderer: Renderer|CanvasRenderer;\n public static queueResize: () => void;\n private static _resizeId: number;\n private static _resizeTo: Window|HTMLElement;\n private static cancelResize: () => void;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo',\n {\n set(dom: Window|HTMLElement)\n {\n window.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom)\n {\n window.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * Resize is throttled, so it's\n * safe to call this multiple times per frame and it'll\n * only be called once.\n * @method PIXI.Application#queueResize\n */\n this.queueResize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n this.cancelResize();\n\n // // Throttle resize events per raf\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n\n /**\n * Cancel the resize queue.\n * @method PIXI.Application#cancelResize\n * @private\n */\n this.cancelResize = (): void =>\n {\n if (this._resizeId)\n {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n * @method PIXI.Application#resize\n */\n this.resize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n // clear queue resize\n this.cancelResize();\n\n let width: number;\n let height: number;\n\n // Resize to the window\n if (this._resizeTo === window)\n {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n // Resize to other HTML entities\n else\n {\n const { clientWidth, clientHeight } = this._resizeTo as HTMLElement;\n\n width = clientWidth;\n height = clientHeight;\n }\n\n this.renderer.resize(width, height);\n };\n\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n static destroy(): void\n {\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n","import { Application } from './Application';\nimport { ResizePlugin } from './ResizePlugin';\n\nApplication.registerPlugin(ResizePlugin);\n\nexport * from './Application';\n","import { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { RenderTexture } from '@pixi/core';\n\nimport type { Renderer, IRendererPlugin } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\n\nconst TEMP_RECT = new Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nexport class Extract implements IRendererPlugin\n{\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.Extract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n let canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n const target = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n\n target.context.scale(1, -1);\n\n // we can't render to itself because we should be empty before render.\n target.context.drawImage(canvasBuffer.canvas, 0, -height);\n\n canvasBuffer.destroy();\n canvasBuffer = target;\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8Array\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\n static arrayPostDivide(\n pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray\n ): void\n {\n for (let i = 0; i < pixels.length; i += 4)\n {\n const alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n }\n}\n","'use strict'\n\nfunction parseURI (str, opts) {\n if (!str) return undefined\n\n opts = opts || {}\n\n var o = {\n key: [\n 'source',\n 'protocol',\n 'authority',\n 'userInfo',\n 'user',\n 'password',\n 'host',\n 'port',\n 'relative',\n 'path',\n 'directory',\n 'file',\n 'query',\n 'anchor'\n ],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n\nmodule.exports = parseURI\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() { /* empty */ }\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\nexport function eachSeries(array, iterator, callback, deferNext) {\n let i = 0;\n const len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(() => {\n iterator(array[i++], next);\n }, 1);\n }\n else {\n iterator(array[i++], next);\n }\n })();\n}\n\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\nexport function queue(worker, concurrency) {\n if (concurrency == null) { // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n }\n else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n let workers = 0;\n const q = {\n _tasks: [],\n concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push(data, callback) {\n _insert(data, false, callback);\n },\n kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift(data, callback) {\n _insert(data, true, callback);\n },\n process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n const task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length() {\n return q._tasks.length;\n },\n running() {\n return workers;\n },\n idle() {\n return q._tasks.length + workers === 0;\n },\n pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false;\n\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n },\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') { // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) { // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(() => q.drain(), 1);\n\n return;\n }\n\n const item = {\n data,\n callback: typeof callback === 'function' ? callback : _noop,\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n }\n else {\n q._tasks.push(item);\n }\n\n setTimeout(() => q.process(), 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) { // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= (q.concurrency - q.buffer)) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n","// a simple in-memory cache for resources\nconst cache = {};\n\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function caching(resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(() => (cache[this.url] = this.data));\n }\n\n next();\n}\n","import parseUri from 'parse-uri';\nimport Signal from 'mini-signals';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nconst useXdr = !!(window.XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\nlet tempAnchor = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop() { /* empty */ }\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\nclass Resource {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n constructor(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.url = url;\n\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.extension = this._getExtension();\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n this.timeout = options.timeout || 0;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n this.metadata = options.metadata || {};\n\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n this.error = null;\n\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n this.children = [];\n\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n this.type = Resource.TYPE.UNKNOWN;\n\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n this.progressChunk = 0;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._dequeue = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._onLoadBinding = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n this._elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n get isDataUrl() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n get isComplete() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n get isLoading() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n\n /**\n * Marks the resource as complete.\n *\n */\n complete() {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr) {\n this.xhr.abort();\n }\n else if (this.xdr) {\n this.xdr.abort();\n }\n else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n }\n // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb) {\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n }\n else {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n _setFlag(flag, value) {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /**\n * Finalizes the load.\n *\n * @private\n */\n _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url)) {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i) {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n _createSource(type, url, mime) {\n if (!mime) {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n _onError(event) {\n this.abort(`Failed to load element using: ${event.target.nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n _onTimeout() {\n this.abort(`Load timed out.`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnError() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnTimeout() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnAbort() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n _xhrOnLoad() {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n }\n else {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n const protocol = url.protocol ? `${url.protocol}:` : '';\n\n // if cross origin\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n _getExtension() {\n let url = this.url;\n let ext = '';\n\n if (this.isDataUrl) {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: (1 << 0),\n COMPLETE: (1 << 1),\n LOADING: (1 << 2),\n};\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6,\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4,\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n /** Blob */\n BLOB: 'blob',\n /** Document */\n DOCUMENT: 'document',\n /** Object */\n JSON: 'json',\n /** String */\n TEXT: 'text',\n};\n\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO,\n};\n\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n};\n\n// We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nexport { Resource };\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input) {\n let output = '';\n let inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { Resource } from '../Resource';\nimport { encodeBinary } from '../encodeBinary';\n\nconst Url = window.URL || window.webkitURL;\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function parsing(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () => {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () => {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import Signal from 'mini-signals';\nimport parseUri from 'parse-uri';\nimport * as async from './async';\nimport { Resource } from './Resource';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\nclass Loader {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10) {\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n this.loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n this.defaultQueryString = '';\n\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n this._resourcesParsing = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n this.resources = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n this.onError = new Signal();\n\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n this.onLoad = new Signal();\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n // Add default before middleware\n for (let i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n }\n\n // Add default after middleware\n for (let i = 0; i < Loader._defaultAfterMiddleware.length; ++i) {\n this.use(Loader._defaultAfterMiddleware[i]);\n }\n }\n\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (let i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading) {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i) {\n if (!parent.children[i].isComplete) {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i) {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources) {\n const res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n this._onComplete();\n }\n else {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n get concurrency() {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n set concurrency(concurrency) {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _prepareUrl(url) {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n ) {\n result = `${this.baseUrl}/${url}`;\n }\n else {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString) {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += `&${this.defaultQueryString}`;\n }\n else {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n _loadResource(resource, dequeue) {\n resource._dequeue = dequeue;\n\n // run before middleware\n async.eachSeries(\n this._beforeMiddleware,\n (fn, next) => {\n fn.call(this, resource, () => {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () => {\n if (resource.isComplete) {\n this._onLoad(resource);\n }\n else {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /**\n * Called once loading has started.\n *\n * @private\n */\n _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n _onLoad(resource) {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n async.eachSeries(\n this._afterMiddleware,\n (fn, next) => {\n fn.call(this, resource, next);\n },\n () => {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error) {\n this.onError.dispatch(resource.error, this, resource);\n }\n else {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0) {\n this._onComplete();\n }\n },\n true\n );\n }\n}\n\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultBeforeMiddleware = [];\n\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultAfterMiddleware = [];\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\nexport { Loader };\n\n","import { Resource } from 'resource-loader';\n\nimport type { Spritesheet } from '@pixi/spritesheet';\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, Resource.IMetadata {\n imageMetadata?: any;\n}\nexport interface ILoaderResource extends GlobalMixins.ILoaderResource, Resource\n{\n texture?: Texture;\n spritesheet?: Spritesheet;\n\n // required for Spritesheet\n textures?: Dict;\n\n // required specific type for Spritesheet\n metadata: IResourceMetadata;\n}\n\n// Mix constructor and typeof Resource , otherwise we can't access to statics field\ntype TLoaderResource = { new(...args: any[]): ILoaderResource } & typeof Resource;\n\n/**\n* Reference to **{@link https://github.com/englercj/resource-loader\n* resource-loader}**'s Resource class.\n* @see http://englercj.github.io/resource-loader/Resource.html\n* @class LoaderResource\n* @memberof PIXI\n*/\nexport const LoaderResource: TLoaderResource = Resource;\n","import { Resource } from 'resource-loader';\nimport { Texture } from '@pixi/core';\n\nimport type { ILoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class TextureLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n public static use(resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n }\n}\n","import { Loader as ResourceLoader, middleware } from 'resource-loader';\nimport { TextureLoader } from './TextureLoader';\n\nimport type { Resource } from 'resource-loader';\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nexport class Loader extends ResourceLoader\n{\n /**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\n private static _plugins: Array = [];\n private static _shared: Loader;\n private _protected: boolean;\n\n constructor(baseUrl?: string, concurrency?: number)\n {\n super(baseUrl, concurrency);\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n }\n\n /**\n * Destroy the loader, removes references.\n * @memberof PIXI.Loader#\n * @method destroy\n * @public\n */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n }\n}\n\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: middleware.parsing });\n\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n\nexport interface ILoaderPlugin {\n add?(): void;\n pre?(resource: Resource, next?: (...args: any[]) => void): void;\n use?(resource: Resource, next?: (...args: any[]) => void): void;\n}\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef {object} ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {object} ICallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalCallback\n * @param {function} callback - Callback function\n * @param {object} [context] - Context\n * @returns {ICallbackID} - CallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalDetach\n * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef ILoaderSignal\n * @property {ISignalCallback} add - Register callback\n * @property {ISignalCallback} once - Register oneshot callback\n * @property {ISignalDetach} detach - Detach specific callback by ID\n */\n\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when the loader begins to loading process.\n * @member {PIXI.Loader.ILoaderSignal} onStart\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded or errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onProgress\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onError\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded resource.\n * @member {PIXI.Loader.ILoaderSignal} onLoad\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when completely loaded all resources.\n * @member {PIXI.Loader.ILoaderSignal} onComplete\n */\n","import { Loader } from './Loader';\n\nimport type { IApplicationOptions } from '@pixi/app';\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n public static loader: Loader;\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n static init(options?: IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n *\n * @name LINE_JOIN\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet\n * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @property {string} ROUND - 'round': add an arc at the joint\n */\nexport enum LINE_JOIN {\n MITER = 'miter',\n BEVEL = 'bevel',\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n *\n * @name LINE_CAP\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @property {string} ROUND - 'round': add semicircle at ends\n * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end)\n */\nexport enum LINE_CAP {\n BUTT = 'butt',\n ROUND = 'round',\n SQUARE = 'square'\n}\n\nexport interface IGraphicsCurvesSettings {\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nexport const GRAPHICS_CURVES: IGraphicsCurvesSettings = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { hex2rgb } from '@pixi/utils';\n\nimport type { BaseTexture, Renderer } from '@pixi/core';\nimport type { ParticleBuffer } from './ParticleBuffer';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IParticleProperties {\n vertices?: boolean;\n position?: boolean;\n rotation?: boolean;\n uvs?: boolean;\n tint?: boolean;\n alpha?: boolean;\n scale?: boolean;\n}\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class ParticleContainer extends Container\n{\n public readonly blendMode: BLEND_MODES;\n public autoResize: boolean;\n public roundPixels: boolean;\n public baseTexture: BaseTexture;\n public tintRgb: Float32Array;\n\n _maxSize: number;\n _buffers: ParticleBuffer[];\n _batchSize: number;\n _properties: boolean[];\n _bufferUpdateIDs: number[];\n _updateID: number;\n private _tint: number;\n\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] - If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n constructor(maxSize = 1500, properties: IParticleProperties, batchSize = 16384, autoResize = false)\n {\n super();\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n const maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {Array}\n * @private\n */\n this._buffers = null;\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n public setProperties(properties: IParticleProperties): void\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform(): void\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n }\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n public render(renderer: Renderer): void\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = (this.children[0] as any)._texture.baseTexture;\n if (!this.baseTexture.valid)\n {\n this.baseTexture.once('update', () => this.onChildrenChange(0));\n }\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n }\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n protected onChildrenChange(smallestChildIndex: number): void\n {\n const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n }\n\n public dispose(): void\n {\n if (this._buffers)\n {\n for (let i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n\n this._buffers = null;\n }\n }\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.dispose();\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n }\n}\n","import { createIndicesForQuads } from '@pixi/utils';\nimport { Geometry, Buffer } from '@pixi/core';\nimport { TYPES } from '@pixi/constants';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { IParticleRendererProperty } from './ParticleRenderer';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class ParticleBuffer\n{\n public geometry: Geometry;\n public staticStride: number;\n public staticBuffer: Buffer;\n public staticData: Float32Array;\n public staticDataUint32: Uint32Array;\n public dynamicStride: number;\n public dynamicBuffer: Buffer;\n public dynamicData: Float32Array;\n public dynamicDataUint32: Uint32Array;\n public _updateID: number;\n\n indexBuffer: Buffer;\n private size: number;\n private dynamicProperties: IParticleRendererProperty[];\n private staticProperties: IParticleRendererProperty[];\n\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(properties: IParticleRendererProperty[], dynamicPropertyFlags: boolean[], size: number)\n {\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n private initBuffers(): void\n {\n const geometry = this.geometry;\n\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.dynamicBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.staticBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n }\n\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n destroy(): void\n {\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { ObjectRenderer, Shader, State } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { ParticleBuffer } from './ParticleBuffer';\nimport fragment from './particles.frag';\nimport vertex from './particles.vert';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { ParticleContainer } from './ParticleContainer';\nimport type { Renderer } from '@pixi/core';\n\nexport interface IParticleRendererProperty {\n attributeName: string;\n size: number;\n type?: TYPES;\n uploadFunction: (...params: any[]) => any;\n offset: number;\n}\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nexport class ParticleRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public shader: Shader;\n public tempMatrix: Matrix;\n public properties: IParticleRendererProperty[];\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n\n this.shader = Shader.from(vertex, fragment, {});\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n public render(container: ParticleContainer): void\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n const baseTexture = (children[0] as any)._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n private generateBuffers(container: ParticleContainer): ParticleBuffer[]\n {\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n private _generateOneMoreBuffer(container: ParticleContainer): ParticleBuffer\n {\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadVertices(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadPosition(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadRotation(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadUvs(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = (children[startIndex + i] as any)._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadTint(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n const alpha = sprite.alpha;\n\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied\n ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n */\n public destroy(): void\n {\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n }\n}\n","import { Texture } from '@pixi/core';\nimport type { Matrix } from '@pixi/math';\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform aplpied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n public matrix: Matrix = null;\n\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /**\n * Reset\n */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /**\n * Destroy and don't use after this\n */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n","import { earcut } from '@pixi/utils';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Polygon } from '@pixi/math';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n","// for type only\nimport { SHAPES } from '@pixi/math';\n\nimport type { Circle, Ellipse } from '@pixi/math';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildCircle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape as Circle;\n const points = graphicsData.points;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n const ellipseData = graphicsData.shape as Ellipse;\n\n width = ellipseData.width;\n height = ellipseData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n let totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n\n totalSegs /= 2.3;\n\n const seg = (Math.PI * 2) / totalSegs;\n\n for (let i = 0; i < totalSegs - 0.5; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(points[0], points[1]);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n let vertPos = verts.length / 2;\n const center = vertPos;\n\n const circle = (graphicsData.shape) as Circle;\n const matrix = graphicsData.matrix;\n const x = circle.x;\n const y = circle.y;\n\n // Push center (special point)\n verts.push(\n graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x,\n graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n\n for (let i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n","import type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n","import { earcut } from '@pixi/utils';\n\n// for type only\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { RoundedRectangle } from '@pixi/math';\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1: number, n2: number, perc: number): number\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number,\n out: Array = []): Array\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n const rrectData = graphicsData.shape as RoundedRectangle;\n const points = graphicsData.points;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n // Don't allow negative radius or greater than half the smallest width\n const radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n\n points.length = 0;\n\n // No radius, do a simple rectangle\n if (!radius)\n {\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n }\n else\n {\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n }\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n const vecPos = verts.length / 2;\n\n const triangles = earcut(points, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = points.length; i < j; i++)\n {\n verts.push(points[i], points[++i]);\n }\n },\n};\n","import { Point, SHAPES } from '@pixi/math';\n\nimport type { Polygon } from '@pixi/math';\nimport type { GraphicsData } from '../GraphicsData';\nimport type { GraphicsGeometry } from '../GraphicsGeometry';\nimport { LINE_JOIN, LINE_CAP } from '../const';\nimport { GRAPHICS_CURVES } from '../const';\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(\n x: number,\n y: number,\n nx: number,\n ny: number,\n innerWeight: number,\n outerWeight: number,\n clockwise: boolean, /* rotation for square (true at left end, false at right end) */\n verts: Array\n): number\n{\n const ix = x - (nx * innerWeight);\n const iy = y - (ny * innerWeight);\n const ox = x + (nx * outerWeight);\n const oy = y + (ny * outerWeight);\n\n /* Rotate nx,ny for extension vector */\n let exx; let\n eyy;\n\n if (clockwise)\n {\n exx = ny;\n eyy = -nx;\n }\n else\n {\n exx = -ny;\n eyy = nx;\n }\n\n /* [i|0]x,y extended at cap */\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n\n return 2;\n}\n\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(\n cx: number,\n cy: number,\n sx: number,\n sy: number,\n ex: number,\n ey: number,\n verts: Array,\n clockwise: boolean, /* if not cap, then clockwise is turn of joint, otherwise rotation from angle0 to angle1 */\n): number\n{\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n\n if (clockwise && angle0 < angle1)\n {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1)\n {\n angle1 += Math.PI * 2;\n }\n\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n\n const radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n const segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n const angleInc = angleDiff / segCount;\n\n startAngle += angleInc;\n\n if (clockwise)\n {\n verts.push(cx, cy);\n verts.push(sx, sy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n }\n\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else\n {\n verts.push(sx, sy);\n verts.push(cx, cy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n\n return segCount * 2;\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n const shape = graphicsData.shape as Polygon;\n let points = graphicsData.points || shape.points.slice();\n const eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n const style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = graphicsGeometry.points;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n\n // Max. inner and outer width\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n\n /* Line segments of interest where (x1,y1) forms the corner. */\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n let perpx = -(y0 - y1);\n let perpy = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = style.alignment;// 0.5;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x0 - (perpx * (innerWeight - outerWeight) * 0.5),\n y0 - (perpy * (innerWeight - outerWeight) * 0.5),\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight),\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight),\n verts,\n true,\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n\n // Push first point (below & above vertices)\n verts.push(\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight));\n verts.push(\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight));\n\n for (let i = 1; i < length - 1; ++i)\n {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n\n /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n const cross = (dy0 * dx1) - (dy1 * dx0);\n const clockwise = (cross < 0);\n\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1)\n {\n verts.push(\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight));\n verts.push(\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight));\n\n continue;\n }\n\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n const c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n const c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n const px = ((dx0 * c2) - (dx1 * c1)) / cross;\n const py = ((dy1 * c1) - (dy0 * c2)) / cross;\n const pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n\n /* Inner miter point */\n const imx = x1 + ((px - x1) * innerWeight);\n const imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n const omx = x1 - ((px - x1) * outerWeight);\n const omy = y1 - ((py - y1) * outerWeight);\n\n /* Is the inside miter point too far away, creating a spike? */\n const smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n const insideMiterOk = pdist <= smallerInsideDiagonalSq;\n\n if (insideMiterOk)\n {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n if (clockwise) /* rotating at inner angle */\n {\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));// first segment's outer vertex\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));// second segment's outer vertex\n }\n else /* rotating at outer angle */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));// first segment's inner vertex\n verts.push(omx, omy);// outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));// second segment's outer vertex\n verts.push(omx, omy);// outer miter point\n }\n\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 4;\n\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 4;\n\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else\n {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n // Nothing needed\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 2;\n }\n else /* arc is inside */\n {\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 2;\n }\n }\n else\n {\n if (clockwise)\n {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else\n {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x1 - (perpx * (innerWeight - outerWeight) * 0.5),\n y1 - (perpy * (innerWeight - outerWeight) * 0.5),\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight),\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight),\n verts,\n false\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n\n const indices = graphicsGeometry.indices;\n const eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n\n // indices.push(indexStart);\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i)\n {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2)\n {\n continue;\n }\n\n indices.push(i, i + 1, i + 2);\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n let i = 0;\n\n const shape = graphicsData.shape as Polygon;\n const points = graphicsData.points || shape.points;\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) return;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n const length = points.length / 2;\n\n const startIndex = verts.length / 2;\n let currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nexport function buildLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n","import { Polygon, PI_2 } from '@pixi/math';\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI.graphicsUtils\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nexport class Star extends Polygon\n{\n constructor(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0)\n {\n innerRadius = innerRadius || radius / 2;\n\n const startAngle = (-1 * Math.PI / 2) + rotation;\n const len = points * 2;\n const delta = PI_2 / len;\n const polygon = [];\n\n for (let i = 0; i < len; i++)\n {\n const r = i % 2 ? innerRadius : radius;\n const angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n super(polygon);\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\nimport { PI_2 } from '@pixi/math';\n\ninterface IArcLikeShape {\n cx: number;\n cy: number;\n radius: number;\n startAngle: number;\n endAngle: number;\n anticlockwise: boolean;\n}\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nexport class ArcUtils\n{\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array): IArcLikeShape\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius,\n startAngle,\n endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n }\n\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n static arc(_startX: number, _startY: number, cx: number, cy: number, radius: number,\n startAngle: number, endAngle: number, _anticlockwise: boolean, points: Array): void\n {\n const sweep = endAngle - startAngle;\n const n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n const theta = (sweep) / (n * 2);\n const theta2 = theta * 2;\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n const segMinus = n - 1;\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n const angle = ((theta) + startAngle + (theta2 * real));\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n }\n /* eslint-enable max-len */\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n","import type { LineStyle } from '../styles/LineStyle';\nimport type { FillStyle } from '../styles/FillStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n","/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\nimport { buildPoly } from './buildPoly';\nexport { buildPoly };\n\nimport { buildCircle } from './buildCircle';\nexport { buildCircle };\n\nimport { buildRectangle } from './buildRectangle';\nexport { buildRectangle };\n\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\nexport { buildRoundedRectangle };\n\nexport * from './buildLine';\nexport * from './Star';\nexport * from './ArcUtils';\nexport * from './BezierUtils';\nexport * from './QuadraticUtils';\nexport * from './BatchPart';\n\n// for type only\nimport { BatchPart } from './BatchPart';\nimport { SHAPES } from '@pixi/math';\nimport { BatchDrawCall } from '@pixi/core';\nimport { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nexport const BATCH_POOL: Array = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array = [];\n","import type { Matrix, SHAPES, IShape } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n shape: IShape;\n lineStyle: LineStyle;\n fillStyle: FillStyle;\n matrix: Matrix;\n type: SHAPES;\n points: number[];\n holes: Array;\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /**\n * Destroys the Graphics data.\n *\n */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n","import {\n buildLine,\n buildPoly,\n BatchPart,\n FILL_COMMANDS,\n BATCH_POOL,\n DRAW_CALL_POOL,\n} from './utils';\n\nimport {\n BatchGeometry,\n BatchDrawCall,\n BatchTextureArray,\n BaseTexture,\n Texture,\n} from '@pixi/core';\n\nimport { DRAW_MODES, WRAP_MODES } from '@pixi/constants';\nimport { SHAPES, Point, Matrix } from '@pixi/math';\nimport { GraphicsData } from './GraphicsData';\nimport { premultiplyTint } from '@pixi/utils';\nimport { Bounds } from '@pixi/display';\n\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * @description Complex shape type\n * @todo Move to Math shapes\n */\ntype IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nconst tmpPoint = new Point();\nconst tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nexport class GraphicsGeometry extends BatchGeometry\n{\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\n public static BATCHABLE_SIZE = 100;\n\n public closePointEps: number;\n public boundsPadding: number;\n\n uvsFloat32: Float32Array = null;\n indicesUint16: Uint16Array | Uint32Array = null;\n batchable: boolean;\n points: Array;\n colors: Array;\n uvs: Array;\n indices: Array;\n textureIds: Array;\n graphicsData: Array;\n drawCalls: Array;\n batchDirty: number;\n batches: Array;\n\n protected dirty: number;\n protected cacheDirty: number;\n protected clearDirty: number;\n protected shapeIndex: number;\n protected _bounds: Bounds;\n protected boundsDirty: number;\n\n constructor()\n {\n super();\n\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n this.points = [];\n\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n this.colors = [];\n\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n this.uvs = [];\n\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n this.indices = [];\n\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n this.textureIds = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n this.graphicsData = [];\n\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n this.dirty = 0;\n\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n this.batchDirty = -1;\n\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n this.cacheDirty = -1;\n\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n this.clearDirty = 0;\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n this.drawCalls = [];\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n * @protected\n */\n this.batches = [];\n\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n this.shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n this.boundsDirty = -1;\n\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n this.boundsPadding = 0;\n\n this.batchable = false;\n\n this.indicesUint16 = null;\n\n this.uvsFloat32 = null;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n this.closePointEps = 1e-4;\n }\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n public get bounds(): Bounds\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n }\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n protected invalidate(): void\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batchPart = this.batches[i];\n\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n\n this.batches.length = 0;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n public clear(): GraphicsGeometry\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawShape(\n shape: IShape,\n fillStyle: FillStyle = null,\n lineStyle: LineStyle = null,\n matrix: Matrix = null): GraphicsGeometry\n {\n const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawHole(shape: IShape, matrix: Matrix = null): GraphicsGeometry\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n const data = new GraphicsData(shape, null, null, matrix);\n\n const lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n public destroy(): void\n {\n super.destroy();\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n }\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n public containsPoint(point: IPointData): boolean\n {\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n let hitHole = false;\n\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices\n */\n updateBatches(allow32Indices?: boolean): void\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n const uvs = this.uvs;\n const graphicsData = this.graphicsData;\n\n let batchPart: BatchPart = null;\n\n let currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (let i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n const data = graphicsData[i];\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n const command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (let j = 0; j < 2; j++)\n {\n const style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) continue;\n\n const nextTexture = style.texture.baseTexture;\n const index = this.indices.length;\n const attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n const size = (this.points.length / 2) - attribIndex;\n\n if (size === 0) continue;\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n\n const index = this.indices.length;\n const attrib = this.points.length / 2;\n\n if (batchPart)\n {\n batchPart.end(index, attrib);\n }\n\n if (this.batches.length === 0)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length)\n {\n this.indicesUint16.set(this.indices);\n }\n else\n {\n const need32\n = attrib > 0xffff && allow32Indices;\n\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n }\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n protected _compareStyles(styleA: FillStyle | LineStyle, styleB: FillStyle | LineStyle): boolean\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!(styleA as LineStyle).native !== !!(styleB as LineStyle).native)\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n protected validateBatching(): boolean\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (let i = 0, l = this.graphicsData.length; i < l; i++)\n {\n const data = this.graphicsData[i];\n const fill = data.fillStyle;\n const line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) return false;\n if (line && !line.texture.baseTexture.valid) return false;\n }\n\n return true;\n }\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n protected packBatches(): void\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n const batches = this.batches;\n\n for (let i = 0, l = batches.length; i < l; i++)\n {\n const batch = batches[i];\n\n for (let j = 0; j < batch.size; j++)\n {\n const index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n }\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n protected isBatchable(): boolean\n {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2)\n {\n return false;\n }\n\n const batches = this.batches;\n\n for (let i = 0; i < batches.length; i++)\n {\n if ((batches[i].style as LineStyle).native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n }\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n protected buildDrawCalls(): void\n {\n let TICK = ++BaseTexture._globalBatch;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n let currentGroup: BatchDrawCall = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n let textureCount = 0;\n let currentTexture = null;\n let textureId = 0;\n let native = false;\n let drawMode = DRAW_MODES.TRIANGLES;\n\n let index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (let i = 0; i < this.batches.length; i++)\n {\n const data = this.batches[i];\n\n // TODO add some full on MAX_TEXTURE CODE..\n const MAX_TEXTURES = 8;\n\n // Forced cast for checking `native` without errors\n const style = data.style as LineStyle;\n\n const nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1;// touch;\n\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize);\n this.addTextureIds(textureIds, textureId, data.attribSize);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n }\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n protected packAttributes(): void\n {\n const verts = this.points;\n const uvs = this.uvs;\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n const glPoints = new ArrayBuffer(verts.length * 3 * 4);\n const f32 = new Float32Array(glPoints);\n const u32 = new Uint32Array(glPoints);\n\n let p = 0;\n\n for (let i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n }\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processFill(data: GraphicsData): void\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n const command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n }\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processLine(data: GraphicsData): void\n {\n buildLine(data, this);\n\n for (let i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n }\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n protected processHoles(holes: Array): void\n {\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n const command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n }\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n protected calculateBounds(): void\n {\n const bounds = this._bounds;\n const sequenceBounds = tmpBounds;\n let curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const shape = data.shape;\n const type = data.type;\n const lineStyle = data.lineStyle;\n const nextMatrix = data.matrix || Matrix.IDENTITY;\n let lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n const alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n const rect = shape as Rectangle | RoundedRectangle;\n\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n const circle = shape as Circle;\n\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y,\n circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n const ellipse = shape as Ellipse;\n\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y,\n ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else\n {\n const poly = shape as Polygon;\n // adding directly to the bounds\n\n bounds.addVerticesMatrix(curMatrix, (poly.points as any), 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n }\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n protected transformPoints(points: Array, matrix: Matrix): void\n {\n for (let i = 0; i < points.length / 2; i++)\n {\n const x = points[(i * 2)];\n const y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n }\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n */\n protected addColors(colors: Array, color: number, alpha: number, size: number): void\n {\n // TODO use the premultiply bits Ivan added\n const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n const rgba = premultiplyTint(rgb, alpha);\n\n while (size-- > 0)\n {\n colors.push(rgba);\n }\n }\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n */\n protected addTextureIds(textureIds: Array, id: number, size: number): void\n {\n while (size-- > 0)\n {\n textureIds.push(id);\n }\n }\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n protected addUvs(\n verts: Array,\n uvs: Array,\n texture: Texture,\n start: number, size:\n number, matrix:\n Matrix = null): void\n {\n let index = 0;\n const uvsStart = uvs.length;\n const frame = texture.frame;\n\n while (index < size)\n {\n let x = verts[(start + index) * 2];\n let y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n const nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n const baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n }\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n protected adjustUvs(uvs: Array, texture: Texture, start: number, size: number): void\n {\n const baseTexture = texture.baseTexture;\n const eps = 1e-6;\n const finish = start + (size * 2);\n const frame = texture.frame;\n const scaleX = frame.width / baseTexture.width;\n const scaleY = frame.height / baseTexture.height;\n let offsetX = frame.x / frame.width;\n let offsetY = frame.y / frame.height;\n let minX = Math.floor(uvs[start] + eps);\n let minY = Math.floor(uvs[start + 1] + eps);\n\n for (let i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (let i = start; i < finish; i += 2)\n {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n }\n}\n","import { FillStyle } from './FillStyle';\nimport { LINE_JOIN, LINE_CAP } from '../const';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nexport class LineStyle extends FillStyle\n{\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n public width = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n public alignment = 0.5;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n public native = false;\n\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /**\n * Miter limit.\n *\n * @member {number}\n * @default 10\n */\n public miterLimit = 10;\n\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /**\n * Reset the line style to default.\n */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n }\n}\n","import {\n Circle,\n Ellipse,\n PI_2,\n Point,\n Polygon,\n Rectangle,\n RoundedRectangle,\n Matrix,\n SHAPES,\n} from '@pixi/math';\n\nimport { Texture, UniformGroup, State, Renderer, BatchDrawCall } from '@pixi/core';\nimport { BezierUtils, QuadraticUtils, ArcUtils, Star } from './utils';\nimport { hex2rgb, deprecation } from '@pixi/utils';\nimport { GraphicsGeometry } from './GraphicsGeometry';\nimport { FillStyle } from './styles/FillStyle';\nimport { LineStyle } from './styles/LineStyle';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { Shader } from '@pixi/core';\n\nimport type { IShape, IPointData } from '@pixi/math';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { LINE_JOIN, LINE_CAP } from './const';\n\n/**\n * Batch element computed from Graphics geometry\n */\nexport interface IGraphicsBatchElement {\n vertexData: Float32Array;\n blendMode: BLEND_MODES;\n indices: Uint16Array | Uint32Array;\n uvs: Float32Array;\n alpha: number;\n worldAlpha: number;\n _batchRGB: number[];\n _tintRGB: number;\n _texture: Texture;\n}\n\nexport interface IFillStyleOptions {\n color?: number;\n alpha?: number;\n texture?: Texture;\n matrix?: Matrix;\n}\n\nexport interface ILineStyleOptions extends IFillStyleOptions {\n width?: number;\n alignment?: number;\n native?: boolean;\n cap?: LINE_CAP;\n join?: LINE_JOIN;\n miterLimit?: number;\n}\n\nconst temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nconst DEFAULT_SHADERS: {[key: string]: Shader} = {};\n\nexport interface Graphics extends GlobalMixins.Graphics, Container {}\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Graphics extends Container\n{\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\n\n static _TEMP_POINT = new Point();\n\n public shader: Shader;\n public pluginName: string;\n\n protected currentPath: Polygon;\n protected batches: Array;\n protected batchTint: number;\n protected batchDirty: number;\n protected vertexData: Float32Array;\n\n protected _fillStyle: FillStyle;\n protected _lineStyle: LineStyle;\n protected _matrix: Matrix;\n protected _holeMode: boolean;\n protected _transformID: number;\n protected _tint: number;\n\n private state: State;\n private _geometry: GraphicsGeometry;\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n public get geometry(): GraphicsGeometry\n {\n return this._geometry;\n }\n\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n constructor(geometry: GraphicsGeometry = null)\n {\n super();\n\n this._geometry = geometry || new GraphicsGeometry();\n this._geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n this.state = State.for2d();\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n this._fillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n this._lineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n this._matrix = null;\n\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n this._holeMode = false;\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n this.currentPath = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n this.batches = [];\n\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchTint = -1;\n\n /**\n * Update dirty for limiting calculating batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchDirty = -1;\n\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n this.vertexData = null;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n this._transformID = -1;\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n public clone(): Graphics\n {\n this.finishPoly();\n\n return new Graphics(this._geometry);\n }\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n public set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n public get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n this._tint = value;\n }\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n public get fill(): FillStyle\n {\n return this._fillStyle;\n }\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n public get line(): LineStyle\n {\n return this._lineStyle;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(options: ILineStyleOptions = null): this\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n // eslint-disable-next-line\n const args = arguments;\n\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n\n return this.lineTextureStyle(options);\n }\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTextureStyle(options: ILineStyleOptions): this\n {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number')\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n\n // eslint-disable-next-line\n const [width, texture, color, alpha, matrix, alignment, native] = arguments as any;\n\n options = { width, texture, color, alpha, matrix, alignment, native };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Start a polygon object internally\n * @protected\n */\n protected startPoly(): void\n {\n if (this.currentPath)\n {\n const points = this.currentPath.points;\n const len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n }\n\n /**\n * Finish the polygon object.\n * @protected\n */\n finishPoly(): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public moveTo(x: number, y: number): this\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTo(x: number, y: number): this\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n const points = this.currentPath.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n }\n\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n protected _initCurve(x = 0, y = 0): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n const points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this\n {\n this._initCurve(x1, y1);\n\n const points = this.currentPath.points;\n\n const result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n const { cx, cy, radius, startAngle, endAngle, anticlockwise } = result;\n\n this.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise = false): this\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n const eps = this._geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tessellation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public beginFill(color = 0, alpha = 1): this\n {\n return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });\n }\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginTextureFill(options: IFillStyleOptions): this\n {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof Texture)\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n\n // eslint-disable-next-line\n const [texture, color, alpha, matrix] = arguments as any;\n\n options = { texture, color, alpha, matrix };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options) as IFillStyleOptions;\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public endFill(): this\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n }\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRect(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n }\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawCircle(x: number, y: number, radius: number): this\n {\n return this.drawShape(new Circle(x, y, radius));\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawEllipse(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n }\n\n public drawPolygon(...path: Array | Array): this\n public drawPolygon(path: Array | Array | Polygon): this\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawPolygon(...path: any[]): this\n {\n let points: Array | Array;\n let closeStroke = true;// !!this._fillStyle;\n\n const poly = path[0] as Polygon;\n\n // check if data has points..\n if (poly.points)\n {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else\n if (Array.isArray(path[0]))\n {\n points = path[0];\n }\n else\n {\n points = path;\n }\n\n const shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawShape(shape: IShape): this\n {\n if (!this._holeMode)\n {\n this._geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this._geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n }\n\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0): this\n {\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation) as Polygon);\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public clear(): this\n {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n public isFastRect(): boolean\n {\n const data = this._geometry.graphicsData;\n\n return data.length === 1\n && data[0].shape.type === SHAPES.RECT\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n const hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n\n geometry.updateBatches(hasuint32);\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n }\n\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n protected _populateBatches(): void\n {\n const geometry = this._geometry;\n const blendMode = this.blendMode;\n const len = geometry.batches.length;\n\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (let i = 0; i < len; i++)\n {\n const gI = geometry.batches[i];\n const color = gI.style.color;\n const vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n const batch = {\n vertexData,\n blendMode,\n indices,\n uvs,\n _batchRGB: hex2rgb(color) as Array,\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n }\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderBatched(renderer: Renderer): void\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (let i = 0, l = this.batches.length; i < l; i++)\n {\n const batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n }\n\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderDirect(renderer: Renderer): void\n {\n const shader = this._resolveDirectShader(renderer);\n\n const geometry = this._geometry;\n const tint = this.tint;\n const worldAlpha = this.worldAlpha;\n const uniforms = shader.uniforms;\n const drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (let i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n }\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void\n {\n const { texArray, type, size, start } = drawCall;\n const groupTextureCount = texArray.count;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(texArray.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n }\n\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _resolveDirectShader(renderer: Renderer): Shader\n {\n let shader = this.shader;\n\n const pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n const MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n const sampleValues = new Int32Array(MAX_TEXTURES);\n\n for (let i = 0; i < MAX_TEXTURES; i++)\n {\n sampleValues[i] = i;\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n const program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n }\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n }\n\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n protected calculateTints(): void\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n const tintRGB = hex2rgb(this.tint, temp);\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batch = this.batches[i];\n\n const batchTint = batch._batchRGB;\n\n const r = (tintRGB[0] * batchTint[0]) * 255;\n const g = (tintRGB[1] * batchTint[1]) * 255;\n const b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n const color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n }\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n protected calculateVertices(): void\n {\n const wtID = this.transform._worldID;\n\n if (this._transformID === wtID)\n {\n return;\n }\n\n this._transformID = wtID;\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const data = this._geometry.points;// batch.vertexDataOriginal;\n const vertexData = this.vertexData;\n\n let count = 0;\n\n for (let i = 0; i < data.length; i += 2)\n {\n const x = data[i];\n const y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n public closePath(): this\n {\n const currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n\n return this;\n }\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n public setMatrix(matrix: Matrix): this\n {\n this._matrix = matrix;\n\n return this;\n }\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n public beginHole(): this\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n }\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n public endHole(): this\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n super.destroy(options);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource|Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n public pluginName: string;\n\n _width: number;\n _height: number;\n _texture: Texture;\n _textureID: number;\n _cachedTint: number;\n protected _textureTrimmedID: number;\n protected uvs: Float32Array;\n protected _anchor: ObservablePoint;\n protected vertexData: Float32Array;\n\n private vertexTrimmedData: Float32Array;\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n private _tint: number;\n\n // Internal-only properties\n _tintRGB: number;\n\n /**\n * @param {PIXI.Texture} [texture] - The texture for this sprite.\n */\n constructor(texture: Texture)\n {\n super();\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 16777215\n */\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n static from(source: SpriteSource, options: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport enum TEXT_GRADIENT {\n LINEAR_VERTICAL = 0,\n LINEAR_HORIZONTAL = 1\n}\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from './const';\nimport { hex2string } from '@pixi/utils';\n\nexport type TextStyleAlign = 'left'|'center'|'right';\nexport type TextStyleFill = string|string[]|number|number[]|CanvasGradient|CanvasPattern;\nexport type TextStyleFontStyle = 'normal'|'italic'|'oblique';\nexport type TextStyleFontVariant = 'normal'|'small-caps';\nexport type TextStyleFontWeight = 'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900';\nexport type TextStyleLineJoin = 'miter'|'round'|'bevel';\nexport type TextStyleTextBaseline = 'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom';\nexport type TextStyleWhiteSpace = 'normal'|'pre'|'pre-line';\n\nexport interface ITextStyle {\n align: TextStyleAlign;\n breakWords: boolean;\n dropShadow: boolean;\n dropShadowAlpha: number;\n dropShadowAngle: number;\n dropShadowBlur: number;\n dropShadowColor: string|number;\n dropShadowDistance: number;\n fill: TextStyleFill;\n fillGradientType: TEXT_GRADIENT;\n fillGradientStops: number[];\n fontFamily: string | string[];\n fontSize: number | string;\n fontStyle: TextStyleFontStyle;\n fontVariant: TextStyleFontVariant;\n fontWeight: TextStyleFontWeight;\n letterSpacing: number;\n lineHeight: number;\n lineJoin: TextStyleLineJoin;\n miterLimit: number;\n padding: number;\n stroke: string|number;\n strokeThickness: number;\n textBaseline: TextStyleTextBaseline;\n trim: boolean;\n whiteSpace: TextStyleWhiteSpace;\n wordWrap: boolean;\n wordWrapWidth: number;\n leading: number;\n}\n\nconst defaultStyle: ITextStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nexport class TextStyle implements ITextStyle\n{\n public styleID: number;\n\n protected _align: TextStyleAlign;\n protected _breakWords: boolean;\n protected _dropShadow: boolean;\n protected _dropShadowAlpha: number;\n protected _dropShadowAngle: number;\n protected _dropShadowBlur: number;\n protected _dropShadowColor: string|number;\n protected _dropShadowDistance: number;\n protected _fill: TextStyleFill;\n protected _fillGradientType: TEXT_GRADIENT;\n protected _fillGradientStops: number[];\n protected _fontFamily: string|string[];\n protected _fontSize: number|string;\n protected _fontStyle: TextStyleFontStyle;\n protected _fontVariant: TextStyleFontVariant;\n protected _fontWeight: TextStyleFontWeight;\n protected _letterSpacing: number;\n protected _lineHeight: number;\n protected _lineJoin: TextStyleLineJoin;\n protected _miterLimit: number;\n protected _padding: number;\n protected _stroke: string|number;\n protected _strokeThickness: number;\n protected _textBaseline: TextStyleTextBaseline;\n protected _trim: boolean;\n protected _whiteSpace: TextStyleWhiteSpace;\n protected _wordWrap: boolean;\n protected _wordWrapWidth: number;\n protected _leading: number;\n\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style: Partial)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n const clonedProperties: Partial = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n public reset(): void\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align(): TextStyleAlign\n {\n return this._align;\n }\n set align(align: TextStyleAlign)\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get breakWords(): boolean\n {\n return this._breakWords;\n }\n set breakWords(breakWords: boolean)\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get dropShadow(): boolean\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow: boolean)\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get dropShadowAlpha(): number\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha: number)\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get dropShadowAngle(): number\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle: number)\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get dropShadowBlur(): number\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur: number)\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get dropShadowColor(): number | string\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor: number | string)\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get dropShadowDistance(): number\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance: number)\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill(): TextStyleFill\n {\n return this._fill;\n }\n set fill(fill: TextStyleFill)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n const outputColor = getColor(fill as any);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get fillGradientType(): TEXT_GRADIENT\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType: TEXT_GRADIENT)\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get fillGradientStops(): number[]\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops: number[])\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get fontFamily(): string | string[]\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily: string | string[])\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get fontSize(): number | string\n {\n return this._fontSize;\n }\n set fontSize(fontSize: number | string)\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle(): TextStyleFontStyle\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle: TextStyleFontStyle)\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant(): TextStyleFontVariant\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant: TextStyleFontVariant)\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight(): TextStyleFontWeight\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight: TextStyleFontWeight)\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing: number)\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get lineHeight(): number\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight: number)\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /**\n * The space between lines\n *\n * @member {number}\n */\n get leading(): number\n {\n return this._leading;\n }\n set leading(leading: number)\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin(): TextStyleLineJoin\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin: TextStyleLineJoin)\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get miterLimit(): number\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit: number)\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get padding(): number\n {\n return this._padding;\n }\n set padding(padding: number)\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get stroke(): string | number\n {\n return this._stroke;\n }\n set stroke(stroke: string | number)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get strokeThickness(): number\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness: number)\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline(): TextStyleTextBaseline\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline: TextStyleTextBaseline)\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get trim(): boolean\n {\n return this._trim;\n }\n set trim(trim: boolean)\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace(): TextStyleWhiteSpace\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace: TextStyleWhiteSpace)\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get wordWrap(): boolean\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap: boolean)\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get wordWrapWidth(): number\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth: number)\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n public toFontString(): string\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies: string|string[] = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n (fontFamilies as string[])[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${(fontFamilies as string[]).join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {string|number} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color: string|number): string\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if (typeof color === 'string')\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {string|number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color: (string|number)[]): string[];\nfunction getColor(color: string|number): string;\nfunction getColor(color: string|number|(string|number)[]): string|string[]\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color as string[];\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 - First array to compare\n * @param {Array} array2 - Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1: T[], array2: T[]): boolean\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target - Target object to copy properties into\n * @param {Object} source - Source object for the properties to copy\n * @param {string} propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target: Record, source: Record, propertyObj: Record): void {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import { TextStyle, TextStyleWhiteSpace } from './TextStyle';\n\ninterface IFontMetrics {\n ascent: number;\n descent: number;\n fontSize: number;\n}\n\ntype CharacterWidthCache = { [key: string]: number };\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nexport class TextMetrics\n{\n public text: string;\n public style: TextStyle;\n public width: number;\n public height: number;\n public lines: string[];\n public lineWidths: number[];\n public lineHeight: number;\n public maxLineWidth: number;\n public fontProperties: IFontMetrics;\n\n public static METRICS_STRING: string;\n public static BASELINE_SYMBOL: string;\n public static BASELINE_MULTIPLIER: number;\n\n // TODO: These should be protected but they're initialized outside of the class.\n public static _canvas: HTMLCanvasElement|OffscreenCanvas;\n public static _context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D;\n public static _fonts: { [font: string]: IFontMetrics };\n public static _newlines: number[];\n public static _breakingSpaces: number[];\n\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[],\n lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics)\n {\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n public static measureText(text: string, style: TextStyle, wordWrap: boolean, canvas = TextMetrics._canvas): TextMetrics\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize as number;\n fontProperties.ascent = style.fontSize as number;\n }\n\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n private static wordWrap(text: string, style: TextStyle, canvas = TextMetrics._canvas): string\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache: CharacterWidthCache = Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = TextMetrics.wordWrapSplit(token);\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n private static addLine(line: string, newLine = true): string\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key - The key\n * @param {number} letterSpacing - The letter spacing\n * @param {object} cache - The cache\n * @param {CanvasRenderingContext2D} context - The canvas context\n * @return {number} The from cache.\n */\n private static getFromCache(key: string, letterSpacing: number, cache: CharacterWidthCache,\n context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D): number\n {\n let width = cache[key];\n\n if (typeof width !== 'number')\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace - The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n private static collapseSpaces(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace - The white space\n * @return {boolean} should collapse\n */\n private static collapseNewlines(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text - The text\n * @return {string} trimmed string\n */\n private static trimRight(text: string): string\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if newline, False otherwise.\n */\n private static isNewline(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n private static isBreakingSpace(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text - The text\n * @return {string[]} A tokenized array\n */\n private static tokenize(text: string): string[]\n {\n const tokens: string[] = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param {string} token - The token\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakWords(_token: string, breakWords: boolean): boolean\n {\n return breakWords;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param {string} char - The character\n * @param {string} nextChar - The next character\n * @param {string} token - The token/word the characters are from\n * @param {number} index - The index in the token of the char\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number,\n _breakWords: boolean): boolean\n {\n return true;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param {string} token - The token to split\n * @return {string[]} The characters of the token\n */\n static wordWrapSplit(token: string): string[]\n {\n return token.split('');\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\n public static measureFont(font: string): IFontMetrics\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties: IFontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n public static clearMetrics(font = ''): void\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nconst canvas = ((): HTMLCanvasElement|OffscreenCanvas =>\n{\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext('2d');\n\n if (context && context.measureText)\n {\n return c;\n }\n\n return document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n","/* eslint max-depth: [2, 8] */\nimport { Sprite } from '@pixi/sprite';\nimport { Texture } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { Rectangle } from '@pixi/math';\nimport { sign, trimCanvas, hex2rgb, string2hex } from '@pixi/utils';\nimport { TEXT_GRADIENT } from './const';\nimport { TextStyle } from './TextStyle';\nimport { TextMetrics } from './TextMetrics';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Renderer } from '@pixi/core';\nimport type { ITextStyle } from './TextStyle';\n\nconst defaultDestroyOptions: IDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class Text extends Sprite\n{\n public canvas: HTMLCanvasElement;\n public context: CanvasRenderingContext2D;\n public localStyleID: number;\n public dirty: boolean;\n\n _resolution: number;\n _autoResolution: boolean;\n protected _text: string;\n protected _font: string;\n protected _style: TextStyle;\n protected _styleListener: () => void;\n private _ownCanvas: boolean;\n\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n constructor(text: string, style: Partial|TextStyle, canvas: HTMLCanvasElement)\n {\n let ownCanvas = false;\n\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n ownCanvas = true;\n }\n\n canvas.width = 3;\n canvas.height = 3;\n\n const texture = Texture.from(canvas);\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n super(texture);\n\n /**\n * Keep track if this Text object created it's own canvas\n * element (`true`) or uses the constructor argument (`false`).\n * Used to workaround a GC issues with Safari < 13 when\n * destroying Text. See `destroy` for more info.\n *\n * @member {boolean}\n * @private\n */\n this._ownCanvas = ownCanvas;\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n this._resolution = settings.RESOLUTION;\n this._autoResolution = true;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n /**\n * Renders text to its canvas, and updates its texture.\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n *\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n public updateText(respectDirty: boolean): void\n {\n const style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n const context = this.context;\n const measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n const width = measured.width;\n const height = measured.height;\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n\n context.scale(this._resolution, this._resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n let linePositionX: number;\n let linePositionY: number;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n const passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (let i = 0; i < passesCount; ++i)\n {\n const isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n const dsOffsetShadow = dsOffsetText * this._resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines, measured);\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n context.strokeStyle = style.stroke as string;\n\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n\n this.updateTexture();\n }\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n private drawLetterSpacing(text: string, x: number, y: number, isStroke = false): void\n {\n const style = this._style;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n let currentPosition = x;\n\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n const stringArray = Array.from ? Array.from(text) : text.split('');\n let previousWidth = this.context.measureText(text).width;\n let currentWidth = 0;\n\n for (let i = 0; i < stringArray.length; ++i)\n {\n const currentChar = stringArray[i];\n\n if (isStroke)\n {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n private updateTexture(): void\n {\n const canvas = this.canvas;\n\n if (this._style.trim)\n {\n const trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n const texture = this._texture;\n const style = this._style;\n const padding = style.trim ? 0 : style.padding;\n const baseTexture = texture.baseTexture;\n\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n\n // Recursively updates transform of all objects from the root to this one\n this._recursivePostUpdateTransform();\n\n this.dirty = false;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super._render(renderer);\n }\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n this.updateText(true);\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n }\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n private _generateFillStyle(style: TextStyle, lines: string[], metrics: TextMetrics): string|CanvasGradient|CanvasPattern\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n }\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n super.destroy(options);\n\n // set canvas width and height to 0 to workaround memory leak in Safari < 13\n // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12\n if (this._ownCanvas)\n {\n this.canvas.height = this.canvas.width = 0;\n }\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n }\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get style(): TextStyle|Partial\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle\n // since the setter creates the TextStyle. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n return this._style;\n }\n\n set style(style: TextStyle|Partial)\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n }\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get text(): string\n {\n return this._text;\n }\n\n set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._autoResolution = false;\n\n if (this._resolution === value)\n {\n return;\n }\n\n this._resolution = value;\n this.dirty = true;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\nexport { settings };\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class CountLimiter\n{\n public maxItemsPerFrame: number;\n public itemsLeft: number;\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame: number)\n {\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return this.itemsLeft-- > 0;\n }\n}\n","import { Texture, BaseTexture } from '@pixi/core';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\nimport { CountLimiter } from './CountLimiter';\n\nimport type { AbstractRenderer } from '@pixi/core';\n\ninterface IArrowFunction {\n (): void;\n}\ninterface IUploadHook {\n (helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean;\n}\n\ninterface IFindHook {\n (item: any, queue: Array): boolean;\n}\n\nexport interface IDisplayObjectExtended extends DisplayObject {\n _textures?: Array;\n _texture?: Texture;\n style?: TextStyle;\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\n\nfunction findMultipleBaseTextures(item: IDisplayObjectExtended, queue: Array): boolean\n{\n let result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item: Texture, queue: Array): boolean\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n const texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item._texture && item._texture instanceof Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof TextStyle)\n {\n const font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item: TextStyle, queue: Array): boolean\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI\n */\nexport class BasePrepare\n{\n private limiter: CountLimiter;\n protected renderer: AbstractRenderer;\n protected uploadHookHelper: any;\n protected queue: Array;\n public addHooks: Array;\n public uploadHooks: Array;\n public completes: Array;\n public ticking: boolean;\n private delayedTick: IArrowFunction;\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer)\n {\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {object}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = (): void =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item: IDisplayObjectExtended | IUploadHook | IFindHook | (() => void), done: () => void): void\n {\n if (typeof item === 'function')\n {\n done = item as () => void;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item as IDisplayObjectExtended | IUploadHook | IFindHook);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick(): void\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems(): void\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {this} Instance of plugin for chaining.\n */\n registerFindHook(addHook: IFindHook): this\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {this} Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook: IUploadHook): this\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {this} Instance of plugin for chaining.\n */\n add(item: IDisplayObjectExtended | IUploadHook | IFindHook): this\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy(): void\n {\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { BasePrepare, IDisplayObjectExtended } from './BasePrepare';\n\nimport type { AbstractRenderer, Renderer } from '@pixi/core';\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])\n {\n (renderer as Renderer).texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n const { geometry } = item;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n const { batches } = geometry;\n\n // upload all textures found in styles\n for (let i = 0; i < batches.length; i++)\n {\n const { texture } = batches[i].style;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n (renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class Prepare extends BasePrepare\n{\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n public maxMilliseconds: number;\n public frameStart: number;\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n constructor(maxMilliseconds: number)\n {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { getResolutionOfUrl } from '@pixi/utils';\nimport type { Dict } from '@pixi/utils';\nimport type { resources } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n */\nexport interface ISpritesheetFrameData {\n frame: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n w: number;\n h: number;\n };\n spriteSourceSize?: {\n x: number;\n y: number;\n };\n anchor?: IPointData;\n}\n\n/**\n * Atlas format.\n */\nexport interface ISpritesheetData {\n frames: Dict;\n animations?: Dict;\n meta: {\n scale: string;\n };\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nexport class Spritesheet\n{\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n static readonly BATCH_SIZE = 1000;\n\n public baseTexture: BaseTexture;\n public textures: Dict;\n public animations: Dict;\n public data: ISpritesheetData;\n public resolution: number;\n\n private _texture: Texture;\n private _frames: Dict;\n private _frameKeys: string[];\n private _batchIndex: number;\n private _callback: (textures: Dict) => void;\n\n /**\n * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(texture: BaseTexture | Texture, data: ISpritesheetData, resolutionFilename: string = null)\n {\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n * @type {PIXI.Texture}\n * @private\n */\n this._texture = texture instanceof Texture ? texture : null;\n\n /**\n * Reference to ths source texture.\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n const resource = this.baseTexture.resource as resources.ImageResource;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n private _updateResolution(resolutionFilename: string = null): number\n {\n const { scale } = this.data.meta;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n public parse(callback: () => void): void\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n private _processFrames(initialFrameIndex: number): void\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /**\n * Parse animations config\n *\n * @private\n */\n private _processAnimations(): void\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++)\n {\n const frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /**\n * The parse has completed.\n *\n * @private\n */\n private _parseComplete(): void\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n private _nextBatch(): void\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n public destroy(destroyBase = false): void\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this._texture?.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n }\n}\n","import { url } from '@pixi/utils';\nimport { Spritesheet } from './Spritesheet';\nimport { LoaderResource } from '@pixi/loaders';\nimport type { Loader, ILoaderResource } from '@pixi/loaders';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class SpritesheetLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(resource: ILoaderResource, next: (...args: unknown[]) => void): void\n {\n // because this is middleware, it execute in loader context. `this` = loader\n const loader = (this as any) as Loader;\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res: ILoaderResource)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n }\n\n /**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\n static getResourcePath(resource: ILoaderResource, baseUrl: string): string\n {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n }\n}\n","import { Texture, TextureMatrix } from '@pixi/core';\nimport { Point, Rectangle, Transform } from '@pixi/math';\nimport { Sprite } from '@pixi/sprite';\nimport { deprecation } from '@pixi/utils';\nimport type { Renderer, IBaseTextureOptions, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPoint, IPointData, ISize, ObservablePoint } from '@pixi/math';\n\nconst tempPoint = new Point();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface TilingSprite extends GlobalMixins.TilingSprite {}\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class TilingSprite extends Sprite\n{\n public tileTransform: Transform;\n public uvMatrix: TextureMatrix;\n public uvRespectAnchor: boolean;\n\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n constructor(texture: Texture, width = 100, height = 100)\n {\n super(texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n this.tileTransform = new Transform();\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = this.texture.uvMatrix || new TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get clampMargin(): number\n {\n return this.uvMatrix.clampMargin;\n }\n\n set clampMargin(value: number)\n {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n }\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tileScale(): ObservablePoint\n {\n return this.tileTransform.scale;\n }\n\n set tileScale(value: ObservablePoint)\n {\n this.tileTransform.scale.copyFrom(value as IPoint);\n }\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tilePosition(): ObservablePoint\n {\n return this.tileTransform.position;\n }\n\n set tilePosition(value: ObservablePoint)\n {\n this.tileTransform.position.copyFrom(value as IPoint);\n }\n\n /**\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n if (this.uvMatrix)\n {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n // tweak our texture temporarily..\n const texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const minX = this._width * -this._anchor._x;\n const minY = this._height * -this._anchor._y;\n const maxX = this._width * (1 - this._anchor._x);\n const maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.IPointData} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._width;\n const height = this._height;\n const x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n const y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.tileTransform = null;\n this.uvMatrix = null;\n }\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {number} options.width - required width of the tiling sprite\n * @param {number} options.height - required height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n static from(source: TextureSource, options: ISize & IBaseTextureOptions): TilingSprite\n {\n // Deprecated\n if (typeof options === 'number')\n {\n deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args');\n // eslint-disable-next-line prefer-rest-params\n options = { width: options, height: arguments[2] } as ISize;\n }\n\n return new TilingSprite(\n Texture.from(source, options),\n options.width,\n options.height\n );\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n }\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n }\n}\n","import { ObjectRenderer, Shader, State, QuadUv } from '@pixi/core';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\n\nimport vertex from './tilingSprite.vert';\nimport fragment from './tilingSprite.frag';\nimport fragmentSimple from './tilingSprite_simple.frag';\n\nimport type { Renderer } from '@pixi/core';\nimport type { TilingSprite } from './TilingSprite';\n\nconst tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class TilingSpriteRenderer extends ObjectRenderer\n{\n public shader: Shader;\n public simpleShader: Shader;\n public quad: QuadUv;\n public readonly state: State;\n\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n const uniforms = { globals: this.renderer.globalUniforms };\n\n this.shader = Shader.from(vertex, fragment, uniforms);\n\n this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);\n\n this.quad = new QuadUv();\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n *\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n public render(ts: TilingSprite): void\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.invalidate();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvMatrix;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode as any);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n\n this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode as any);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n","import type { TextureMatrix, Buffer } from '@pixi/core';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nexport class MeshBatchUvs\n{\n public readonly data: Float32Array;\n public uvBuffer: Buffer;\n public uvMatrix: TextureMatrix;\n\n private _bufferUpdateId: number;\n private _textureUpdateId: number;\n\n // Internal-only properties\n _updateID: number;\n\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n constructor(uvBuffer: Buffer, uvMatrix: TextureMatrix)\n {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n }\n\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n public update(forceUpdate?: boolean): void\n {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID\n )\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n const data = this.uvBuffer.data as Float32Array;\n\n if (!this.data || this.data.length !== data.length)\n {\n (this.data as any) = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n }\n}\n","import { State } from '@pixi/core';\nimport { Point, Polygon } from '@pixi/math';\nimport { BLEND_MODES, DRAW_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { MeshBatchUvs } from './MeshBatchUvs';\nimport { MeshMaterial } from './MeshMaterial';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Texture, Renderer, Geometry, Buffer } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst tempPolygon = new Polygon();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Mesh extends GlobalMixins.Mesh {}\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Mesh extends Container\n{\n public readonly geometry: Geometry;\n public shader: MeshMaterial;\n public state: State;\n public drawMode: DRAW_MODES;\n public start: number;\n public size: number;\n\n private vertexData: Float32Array;\n private vertexDirty: number;\n private _transformID: number;\n private _roundPixels: boolean;\n private batchUvs: MeshBatchUvs;\n\n // Internal-only properties\n uvs: Float32Array;\n indices: Uint16Array;\n _tintRGB: number;\n _texture: Texture;\n\n /**\n * @param {PIXI.Geometry} geometry - the geometry the mesh will use\n * @param {PIXI.MeshMaterial} shader - the shader the mesh will use\n * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts\n */\n constructor(geometry: Geometry, shader: MeshMaterial, state?: State, drawMode = DRAW_MODES.TRIANGLES)\n {\n super();\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n this.geometry = geometry;\n\n geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n this.shader = shader;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = state || State.for2d();\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n this.drawMode = drawMode;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n this.start = 0;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n this.size = 0;\n\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n this.uvs = null;\n\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n this.indices = null;\n\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n this.vertexData = new Float32Array(1);\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n this.vertexDirty = 0;\n\n this._transformID = -1;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n this.batchUvs = null;\n }\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get uvBuffer(): Buffer\n {\n return this.geometry.buffers[1];\n }\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get verticesBuffer(): Buffer\n {\n return this.geometry.buffers[0];\n }\n\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.MeshMaterial}\n */\n set material(value: MeshMaterial)\n {\n this.shader = value;\n }\n\n get material(): MeshMaterial\n {\n return this.shader;\n }\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this.shader.tint;\n }\n\n set tint(value: number)\n {\n this.shader.tint = value;\n }\n\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n set texture(value: Texture)\n {\n this.shader.texture = value;\n }\n\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _render(renderer: Renderer): void\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n const vertices = this.geometry.buffers[0].data;\n\n // TODO benchmark check for attribute size..\n if (\n this.shader.batchable\n && this.drawMode === DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2\n )\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n }\n\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderDefault(renderer: Renderer): void\n {\n const shader = this.shader;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n if (shader.program.uniformData.translationMatrix)\n {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n }\n\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderToBatch(renderer: Renderer): void\n {\n const geometry = this.geometry;\n\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data as Uint16Array;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n\n const pluginName = this.material.pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n }\n\n /**\n * Updates vertexData field based on transform and vertices\n */\n public calculateVertices(): void\n {\n const geometry = this.geometry;\n const vertices = geometry.buffers[0].data;\n\n if ((geometry as any).vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const vertexData = this.vertexData;\n\n for (let i = 0; i < vertexData.length / 2; i++)\n {\n const x = vertices[(i * 2)];\n const y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n\n this.vertexDirty = (geometry as any).vertexDirtyId;\n }\n\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n public calculateUvs(): void\n {\n const geomUvs = this.geometry.buffers[1];\n\n if (!this.shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data as Float32Array;\n }\n }\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n const points = tempPolygon.points;\n const indices = this.geometry.getIndex().data;\n const len = indices.length;\n const step = this.drawMode === 4 ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n (this as any).geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n }\n\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\n public static BATCHABLE_SIZE = 100;\n}\n\n","import { Program, Shader, TextureMatrix } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba } from '@pixi/utils';\nimport fragment from './shader/mesh.frag';\nimport vertex from './shader/mesh.vert';\n\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IMeshMaterialOptions {\n alpha?: number;\n tint?: number;\n pluginName?: string;\n program?: Program;\n uniforms?: Dict;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MeshMaterial extends GlobalMixins.MeshMaterial {}\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class MeshMaterial extends Shader\n{\n public readonly uvMatrix: TextureMatrix;\n\n public batchable: boolean;\n public pluginName: string;\n\n // Internal-only properties\n _tintRGB: number;\n\n private _colorDirty: boolean;\n private _alpha: number;\n private _tint: number;\n\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n constructor(uSampler: Texture, options?: IMeshMaterialOptions)\n {\n const uniforms = {\n uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n super(options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.uniforms.uSampler;\n }\n set texture(value: Texture)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n }\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set alpha(value: number)\n {\n if (value === this._alpha) return;\n\n this._alpha = value;\n this._colorDirty = true;\n }\n get alpha(): number\n {\n return this._alpha;\n }\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set tint(value: number)\n {\n if (value === this._tint) return;\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n }\n get tint(): number\n {\n return this._tint;\n }\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n public update(): void\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n const baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(\n this._tint, this._alpha, this.uniforms.uColor, (baseTexture.alphaMode as unknown as boolean)\n );\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Buffer, Geometry } from '@pixi/core';\n\nimport type { IArrayBuffer } from '@pixi/core';\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class MeshGeometry extends Geometry\n{\n // Internal-only properties\n _updateId: number;\n\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n constructor(vertices?: IArrayBuffer, uvs?: IArrayBuffer, index?: IArrayBuffer)\n {\n super();\n\n const verticesBuffer = new Buffer(vertices);\n const uvsBuffer = new Buffer(uvs, true);\n const indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get vertexDirtyId(): number\n {\n return this.buffers[0]._updateID;\n }\n}\n","/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n public info: IBitmapFontDataInfo[];\n public common: IBitmapFontDataCommon[];\n public page: IBitmapFontDataPage[];\n public char: IBitmapFontDataChar[];\n public kerning: IBitmapFontDataKerning[];\n\n constructor()\n {\n /**\n * @member {PIXI.IBitmapFontDataInfo[]}\n * @readOnly\n */\n this.info = [];\n\n /**\n * @member {PIXI.IBitmapFontDataCommon[]}\n * @readOnly\n */\n this.common = [];\n\n /**\n * @member {PIXI.IBitmapFontDataPage[]}\n * @readOnly\n */\n this.page = [];\n\n /**\n * @member {PIXI.IBitmapFontDataChar[]}\n * @readOnly\n */\n this.char = [];\n\n /**\n * @member {PIXI.IBitmapFontDataKerning[]}\n * @readOnly\n */\n this.kerning = [];\n }\n}\n\nexport interface IBitmapFontDataInfo {\n face: string;\n size: number;\n}\n\nexport interface IBitmapFontDataCommon {\n lineHeight: number;\n}\n\nexport interface IBitmapFontDataPage {\n id: number;\n file: string;\n}\n\nexport interface IBitmapFontDataChar {\n id: number;\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n xoffset: number;\n yoffset: number;\n xadvance: number;\n}\n\nexport interface IBitmapFontDataKerning {\n first: number;\n second: number;\n amount: number;\n}\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataInfo\n * @property {string} face\n * @property {number} size\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataCommon\n * @property {number} lineHeight\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataPage\n * @property {number} id\n * @property {string} file\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataChar\n * @property {string} id\n * @property {number} page\n * @property {number} x\n * @property {number} y\n * @property {number} width\n * @property {number} height\n * @property {number} xoffset\n * @property {number} yoffset\n * @property {number} xadvance\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataKerning\n * @property {number} first\n * @property {number} second\n * @property {number} amount\n */\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * Internal data format used to convert to BitmapFontData.\n * @private\n */\ninterface IBitmapFontRawData {\n info: {\n face: string;\n size: string;\n }[];\n common: { lineHeight: string }[];\n page: {\n id: string;\n file: string;\n }[];\n chars: {\n count: number;\n }[];\n char: {\n id: string;\n page: string;\n x: string;\n y: string;\n width: string;\n height: string;\n xoffset: string;\n yoffset: string;\n xadvance: string;\n }[];\n kernings?: {\n count: number;\n }[];\n kerning?: {\n first: string;\n second: string;\n amount: string;\n }[];\n}\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @class\n * @private\n */\nexport class TextFormat\n{\n /**\n * Check if resource refers to txt font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n }\n\n /**\n * Convert text font data to a javascript object.\n *\n * @static\n * @private\n * @param {string} txt - Raw string data to be converted\n * @return {PIXI.BitmapFontData} Parsed font data\n */\n static parse(txt: string): BitmapFontData\n {\n // Retrieve data item\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData: IBitmapFontRawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n };\n\n for (const i in items)\n {\n // Extract item name\n const name = items[i].match(/^[a-z]+/gm)[0] as keyof BitmapFontData;\n\n // Extract item attribute list as string ex.: \"width=10\"\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n\n // Convert attribute list into an object\n const itemData: any = {};\n\n for (const i in attributeList)\n {\n // Split key-value pairs\n const split = attributeList[i].split('=');\n const key = split[0];\n\n // Remove eventual quotes from value\n const strValue = split[1].replace(/\"/gm, '');\n\n // Try to convert value into float\n const floatValue = parseFloat(strValue);\n\n // Use string value case float value is NaN\n const value = isNaN(floatValue) ? strValue : floatValue;\n\n itemData[key] = value;\n }\n\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n\n const font = new BitmapFontData();\n\n rawData.info.forEach((info) => font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }));\n\n rawData.common.forEach((common) => font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }));\n\n rawData.page.forEach((page) => font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }));\n\n rawData.char.forEach((char) => font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }));\n\n rawData.kerning.forEach((kerning) => font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }));\n\n return font;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLFormat\n{\n /**\n * Check if resource refers to xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n }\n\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {XMLDocument} xml\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xml: XMLDocument): BitmapFontData\n {\n const data = new BitmapFontData();\n const info = xml.getElementsByTagName('info');\n const common = xml.getElementsByTagName('common');\n const page = xml.getElementsByTagName('page');\n const char = xml.getElementsByTagName('char');\n const kerning = xml.getElementsByTagName('kerning');\n\n for (let i = 0; i < info.length; i++)\n {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n\n for (let i = 0; i < common.length; i++)\n {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n\n for (let i = 0; i < page.length; i++)\n {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n\n for (let i = 0; i < char.length; i++)\n {\n const letter = char[i];\n\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n\n for (let i = 0; i < kerning.length; i++)\n {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n\n return data;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\nimport { XMLFormat } from './XMLFormat';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n if (typeof data === 'string' && data.indexOf('') > -1)\n {\n const xml = new self.DOMParser().parseFromString(data, 'text/xml');\n\n return XMLFormat.test(xml);\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {string} xmlTxt\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n const xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml');\n\n return XMLFormat.parse(xml);\n }\n}\n","import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nexport function autoDetectFormat(data: unknown): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n","import { TextStyle, TextMetrics, TEXT_GRADIENT } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nexport function generateFillStyle(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n style: TextStyle,\n resolution: number,\n lines: string[],\n metrics: TextMetrics\n): string|CanvasGradient|CanvasPattern\n{\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n}\n","import { generateFillStyle } from './generateFillStyle';\nimport { hex2rgb, string2hex } from '@pixi/utils';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n if (style.dropShadow)\n {\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n","import { getResolutionOfUrl } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { TextStyle, TextMetrics } from '@pixi/text';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFontData } from './BitmapFontData';\nimport { resolveCharacters, drawGlyph } from './utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITextStyle } from '@pixi/text';\n\nexport interface IBitmapFontCharacter\n{\n xOffset: number;\n yOffset: number;\n xAdvance: number;\n texture: Texture;\n page: number;\n kerning: Dict;\n}\n\nexport interface IBitmapFontOptions\n{\n chars?: string | (string | string[])[];\n resolution?: number;\n padding?: number;\n textureWidth?: number;\n textureHeight?: number;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFont\n{\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n public static readonly ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n public static readonly NUMERIC = [['0', '9']];\n\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @readonly\n * @static\n * @member {string[][]}\n */\n public static readonly ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n\n /**\n * This character set consists of all the ASCII table.\n * @readonly\n * @static\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n public static readonly ASCII = [[' ', '~']];\n\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @readonly\n * @static\n * @member {PIXI.IBitmapFontOptions}\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC\n */\n public static readonly defaultOptions: IBitmapFontOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n\n /**\n * Collection of available/installed fonts.\n *\n * @readonly\n * @static\n * @member {Object.}\n */\n public static readonly available: Dict = {};\n public readonly font: string;\n public readonly size: number;\n public readonly lineHeight: number;\n public readonly chars: Dict;\n public readonly pageTextures: Dict;\n\n /**\n * @param {PIXI.BitmapFontData} data\n * @param {PIXI.Texture[]|Object.} textures\n */\n constructor(data: BitmapFontData, textures: Texture[]|Dict)\n {\n const [info] = data.info;\n const [common] = data.common;\n const [page] = data.page;\n const res = getResolutionOfUrl(page.file);\n const pageTextures: Dict = {};\n\n /**\n * The name of the font face.\n *\n * @member {string}\n * @readonly\n */\n this.font = info.face;\n\n /**\n * The size of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.size = info.size;\n\n /**\n * The line-height of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.lineHeight = common.lineHeight / res;\n\n /**\n * The map of characters by character code.\n *\n * @member {object}\n * @readonly\n */\n this.chars = {};\n\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n *\n * @member {object}\n * @readonly\n * @private\n */\n this.pageTextures = pageTextures;\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < data.page.length; i++)\n {\n const { id, file } = data.page[i];\n\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n }\n\n // parse letters\n for (let i = 0; i < data.char.length; i++)\n {\n const { id, page } = data.char[i];\n let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];\n\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n\n const rect = new Rectangle(\n x + (pageTextures[page].frame.x / res),\n y + (pageTextures[page].frame.y / res),\n width,\n height\n );\n\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new Texture(\n pageTextures[page].baseTexture,\n rect\n ),\n page,\n };\n }\n\n // parse kernings\n for (let i = 0; i < data.kerning.length; i++)\n {\n let { first, second, amount } = data.kerning[i];\n\n first /= res;\n second /= res;\n amount /= res;\n\n if (this.chars[second])\n {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n\n /**\n * Remove references to created glyph textures.\n */\n public destroy(): void\n {\n for (const id in this.chars)\n {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n\n for (const id in this.pageTextures)\n {\n this.pageTextures[id].destroy(true);\n this.pageTextures[id] = null;\n }\n\n // Set readonly null.\n (this as any).chars = null;\n (this as any).pageTextures = null;\n }\n\n /**\n * Register a new bitmap font.\n *\n * @static\n * @param {XMLDocument|string|PIXI.BitmapFontData} data - The\n * characters map that could be provided as xml or raw string.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]}\n * textures - List of textures for each page.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n public static install(\n data: string|XMLDocument|BitmapFontData,\n textures: Texture|Texture[]|Dict\n ): BitmapFont\n {\n let fontData;\n\n if (data instanceof BitmapFontData)\n {\n fontData = data;\n }\n else\n {\n const format = autoDetectFormat(data);\n\n if (!format)\n {\n throw new Error('Unrecognized data format for font.');\n }\n\n fontData = format.parse(data as any);\n }\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n const font = new BitmapFont(fontData, textures);\n\n BitmapFont.available[font.font] = font;\n\n return font;\n }\n\n /**\n * Remove bitmap font by name.\n *\n * @static\n * @param {string} name\n */\n public static uninstall(name: string): void\n {\n const font = BitmapFont.available[name];\n\n if (!font)\n {\n throw new Error(`No font found named '${name}'`);\n }\n\n font.destroy();\n delete BitmapFont.available[name];\n }\n\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param {string} name - The name of the custom font to use with BitmapText.\n * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont.\n * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return {PIXI.BitmapFont} Font generated by style options.\n * @static\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n public static from(name: string, textStyle?: TextStyle | Partial, options?: IBitmapFontOptions): BitmapFont\n {\n if (!name)\n {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n\n const {\n chars,\n padding,\n resolution,\n textureWidth,\n textureHeight } = Object.assign(\n {}, BitmapFont.defaultOptions, options);\n\n const charsList = resolveCharacters(chars);\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const lineWidth = textureWidth;\n const fontData = new BitmapFontData();\n\n fontData.info[0] = {\n face: style.fontFamily as string,\n size: style.fontSize as number,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize as number,\n };\n\n let positionX = 0;\n let positionY = 0;\n\n let canvas;\n let context;\n let baseTexture;\n let maxCharHeight = 0;\n const baseTextures = [];\n const textures: Texture[] = [];\n\n for (let i = 0; i < charsList.length; i++)\n {\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n\n context = canvas.getContext('2d');\n baseTexture = new BaseTexture(canvas, { resolution });\n\n baseTextures.push(baseTexture);\n textures.push(new Texture(baseTexture));\n\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n\n // Measure glyph dimensions\n const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);\n const width = metrics.width;\n const height = Math.ceil(metrics.height);\n\n // This is ugly - but italics are given more space so they don't overlap\n const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution))\n {\n if (positionY === 0)\n {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is `\n + `too small for ${style.fontSize}px fonts`);\n }\n\n --i;\n\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth)\n {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n\n // Unique (numeric) ID mapping to this glyph\n const id = metrics.text.charCodeAt(0);\n\n // Create a texture holding just the glyph\n fontData.char.push({\n id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n\n const font = new BitmapFont(fontData, textures);\n\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined)\n {\n BitmapFont.uninstall(name);\n }\n\n BitmapFont.available[name] = font;\n\n return font;\n }\n}\n\n/**\n * @memberof PIXI\n * @interface IBitmapFontOptions\n * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate\n * @property {number} [resolution=1] - the resolution for rendering\n * @property {number} [padding=4] - the padding between glyphs in the atlas\n * @property {number} [textureWidth=512] - the width of the texture atlas\n * @property {number} [textureHeight=512] - the height of the texture atlas\n */\n\n","/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...item.split(''));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n","import { ObservablePoint, Point } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { removeItems, deprecation } from '@pixi/utils';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Rectangle } from '@pixi/math';\nimport { Texture } from '@pixi/core';\nimport type { IBitmapTextStyle } from './BitmapTextStyle';\nimport type { TextStyleAlign } from '@pixi/text';\nimport type { BitmapFontData } from './BitmapFontData';\nimport { Container } from '@pixi/display';\nimport type { IDestroyOptions } from '@pixi/display';\n\ninterface PageMeshData {\n index: number;\n indexCount: number;\n vertexCount: number;\n uvsCount: number;\n total: number;\n mesh: Mesh;\n vertices?: Float32Array;\n uvs?: Float32Array;\n indices?: Uint16Array;\n}\ninterface CharRenderData {\n texture: Texture;\n line: number;\n charCode: number;\n position: Point;\n}\n\nconst pageMeshDataPool: PageMeshData[] = [];\nconst charRenderDataPool: CharRenderData[] = [];\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class BitmapText extends Container\n{\n public static styleDefaults: Partial = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n public dirty: boolean;\n protected _textWidth: number;\n protected _textHeight: number;\n protected _text: string;\n protected _maxWidth: number;\n protected _maxLineHeight: number;\n protected _letterSpacing: number;\n protected _anchor: ObservablePoint;\n protected _fontName: string;\n protected _fontSize: number;\n protected _align: TextStyleAlign;\n protected _activePagesMeshData: PageMeshData[];\n protected _tint = 0xFFFFFF;\n protected _roundPixels: boolean;\n private _textureCache: Record;\n\n /**\n * @param {string} text - A string that you would like the text to display.\n * @param {object} style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n constructor(text: string, style: Partial = {})\n {\n super();\n\n if (style.font)\n {\n deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.');\n\n this._upgradeStyle(style);\n }\n\n // Apply the defaults\n const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(\n {}, BitmapText.styleDefaults, style);\n\n if (!BitmapFont.available[fontName])\n {\n throw new Error(`Missing BitmapFont \"${fontName}\"`);\n }\n\n /**\n * Collection of page mesh data.\n *\n * @member {object}\n * @private\n */\n this._activePagesMeshData = [];\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the current text align.\n *\n * @member {string}\n * @private\n */\n this._align = align;\n\n /**\n * Private tracker for the current tint.\n *\n * @member {number}\n * @private\n */\n this._tint = tint;\n\n /**\n * Private tracker for the current font name.\n *\n * @member {string}\n * @private\n */\n this._fontName = fontName;\n\n /**\n * Private tracker for the current font size.\n *\n * @member {number}\n * @private\n */\n this._fontSize = fontSize || BitmapFont.available[fontName].size;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = maxWidth;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = letterSpacing;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint((): void => { this.dirty = true; }, this, 0, 0);\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Set to `true` if the BitmapText needs to be redrawn.\n *\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * Cached char texture is destroyed when BitmapText is destroyed\n * @member {Record}\n * @private\n */\n this._textureCache = {};\n }\n\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n public updateText(): void\n {\n const data = BitmapFont.available[this._fontName];\n const scale = this._fontSize / data.size;\n const pos = new Point();\n const chars: CharRenderData[] = [];\n const lineWidths = [];\n const text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n const textLength = text.length;\n const maxWidth = this._maxWidth * data.size / this._fontSize;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n\n for (let i = 0; i < textLength; i++)\n {\n const charCode = text.charCodeAt(i);\n const char = text.charAt(i);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n const charRenderData = charRenderDataPool.pop() || {\n texture: Texture.EMPTY,\n line: 0,\n charCode: 0,\n position: new Point(),\n };\n\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n\n chars.push(charRenderData);\n\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n const lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n\n const pagesMeshData: Record = {};\n\n const newPagesMeshData: PageMeshData[] = [];\n\n const activePagesMeshData = this._activePagesMeshData;\n\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const texture = chars[i].texture;\n const baseTextureUid = texture.baseTexture.uid;\n\n if (!pagesMeshData[baseTextureUid])\n {\n let pageMeshData = pageMeshDataPool.pop();\n\n if (!pageMeshData)\n {\n const geometry = new MeshGeometry();\n const material = new MeshMaterial(Texture.EMPTY);\n\n const mesh = new Mesh(geometry, material);\n\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n\n // TODO need to get page texture here somehow..\n const { _textureCache } = this;\n\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n\n pageMeshData.mesh.tint = this._tint;\n\n newPagesMeshData.push(pageMeshData);\n\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n\n pagesMeshData[baseTextureUid].total++;\n }\n\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1)\n {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (let i = 0; i < newPagesMeshData.length; i++)\n {\n if (newPagesMeshData[i].mesh.parent !== this)\n {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n const total = pageMeshData.total;\n\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else\n {\n const total = pageMeshData.total;\n const vertices = pageMeshData.vertices;\n\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (let i = total * 4 * 2; i < vertices.length; i++)\n {\n vertices[i] = 0;\n }\n }\n\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const char = chars[i];\n let offset = char.position.x + lineAlignOffsets[char.line];\n\n if (this._roundPixels)\n {\n offset = Math.round(offset);\n }\n\n const xPos = offset * scale;\n const yPos = char.position.y * scale;\n const texture = char.texture;\n\n const pageMesh = pagesMeshData[texture.baseTexture.uid];\n\n const textureFrame = texture.frame;\n const textureUvs = texture._uvs;\n\n const index = pageMesh.index++;\n\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n let vertexCount = 0;\n\n const anchorOffsetX = this._textWidth * this.anchor.x;\n const anchorOffsetY = this._textHeight * this.anchor.y;\n\n for (let i = 0; i < pageMeshData.total; i++)\n {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n\n this._maxLineHeight = maxLineHeight * scale;\n\n const vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n const textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n const indexBuffer = pageMeshData.mesh.geometry.getIndex();\n\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n\n for (let i = 0; i < chars.length; i++)\n {\n charRenderDataPool.push(chars[i]);\n }\n }\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n updateTransform(): void\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n public getLocalBounds(): Rectangle\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n protected validate(): void\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n * @default 0xffffff\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n if (this._tint === value) return;\n\n this._tint = value;\n\n for (let i = 0; i < this._activePagesMeshData.length; i++)\n {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n }\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n public get align(): TextStyleAlign\n {\n return this._align;\n }\n\n public set align(value: TextStyleAlign)\n {\n if (this._align !== value)\n {\n this._align = value;\n this.dirty = true;\n }\n }\n\n /**\n * The name of the BitmapFont.\n *\n * @member {string}\n */\n public get fontName(): string\n {\n return this._fontName;\n }\n\n public set fontName(value: string)\n {\n if (!BitmapFont.available[value])\n {\n throw new Error(`Missing BitmapFont \"${value}\"`);\n }\n\n if (this._fontName !== value)\n {\n this._fontName = value;\n this.dirty = true;\n }\n }\n\n /**\n * The size of the font to display.\n *\n * @member {number}\n */\n public get fontSize(): number\n {\n return this._fontSize;\n }\n\n public set fontSize(value: number)\n {\n if (this._fontSize !== value)\n {\n this._fontSize = value;\n this.dirty = true;\n }\n }\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n public get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n public set anchor(value: ObservablePoint)\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n }\n\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n public get text(): string\n {\n return this._text;\n }\n\n public set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n public get maxWidth(): number\n {\n return this._maxWidth;\n }\n\n public set maxWidth(value: number)\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n public get maxLineHeight(): number\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textWidth(): number\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n public get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n\n public set letterSpacing(value: number)\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n public get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n public set roundPixels(value: boolean)\n {\n if (value !== this._roundPixels)\n {\n this._roundPixels = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textHeight(): number\n {\n this.validate();\n\n return this._textHeight;\n }\n\n /**\n * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties.\n *\n * @private\n * @deprecated since 5.3.0\n */\n _upgradeStyle(style: Partial): void\n {\n if (typeof style.font === 'string')\n {\n const valueSplit = style.font.split(' ');\n\n style.fontName = valueSplit.length === 1\n ? valueSplit[0]\n : valueSplit.slice(1).join(' ');\n\n if (valueSplit.length >= 2)\n {\n style.fontSize = parseInt(valueSplit[0], 10);\n }\n }\n else\n {\n style.fontName = style.font.name;\n style.fontSize = typeof style.font.size === 'number'\n ? style.font.size\n : parseInt(style.font.size, 10);\n }\n }\n\n destroy(options?: boolean | IDestroyOptions): void\n {\n const { _textureCache } = this;\n\n for (const id in _textureCache)\n {\n const texture = _textureCache[id];\n\n texture.destroy();\n delete _textureCache[id];\n }\n\n this._textureCache = null;\n\n super.destroy(options);\n }\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @deprecated since 5.3.0\n * @see PIXI.BitmapFont.install\n * @static\n */\n static registerFont(data: string|XMLDocument|BitmapFontData, textures: Texture|Texture[]|Dict): BitmapFont\n {\n deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install');\n\n return BitmapFont.install(data, textures);\n }\n\n /**\n * Get the list of installed fonts.\n *\n * @see PIXI.BitmapFont.available\n * @deprecated since 5.3.0\n * @static\n * @readonly\n * @member {Object.}\n */\n static get fonts(): Dict\n {\n deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available');\n\n return BitmapFont.available;\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { ILoaderResource } from '@pixi/loaders';\nimport type { Dict } from '@pixi/utils';\nimport type { Loader } from '@pixi/loaders';\nimport type { Texture } from '@pixi/core';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class BitmapFontLoader\n{\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n public static add(): void\n {\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(this: Loader, resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n const format = autoDetectFormat(resource.data);\n\n // Resource was not recognised as any of the expected font data format\n if (!format)\n {\n next();\n\n return;\n }\n\n const baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n const data = format.parse(resource.data);\n const textures: Dict = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page: ILoaderResource): void =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === data.page.length)\n {\n resource.bitmapFont = BitmapFont.install(data, textures);\n next();\n }\n };\n\n for (let i = 0; i < data.page.length; ++i)\n {\n const pageFile = data.page[i].file;\n const url = baseUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource: ILoaderResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n }\n\n /**\n * Get folder path from a resource\n * @private\n * @param {PIXI.Loader} loader\n * @param {PIXI.LoaderResource} resource\n * @return {string}\n */\n private static getBaseUrl(loader: Loader, resource: ILoaderResource): string\n {\n let resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (resUrl === '.')\n {\n resUrl = '';\n }\n\n if (loader.baseUrl && resUrl)\n {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/')\n {\n resUrl += '/';\n }\n }\n }\n\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/')\n {\n resUrl += '/';\n }\n\n return resUrl;\n }\n\n /**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url - Path to get directory for\n */\n private static dirname(url: string): string\n {\n const dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n }\n}\n","import { Filter, defaultVertex } from '@pixi/core';\nimport fragment from './alpha.frag';\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class AlphaFilter extends Filter\n{\n /**\n * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n","const vertTemplate = `\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }`;\n\nexport function generateBlurVertSource(kernelSize: number, x: boolean): string\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n\n return vertSource;\n}\n","interface IGAUSSIAN_VALUES {\n [x: number]: number[];\n}\nconst GAUSSIAN_VALUES: IGAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport function generateBlurFragSource(kernelSize: number): string\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value: number;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value].toString());\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n\n return fragSource;\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { generateBlurVertSource } from './generateBlurVertSource';\nimport { generateBlurFragSource } from './generateBlurFragSource';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilterPass extends Filter\n{\n public horizontal: boolean;\n public strength: number;\n public passes: number;\n\n private _quality: number;\n\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(horizontal: boolean, strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n const vertSrc = generateBlurVertSource(kernelSize, horizontal);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution;\n\n this._quality = 0;\n\n this.quality = quality;\n\n this.blur = strength;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else\n {\n const renderTarget = filterManager.getFilterTexture();\n const renderer = filterManager.renderer;\n\n let flip = input;\n let flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n\n for (let i = 1; i < this.passes - 1; i++)\n {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n\n this.uniforms.uSampler = flop;\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n }\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur(): number\n {\n return this.strength;\n }\n\n set blur(value: number)\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality(): number\n {\n return this._quality;\n }\n\n set quality(value: number)\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { BlurFilterPass } from './BlurFilterPass';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilter extends Filter\n{\n public blurXFilter: BlurFilterPass;\n public blurYFilter: BlurFilterPass;\n\n private _repeatEdgePixels: boolean;\n\n /**\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n super();\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution;\n this.quality = quality;\n this.blur = strength;\n\n this.repeatEdgePixels = false;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n apply(filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const xStrength = Math.abs(this.blurXFilter.strength);\n const yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n const renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n }\n\n protected updatePadding(): void\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get blur(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value: number)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get quality(): number\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value: number)\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get blurX(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value: number)\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get blurY(): number\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value: number)\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.blurYFilter.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blurYFilter.blendMode = value;\n }\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {boolean}\n * @default false\n */\n get repeatEdgePixels(): boolean\n {\n return this._repeatEdgePixels;\n }\n\n set repeatEdgePixels(value: boolean)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './colorMatrix.frag';\n\nimport type { ArrayFixed } from '@pixi/utils';\n\nexport type ColorMatrix = ArrayFixed;\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class ColorMatrixFilter extends Filter\n{\n public grayscale: (scale: number, multiply: boolean) => void;\n\n constructor()\n {\n const uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n super(defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n private _loadMatrix(matrix: ColorMatrix, multiply = false): void\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix) as any;\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n private _multiply(out: ColorMatrix, a: ColorMatrix, b: ColorMatrix): ColorMatrix\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n private _colorMatrix(matrix: ColorMatrix): ColorMatrix\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m as any;\n }\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public brightness(b: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public greyscale(scale: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public blackAndWhite(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public hue(rotation: number, multiply: boolean): void\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix: ColorMatrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public contrast(amount: number, multiply: boolean): void\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix: ColorMatrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public saturate(amount = 0, multiply?: boolean): void\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix: ColorMatrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n public desaturate(): void // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public negative(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public sepia(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public technicolor(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public polaroid(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public toBGR(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public kodachrome(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public browni(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public vintage(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {number} lightColor - Tone values, example: `0xFFE580`\n * @param {number} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean): void\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix: ColorMatrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public night(intensity: number, multiply: boolean): void\n {\n intensity = intensity || 0.1;\n\n const matrix: ColorMatrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public predator(amount: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public lsd(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n public reset(): void\n {\n const matrix: ColorMatrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix(): ColorMatrix\n {\n return this.uniforms.m;\n }\n\n set matrix(value: ColorMatrix)\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\nimport fragment from './displacement.frag';\nimport vertex from './displacement.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { RenderTexture, systems, Texture, ISpriteMaskTarget } from '@pixi/core';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class DisplacementFilter extends Filter\n{\n public maskSprite: ISpriteMaskTarget;\n public maskMatrix: Matrix;\n public scale: Point;\n\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} [scale] - The scale of the displacement\n */\n constructor(sprite: ISpriteMaskTarget, scale: number)\n {\n const maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n super(vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - clearMode.\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n const wt = this.maskSprite.worldTransform;\n const lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n const lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n }\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get map(): Texture\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value: Texture)\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport vertex from './fxaa.vert';\nimport fragment from './fxaa.frag';\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nexport class FXAAFilter extends Filter\n{\n constructor()\n {\n // TODO - needs work\n super(vertex, fragment);\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './noise.frag';\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class NoiseFilter extends Filter\n{\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get noise(): number\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value: number)\n {\n this.uniforms.uNoise = value;\n }\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get seed(): number\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value: number)\n {\n this.uniforms.uSeed = value;\n }\n}\n","import { Texture, BaseTexture, RenderTexture, Renderer, MaskData } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Container, DisplayObject, IDestroyOptions } from '@pixi/display';\nimport { IPointData, Matrix, Rectangle } from '@pixi/math';\nimport { uid } from '@pixi/utils';\nimport { settings } from '@pixi/settings';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\n\nconst _tempMatrix = new Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = null;\n\n// figured there's no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nexport class CacheData\n{\n public textureCacheId: string;\n public originalRender: (renderer: Renderer) => void;\n public originalRenderCanvas: (renderer: CanvasRenderer) => void;\n public originalCalculateBounds: () => void;\n public originalGetLocalBounds: (rect?: Rectangle) => Rectangle;\n public originalUpdateTransform: () => void;\n public originalDestroy: (options?: IDestroyOptions|boolean) => void;\n public originalMask: Container|MaskData;\n public originalFilterArea: Rectangle;\n public originalContainsPoint: (point: IPointData) => boolean;\n public sprite: Sprite;\n\n constructor()\n {\n this.textureCacheId = null;\n\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.originalContainsPoint = null;\n this.sprite = null;\n }\n}\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get(): CacheData\n {\n return this._cacheAsBitmap;\n },\n set(value: CacheData): void\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n let data: CacheData;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCached = function _renderCached(renderer: Renderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._render(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer: Renderer): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n const bounds = (this as Container).getLocalBounds(null, true).clone();\n\n // add some padding!\n if (this.filters)\n {\n const padding = this.filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n const cachedRenderTexture = renderer.renderTexture.current;\n const cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();\n const cachedProjectionTransform = renderer.projection.transform;\n\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);\n\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);\n\n // renderer.filterManager.filterStack = stack;\n\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.enableTempParent();\n this.updateTransform();\n this.disableTempParent(null);\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(\n renderer: CanvasRenderer\n): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n const bounds = (this as Container).getLocalBounds(null, true);\n\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n const cachedRenderTarget = renderer.context;\n const cachedProjectionTransform = (renderer as any)._projTransform;\n\n bounds.ceil(settings.RESOLUTION);\n\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n this.transform.localTransform.copyTo(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n (renderer as any)._projTransform = cachedProjectionTransform;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = (renderer as any)._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds(): void\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n (this._cacheData.sprite as any)._calculateBounds();\n this._bounds.updateID = (this as any)._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds(): Rectangle\n{\n return this._cacheData.sprite.getLocalBounds(null);\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject(): void\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options: IDestroyOptions|boolean): void\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n","import { DisplayObject, Container } from '@pixi/display';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\nDisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container.\n *\n * Recursive searches are done in a preorder traversal.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\nContainer.prototype.getChildByName = function getChildByName(name: string, deep?: boolean): DisplayObject\n{\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n if (deep)\n {\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n const child = (this.children[i] as Container);\n\n if (!child.getChildByName)\n {\n continue;\n }\n\n const target = (this.children[i] as Container).getChildByName(name, true);\n\n if (target)\n {\n return target;\n }\n }\n }\n\n return null;\n};\n","import { DisplayObject } from '@pixi/display';\nimport { Point } from '@pixi/math';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\nDisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point: Point = new Point(), skipUpdate = false): Point\n{\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","import { MeshGeometry } from '@pixi/mesh';\n\nexport class PlaneGeometry extends MeshGeometry\n{\n public segWidth: number;\n public segHeight: number;\n public width: number;\n public height: number;\n\n constructor(width = 100, height = 100, segWidth = 10, segHeight = 10)\n {\n super();\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n build(): void\n {\n const total = this.segWidth * this.segHeight;\n const verts = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.segWidth - 1;\n const segmentsY = this.segHeight - 1;\n\n const sizeX = (this.width) / segmentsX;\n const sizeY = (this.height) / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.segWidth);\n const y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.segWidth) + xpos;\n const value2 = (ypos * this.segWidth) + xpos + 1;\n const value3 = ((ypos + 1) * this.segWidth) + xpos;\n const value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nexport class RopeGeometry extends MeshGeometry\n{\n public points: IPoint[];\n public readonly textureScale: number;\n _width: number;\n\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n constructor(width = 200, points: IPoint[], textureScale = 0)\n {\n super(new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this._width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n private build(): void\n {\n const points = this.points;\n\n if (!points) return;\n\n const vertexBuffer = this.getBuffer('aVertexPosition');\n const uvBuffer = this.getBuffer('aTextureCoord');\n const indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n const uvs = uvBuffer.data;\n const indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n let amount = 0;\n let prev = points[0];\n const textureWidth = this._width * this.textureScale;\n const total = points.length; // - 1;\n\n for (let i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n const index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n const dx = prev.x - points[i].x;\n const dy = prev.y - points[i].y;\n const distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n let indexCount = 0;\n\n for (let i = 0; i < total - 1; i++)\n {\n const index = i * 2;\n\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n public updateVertices(): void\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n const vertices = this.buffers[0].data;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n }\n\n public update(): void\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n }\n}\n","import { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { RopeGeometry } from './geometry/RopeGeometry';\n\nimport type { Texture, Renderer } from '@pixi/core';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimpleRope extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be streched instead.\n */\n constructor(texture: Texture, points: IPoint[], textureScale = 0)\n {\n const ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n const meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n super(ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n _render(renderer: Renderer): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.shader.texture.height)\n {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { PlaneGeometry } from './geometry/PlaneGeometry';\n\nimport type{ Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimplePlane extends Mesh\n{\n protected _textureID: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the SimplePlane.\n * @param {number} verticesX - The number of vertices in the x-axis\n * @param {number} verticesY - The number of vertices in the y-axis\n */\n constructor(texture: Texture, verticesX: number, verticesY: number)\n {\n const planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n const meshMaterial = new MeshMaterial(Texture.WHITE);\n\n super(planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n\n const geometry: PlaneGeometry = this.geometry as any;\n\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n\n geometry.build();\n }\n\n set texture(value: Texture)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n }\n\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n _render(renderer: Renderer): void\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n super._render(renderer);\n }\n\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.shader.texture.off('update', this.textureUpdated, this);\n super.destroy(options);\n }\n}\n","import { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { Texture } from '@pixi/core';\n\nimport type { ITypedArray, IArrayBuffer, Renderer } from '@pixi/core';\nimport type { DRAW_MODES } from '@pixi/constants';\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nexport class SimpleMesh extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(\n texture = Texture.EMPTY,\n vertices?: IArrayBuffer,\n uvs?: IArrayBuffer,\n indices?: IArrayBuffer,\n drawMode?: DRAW_MODES\n )\n {\n const geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n const meshMaterial = new MeshMaterial(texture);\n\n super(geometry, meshMaterial, null, drawMode);\n\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n _render(renderer: Renderer): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SimplePlane } from './SimplePlane';\n\nimport type { ITypedArray } from '@pixi/core';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface NineSlicePlane extends GlobalMixins.NineSlicePlane {}\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *

\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nexport class NineSlicePlane extends SimplePlane\n{\n private _origWidth: number;\n private _origHeight: number;\n _leftWidth: number;\n _rightWidth: number;\n _topHeight: number;\n _bottomHeight: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n constructor(\n texture: Texture,\n leftWidth = DEFAULT_BORDER_SIZE,\n topHeight = DEFAULT_BORDER_SIZE,\n rightWidth = DEFAULT_BORDER_SIZE,\n bottomHeight = DEFAULT_BORDER_SIZE\n )\n {\n super(Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n this._leftWidth = leftWidth;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n this._rightWidth = rightWidth;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n this._topHeight = topHeight;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n this._bottomHeight = bottomHeight;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n }\n\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n /**\n * Updates the horizontal vertices.\n *\n */\n public updateHorizontalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /**\n * Updates the vertical vertices.\n *\n */\n public updateVerticalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return {number} Smaller number of vertical and horizontal scale.\n * @private\n */\n private _getMinScale(): number\n {\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this._width > w ? 1.0 : this._width / w;\n\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this._height > h ? 1.0 : this._height / h;\n\n const scale = Math.min(scaleW, scaleH);\n\n return scale;\n }\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n this._refresh();\n }\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n this._refresh();\n }\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get leftWidth(): number\n {\n return this._leftWidth;\n }\n\n set leftWidth(value: number)\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get rightWidth(): number\n {\n return this._rightWidth;\n }\n\n set rightWidth(value: number)\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get topHeight(): number\n {\n return this._topHeight;\n }\n\n set topHeight(value: number)\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get bottomHeight(): number\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value: number)\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n private _refresh(): void\n {\n const texture = this.texture;\n\n const uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class AnimatedSprite extends Sprite\n{\n public animationSpeed: number;\n public loop: boolean;\n public updateAnchor: boolean;\n public onComplete: () => void;\n public onFrameChange: (currentFrame: number) => void;\n public onLoop: () => void;\n\n private _playing: boolean;\n private _textures: Texture[];\n private _durations: number[];\n private _autoUpdate: boolean;\n private _isConnectedToTicker: boolean;\n private _currentTime: number;\n private _previousFrame: number;\n\n /**\n * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n constructor(textures: Texture[]|FrameObject[], autoUpdate = true)\n {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n this._textures = null;\n\n /**\n * @type {number[]}\n * @private\n */\n this._durations = null;\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n this._playing = false;\n\n /**\n * The texture index that was displayed last time\n *\n * @member {number}\n * @private\n */\n this._previousFrame = null;\n\n this.textures = textures;\n }\n\n /**\n * Stops the AnimatedSprite.\n *\n */\n public stop(): void\n {\n if (!this._playing)\n {\n return;\n }\n\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Plays the AnimatedSprite.\n *\n */\n public play(): void\n {\n if (this._playing)\n {\n return;\n }\n\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n public gotoAndStop(frameNumber: number): void\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n public gotoAndPlay(frameNumber: number): void\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @param {number} deltaTime - Time since last tick.\n */\n update(deltaTime: number): void\n {\n if (!this._playing)\n {\n return;\n }\n\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n private updateTexture(): void\n {\n const currentFrame = this.currentFrame;\n\n if (this._previousFrame === currentFrame)\n {\n return;\n }\n\n this._previousFrame = currentFrame;\n\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.stop();\n super.destroy(options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames.\n */\n public static fromFrames(frames: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n public static fromImages(images: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get totalFrames(): number\n {\n return this._textures.length;\n }\n\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]}\n */\n get textures(): Texture[]|FrameObject[]\n {\n return this._textures;\n }\n\n set textures(value: Texture[]|FrameObject[])\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value as Texture[];\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push((value[i] as FrameObject).texture);\n this._durations.push((value[i] as FrameObject).time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n get currentFrame(): number\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n get playing(): boolean\n {\n return this._playing;\n }\n\n /**\n * Whether to use PIXI.Ticker.shared to auto update animation time\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\nexport interface FrameObject {\n texture: Texture;\n time: number;\n}\n\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n","import { deprecation } from '@pixi/utils';\nimport type {\n systems,\n resources,\n Renderer,\n ImageSource,\n BaseTexture,\n RenderTexture,\n Texture,\n State,\n AbstractRenderer } from '@pixi/core';\nimport type { DisplayObject, Container } from '@pixi/display';\nimport type { TilingSprite } from '@pixi/sprite-tiling';\nimport type {\n Point,\n ObservablePoint,\n IPoint,\n Rectangle,\n Transform,\n groupD8,\n Matrix } from '@pixi/math';\nimport type { InteractionManager, InteractionData, InteractionEvent } from '@pixi/interaction';\nimport type { AccessibilityManager } from '@pixi/accessibility';\nimport type { Ticker } from '@pixi/ticker';\nimport type { Graphics, GraphicsData } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\nimport type { BitmapText, BitmapFontLoader } from '@pixi/text-bitmap';\nimport type { CanvasRenderTarget } from '@pixi/utils';\nimport type { Loader, LoaderResource } from '@pixi/loaders';\nimport type { BasePrepare, Prepare } from '@pixi/prepare';\nimport type { Extract } from '@pixi/extract';\nimport type { AnimatedSprite } from '@pixi/sprite-animated';\nimport type { Mesh } from '@pixi/mesh';\nimport type { ParticleContainer } from '@pixi/particles';\nimport type { SpritesheetLoader } from '@pixi/spritesheet';\nimport type {\n SimpleRope,\n NineSlicePlane,\n SimpleMesh,\n SimplePlane } from '@pixi/mesh-extras';\n\nconst v5 = '5.0.0';\n\n// Canvas deprecations needs to get moved\n// to the legacy package, but for now, we'll\n// ad this reminder\ntype $FixLegacy = any;\n\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useDeprecated(this: any): void\n{\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const PIXI = this;\n\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get(): RegExp\n {\n deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get(): {[name: string]: number}\n {\n deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get(): typeof Renderer\n {\n deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n\n return PIXI.Renderer;\n },\n },\n\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get(): CanvasRenderTarget\n {\n deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get(): Loader\n {\n deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n\n return PIXI.Loader.shared;\n },\n },\n\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get(): systems.FilterSystem\n {\n deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n\n return PIXI.systems.FilterSystem;\n },\n },\n\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get(): $FixLegacy\n {\n deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n\n return PIXI.canvasUtils;\n },\n },\n\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get(): typeof groupD8\n {\n deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n\n return PIXI.groupD8;\n },\n },\n });\n\n /**\n * @namespace PIXI.accessibility\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.accessibility = {};\n\n Object.defineProperties(PIXI.accessibility, {\n /**\n * @class PIXI.accessibility.AccessibilityManager\n * @deprecated since 5.3.0\n * @see PIXI.AccessibilityManager\n */\n AccessibilityManager: {\n get(): typeof AccessibilityManager\n {\n deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager');\n\n return PIXI.AccessibilityManager;\n },\n },\n });\n\n /**\n * @namespace PIXI.interaction\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.interaction = {};\n\n Object.defineProperties(PIXI.interaction, {\n /**\n * @class PIXI.interaction.InteractionManager\n * @deprecated since 5.3.0\n * @see PIXI.InteractionManager\n */\n InteractionManager: {\n get(): typeof InteractionManager\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager');\n\n return PIXI.InteractionManager;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionData\n * @deprecated since 5.3.0\n * @see PIXI.InteractionData\n */\n InteractionData: {\n get(): typeof InteractionData\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData');\n\n return PIXI.InteractionData;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionEvent\n * @deprecated since 5.3.0\n * @see PIXI.InteractionEvent\n */\n InteractionEvent: {\n get(): typeof InteractionEvent\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent');\n\n return PIXI.InteractionEvent;\n },\n },\n });\n\n /**\n * @namespace PIXI.prepare\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.prepare = {};\n\n Object.defineProperties(PIXI.prepare, {\n /**\n * @class PIXI.prepare.BasePrepare\n * @deprecated since 5.2.1\n * @see PIXI.BasePrepare\n */\n BasePrepare: {\n get(): typeof BasePrepare\n {\n deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare');\n\n return PIXI.BasePrepare;\n },\n },\n /**\n * @class PIXI.prepare.Prepare\n * @deprecated since 5.2.1\n * @see PIXI.Prepare\n */\n Prepare: {\n get(): typeof Prepare\n {\n deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n },\n /**\n * @class PIXI.prepare.CanvasPrepare\n * @deprecated since 5.2.1\n * @see PIXI.CanvasPrepare\n */\n CanvasPrepare: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare');\n\n return PIXI.CanvasPrepare;\n },\n },\n });\n\n /**\n * @namespace PIXI.extract\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.extract = {};\n\n Object.defineProperties(PIXI.extract, {\n /**\n * @class PIXI.extract.Extract\n * @deprecated since 5.2.1\n * @see PIXI.Extract\n */\n Extract: {\n get(): typeof Extract\n {\n deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n },\n /**\n * @class PIXI.extract.CanvasExtract\n * @deprecated since 5.2.1\n * @see PIXI.CanvasExtract\n */\n CanvasExtract: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract');\n\n return PIXI.CanvasExtract;\n },\n },\n });\n\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get(): typeof TilingSprite\n {\n deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get(): typeof AnimatedSprite\n {\n deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get(): typeof BitmapText\n {\n deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n\n return PIXI.BitmapText;\n },\n },\n });\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromFrame\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromFrame = function fromFrame(frameId: string, width: number, height: number): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from');\n\n return PIXI.TilingSprite.from(frameId, { width, height });\n };\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromImage\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromImage = function fromImage(\n imageId: string,\n width: number,\n height: number,\n options: any = {}): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from');\n\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object')\n {\n options = {\n // eslint-disable-next-line prefer-rest-params\n scaleMode: arguments[4],\n resourceOptions: {\n // eslint-disable-next-line prefer-rest-params\n crossorigin: arguments[3],\n },\n };\n }\n\n options.width = width;\n options.height = height;\n\n return PIXI.TilingSprite.from(imageId, options);\n };\n\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get(): typeof resources.SVGResource.getSize\n {\n deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n\n return PIXI.resources.SVGResource.getSize;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get(): typeof SimpleMesh\n {\n deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get(): typeof NineSlicePlane\n {\n deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get(): typeof SimplePlane\n {\n deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get(): typeof SimpleRope\n {\n deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get(): typeof Mesh\n {\n deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n\n return PIXI.MeshRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get(): typeof ParticleContainer\n {\n deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n\n return PIXI.ParticleRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get(): typeof Ticker\n {\n deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get(): Ticker\n {\n deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n\n return PIXI.Ticker.shared;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get(): typeof Loader\n {\n deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get(): typeof LoaderResource\n {\n deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get(): typeof BitmapFontLoader.use\n {\n deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get(): void\n {\n deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed');\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get(): typeof SpritesheetLoader.use\n {\n deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get(): typeof SpritesheetLoader.getResourcePath\n {\n deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware: any): typeof Loader\n {\n deprecation(v5,\n 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'\n );\n\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n\n // convenience for converting event name to signal name\n const eventToSignal = (event: any): string =>\n `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n\n Object.assign(PIXI.Loader.prototype,\n {\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#on\n * @deprecated since 5.0.0\n */\n on(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#on is completely deprecated, use PIXI.Loader#${signal}.add`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#once\n * @deprecated since 5.0.0\n */\n once(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#once is completely deprecated, use PIXI.Loader#${signal}.once`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#off\n * @deprecated since 5.0.0\n */\n off(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#off is completely deprecated, use PIXI.Loader#${signal}.detach`);\n },\n });\n\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get(): typeof Extract\n {\n deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n });\n\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get(): typeof Prepare\n {\n deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n });\n\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n\n this._render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(this: DisplayObject, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n\n this.renderAdvanced(renderer);\n };\n\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get(): number\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n\n return 0;\n },\n set(): void\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n\n const { BaseTexture: BaseTextureAny } = PIXI;\n\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTextureAny.prototype.loadSource = function loadSource(image: string | HTMLImageElement): void\n {\n deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n\n const resource = PIXI.resources.autoDetectResource(image);\n\n resource.internal = true;\n\n this.setResource(resource);\n this.update();\n };\n\n let baseTextureIdDeprecation = false;\n\n Object.defineProperties(BaseTextureAny.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get(): boolean\n {\n deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resources.ImageResource#url\n */\n imageUrl: {\n get(this: BaseTexture): string\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n return (this.resource as resources.ImageResource)?.url;\n },\n\n set(this: BaseTexture, imageUrl: string): void\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n if (this.resource)\n {\n (this.resource as resources.ImageResource).url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get(this: BaseTexture): ImageSource\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n\n return (this.resource as resources.BaseImageResource).source;\n },\n set(this: BaseTexture, source: ImageSource): void\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n\n if (this.resource)\n {\n (this.resource as resources.BaseImageResource).source = source;\n }\n },\n },\n\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get(this: BaseTexture): boolean\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: BaseTexture, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get(this: BaseTexture): number\n {\n if (!baseTextureIdDeprecation)\n {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n\n return this._batchLocation;\n },\n set(this: BaseTexture, value: number): void\n {\n this._batchLocation = value;\n },\n },\n });\n\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromImage = function fromImage(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromCanvas = function fromCanvas(canvas: HTMLCanvasElement, scaleMode: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n\n return BaseTextureAny.from(canvas, { scaleMode });\n };\n\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromSVG = function fromSVG(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get(this: resources.ImageResource): boolean\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: resources.ImageResource, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(this: Point, p: IPoint): Point\n {\n deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(this: ObservablePoint, p: IPoint): ObservablePoint\n {\n deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(this: Rectangle, p: Rectangle): Rectangle\n {\n deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(this: Matrix, p: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n\n return this.copyTo(p);\n };\n\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(this: systems.StateSystem, s: State): void\n {\n deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n\n return this.set(s);\n };\n\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget(this: systems.FilterSystem, _clear: boolean, resolution: number)\n {\n deprecation(v5,\n 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'\n );\n\n return this.getFilterTexture(null, resolution);\n },\n\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget(this: systems.FilterSystem, renderTexture: any)\n {\n deprecation(v5,\n 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture'\n );\n\n this.returnFilterTexture(renderTexture);\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: any)\n {\n deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n\n const mappedMatrix = outputMatrix.identity();\n const { sourceFrame, destinationFrame } = this.activeState;\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n\n return mappedMatrix;\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n\n const { sourceFrame, destinationFrame } = this.activeState;\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n\n const translateScaleX = (destinationFrame.width / sourceFrame.width);\n const translateScaleY = (destinationFrame.height / sourceFrame.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n },\n });\n\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.size property has been removed');\n\n return this._frame;\n },\n },\n });\n\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurXFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(true, strength, quality, resolution, kernelSize);\n }\n }\n\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurYFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(false, strength, quality, resolution, kernelSize);\n }\n }\n\n Object.assign(PIXI.filters, {\n BlurXFilter,\n BlurYFilter,\n });\n\n const {\n Sprite: SpriteAny,\n Texture: TextureAny,\n Graphics: GraphicsAny } = PIXI;\n\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!GraphicsAny.prototype.generateCanvasTexture)\n {\n GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture(): void\n {\n deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(GraphicsAny.prototype, 'graphicsData', {\n get(this: Graphics): GraphicsData[]\n {\n deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n\n return this.geometry.graphicsData;\n },\n });\n\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Sprite\n {\n deprecation(v5, `PIXI.Sprite.${name} method is deprecated, use PIXI.Sprite.from`);\n\n return SpriteAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame');\n\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Texture\n {\n deprecation(v5, `PIXI.Texture.${name} method is deprecated, use PIXI.Texture.from`);\n\n return TextureAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromImage = textureFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame');\n\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get(this: AbstractRenderer): boolean\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n return this.autoDensity;\n },\n set(this: any, value: boolean): void\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n this.autoDensity = value;\n },\n });\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get(this: Renderer)\n {\n deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n\n return this.texture;\n },\n });\n\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n\n /**\n * @memberof PIXI.BitmapText\n * @member {object} font\n * @deprecated since 5.3.0\n */\n Object.defineProperty(PIXI.BitmapText.prototype, 'font', {\n get(this: BitmapText): any\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n return {\n name: this._fontName,\n size: this._fontSize,\n tint: this._tint,\n align: this._align,\n };\n },\n set(this: BitmapText, value: any)\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n if (!value)\n {\n return;\n }\n\n const style: any = { font: value };\n\n this._upgradeStyle(style);\n\n style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size;\n\n this._fontName = style.fontName;\n this._fontSize = style.fontSize;\n\n this.dirty = true;\n },\n });\n}\n","import '@pixi/polyfill';\n\nimport * as utils from '@pixi/utils';\nimport { AccessibilityManager } from '@pixi/accessibility';\nimport { InteractionManager } from '@pixi/interaction';\nimport { Application } from '@pixi/app';\nimport { Renderer, BatchRenderer } from '@pixi/core';\nimport { Extract } from '@pixi/extract';\nimport { Loader, AppLoaderPlugin } from '@pixi/loaders';\nimport { ParticleRenderer } from '@pixi/particles';\nimport { Prepare } from '@pixi/prepare';\nimport { SpritesheetLoader } from '@pixi/spritesheet';\nimport { TilingSpriteRenderer } from '@pixi/sprite-tiling';\nimport { BitmapFontLoader } from '@pixi/text-bitmap';\nimport { TickerPlugin } from '@pixi/ticker';\nimport { AlphaFilter } from '@pixi/filter-alpha';\nimport { BlurFilter, BlurFilterPass } from '@pixi/filter-blur';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { DisplacementFilter } from '@pixi/filter-displacement';\nimport { FXAAFilter } from '@pixi/filter-fxaa';\nimport { NoiseFilter } from '@pixi/filter-noise';\nimport '@pixi/mixin-cache-as-bitmap';\nimport '@pixi/mixin-get-child-by-name';\nimport '@pixi/mixin-get-global-position';\n\n// Export deprecations so Rollup can call it\n// in the footer after global is defined\n// other module must call this manually\nimport { useDeprecated } from './useDeprecated';\n\n// Install renderer plugins\nRenderer.registerPlugin('accessibility', AccessibilityManager);\nRenderer.registerPlugin('extract', Extract);\nRenderer.registerPlugin('interaction', InteractionManager);\nRenderer.registerPlugin('particle', ParticleRenderer);\nRenderer.registerPlugin('prepare', Prepare);\nRenderer.registerPlugin('batch', BatchRenderer);\nRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n\nLoader.registerPlugin(BitmapFontLoader);\nLoader.registerPlugin(SpritesheetLoader);\n\nApplication.registerPlugin(TickerPlugin);\nApplication.registerPlugin(AppLoaderPlugin);\n\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nexport const VERSION = '__VERSION__';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nexport const filters = {\n AlphaFilter,\n BlurFilter,\n BlurFilterPass,\n ColorMatrixFilter,\n DisplacementFilter,\n FXAAFilter,\n NoiseFilter,\n};\n\n// Export ES for those importing specifically by name,\nexport * from '@pixi/accessibility';\nexport * from '@pixi/app';\nexport * from '@pixi/constants';\nexport * from '@pixi/core';\nexport * from '@pixi/display';\nexport * from '@pixi/extract';\nexport * from '@pixi/graphics';\nexport * from '@pixi/loaders';\nexport * from '@pixi/interaction';\nexport * from '@pixi/math';\nexport * from '@pixi/mesh';\nexport * from '@pixi/mesh-extras';\nexport * from '@pixi/particles';\nexport * from '@pixi/prepare';\nexport * from '@pixi/runner';\nexport * from '@pixi/sprite';\nexport * from '@pixi/spritesheet';\nexport * from '@pixi/sprite-animated';\nexport * from '@pixi/sprite-tiling';\nexport * from '@pixi/text';\nexport * from '@pixi/text-bitmap';\nexport * from '@pixi/ticker';\nexport * from '@pixi/settings';\nexport {\n utils,\n useDeprecated,\n};\n","import { SHAPES } from '@pixi/math';\n\nimport type { CanvasRenderer } from '../CanvasRenderer';\nimport type { Graphics } from '@pixi/graphics';\nimport type { MaskData } from '@pixi/core';\nimport type { Container } from '@pixi/display';\n\n/**\n * A set of functions used to handle masking.\n *\n * Sprite masking is not supported on the CanvasRenderer.\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasMaskManager\n{\n private renderer: CanvasRenderer;\n private _foundShapes: Array;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n\n this._foundShapes = [];\n }\n\n /**\n * This method adds it to the current stack of masks.\n *\n * @param {PIXI.MaskData | PIXI.Graphics} maskData - the maskData that will be pushed\n */\n pushMask(maskData: MaskData | Graphics): void\n {\n const renderer = this.renderer;\n const maskObject = ((maskData as MaskData).maskObject || maskData) as Container;\n\n renderer.context.save();\n\n // TODO support sprite alpha masks??\n // lots of effort required. If demand is great enough..\n\n const foundShapes = this._foundShapes;\n\n this.recursiveFindShapes(maskObject, foundShapes);\n if (foundShapes.length > 0)\n {\n const { context } = renderer;\n\n context.beginPath();\n\n for (let i = 0; i < foundShapes.length; i++)\n {\n const shape = foundShapes[i];\n const transform = shape.transform.worldTransform;\n\n this.renderer.setContextTransform(transform);\n\n this.renderGraphicsShape(shape);\n }\n\n foundShapes.length = 0;\n context.clip();\n }\n }\n\n /**\n * Renders all PIXI.Graphics shapes in a subtree.\n *\n * @param {PIXI.Container} container - container to scan.\n * @param {PIXI.Graphics[]} out - where to put found shapes\n */\n recursiveFindShapes(container: Container, out: Array): void\n {\n if ((container as Graphics).geometry && (container as Graphics).geometry.graphicsData)\n {\n out.push(container as Graphics);\n }\n\n const { children } = container;\n\n if (children)\n {\n for (let i = 0; i < children.length; i++)\n {\n this.recursiveFindShapes(children[i] as Container, out);\n }\n }\n }\n\n /**\n * Renders a PIXI.Graphics shape.\n *\n * @param {PIXI.Graphics} graphics - The object to render.\n */\n renderGraphicsShape(graphics: Graphics): void\n {\n graphics.finishPoly();\n\n const context = this.renderer.context;\n const graphicsData = graphics.geometry.graphicsData;\n const len = graphicsData.length;\n\n if (len === 0)\n {\n return;\n }\n\n for (let i = 0; i < len; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n\n if (shape.type === SHAPES.POLY)\n {\n const points = shape.points;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 1; j < points.length / 2; j++)\n {\n context.lineTo(points[j * 2], points[(j * 2) + 1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1])\n {\n context.closePath();\n }\n }\n else if (shape.type === SHAPES.RECT)\n {\n context.rect(shape.x, shape.y, shape.width, shape.height);\n context.closePath();\n }\n else if (shape.type === SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n }\n else if (shape.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n }\n else if (shape.type === SHAPES.RREC)\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n }\n }\n }\n\n /**\n * Restores the current drawing context to the state it was before the mask was applied.\n *\n * @param {PIXI.CanvasRenderer} renderer - The renderer context to use.\n */\n popMask(renderer: CanvasRenderer): void\n {\n renderer.context.restore();\n renderer.invalidateBlendMode();\n }\n\n /**\n * Destroys this canvas mask manager.\n *\n */\n public destroy(): void\n {\n /* empty */\n }\n}\n","/**\n * Creates a little colored canvas\n *\n * @ignore\n * @param {string} color - The color to make the canvas\n * @return {canvas} a small canvas element\n */\nfunction createColoredCanvas(color: string): HTMLCanvasElement\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = color;\n context.fillRect(0, 0, 6, 1);\n\n return canvas;\n}\n\n/**\n * Checks whether the Canvas BlendModes are supported by the current browser\n *\n * @private\n * @return {boolean} whether they are supported\n */\nexport function canUseNewCanvasBlendModes(): boolean\n{\n if (typeof document === 'undefined')\n {\n return false;\n }\n\n const magenta = createColoredCanvas('#ff00ff');\n const yellow = createColoredCanvas('#ffff00');\n\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.globalCompositeOperation = 'multiply';\n context.drawImage(magenta, 0, 0);\n context.drawImage(yellow, 2, 0);\n\n const imageData = context.getImageData(2, 0, 1, 1);\n\n if (!imageData)\n {\n return false;\n }\n\n const data = imageData.data;\n\n return (data[0] === 255 && data[1] === 0 && data[2] === 0);\n}\n","import { AbstractRenderer, resources } from '@pixi/core';\nimport { CanvasRenderTarget, sayHello, rgb2hex, hex2string } from '@pixi/utils';\nimport { CanvasMaskManager } from './utils/CanvasMaskManager';\nimport { mapCanvasBlendModesToPixi } from './utils/mapCanvasBlendModesToPixi';\nimport { RENDERER_TYPE, SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { Matrix } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type {\n IRendererOptions, IRendererPlugin,\n IRendererPlugins,\n RenderTexture,\n BaseRenderTexture,\n} from '@pixi/core';\n\nconst tempMatrix = new Matrix();\n\nexport interface ICanvasRendererPluginConstructor {\n new (renderer: CanvasRenderer, options?: any): IRendererPlugin;\n}\n\nexport interface ICanvasRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * Different browsers support different smoothing property names\n * this is the list of all platform props.\n */\ntype SmoothingEnabledProperties =\n 'imageSmoothingEnabled' |\n 'webkitImageSmoothingEnabled' |\n 'mozImageSmoothingEnabled' |\n 'oImageSmoothingEnabled' |\n 'msImageSmoothingEnabled';\n\n/**\n * Renderering context for all browsers. This includes platform-specific\n * properties that are not included in the spec for CanvasRenderingContext2D\n */\nexport interface CrossPlatformCanvasRenderingContext2D extends CanvasRenderingContext2D\n{\n webkitImageSmoothingEnabled: boolean;\n mozImageSmoothingEnabled: boolean;\n oImageSmoothingEnabled: boolean;\n msImageSmoothingEnabled: boolean;\n}\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas.\n *\n * This renderer should be used for browsers that do not support WebGL.\n * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class CanvasRenderer extends AbstractRenderer\n{\n public readonly rootContext: CrossPlatformCanvasRenderingContext2D;\n public context: CrossPlatformCanvasRenderingContext2D;\n public refresh: boolean;\n public maskManager: CanvasMaskManager;\n public smoothProperty: SmoothingEnabledProperties;\n public readonly blendModes: string[];\n public renderingToScreen: boolean;\n\n private _activeBlendMode: BLEND_MODES;\n private _projTransform: Matrix;\n\n _outerBlend: boolean;\n\n /**\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.CANVAS, options);\n\n /**\n * The root canvas 2d context that everything is drawn with.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.rootContext = this.view.getContext('2d', { alpha: this.transparent }) as\n CrossPlatformCanvasRenderingContext2D;\n\n /**\n * The currently active canvas 2d context (could change with renderTextures)\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.rootContext;\n\n /**\n * Boolean flag controlling canvas refresh.\n *\n * @member {boolean}\n */\n this.refresh = true;\n\n /**\n * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.\n *\n * @member {PIXI.CanvasMaskManager}\n */\n this.maskManager = new CanvasMaskManager(this);\n\n /**\n * The canvas property used to set the canvas smoothing property.\n *\n * @member {string}\n */\n this.smoothProperty = 'imageSmoothingEnabled';\n\n if (!this.rootContext.imageSmoothingEnabled)\n {\n const rc = this.rootContext;\n\n if (rc.webkitImageSmoothingEnabled)\n {\n this.smoothProperty = 'webkitImageSmoothingEnabled';\n }\n else if (rc.mozImageSmoothingEnabled)\n {\n this.smoothProperty = 'mozImageSmoothingEnabled';\n }\n else if (rc.oImageSmoothingEnabled)\n {\n this.smoothProperty = 'oImageSmoothingEnabled';\n }\n else if (rc.msImageSmoothingEnabled)\n {\n this.smoothProperty = 'msImageSmoothingEnabled';\n }\n }\n\n this.initPlugins(CanvasRenderer.__plugins);\n\n /**\n * Tracks the blend modes useful for this renderer.\n *\n * @member {object}\n */\n this.blendModes = mapCanvasBlendModesToPixi();\n this._activeBlendMode = null;\n this._outerBlend = false;\n\n /**\n * Projection transform, passed in render() stored here\n * @type {null}\n * @private\n */\n this._projTransform = null;\n\n this.renderingToScreen = false;\n\n sayHello('Canvas');\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.CanvasRenderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.CanvasRenderer#prerender\n */\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Renders the object to this canvas view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered\n * @param {PIXI.RenderTexture} [renderTexture] - A render texture to be rendered to.\n * If unset, it will render to the root context.\n * @param {boolean} [clear=this.clearBeforeRender] - Whether to clear the canvas before drawing\n * @param {PIXI.Matrix} [transform] - A transformation to be applied\n * @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform\n */\n public render(displayObject: DisplayObject, renderTexture?: RenderTexture | BaseRenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n if (!this.view)\n {\n return;\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.emit('prerender');\n\n const rootResolution = this.resolution;\n\n if (renderTexture)\n {\n renderTexture = renderTexture.castToBaseTexture() as BaseRenderTexture;\n\n if (!renderTexture._canvasRenderTarget)\n {\n renderTexture._canvasRenderTarget = new CanvasRenderTarget(\n renderTexture.width,\n renderTexture.height,\n renderTexture.resolution\n );\n renderTexture.resource = new resources.CanvasResource(renderTexture._canvasRenderTarget.canvas);\n renderTexture.valid = true;\n }\n\n this.context = renderTexture._canvasRenderTarget.context as CrossPlatformCanvasRenderingContext2D;\n this.resolution = renderTexture._canvasRenderTarget.resolution;\n }\n else\n {\n this.context = this.rootContext;\n }\n\n const context = this.context;\n\n this._projTransform = transform || null;\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n }\n\n context.save();\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.globalAlpha = 1;\n this._activeBlendMode = BLEND_MODES.NORMAL;\n this._outerBlend = false;\n context.globalCompositeOperation = this.blendModes[BLEND_MODES.NORMAL];\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n if (this.renderingToScreen)\n {\n if (this.transparent)\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n else\n {\n context.fillStyle = this._backgroundColorString;\n context.fillRect(0, 0, this.width, this.height);\n }\n }\n else\n {\n renderTexture = (renderTexture as BaseRenderTexture);\n renderTexture._canvasRenderTarget.clear();\n\n const clearColor = renderTexture.clearColor;\n\n if (clearColor[3] > 0)\n {\n context.fillStyle = hex2string(rgb2hex(clearColor));\n context.fillRect(0, 0, renderTexture.realWidth, renderTexture.realHeight);\n }\n }\n }\n\n // TODO RENDER TARGET STUFF HERE..\n const tempContext = this.context;\n\n this.context = context;\n displayObject.renderCanvas(this);\n this.context = tempContext;\n\n context.restore();\n\n this.resolution = rootResolution;\n this._projTransform = null;\n\n this.emit('postrender');\n }\n\n /**\n * sets matrix of context\n * called only from render() methods\n * takes care about resolution\n * @param {PIXI.Matrix} transform - world matrix of current element\n * @param {boolean} [roundPixels] - whether to round (tx,ty) coords\n * @param {number} [localResolution] - If specified, used instead of `renderer.resolution` for local scaling\n */\n setContextTransform(transform: Matrix, roundPixels?: boolean, localResolution?: number): void\n {\n let mat = transform;\n const proj = this._projTransform;\n const resolution = this.resolution;\n\n localResolution = localResolution || resolution;\n\n if (proj)\n {\n mat = tempMatrix;\n mat.copyFrom(transform);\n mat.prepend(proj);\n }\n\n if (roundPixels)\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n (mat.tx * resolution) | 0,\n (mat.ty * resolution) | 0\n );\n }\n else\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n mat.tx * resolution,\n mat.ty * resolution\n );\n }\n }\n\n /**\n * Clear the canvas of renderer.\n *\n * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent.\n */\n public clear(clearColor: string): void\n {\n const context = this.context;\n\n clearColor = clearColor || this._backgroundColorString;\n\n if (!this.transparent && clearColor)\n {\n context.fillStyle = clearColor;\n context.fillRect(0, 0, this.width, this.height);\n }\n else\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n }\n\n /**\n * Sets the blend mode of the renderer.\n *\n * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values.\n * @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite.\n * Pass `true` only if you are ready to use them.\n */\n setBlendMode(blendMode: BLEND_MODES, readyForOuterBlend?: boolean): void\n {\n const outerBlend = blendMode === BLEND_MODES.SRC_IN\n || blendMode === BLEND_MODES.SRC_OUT\n || blendMode === BLEND_MODES.DST_IN\n || blendMode === BLEND_MODES.DST_ATOP;\n\n if (!readyForOuterBlend && outerBlend)\n {\n blendMode = BLEND_MODES.NORMAL;\n }\n\n if (this._activeBlendMode === blendMode)\n {\n return;\n }\n\n this._activeBlendMode = blendMode;\n this._outerBlend = outerBlend;\n this.context.globalCompositeOperation = this.blendModes[blendMode];\n }\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n public destroy(removeView?: boolean): void\n {\n // call the base destroy\n super.destroy(removeView);\n\n this.context = null;\n\n this.refresh = true;\n\n this.maskManager.destroy();\n this.maskManager = null;\n\n this.smoothProperty = null;\n }\n\n /**\n * Resizes the canvas view to the specified width and height.\n *\n * @extends PIXI.AbstractRenderer#resize\n *\n * @param {number} screenWidth - the new width of the screen\n * @param {number} screenHeight - the new height of the screen\n */\n public resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n // reset the scale mode.. oddly this seems to be reset when the canvas is resized.\n // surely a browser bug?? Let PixiJS fix that for you..\n if (this.smoothProperty)\n {\n this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === SCALE_MODES.LINEAR);\n }\n }\n\n /**\n * Checks if blend mode has changed.\n */\n invalidateBlendMode(): void\n {\n this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation);\n }\n\n static __plugins: IRendererPlugins;\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.CanvasRenderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.CanvasExtract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.CanvasPrepare} prepare Pre-render display objects.\n */\n\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: ICanvasRendererPluginConstructor): void\n {\n CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};\n CanvasRenderer.__plugins[pluginName] = ctor;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { canUseNewCanvasBlendModes } from './canUseNewCanvasBlendModes';\n\n/**\n * Maps blend combinations to Canvas.\n *\n * @memberof PIXI\n * @function mapCanvasBlendModesToPixi\n * @private\n * @param {string[]} [array=[]] - The array to output into.\n * @return {string[]} Mapped modes.\n */\nexport function mapCanvasBlendModesToPixi(array: string[] = []): string[]\n{\n if (canUseNewCanvasBlendModes())\n {\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'multiply';\n array[BLEND_MODES.SCREEN] = 'screen';\n array[BLEND_MODES.OVERLAY] = 'overlay';\n array[BLEND_MODES.DARKEN] = 'darken';\n array[BLEND_MODES.LIGHTEN] = 'lighten';\n array[BLEND_MODES.COLOR_DODGE] = 'color-dodge';\n array[BLEND_MODES.COLOR_BURN] = 'color-burn';\n array[BLEND_MODES.HARD_LIGHT] = 'hard-light';\n array[BLEND_MODES.SOFT_LIGHT] = 'soft-light';\n array[BLEND_MODES.DIFFERENCE] = 'difference';\n array[BLEND_MODES.EXCLUSION] = 'exclusion';\n array[BLEND_MODES.HUE] = 'hue';\n array[BLEND_MODES.SATURATION] = 'saturate';\n array[BLEND_MODES.COLOR] = 'color';\n array[BLEND_MODES.LUMINOSITY] = 'luminosity';\n }\n else\n {\n // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'source-over';\n array[BLEND_MODES.SCREEN] = 'source-over';\n array[BLEND_MODES.OVERLAY] = 'source-over';\n array[BLEND_MODES.DARKEN] = 'source-over';\n array[BLEND_MODES.LIGHTEN] = 'source-over';\n array[BLEND_MODES.COLOR_DODGE] = 'source-over';\n array[BLEND_MODES.COLOR_BURN] = 'source-over';\n array[BLEND_MODES.HARD_LIGHT] = 'source-over';\n array[BLEND_MODES.SOFT_LIGHT] = 'source-over';\n array[BLEND_MODES.DIFFERENCE] = 'source-over';\n array[BLEND_MODES.EXCLUSION] = 'source-over';\n array[BLEND_MODES.HUE] = 'source-over';\n array[BLEND_MODES.SATURATION] = 'source-over';\n array[BLEND_MODES.COLOR] = 'source-over';\n array[BLEND_MODES.LUMINOSITY] = 'source-over';\n }\n // not-premultiplied, only for webgl\n array[BLEND_MODES.NORMAL_NPM] = array[BLEND_MODES.NORMAL];\n array[BLEND_MODES.ADD_NPM] = array[BLEND_MODES.ADD];\n array[BLEND_MODES.SCREEN_NPM] = array[BLEND_MODES.SCREEN];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = 'source-in';\n array[BLEND_MODES.SRC_OUT] = 'source-out';\n array[BLEND_MODES.SRC_ATOP] = 'source-atop';\n array[BLEND_MODES.DST_OVER] = 'destination-over';\n array[BLEND_MODES.DST_IN] = 'destination-in';\n array[BLEND_MODES.DST_OUT] = 'destination-out';\n array[BLEND_MODES.DST_ATOP] = 'destination-atop';\n array[BLEND_MODES.XOR] = 'xor';\n\n // SUBTRACT from flash, does not exist in canvas\n array[BLEND_MODES.SUBTRACT] = 'source-over';\n\n return array;\n}\n","import { hex2rgb, rgb2hex } from '@pixi/utils';\nimport { canUseNewCanvasBlendModes } from './utils/canUseNewCanvasBlendModes';\n\nimport type { Texture } from '@pixi/core';\n\n/**\n * Utility methods for Sprite/Texture tinting.\n *\n * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture,\n * so be aware of the performance implications.\n *\n * @namespace PIXI.canvasUtils\n * @memberof PIXI\n */\nexport const canvasUtils = {\n canvas: null as HTMLCanvasElement,\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Sprite} sprite - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedCanvas: (sprite: { texture: Texture }, color: number): HTMLCanvasElement | HTMLImageElement =>\n {\n const texture = sprite.texture;\n\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.tintCache = texture.tintCache || {};\n\n const cachedCanvas = texture.tintCache[stringColor];\n\n let canvas: HTMLCanvasElement;\n\n if (cachedCanvas)\n {\n if (cachedCanvas.tintId === texture._updateID)\n {\n return texture.tintCache[stringColor];\n }\n\n canvas = texture.tintCache[stringColor] as HTMLCanvasElement;\n }\n else\n {\n canvas = document.createElement('canvas');\n }\n\n canvasUtils.tintMethod(texture, color, canvas);\n\n canvas.tintId = texture._updateID;\n\n if (canvasUtils.convertTintToImage)\n {\n // is this better?\n const tintImage = new Image();\n\n tintImage.src = (canvas as HTMLCanvasElement).toDataURL();\n\n texture.tintCache[stringColor] = tintImage;\n }\n else\n {\n texture.tintCache[stringColor] = canvas;\n }\n\n return canvas;\n },\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedPattern: (texture: Texture, color: number): CanvasPattern =>\n {\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.patternCache = texture.patternCache || {};\n\n let pattern = texture.patternCache[stringColor];\n\n if (pattern && pattern.tintId === texture._updateID)\n {\n return pattern;\n }\n if (!canvasUtils.canvas)\n {\n canvasUtils.canvas = document.createElement('canvas');\n }\n canvasUtils.tintMethod(texture, color, canvasUtils.canvas);\n pattern = canvasUtils.canvas.getContext('2d').createPattern(canvasUtils.canvas, 'repeat');\n pattern.tintId = texture._updateID;\n texture.patternCache[stringColor] = pattern;\n\n return pattern;\n },\n\n /**\n * Tint a texture using the 'multiply' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithMultiply: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'multiply';\n\n const source = texture.baseTexture.getDrawableSource();\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n context.globalCompositeOperation = 'destination-atop';\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n },\n\n /**\n * Tint a texture using the 'overlay' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithOverlay: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'destination-atop';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n // context.globalCompositeOperation = 'copy';\n context.restore();\n },\n\n /**\n * Tint a texture pixel per pixel.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithPerPixel: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n\n const rgbValues = hex2rgb(color);\n const r = rgbValues[0];\n const g = rgbValues[1];\n const b = rgbValues[2];\n\n const pixelData = context.getImageData(0, 0, crop.width, crop.height);\n\n const pixels = pixelData.data;\n\n for (let i = 0; i < pixels.length; i += 4)\n {\n pixels[i + 0] *= r;\n pixels[i + 1] *= g;\n pixels[i + 2] *= b;\n }\n\n context.putImageData(pixelData, 0, 0);\n },\n\n /**\n * Rounds the specified color according to the canvasUtils.cacheStepsPerColorChannel.\n *\n * @memberof PIXI.canvasUtils\n * @param {number} color - the color to round, should be a hex color\n * @return {number} The rounded color.\n */\n roundColor: (color: number): number =>\n {\n const step = canvasUtils.cacheStepsPerColorChannel;\n\n const rgbValues = hex2rgb(color);\n\n rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step);\n rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step);\n rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step);\n\n return rgb2hex(rgbValues);\n },\n\n /**\n * Number of steps which will be used as a cap when rounding colors.\n *\n * @memberof PIXI.canvasUtils\n * @type {number}\n */\n cacheStepsPerColorChannel: 8,\n\n /**\n * Tint cache boolean flag.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n convertTintToImage: false,\n\n /**\n * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n canUseMultiply: canUseNewCanvasBlendModes(),\n\n /**\n * The tinting method that will be used.\n *\n * @memberof PIXI.canvasUtils\n * @type {Function}\n */\n tintMethod: null as (texture: Texture, color: number, canvas: HTMLCanvasElement) => void,\n};\n\ncanvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel;\n","import { Renderer } from '@pixi/core';\nimport { CanvasRenderer } from './CanvasRenderer';\n\nimport type { AbstractRenderer, IRendererOptionsAuto } from '@pixi/core';\n\n// Reference to Renderer.create static function\nconst parentCreate = Renderer.create;\n\n/**\n * Override the Renderer.create to fallback to use CanvasRenderer.\n * Also supports forceCanvas option with Application or autoDetectRenderer.\n * @private\n */\nRenderer.create = function create(options: IRendererOptionsAuto): AbstractRenderer\n{\n const forceCanvas = options && options.forceCanvas;\n\n if (!forceCanvas)\n {\n try\n {\n return parentCreate(options);\n }\n catch (err)\n {\n // swallow WebGL-unsupported error\n }\n }\n\n return new CanvasRenderer(options);\n};\n","import { BaseTexture, BaseRenderTexture, Texture } from '@pixi/core';\n\n/**\n * Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable\n * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package.\n * @method getDrawableSource\n * @memberof PIXI.BaseTexture#\n * @return {PIXI.ICanvasImageSource} Source to render with CanvasRenderer\n */\nBaseTexture.prototype.getDrawableSource = function getDrawableSource(): CanvasImageSource\n{\n const resource = this.resource as any;\n\n return resource ? (resource.bitmap || resource.source) : null;\n};\n\n/**\n * A reference to the canvas render target (we only need one as this can be shared across renderers)\n *\n * @protected\n * @member {PIXI.utils.CanvasRenderTarget} _canvasRenderTarget\n * @memberof PIXI.BaseRenderTexture#\n */\n\nBaseRenderTexture.prototype._canvasRenderTarget = null;\n\nTexture.prototype.patternCache = null;\n\nTexture.prototype.tintCache = null;\n","import { DRAW_MODES } from '@pixi/constants';\nimport { canvasUtils } from '@pixi/canvas-renderer';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Mesh } from '@pixi/mesh';\n\n/**\n * Renderer dedicated to meshes.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasMeshRenderer\n{\n public renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The renderer this downport works for\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the Mesh\n *\n * @param {PIXI.Mesh} mesh - the Mesh to render\n */\n public render(mesh: Mesh): void\n {\n const renderer = this.renderer;\n const transform = mesh.worldTransform;\n\n renderer.context.globalAlpha = mesh.worldAlpha;\n renderer.setBlendMode(mesh.blendMode);\n renderer.setContextTransform(transform, mesh.roundPixels);\n\n if (mesh.drawMode !== DRAW_MODES.TRIANGLES)\n {\n this._renderTriangleMesh(mesh);\n }\n else\n {\n this._renderTriangles(mesh);\n }\n }\n\n /**\n * Draws the object in Triangle Mesh mode\n *\n * @private\n * @param {PIXI.Mesh} mesh - the Mesh to render\n */\n private _renderTriangleMesh(mesh: Mesh): void\n {\n // draw triangles!!\n const length = mesh.geometry.buffers[0].data.length;\n\n for (let i = 0; i < length - 2; i++)\n {\n // draw some triangles!\n const index = i * 2;\n\n this._renderDrawTriangle(mesh, index, (index + 2), (index + 4));\n }\n }\n\n /**\n * Draws the object in triangle mode using canvas\n *\n * @private\n * @param {PIXI.Mesh} mesh - the current mesh\n */\n private _renderTriangles(mesh: Mesh): void\n {\n // draw triangles!!\n const indices = mesh.geometry.getIndex().data;\n const length = indices.length;\n\n for (let i = 0; i < length; i += 3)\n {\n // draw some triangles!\n const index0 = indices[i] * 2;\n const index1 = indices[i + 1] * 2;\n const index2 = indices[i + 2] * 2;\n\n this._renderDrawTriangle(mesh, index0, index1, index2);\n }\n }\n\n /**\n * Draws one of the triangles that from the Mesh\n *\n * @private\n * @param {PIXI.Mesh} mesh - the current mesh\n * @param {number} index0 - the index of the first vertex\n * @param {number} index1 - the index of the second vertex\n * @param {number} index2 - the index of the third vertex\n */\n private _renderDrawTriangle(mesh: Mesh, index0: number, index1: number, index2: number): void\n {\n const context = this.renderer.context;\n const vertices = mesh.geometry.buffers[0].data;\n const { uvs, texture } = mesh;\n\n if (!texture.valid)\n {\n return;\n }\n const isTinted = mesh.tint !== 0xFFFFFF;\n const base = texture.baseTexture;\n const textureWidth = base.width;\n const textureHeight = base.height;\n\n if (isTinted)\n {\n if (mesh._cachedTint !== mesh.tint)\n {\n mesh._cachedTint = mesh.tint;\n mesh._tintedCanvas = canvasUtils.getTintedCanvas(mesh, mesh.tint) as HTMLCanvasElement;\n }\n }\n\n const textureSource = isTinted ? mesh._tintedCanvas : base.getDrawableSource();\n\n const u0 = uvs[index0] * base.width;\n const u1 = uvs[index1] * base.width;\n const u2 = uvs[index2] * base.width;\n const v0 = uvs[index0 + 1] * base.height;\n const v1 = uvs[index1 + 1] * base.height;\n const v2 = uvs[index2 + 1] * base.height;\n\n let x0 = vertices[index0];\n let x1 = vertices[index1];\n let x2 = vertices[index2];\n let y0 = vertices[index0 + 1];\n let y1 = vertices[index1 + 1];\n let y2 = vertices[index2 + 1];\n\n const canvasPadding = mesh.canvasPadding / this.renderer.resolution;\n\n if (canvasPadding > 0)\n {\n const paddingX = canvasPadding / Math.abs(mesh.worldTransform.a);\n const paddingY = canvasPadding / Math.abs(mesh.worldTransform.d);\n const centerX = (x0 + x1 + x2) / 3;\n const centerY = (y0 + y1 + y2) / 3;\n\n let normX = x0 - centerX;\n let normY = y0 - centerY;\n\n let dist = Math.sqrt((normX * normX) + (normY * normY));\n\n x0 = centerX + ((normX / dist) * (dist + paddingX));\n y0 = centerY + ((normY / dist) * (dist + paddingY));\n\n //\n\n normX = x1 - centerX;\n normY = y1 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x1 = centerX + ((normX / dist) * (dist + paddingX));\n y1 = centerY + ((normY / dist) * (dist + paddingY));\n\n normX = x2 - centerX;\n normY = y2 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x2 = centerX + ((normX / dist) * (dist + paddingX));\n y2 = centerY + ((normY / dist) * (dist + paddingY));\n }\n\n context.save();\n context.beginPath();\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n\n context.closePath();\n\n context.clip();\n\n // Compute matrix transform\n const delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2);\n const deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2);\n const deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2);\n const deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2);\n const deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2);\n const deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2);\n const deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2);\n\n context.transform(\n deltaA / delta,\n deltaD / delta,\n deltaB / delta,\n deltaE / delta,\n deltaC / delta,\n deltaF / delta\n );\n\n context.drawImage(\n textureSource,\n 0,\n 0,\n textureWidth * base.resolution,\n textureHeight * base.resolution,\n 0,\n 0,\n textureWidth,\n textureHeight\n );\n\n context.restore();\n this.renderer.invalidateBlendMode();\n }\n\n /**\n * Renders a flat Mesh\n *\n * @private\n * @param {PIXI.Mesh} mesh - The Mesh to render\n */\n renderMeshFlat(mesh: Mesh): void\n {\n const context = this.renderer.context;\n const vertices = mesh.geometry.getBuffer('aVertexPosition').data;\n const length = vertices.length / 2;\n\n // this.count++;\n\n context.beginPath();\n\n for (let i = 1; i < length - 2; ++i)\n {\n // draw some triangles!\n const index = i * 2;\n\n const x0 = vertices[index];\n const y0 = vertices[index + 1];\n\n const x1 = vertices[index + 2];\n const y1 = vertices[index + 3];\n\n const x2 = vertices[index + 4];\n const y2 = vertices[index + 5];\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n }\n\n context.fillStyle = '#FF0000';\n context.fill();\n context.closePath();\n }\n\n /**\n * destroy the the renderer.\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default `canvasPadding` for canvas-based Mesh rendering.\n *\n * @see PIXI.Mesh2d#canvasPadding\n * @static\n * @name MESH_CANVAS_PADDING\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\nsettings.MESH_CANVAS_PADDING = 0;\n\nexport { settings };\n","import { MeshMaterial } from '@pixi/mesh';\n\nimport type { Mesh } from '@pixi/mesh';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the mesh using the Canvas renderer\n *\n * @protected\n * @method render\n * @memberof PIXI.MeshMaterial#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n * @param {PIXI.Mesh} mesh - Mesh to render.\n */\nMeshMaterial.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer, mesh: Mesh): void\n{\n renderer.plugins.mesh.render(mesh);\n};\n","import { canvasUtils } from '@pixi/canvas-renderer';\nimport { NineSlicePlane } from '@pixi/mesh-extras';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.NineSlicePlane#\n * @member {number} _cachedTint\n * @protected\n */\nNineSlicePlane.prototype._cachedTint = 0xFFFFFF;\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.NineSlicePlane#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nNineSlicePlane.prototype._tintedCanvas = null;\n\n/**\n * Temporary storage for canvas source coords\n * @memberof PIXI.NineSlicePlane#\n * @member {number[]} _canvasUvs\n * @private\n */\nNineSlicePlane.prototype._canvasUvs = null;\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.NineSlicePlane#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with.\n */\nNineSlicePlane.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n const context = renderer.context;\n const transform = this.worldTransform;\n const isTinted = this.tint !== 0xFFFFFF;\n const texture = this.texture;\n\n if (!texture.valid)\n {\n return;\n }\n\n // Work out tinting\n if (isTinted)\n {\n if (this._cachedTint !== this.tint)\n {\n // Tint has changed, need to update the tinted texture and use that instead\n\n this._cachedTint = this.tint;\n\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint) as HTMLCanvasElement;\n }\n }\n\n const textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas;\n\n if (!this._canvasUvs)\n {\n this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n const vertices = this.vertices;\n const uvs = this._canvasUvs;\n const u0 = isTinted ? 0 : texture.frame.x;\n const v0 = isTinted ? 0 : texture.frame.y;\n const u1 = u0 + texture.frame.width;\n const v1 = v0 + texture.frame.height;\n\n uvs[0] = u0;\n uvs[1] = u0 + this._leftWidth;\n uvs[2] = u1 - this._rightWidth;\n uvs[3] = u1;\n uvs[4] = v0;\n uvs[5] = v0 + this._topHeight;\n uvs[6] = v1 - this._bottomHeight;\n uvs[7] = v1;\n\n for (let i = 0; i < 8; i++)\n {\n uvs[i] *= texture.baseTexture.resolution;\n }\n\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n renderer.setContextTransform(transform, this.roundPixels);\n\n for (let row = 0; row < 3; row++)\n {\n for (let col = 0; col < 3; col++)\n {\n const ind = (col * 2) + (row * 8);\n const sw = Math.max(1, uvs[col + 1] - uvs[col]);\n const sh = Math.max(1, uvs[row + 5] - uvs[row + 4]);\n const dw = Math.max(1, vertices[ind + 10] - vertices[ind]);\n const dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]);\n\n context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh,\n vertices[ind], vertices[ind + 1], dw, dh);\n }\n }\n};\n","import { Mesh } from '@pixi/mesh';\nimport { settings } from './settings';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\nlet warned = false;\n\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.Mesh#\n * @member {number} _cachedTint\n * @protected\n */\nMesh.prototype._cachedTint = 0xFFFFFF;\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.Mesh#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nMesh.prototype._tintedCanvas = null;\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nMesh.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n if (this.material._renderCanvas)\n {\n this.material._renderCanvas(renderer, this);\n }\n else if (!warned)\n {\n warned = true;\n if (window.console)\n {\n console.warn('Mesh with custom shaders are not supported in CanvasRenderer.');\n }\n }\n};\n\n// IMPORTANT: Please do NOT use this as a precedent to use `settings` after the object is created\n// this was merely created to completely decouple canvas from the base Mesh class and we are\n// unable to add `canvasPadding` in the constructor anymore, as the case was for PixiJS v4.\n\n/**\n * Internal variable for `canvasPadding`.\n *\n * @private\n * @memberof PIXI.Mesh\n * @member {number}\n * @default null\n */\nMesh.prototype._canvasPadding = null;\n\n/**\n * Triangles in canvas mode are automatically antialiased, use this value to force triangles\n * to overlap a bit with each other. To set the global default, set {@link PIXI.settings.MESH_CANVAS_PADDING}\n *\n * @see PIXI.settings.MESH_CANVAS_PADDING\n * @member {number} canvasPadding\n * @memberof PIXI.SimpleMesh#\n * @default 0\n */\nObject.defineProperty(Mesh.prototype, 'canvasPadding', {\n get()\n {\n return this._canvasPadding !== null ? this._canvasPadding : settings.MESH_CANVAS_PADDING;\n },\n set(value)\n {\n this._canvasPadding = value;\n },\n});\n","import { SimpleMesh } from '@pixi/mesh-extras';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleMesh.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n if (this.shader.update)\n {\n this.shader.update();\n }\n\n this.calculateUvs();\n\n this.material._renderCanvas(renderer, this);\n};\n","import { SimpleRope } from '@pixi/mesh-extras';\n\nimport type { RopeGeometry } from '@pixi/mesh-extras';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleRope.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.autoUpdate\n || (this.geometry as RopeGeometry)._width !== this.shader.texture.height)\n {\n (this.geometry as RopeGeometry)._width = this.shader.texture.height;\n (this.geometry as RopeGeometry).update();\n }\n\n if (this.shader.update)\n {\n this.shader.update();\n }\n\n this.calculateUvs();\n\n this.material._renderCanvas(renderer, this);\n};\n","import { Graphics } from '@pixi/graphics';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport { RenderTexture, Texture } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nlet canvasRenderer: CanvasRenderer;\nconst tempMatrix = new Matrix();\n\n/**\n * Generates a canvas texture. Only available with **pixi.js-legacy** bundle\n * or the **@pixi/canvas-graphics** package.\n * @method generateCanvasTexture\n * @memberof PIXI.Graphics#\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution of the texture.\n * @return {PIXI.Texture} The new texture.\n */\nGraphics.prototype.generateCanvasTexture = function generateCanvasTexture(scaleMode: SCALE_MODES, resolution = 1): Texture\n{\n const bounds = this.getLocalBounds();\n\n const canvasBuffer = RenderTexture.create({\n width: bounds.width,\n height: bounds.height,\n scaleMode,\n resolution,\n });\n\n if (!canvasRenderer)\n {\n canvasRenderer = new CanvasRenderer();\n }\n\n this.transform.updateLocalTransform();\n this.transform.localTransform.copyTo(tempMatrix);\n\n tempMatrix.invert();\n\n tempMatrix.tx -= bounds.x;\n tempMatrix.ty -= bounds.y;\n\n canvasRenderer.render(this, canvasBuffer, true, tempMatrix);\n\n const texture = Texture.from((canvasBuffer.baseTexture as BaseRenderTexture)._canvasRenderTarget.canvas, {\n scaleMode,\n });\n\n texture.baseTexture.setResolution(resolution);\n\n return texture;\n};\n\nGraphics.prototype.cachedGraphicsData = [];\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Graphics#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nGraphics.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.isMask === true)\n {\n return;\n }\n\n this.finishPoly();\n renderer.plugins.graphics.render(this);\n};\n","import { Texture } from '@pixi/core';\nimport { SHAPES, Matrix } from '@pixi/math';\nimport { canvasUtils } from '@pixi/canvas-renderer';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { FillStyle, Graphics } from '@pixi/graphics';\nimport type { Polygon, Rectangle, Circle, Ellipse, RoundedRectangle } from '@pixi/math';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they\n * now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasGraphicsRenderer:\n * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching graphics objects.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasGraphicsRenderer\n{\n public renderer: CanvasRenderer;\n private _svgMatrix: DOMMatrix|boolean;\n private _tempMatrix: Matrix;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - The current PIXI renderer.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n this._svgMatrix = null;\n this._tempMatrix = new Matrix();\n }\n\n /**\n * calculates fill/stroke style for canvas\n *\n * @private\n * @param {PIXI.FillStyle} style\n * @param {number} tint\n * @returns {string|CanvasPattern}\n */\n private _calcCanvasStyle(style: FillStyle, tint: number): string|CanvasPattern\n {\n let res;\n\n if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture)\n {\n if (style.texture.valid)\n {\n res = canvasUtils.getTintedPattern(style.texture, tint);\n this.setPatternTransform(res, style.matrix || Matrix.IDENTITY);\n }\n else\n {\n res = '#808080';\n }\n }\n else\n {\n res = `#${(`00000${(tint | 0).toString(16)}`).substr(-6)}`;\n }\n\n return res;\n }\n\n /**\n * Renders a Graphics object to a canvas.\n *\n * @param {PIXI.Graphics} graphics - the actual graphics object to render\n */\n public render(graphics: Graphics): void\n {\n const renderer = this.renderer;\n const context = renderer.context;\n const worldAlpha = graphics.worldAlpha;\n const transform = graphics.transform.worldTransform;\n\n renderer.setContextTransform(transform);\n renderer.setBlendMode(graphics.blendMode);\n\n const graphicsData = graphics.geometry.graphicsData;\n\n let contextFillStyle;\n let contextStrokeStyle;\n\n const tintR = ((graphics.tint >> 16) & 0xFF) / 255;\n const tintG = ((graphics.tint >> 8) & 0xFF) / 255;\n const tintB = (graphics.tint & 0xFF) / 255;\n\n for (let i = 0; i < graphicsData.length; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n\n const fillColor = data.fillStyle.color | 0;\n const lineColor = data.lineStyle.color | 0;\n\n if (data.matrix)\n {\n renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));\n }\n\n if (fillStyle.visible)\n {\n const fillTint = (\n (((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((fillColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextFillStyle = this._calcCanvasStyle(fillStyle, fillTint);\n }\n if (lineStyle.visible)\n {\n const lineTint = (\n (((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((lineColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextStrokeStyle = this._calcCanvasStyle(lineStyle, lineTint);\n }\n\n context.lineWidth = lineStyle.width;\n context.lineCap = lineStyle.cap;\n context.lineJoin = lineStyle.join;\n context.miterLimit = lineStyle.miterLimit;\n\n if (data.type === SHAPES.POLY)\n {\n context.beginPath();\n\n const tempShape = shape as Polygon;\n let points = tempShape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n let px;\n let py;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n\n if (tempShape.closeStroke)\n {\n context.closePath();\n }\n\n if (holes.length > 0)\n {\n outerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n outerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = (holes[k].shape as Polygon).points;\n\n if (!points)\n {\n continue;\n }\n\n innerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n innerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n if (innerArea * outerArea < 0)\n {\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n context.moveTo(points[points.length - 2], points[points.length - 1]);\n\n for (let j = points.length - 4; j >= 0; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n\n if ((holes[k].shape as Polygon).closeStroke)\n {\n context.closePath();\n }\n }\n }\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RECT)\n {\n const tempShape = shape as Rectangle;\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fillRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.strokeRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);\n }\n }\n else if (data.type === SHAPES.CIRC)\n {\n const tempShape = shape as Circle;\n\n // TODO - need to be Undefined!\n context.beginPath();\n context.arc(tempShape.x, tempShape.y, tempShape.radius, 0, 2 * Math.PI);\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const tempShape = shape as Ellipse;\n\n const w = tempShape.width * 2;\n const h = tempShape.height * 2;\n\n const x = tempShape.x - (w / 2);\n const y = tempShape.y - (h / 2);\n\n context.beginPath();\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RREC)\n {\n const tempShape = shape as RoundedRectangle;\n\n const rx = tempShape.x;\n const ry = tempShape.y;\n const width = tempShape.width;\n const height = tempShape.height;\n let radius = tempShape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.beginPath();\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n if (lineStyle.visible)\n {\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n }\n }\n\n public setPatternTransform(pattern: CanvasPattern, matrix: Matrix): void\n {\n if (this._svgMatrix === false)\n {\n return;\n }\n if (!this._svgMatrix)\n {\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\n if (svg && svg.createSVGMatrix)\n {\n this._svgMatrix = svg.createSVGMatrix();\n }\n if (!this._svgMatrix || !pattern.setTransform)\n {\n this._svgMatrix = false;\n\n return;\n }\n }\n\n (this._svgMatrix as DOMMatrix).a = matrix.a;\n (this._svgMatrix as DOMMatrix).b = matrix.b;\n (this._svgMatrix as DOMMatrix).c = matrix.c;\n (this._svgMatrix as DOMMatrix).d = matrix.d;\n (this._svgMatrix as DOMMatrix).e = matrix.tx;\n (this._svgMatrix as DOMMatrix).f = matrix.ty;\n pattern.setTransform((this._svgMatrix as DOMMatrix).inverse());\n }\n /**\n * destroy graphics object\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n this._svgMatrix = null;\n this._tempMatrix = null;\n }\n}\n","import { SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { Matrix, groupD8 } from '@pixi/math';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Sprite } from '@pixi/sprite';\n\nconst canvasRenderWorldTransform = new Matrix();\n\n/**\n * Types that can be passed to drawImage\n * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource\n * @memberof PIXI\n */\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasSpriteRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasSpriteRenderer\n{\n protected renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer -The renderer sprite this batch works for.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the sprite object.\n *\n * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch\n */\n render(sprite: Sprite): void\n {\n const texture = sprite._texture;\n const renderer = this.renderer;\n const context = renderer.context;\n\n const width = texture._frame.width;\n const height = texture._frame.height;\n\n let wt = sprite.transform.worldTransform;\n let dx = 0;\n let dy = 0;\n\n const source = texture.baseTexture.getDrawableSource();\n\n if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.valid || !source)\n {\n return;\n }\n\n if (!texture.valid)\n {\n return;\n }\n\n renderer.setBlendMode(sprite.blendMode, true);\n\n renderer.context.globalAlpha = sprite.worldAlpha;\n\n // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture\n const smoothingEnabled = texture.baseTexture.scaleMode === SCALE_MODES.LINEAR;\n\n if (renderer.smoothProperty\n && renderer.context[renderer.smoothProperty] !== smoothingEnabled)\n {\n context[renderer.smoothProperty] = smoothingEnabled;\n }\n\n if (texture.trim)\n {\n dx = (texture.trim.width / 2) + texture.trim.x - (sprite.anchor.x * texture.orig.width);\n dy = (texture.trim.height / 2) + texture.trim.y - (sprite.anchor.y * texture.orig.height);\n }\n else\n {\n dx = (0.5 - sprite.anchor.x) * texture.orig.width;\n dy = (0.5 - sprite.anchor.y) * texture.orig.height;\n }\n\n if (texture.rotate)\n {\n wt.copyTo(canvasRenderWorldTransform);\n wt = canvasRenderWorldTransform;\n groupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy);\n // the anchor has already been applied above, so lets set it to zero\n dx = 0;\n dy = 0;\n }\n\n dx -= width / 2;\n dy -= height / 2;\n\n renderer.setContextTransform(wt, sprite.roundPixels, 1);\n // Allow for pixel rounding\n if (sprite.roundPixels)\n {\n dx = dx | 0;\n dy = dy | 0;\n }\n\n const resolution = texture.baseTexture.resolution;\n const outerBlend = renderer._outerBlend;\n\n if (outerBlend)\n {\n context.save();\n context.beginPath();\n context.rect(\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n context.clip();\n }\n\n if (sprite.tint !== 0xFFFFFF)\n {\n if (sprite._cachedTint !== sprite.tint || sprite._tintedCanvas.tintId !== sprite._texture._updateID)\n {\n sprite._cachedTint = sprite.tint;\n\n // TODO clean up caching - how to clean up the caches?\n sprite._tintedCanvas = canvasUtils.getTintedCanvas(sprite, sprite.tint);\n }\n\n context.drawImage(\n sprite._tintedCanvas,\n 0,\n 0,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n else\n {\n context.drawImage(\n source,\n texture._frame.x * resolution,\n texture._frame.y * resolution,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n\n if (outerBlend)\n {\n context.restore();\n }\n // just in case, leaking outer blend here will be catastrophic!\n renderer.setBlendMode(BLEND_MODES.NORMAL);\n }\n\n /**\n * destroy the sprite object.\n *\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.Sprite#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nSprite.prototype._tintedCanvas = null;\n\n/**\n* Renders the object using the Canvas renderer\n*\n* @private\n* @method _renderCanvas\n* @memberof PIXI.Sprite#\n* @param {PIXI.CanvasRenderer} renderer - The renderer\n*/\nSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n renderer.plugins.sprite.render(this);\n};\n","import { RenderTexture } from '@pixi/core';\nimport { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport { deprecation } from '@pixi/utils';\nimport type { DisplayObject } from '@pixi/display';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nconst TEMP_RECT = new Rectangle();\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasExtract\n{\n public renderer: CanvasRenderer;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `CanvasExtract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n const canvasBuffer = new CanvasRenderTarget(width, height, 1);\n const canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8ClampedArray\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n }\n\n return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n }\n}\n\n/**\n * @name PIXI.CanvasRenderer#extract\n * @type {PIXI.CanvasExtract}\n * @see PIXI.CanvasRenderer#plugins\n * @deprecated since 5.3.0\n */\nObject.defineProperty(CanvasRenderer.prototype, 'extract',\n {\n get()\n {\n deprecation('v5.3.0', 'CanvasRenderer#extract is deprecated, use CanvasRenderer#plugins.extract');\n\n return this.plugins.extract;\n },\n }\n);\n\n","import { BaseTexture } from '@pixi/core';\nimport { BasePrepare } from '@pixi/prepare';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { IDisplayObjectExtended } from '@pixi/prepare';\n\nconst CANVAS_START_SIZE = 16;\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {*} prepare - Instance of CanvasPrepare\n * @param {*} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(prepare: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n const tempPrepare = prepare as CanvasPrepare;\n\n if (item instanceof BaseTexture)\n {\n const image = (item as any).source;\n\n // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.\n // So if the width or height is equal to zero then use the canvas size\n // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.\n const imageWidth = image.width === 0 ? tempPrepare.canvas.width : Math.min(tempPrepare.canvas.width, image.width);\n const imageHeight = image.height === 0 ? tempPrepare.canvas.height\n : Math.min(tempPrepare.canvas.height, image.height);\n\n // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU\n // A smaller draw can be faster.\n tempPrepare.ctx.drawImage(\n image, 0, 0, imageWidth, imageHeight, 0, 0,\n tempPrepare.canvas.width, tempPrepare.canvas.height\n );\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing\n * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class CanvasPrepare extends BasePrepare\n{\n /** @internal */\n canvas: HTMLCanvasElement;\n /** @internal */\n ctx: CanvasRenderingContext2D;\n\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this;\n\n /**\n * An offline canvas to render textures to\n * @type {HTMLCanvasElement}\n * @private\n */\n this.canvas = document.createElement('canvas');\n this.canvas.width = CANVAS_START_SIZE;\n this.canvas.height = CANVAS_START_SIZE;\n\n /**\n * The context to the canvas\n * @type {CanvasRenderingContext2D}\n * @private\n */\n this.ctx = this.canvas.getContext('2d');\n\n // Add textures to upload\n this.registerUploadHook(uploadBaseTextures);\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n public destroy(): void\n {\n super.destroy();\n this.ctx = null;\n this.canvas = null;\n }\n}\n","import { TilingSprite } from '@pixi/sprite-tiling';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasRenderTarget } from '@pixi/utils';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @function _renderCanvas\n * @memberof PIXI.TilingSprite#\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nTilingSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n const texture = this._texture;\n\n if (!texture.baseTexture.valid)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n const baseTexture = texture.baseTexture;\n const source = baseTexture.getDrawableSource();\n const baseTextureResolution = baseTexture.resolution;\n const modX = ((this.tilePosition.x / this.tileScale.x) % texture._frame.width) * baseTextureResolution;\n const modY = ((this.tilePosition.y / this.tileScale.y) % texture._frame.height) * baseTextureResolution;\n\n // create a nice shiny pattern!\n if (this._textureID !== this._texture._updateID || this._cachedTint !== this.tint)\n {\n this._textureID = this._texture._updateID;\n // cut an object from a spritesheet..\n const tempCanvas = new CanvasRenderTarget(texture._frame.width,\n texture._frame.height,\n baseTextureResolution);\n\n // Tint the tiling sprite\n if (this.tint !== 0xFFFFFF)\n {\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint) as HTMLCanvasElement;\n tempCanvas.context.drawImage(this._tintedCanvas, 0, 0);\n }\n else\n {\n tempCanvas.context.drawImage(source,\n -texture._frame.x * baseTextureResolution, -texture._frame.y * baseTextureResolution);\n }\n this._cachedTint = this.tint;\n this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat');\n }\n\n // set context state..\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n renderer.setContextTransform(transform);\n\n // fill the pattern!\n context.fillStyle = this._canvasPattern;\n\n // TODO - this should be rolled into the setTransform above..\n context.scale(this.tileScale.x / baseTextureResolution, this.tileScale.y / baseTextureResolution);\n\n const anchorX = this.anchor.x * -this._width;\n const anchorY = this.anchor.y * -this._height;\n\n if (this.uvRespectAnchor)\n {\n context.translate(modX, modY);\n\n context.fillRect(-modX + anchorX, -modY + anchorY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n else\n {\n context.translate(modX + anchorX, modY + anchorY);\n\n context.fillRect(-modX, -modY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n};\n","import { ParticleContainer } from '@pixi/particles';\nimport type { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.ParticleContainer#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nParticleContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n let isRotated = true;\n\n let positionX = 0;\n let positionY = 0;\n\n let finalWidth = 0;\n let finalHeight = 0;\n\n renderer.setBlendMode(this.blendMode);\n\n context.globalAlpha = this.worldAlpha;\n\n this.displayObjectUpdateTransform();\n\n for (let i = 0; i < this.children.length; ++i)\n {\n const child = this.children[i] as Sprite;\n\n if (!child.visible)\n {\n continue;\n }\n\n if (!child._texture.valid)\n {\n continue;\n }\n\n const frame = child._texture.frame;\n\n context.globalAlpha = this.worldAlpha * child.alpha;\n\n if (child.rotation % (Math.PI * 2) === 0)\n {\n // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call\n if (isRotated)\n {\n renderer.setContextTransform(transform, false, 1);\n isRotated = false;\n }\n\n positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5;\n positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5;\n\n finalWidth = frame.width * child.scale.x;\n finalHeight = frame.height * child.scale.y;\n }\n else\n {\n if (!isRotated)\n {\n isRotated = true;\n }\n\n child.displayObjectUpdateTransform();\n\n const childTransform = child.worldTransform;\n\n renderer.setContextTransform(childTransform, this.roundPixels, 1);\n\n positionX = ((child.anchor.x) * (-frame.width)) + 0.5;\n positionY = ((child.anchor.y) * (-frame.height)) + 0.5;\n\n finalWidth = frame.width;\n finalHeight = frame.height;\n }\n\n const resolution = child._texture.baseTexture.resolution;\n\n context.drawImage(\n child._texture.baseTexture.getDrawableSource(),\n frame.x * resolution,\n frame.y * resolution,\n frame.width * resolution,\n frame.height * resolution,\n positionX * renderer.resolution,\n positionY * renderer.resolution,\n finalWidth * renderer.resolution,\n finalHeight * renderer.resolution\n );\n }\n};\n","import { Container } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { MaskData } from '@pixi/core';\n\n/**\n * To be overridden by the subclass\n * @method _renderCanvas\n * @memberof PIXI.Container#\n * @protected\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype._renderCanvas = function _renderCanvas(_renderer: CanvasRenderer): void\n{\n // this is where content itself gets rendered...\n};\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n // if not visible or the alpha is 0 then no need to render this\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this._mask as MaskData);\n }\n\n this._renderCanvas(renderer);\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderCanvas(renderer);\n }\n\n if (this._mask)\n {\n renderer.maskManager.popMask(renderer);\n }\n};\n","import { DisplayObject } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nDisplayObject.prototype.renderCanvas = function renderCanvas(_renderer: CanvasRenderer): void\n{\n // OVERWRITE;\n};\n","import { Text } from '@pixi/text';\nimport { Sprite } from '@pixi/sprite';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Text#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nText.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n Sprite.prototype._renderCanvas.call(this, renderer);\n};\n","import { AccessibilityManager, InteractionManager } from 'pixi.js';\nimport { CanvasRenderer, canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasMeshRenderer } from '@pixi/canvas-mesh';\nimport { CanvasGraphicsRenderer } from '@pixi/canvas-graphics';\nimport { CanvasSpriteRenderer } from '@pixi/canvas-sprite';\nimport { CanvasExtract } from '@pixi/canvas-extract';\nimport { CanvasPrepare } from '@pixi/canvas-prepare';\nimport '@pixi/canvas-sprite-tiling';\nimport '@pixi/canvas-particles';\nimport '@pixi/canvas-display';\nimport '@pixi/canvas-text';\n\nCanvasRenderer.registerPlugin('accessibility', AccessibilityManager);\nCanvasRenderer.registerPlugin('extract', CanvasExtract);\nCanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer);\nCanvasRenderer.registerPlugin('interaction', InteractionManager);\nCanvasRenderer.registerPlugin('mesh', CanvasMeshRenderer);\nCanvasRenderer.registerPlugin('prepare', CanvasPrepare);\nCanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer);\n\n// Export ES for those importing specifically by name,\n// e.g., `import {autoDetectRenderer} from 'pixi.js-legacy'`\nexport * from 'pixi.js';\nexport {\n CanvasRenderer,\n CanvasGraphicsRenderer,\n CanvasMeshRenderer,\n CanvasSpriteRenderer,\n CanvasExtract,\n CanvasPrepare,\n canvasUtils,\n};\n"],"names":["global","NativePromise","nativePromiseSupported","resolve","r","exports","Promise","PENDING","SEALED","FULFILLED","REJECTED","NOOP","isArray","value","Object","prototype","toString","call","asyncTimer","asyncSetTimer","setImmediate","setTimeout","asyncQueue","asyncFlush","i","length","asyncCall","callback","arg","push","invokeCallback","subscriber","owner","settled","state_","data_","promise","then","e","reject","handleThenable","resolved","TypeError","val","fulfill","reason","publishFulfillment","publishRejection","publish","callbacks","then_","undefined","resolver","this","rejectPromise","invokeResolver","constructor","onFulfillment","onRejection","fulfilled","rejected","catch","all","promises","results","remaining","index","race","window","self","getOwnPropertySymbols","hasOwnProperty","propIsEnumerable","propertyIsEnumerable","assign","test1","String","getOwnPropertyNames","test2","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","toObject","s","arguments","key","Polyfill","objectAssign","Date","now","getTime","performance","startTime_1","lastTime","vendors","x","requestAnimationFrame","p","cancelAnimationFrame","currentTime","delay","id","clearTimeout","Math","sign","Number","isNaN","isInteger","isFinite","floor","ArrayBuffer","Array","Float32Array","Uint32Array","Uint16Array","Uint8Array","Int32Array","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","navigator","platform","maxTouchPoints","MSStream","isMobile","param","nav","userAgent","tmp","match","regex","test","createMatch","result","apple","phone","ipod","tablet","universal","device","amazon","android","windows","other","blackberry","blackberry10","opera","firefox","chrome","any","isMobileCall","settings","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","RESOLUTION","FILTER_RESOLUTION","SPRITE_MAX_TEXTURES","max","allowMax","parseInt","maxRecommendedTextures","SPRITE_BATCH_SIZE","RENDER_OPTIONS","view","antialias","autoDensity","transparent","backgroundColor","clearBeforeRender","preserveDrawingBuffer","width","height","legacy","GC_MODE","GC_MAX_IDLE","GC_MAX_CHECK_COUNT","WRAP_MODE","SCALE_MODE","PRECISION_VERTEX","PRECISION_FRAGMENT","CAN_UPLOAD_SAME_BUFFER","CREATE_IMAGE_BITMAP","ROUND_PIXELS","has","prefix","Events","EE","fn","context","once","addListener","emitter","event","listener","evt","_events","_eventsCount","clearEvent","EventEmitter","create","__proto__","eventNames","events","name","names","slice","concat","listeners","handlers","l","ee","listenerCount","emit","a1","a2","a3","a4","a5","args","len","removeListener","apply","j","on","removeAllListeners","off","prefixed","module","earcut","data","holeIndices","dim","minX","minY","maxX","maxY","y","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","next","prev","start","end","list","queue","steiner","getLeftmost","sort","compareX","eliminateHole","filterPoints","eliminateHoles","earcutLinked","clockwise","last","signedArea","insertNode","equals","removeNode","again","area","ear","pass","z","zOrder","prevZ","nextZ","q","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","stop","isEarHashed","isEar","cureLocalIntersections","splitEarcut","a","b","c","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","maxZ","intersects","locallyInside","isValidDiagonal","splitPolygon","hole","m","hx","hy","qx","Infinity","tan","mx","my","tanMin","abs","sectorContainsSector","findHoleBridge","leftmost","ax","ay","bx","by","cx","cy","px","py","intersectsPolygon","inside","middleInside","p1","p2","q1","q2","o1","o2","o3","o4","onSegment","min","num","Node","b2","an","bp","sum","deviation","polygonArea","trianglesArea","flatten","vertices","holes","dimensions","holeIndex","d","root","freeExports","nodeType","freeModule","freeGlobal","punycode","maxInt","base","tMin","tMax","skew","damp","initialBias","initialN","delimiter","regexPunycode","regexNonASCII","regexSeparators","errors","overflow","not-basic","invalid-input","baseMinusTMin","stringFromCharCode","error","type","RangeError","array","mapDomain","string","parts","replace","ucs2decode","extra","output","counter","charCodeAt","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","k","decode","input","out","basic","oldi","w","t","baseMinusT","codePoint","inputLength","bias","lastIndexOf","splice","encode","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","version","ucs2","toASCII","toUnicode","toLowerCase","isString","isObject","isNull","isNullOrUndefined","obj","prop","qs","sep","eq","options","regexp","maxKeys","kstr","vstr","v","idx","indexOf","substr","decodeURIComponent","stringifyPrimitive","ks","encodeURIComponent","require$$0","require$$1","urlParse","relative","resolveObject","util","Url","format","protocol","slashes","auth","host","port","hostname","hash","search","query","pathname","path","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","javascript","javascript:","hostlessProtocol","slashedProtocol","http","https","ftp","gopher","file","http:","https:","ftp:","gopher:","file:","url","parseQueryString","slashesDenoteHost","u","parse","queryIndex","splitter","uSplit","rest","trim","simplePath","exec","querystring","proto","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","part","newpart","validParts","notHost","bit","unshift","h","ae","esc","escape","qm","stringify","charAt","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","shift","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","pop","authInHost","hasTrailingSlash","up","isAbsolute","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","VERSION","sayHello","_a","console","log","isWebGLSupported","contextOptions","stencil","failIfMajorPerformanceCaveat","WebGLRenderingContext","canvas","document","createElement","gl","getContext","success","getContextAttributes","loseContext","getExtension","hex2rgb","hex","hex2string","hexString","string2hex","rgb2hex","rgb","premultiplyBlendMode","pm","npm","NORMAL_NPM","NORMAL","ADD_NPM","ADD","SCREEN_NPM","SCREEN","mapPremultipliedBlendModes","correctBlendMode","blendMode","premultiplied","premultiplyRgba","alpha","premultiply","premultiplyTint","tint","R","G","B","premultiplyTintToRgba","createIndicesForQuads","size","outBuffer","totalIndices","Error","getBufferType","BYTES_PER_ELEMENT","nextPow2","isPow2","log2","removeItems","arr","startIdx","removeCount","nextUid","uid","warnings","deprecation","message","ignoreDepth","stack","warn","groupCollapsed","groupEnd","ProgramCache","TextureCache","BaseTextureCache","resolution","resize","CanvasRenderTarget","setTransform","clearRect","trimCanvas","pixels","getImageData","bound","top","left","right","bottom","tempAnchor","DATA_URI","determineCrossOrigin","loc","location","parsedUrl","_url.parse","samePort","getResolutionOfUrl","defaultValue","parseFloat","SHAPES","dataUri","dataUriMatch","mediaType","subType","charset","encoding","destroy","arrays","sizes","outSize","stride","views","buffer","littleOffset","PI_2","PI","RAD_TO_DEG","DEG_TO_RAD","RECT","Rectangle","rectangle","paddingX","paddingY","x1","x2","y1","y2","eps","ceil","radius","CIRC","Circle","r2","dx","dy","halfWidth","halfHeight","ELIP","Ellipse","normx","normy","_i","points","flat","il","POLY","closeStroke","Polygon","polygon","xi","yi","xj","yj","RREC","RoundedRectangle","radius2","Point","set","cb","scope","_x","_y","ObservablePoint","tx","ty","Matrix","transpose","pos","newPos","angle","cos","sin","c1","tx1","matrix","b1","d1","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","transform","atan2","scale","sqrt","position","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","mat","init","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","add","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","append","worldTransform","localTransform","onChange","pivot","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","Transform","lt","parentTransform","pt","wt","decompose","SORTABLE_CHILDREN","rect","updateID","Bounds","EMPTY","point","x0","y0","addFrameMatrix","vertexData","beginOffset","endOffset","addVerticesMatrix","padX","padY","rawX","rawY","bounds","mask","_minX","_minY","_maxX","_maxY","isEmpty","extendStatics","setPrototypeOf","__extends","__","_super","_this","tempDisplayObjectParent","visible","renderable","parent","worldAlpha","_lastSortedIndex","_zIndex","filterArea","filters","_enabledFilters","_bounds","_localBounds","_boundsID","_boundsRect","_localBoundsRect","_mask","_destroyed","isSprite","isMask","DisplayObject","propertyName","defineProperty","getOwnPropertyDescriptor","_recursivePostUpdateTransform","updateTransform","_tempDisplayObjectParent","skipUpdate","calculateBounds","getRectangle","transformRef","parentRef","worldBounds","worldBoundsID","getBounds","displayObjectUpdateTransform","toGlobal","applyInverse","container","addChild","_options","removeChild","hitArea","interactive","interactiveChildren","TemporaryDisplayObject","myParent","cacheParent","copyFrom","sortDirty","item","maskObject","sortChildren","zIndex","children","sortableChildren","Container","_length","child","onChildrenChange","child2","index1","getChildIndex","index2","currentIndex","getChildAt","beginIndex","endIndex","removed","begin","range","sortRequired","clear","_calculateBounds","addBoundsMask","addBoundsArea","addBounds","skipChildrenUpdate","getLocalBounds","renderer","renderAdvanced","_render","render","batch","flush","enabled","filter","_renderer","destroyChildren","oldChildren","removeChildren","_width","_height","containerUpdateTransform","accessibleTarget","accessible","accessibleTitle","accessibleHint","tabIndex","_accessibleActive","_accessibleDiv","accessibleType","accessiblePointerEvents","accessibleChildren","renderId","mixin","UPDATE_PRIORITY","DIV_TOUCH_SIZE","DIV_TOUCH_POS_X","DIV_TOUCH_POS_Y","DIV_TOUCH_ZINDEX","_hookDiv","createTouchHook","div","style","pool","debug","_onKeyDown","bind","_onMouseMove","_isActive","_isMobileAccessibility","androidUpdateCount","androidUpdateFrequency","addEventListener","AccessibilityManager","hookDiv","DIV_HOOK_SIZE","DIV_HOOK_POS_X","DIV_HOOK_POS_Y","title","activate","destroyTouchHook","body","appendChild","removeEventListener","update","parentNode","displayObject","updateAccessibleObjects","renderingToScreen","_lastObjectRendered","getBoundingClientRect","sx","sy","capHitArea","getAttribute","setAttribute","updateDebugHTML","innerHTML","borderStyle","_onClick","_onFocus","_onFocusOut","pointerEvents","interactionManager","plugins","interaction","dispatchEvent","eventData","keyCode","movementX","movementY","deactivate","TARGET_FPMS","priority","previous","TickerListener","deltaTime","redirect","hard","_head","_requestId","_maxElapsedMS","_minElapsedMS","autoStart","deltaMS","elapsedMS","speed","started","_protected","_lastFrame","_tick","time","Ticker","_requestIfNeeded","_addListener","current","connect","_startIfPossible","_cancelIfNeeded","count","head","fps","minFPS","maxFPS","minFPMS","round","_shared","shared","_system","system","TickerPlugin","sharedTicker","ticker","_ticker","remove","LOW","get","oldTicker","originalEvent","identifier","isPrimary","button","buttons","tiltX","tiltY","pointerType","pressure","rotationAngle","twist","tangentialPressure","InteractionData","globalPos","which","stopped","stopsPropagatingAt","stopPropagationHint","currentTarget","InteractionEvent","pointerId","_pointerId","_flags","InteractionTrackingData","FLAGS","NONE","yn","flags","OVER","_doSet","RIGHT_DOWN","LEFT_DOWN","freeze","_tempPoint","TreeSearch","interactionEvent","func","hitTest","hit","interactiveParent","hitTestChildren","contains","containsPoint","childHit","recursiveFindHit","interactiveTarget","buttonMode","cursor","trackedPointers","_trackedPointers","MOUSE_POINTER_ID","hitTestEvent","autoPreventDefault","interactionFrequency","mouse","activeInteractionData","interactionDataPool","interactionDOMElement","moveWhenInside","eventsAdded","tickerAdded","mouseOverRenderer","supportsTouchEvents","supportsPointerEvents","PointerEvent","onPointerUp","processPointerUp","onPointerCancel","processPointerCancel","onPointerDown","processPointerDown","onPointerMove","processPointerMove","onPointerOut","processPointerOverOut","onPointerOver","cursorStyles","default","pointer","currentCursorMode","delayedEvents","_tempDisplayObject","_useSystemTicker","useSystemTicker","setTargetElement","InteractionManager","addTickerListener","removeTickerListener","globalPoint","lastObjectRendered","processInteractive","element","removeEvents","addEvents","tickerUpdate","INTERACTION","msPointerEnabled","msContentZooming","msTouchAction","touchAction","_deltaTime","_didMove","interactionData","configureInteractionEventForDOMEvent","setCursorMode","mode","eventString","parentElement","resolutionMultiplier","findHit","delayedLen","displayObject_1","normalizeToPointerData","isNormalized","cancelable","preventDefault","eventLen","getInteractionDataForPointerId","isRightButton","rightDown","leftDown","cancelled","eventAppend","releaseInteractionDataForPointerId","onPointerComplete","trackingData","isTouch","isMouse","isMouseTap","isDown","over","none","delayDispatchEvent","copyEvent","reset","pointerEvent","mapPositionToPoint","clientX","clientY","globalX","globalY","normalizedEvents","TouchEvent","li","changedTouches","touch","touches","radiusX","radiusY","force","layerX","offsetX","layerY","offsetY","MouseEvent","tempEvent","items","_name","_aliasCount","Runner","a0","a6","a7","ensureNonAliasedItems","removeAll","defineProperties","dispatch","run","PREFER_ENV","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","extension","ResourcePlugin","destroyed","internal","onResize","onUpdate","onError","Resource","baseTexture","_baseTexture","_glTexture","dispose","_source","_extension","BufferResource","glTexture","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","alphaMode","UNPACK","texSubImage2D","texImage2D","internalFormat","defaultBufferOptions","scaleMode","NEAREST","RGBA","NPM","resource","mipmap","anisotropicLevel","wrapMode","resourceOptions","UNSIGNED_BYTE","TEXTURE_2D","premultiplyAlpha","touched","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","valid","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","BaseTexture","dirty","realWidth","realHeight","oldResolution","unbind","removeFromCache","strict","isFrame","_pixiId","addToCache","FLOAT","baseTextureFromCache","itemDirtyIds","partTexture","_load","AbstractMultiResource","resources","castToBaseTexture","addBaseTextureAt","addResourceAt","load","urls","initFromArray","ArrayResource","TEXTURE_2D_ARRAY","texture","texImage3D","texSubImage3D","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","BaseImageResource","crossorigin","crossOrigin","CanvasResource","OffscreenCanvas","HTMLCanvasElement","autoLoad","linkBaseTexture","CubeResource","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","side","upload","HTMLImageElement","imageElement","Image","src","complete","_process","preserveBitmap","createBitmap","createImageBitmap","bitmap","ImageResource","completed","onload","onerror","process","glTextures","otherTex","close","sourceBase64","svg","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVGResource","btoa","unescape","_loadSvg","tempImage","svgWidth","svgHeight","drawImage","svgString","sizeMatch","SVG_SIZE","HTMLVideoElement","videoElement","firstSrc","sourceElement","mime","baseSrc","ext","VideoResource","MIME_TYPES","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","playbackRate","readyState","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","_onPlayStart","_onPlayStop","_isSourceReady","paused","ended","autoUpdate","_isSourcePlaying","play","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","System","DepthResource","webGLVersion","DEPTH_COMPONENT","DEPTH_COMPONENT16","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","Framebuffer","OFF","UNSIGNED_SHORT","setSize","clearColor","framebuffer","addColorTexture","maskStack","filterStack","BaseRenderTexture","destroyDepthTexture","x3","y3","uvsFloat32","TextureUvs","frame","baseFrame","rotate","tw","th","w2","h2","cX","cY","DEFAULT_UVS","orig","anchor","noFrame","Texture","_frame","_uvs","uvMatrix","_rotate","defaultAnchor","_updateID","onBaseTextureUpdated","updateUvs","destroyBase","clone","fromBuffer","imageUrl","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","removeAllHandlers","tex","WHITE","fillStyle","fillRect","createWhiteTexture","baseRenderTexture","_legacyRenderer","legacyRenderer","filterFrame","filterPoolKey","RenderTexture","resizeBaseTexture","setResolution","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","RenderTexturePool","minWidth","minHeight","SCREEN_KEY","renderTexture","createTexture","filterTexture","getOptimalTexture","returnTexture","destroyTextures","textures","screenKey","normalized","instance","Attribute","UID","_static","_glBuffers","static","Buffer","byteSizeMap","5126","5123","5121","buffers","attributes","indexBuffer","glVertexArrayObjects","instanced","instanceCount","refCount","Geometry","ids","addAttribute","bufferIndex","interleavedBuffer","attribute","interleaveTypedArrays","geometry","attrib","geometries","geometryOut","offsets","offset","offset2","bufferIndexToCount","indexBufferData","addIndex","uvs","vertexBuffer","uvBuffer","QuadUv","targetTextureFrame","destinationFrame","invalidate","uniforms","group","syncUniforms","UniformGroup","sourceFrame","FilterState","defaultFilterStack","setScreenSize","statePool","quad","Quad","quadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterClamp","forceClear","useMaxPadding","FilterSystem","state","padding","autoFit","pad","fit","getOptimalFilterTexture","lastState","blit","BLEND","returnFilterTexture","flip","flop","CLEAR","clearMode","BLIT","bindAndClear","uSampler","filterGlobals","shader","draw","TRIANGLES","TRIANGLE_STRIP","outputMatrix","sprite","_texture","mappedMatrix","copyTo","TEMP_MATRIX","invert","prepend","translate","swap","ObjectRenderer","_object","emptyRenderer","currentRenderer","BatchSystem","objectRenderer","setObjectRenderer","maxTextures","boundTextures","texArray","batchId","elements","CONTEXT_UID_COUNTER","extensions","supports","uint32Indices","handleContextLost","handleContextRestored","ContextSystem","isContextLost","CONTEXT_UID","restoreContext","validateContext","runners","contextChange","createContext","initFromContext","getExtensions","drawBuffers","vertexArrayObject","anisotropicFiltering","uint32ElementIndex","floatTexture","floatTextureLinear","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","useProgram","isWebGl2","WebGL2RenderingContext","hasuint32","msaaBuffer","blitFramebuffer","tempRectangle","managedFramebuffers","unknownFramebuffer","msaaSamples","FramebufferSystem","viewport","hasMRT","writeDepthTexture","disposeAll","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","setViewport","g","COLOR","DEPTH","GLFramebuffer","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorage","DEPTH_STENCIL","createRenderbuffer","renderbufferStorageMultisample","framebufferRenderbuffer","COLOR_ATTACHMENT0","parentTexture","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","res","sourcePixels","destPixels","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","LINEAR","contextLost","deleteFramebuffer","deleteRenderbuffer","disposeFramebuffer","enableStencil","byteLength","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","managedBuffers","GeometrySystem","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","program","initGeometryVao","activateVao","updateBuffers","glBuffer","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","bindBuffer","_boundBuffer","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","geometryAttributes","shaderAttributes","attributeData","attribs","strings","checkCompatibility","signature","getSignature","vaoObjectHash","tempStride","tempStart","attribSize","GLBuffer","createBuffer","deleteBuffer","buf","disposeBuffer","vaoId","disposeGeometry","lastBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","glType","UNSIGNED_INT","drawElements","getSize","drawArrays","autoDetect","pooled","isMaskData","_stencilCounter","_scissorCounter","_scissorRect","_target","MaskData","maskAbove","compileShader","createShader","shaderSource","compileProgram","vertexSrc","fragmentSrc","attributeLocations","glVertShader","VERTEX_SHADER","glFragShader","FRAGMENT_SHADER","createProgram","attachShader","bindAttribLocation","linkProgram","getProgramParameter","LINK_STATUS","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","VALIDATE_STATUS","getError","getProgramInfoLog","deleteProgram","deleteShader","booleanArray","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","substring","precision","HIGH","MEDIUM","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","nameCache","Program","defaultVertexSrc","defaultFragmentSrc","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","extractData","glPrograms","getAttributeData","uniformData","getUniformData","attributesArray","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","uniformGroup","Shader","checkUniformExists","polygonOffset","blend","State","_blendMode","_polygonOffset","depthTest","Filter","aTextureCoord","filterManager","_currentState","applyFilter","tempMat","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","clampOffset","isSimple","TextureMatrix","forceUpdate","texBase","margin","maskMatrix","vertex","fragment","maskSprite","SpriteMaskFilter","npmAlpha","otherMatrix","calculateSpriteMatrix","maskClamp","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","MaskSystem","scissor","setMaskStack","maskDataOrTarget","maskData","detect","copyCountersOrReset","SCISSOR","STENCIL","SPRITE","pushSpriteMask","popSpriteMask","isFastRect","rotX","rotXY","alphaMaskFilter","stashFilterArea","glConst","AbstractMaskSystem","curStackLen","getStackLength","newStackLen","disable","enable","_useCurrent","SCISSOR_TEST","ScissorSystem","prevData","rt","projection","STENCIL_TEST","StencilSystem","prevMaskCount","forceStencil","colorMask","stencilFunc","EQUAL","_getBitwiseMask","stencilOp","KEEP","INCR","STENCIL_BUFFER_BIT","clearStencil","DECR","defaultFrame","projectionMatrix","ProjectionSystem","calculateProjection","syncUniformGroup","globals","_destinationFrame","_resolution","identity","_matrix","tempRect2","viewportFrame","_backgroundColorRgba","defaultMaskStack","RenderTextureSystem","screen","uniformGroups","GLProgram","defaultSyncData","textureCount","systemCheck","cache","ShaderSystem","Function","unsafeEvalSupported","dontSync","glProgram","generateShader","syncData","getglProgram","createSyncGroups","funcFragments","parsed","template","generateUniformsSync","attribMap","shaderProgram","getUniformLocation","OFFSET","CULLING","DEPTH_TEST","WINDING","stateId","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","checks","defaultState","StateSystem","blendModes","ONE","ONE_MINUS_SRC_ALPHA","MULTIPLY","DST_COLOR","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","SRC_ALPHA","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","CULL_FACE","frontFace","blendFunc","blendFuncSeparate","blendEquationSeparate","UNPACK_FLIP_Y_WEBGL","forceState","setBlendMode","setPolygonOffset","checkCount","maxIdle","checkCountMax","TextureGCSystem","MANUAL","tm","managedTextures","wasRemoved","destroyTexture","unload","currentLocation","_unknownBoundTextures","unknownTexture","TextureSystem","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","GLTexture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","RGBA32F","HALF_FLOAT","RGBA16F","initTextureType","updateTextureStyle","skipRemove","deleteTexture","POW2","CLAMP","setStyle","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","tempMatrix","UNKNOWN","roundPixels","autoResize","_backgroundColor","_backgroundColorString","AbstractRenderer","staticMap","o","screenWidth","screenHeight","region","removeView","postrender","prerender","addSystem","initPlugins","Renderer","__plugins","initFromOptions","premultipliedAlpha","powerPreference","ClassRef","skipUpdateTransform","isLost","enableTempParent","disableTempParent","pluginName","ctor","autoDetectRenderer","BatchTextureArray","rawBinaryData","uint32View","float32View","ViewableBuffer","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","shaderGenerator","geometryClass","vertexSize","for2d","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","AbstractBatchRenderer","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","BatchDrawCall","indices","textureArrays","TICK","_globalBatch","countTexArrays","copyBoundTextures","boundArray","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","packInterleavedGeometry","textureSystem","packedGeometries","attributeBuffer","_buffer","dcCount","stateSystem","curTexArray","_b","bindAndClearTexArray","getAttributeBuffer","getIndexBuffer","buildTexturesAndDrawCalls","updateGeometry","drawBatches","roundedP2","roundedSizeIndex","roundedSize","packedVertices","indicies","textureId","argb","_tintRGB","programCache","defaultGroupCache","BatchShaderGenerator","sampleValues","uSamplers","generateSampleSrc","translationMatrix","BatchPluginFactory","defaultVertex","defaultFragment","BatchGeometry","BatchRenderer","forceCanvas","stage","Application","_plugins","plugin","stageOptions","reverse","ResizePlugin","dom","queueResize","_resizeTo","cancelResize","_resizeId","innerWidth","innerHeight","resizeTo","registerPlugin","TEMP_RECT","extract","Extract","quality","image","base64","toDataURL","flipY","generated","generateTexture","canvasBuffer","webglPixels","readPixels","canvasData","arrayPostDivide","putImageData","target_1","str","opts","parser","loose","strictMode","uri","$0","$1","$2","_createClass","props","descriptor","enumerable","configurable","writable","Constructor","protoProps","staticProps","_classCallCheck","MiniSignalBinding","thisArg","_fn","_once","_thisArg","_next","_prev","_owner","detach","_addMiniSignalBinding","node","_tail","MiniSignal","exists","_noop","eachSeries","iterator","deferNext","onlyOnce","callFn","worker","concurrency","workers","_tasks","saturated","unsaturated","empty","drain","_insert","kill","task","running","idle","resume","insertAtFront","useXdr","XDomainRequest","XMLHttpRequest","_setFlag","STATUS_FLAGS","DATA_URL","_getExtension","timeout","loadType","_determineLoadType","xhrType","metadata","xhr","TYPE","progressChunk","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_onProgress","_boundOnTimeout","_onTimeout","_boundXhrOnError","_xhrOnError","_boundXhrOnTimeout","_xhrOnTimeout","_boundXhrOnAbort","_xhrOnAbort","_boundXhrOnLoad","_xhrOnLoad","onStart","Signal","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","extname","setExtMap","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","_clearEvents","_finish","abort","xdr","EMPTY_GIF","firstChild","isLoading","isComplete","LOADING","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","_loadXdr","_loadXhr","_hasFlag","ontimeout","onprogress","COMPLETE","loadElement","skipSource","Audio","isCocoonJS","mimeTypes","mimeType","_createSource","_determineXhrType","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","nodeName","lengthComputable","loaded","total","reqType","status","statusText","text","responseText","BUFFER","DOMParser","domparser","parseFromString","XML","response","responseURL","origin","parseUri","isDataUrl","slashIndex","queryStart","hashStart","_getMimeFromXhrType","BLOB","DEFAULT","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","_keyStr","URL","webkitURL","Blob","createObjectURL","blob","revokeObjectURL","getResponseHeader","inx","bytebuffer","encodedCharIndexes","jnx","encodeBinary","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","_loadResource","_queue","async","onLoad","_defaultBeforeMiddleware","pre","_defaultAfterMiddleware","use","parentResource","_prepareUrl","incompleteChildren","eachChunk","_onStart","_onComplete","chunk","dequeue","_this2","_onLoad","_this3","LoaderResource","TextureLoader","fromLoader","ResourceLoader","middleware","parsing","AppLoaderPlugin","sharedLoader","loader","LINE_JOIN","LINE_CAP","maxSize","properties","batchSize","_properties","_maxSize","_batchSize","_buffers","_bufferUpdateIDs","setProperties","_tint","tintRgb","ParticleContainer","particle","smallestChildIndex","dynamicPropertyFlags","dynamicProperties","staticProperties","property","attributeName","uploadFunction","staticStride","staticBuffer","staticData","staticDataUint32","dynamicStride","dynamicBuffer","dynamicData","dynamicDataUint32","initBuffers","ParticleBuffer","dynamicOffset","dynBuffer","staticOffset","statBuffer","startIndex","amount","uploadVertices","uploadPosition","uploadRotation","uploadUvs","uploadTint","ParticleRenderer","totalChildren","generateBuffers","toArray","uColor","updateStatic","_generateOneMoreBuffer","uploadDynamic","bid","uploadStatic","w0","w1","h0","h1","spritePosition","spriteRotation","textureUvs","GRAPHICS_CURVES","adaptive","maxLength","minSegments","maxSegments","epsilon","_segmentsCount","defaultSegments","FillStyle","color","buildPoly","build","graphicsData","shape","triangulate","graphicsGeometry","verts","holeArray","vertPos","buildCircle","circleData","ellipseData","totalSegs","seg","center","circle","buildRectangle","rectData","getPt","n1","n2","perc","quadraticBezierCurve","fromX","fromY","cpX","cpY","toX","toY","xa","ya","xb","yb","buildRoundedRectangle","rrectData","vecPos","square","nx","ny","innerWeight","outerWeight","exx","eyy","eix","eiy","eox","eoy","ex","ey","cx2p0x","cy2p0y","angle0","angle1","startAngle","angleDiff","absAngleDiff","segCount","angleInc","buildLine","lineStyle","native","closedShape","buildNativeLine","closePointEps","firstPoint","lastPoint","closedPath","midPointX","midPointY","indexCount","indexStart","widthSquared","miterLimitSquared","miterLimit","perpx","perpy","perp1x","perp1y","dist","ratio","alignment","cap","ROUND","SQUARE","dx0","dy0","dx1","dy1","cross","c2","pdist","imx","imy","omx","omy","insideWeight","BEVEL","eps2","buildNonNativeLine","innerRadius","ArcUtils","mm","dd","cc","tt","k1","k2","j1","j2","qy","endAngle","anticlockwise","_startX","_startY","_anticlockwise","sweep","theta","theta2","cTheta","sTheta","segMinus","remainder","BezierUtils","cpX2","cpY2","t2","t3","nt","nt2","nt3","prevX","prevY","curveLength","dt","dt2","dt3","QuadraticUtils","a32","ba","BatchPart","attribStart","endAttrib","FILL_COMMANDS","BATCH_POOL","DRAW_CALL_POOL","GraphicsData","tmpPoint","tmpBounds","colors","textureIds","batchDirty","cacheDirty","clearDirty","batches","shapeIndex","boundsDirty","boundsPadding","batchable","indicesUint16","GraphicsGeometry","batchPart","lastShape","hitHole","i_1","allow32Indices","validateBatching","currentStyle","transformPoints","nextTexture","index_1","attribIndex","REPEAT","processFill","processLine","_compareStyles","addUvs","need32","isBatchable","packBatches","styleA","styleB","fill","line","BATCHABLE_SIZE","currentGroup","currentTexture","drawMode","LINES","addColors","addTextureIds","packAttributes","glPoints","f32","u32","processHoles","sequenceBounds","curMatrix","IDENTITY","nextMatrix","lineWidth","addBoundsMatrix","addFramePad","ellipse","poly","rgba","uvsStart","adjustUvs","BUTT","MITER","LineStyle","temp","DEFAULT_SHADERS","_geometry","_fillStyle","_lineStyle","_holeMode","currentPath","batchTint","_transformID","Graphics","finishPoly","lineTextureStyle","startPoly","drawShape","moveTo","_initCurve","curveTo","radius_1","arc","startX","startY","xDiff","yDiff","beginTextureFill","drawHole","drawPolygon","Star","updateBatches","_populateBatches","_renderBatched","_renderDirect","gI","_batchRGB","calculateVertices","calculateTints","_resolveDirectShader","_renderDrawCallDirect","groupTextureCount","addFrame","_TEMP_POINT","tintRGB","wtID","TEXT_GRADIENT","tempPoint","_anchor","_onAnchorUpdate","_cachedTint","vertexTrimmedData","_transformTrimmedID","_textureTrimmedID","_roundPixels","Sprite","addQuad","calculateTrimmedVertices","_onTextureUpdate","destroyBaseTexture","defaultStyle","align","breakWords","dropShadow","dropShadowAlpha","dropShadowAngle","dropShadowBlur","dropShadowColor","dropShadowDistance","fillGradientType","LINEAR_VERTICAL","fillGradientStops","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","letterSpacing","lineHeight","lineJoin","stroke","strokeThickness","textBaseline","whiteSpace","wordWrap","wordWrapWidth","leading","genericFontFamilies","styleID","deepCopyProperties","TextStyle","clonedProperties","_align","_breakWords","_dropShadow","_dropShadowAlpha","_dropShadowAngle","_dropShadowBlur","_dropShadowColor","outputColor","getColor","_dropShadowDistance","_fill","_fillGradientType","_fillGradientStops","array1","array2","areArraysEqual","_fontFamily","_fontSize","_fontStyle","_fontVariant","_fontWeight","_letterSpacing","_lineHeight","_leading","_lineJoin","_miterLimit","_padding","_stroke","_strokeThickness","_textBaseline","_trim","_whiteSpace","_wordWrap","_wordWrapWidth","fontSizeString","fontFamilies","getSingleColor","propertyObj","lines","lineWidths","maxLineWidth","fontProperties","TextMetrics","_canvas","font","toFontString","measureFont","ascent","measureText","collapseSpaces","collapseNewlines","canPrependSpaces","tokens","tokenize","token","isNewline","addLine","currIsBreakingSpace","isBreakingSpace","lastIsBreakingSpace","tokenWidth","getFromCache","canBreakWords","characters","wordWrapSplit","char","nextChar","lastChar","canBreakChars","characterWidth","isLastToken","newLine","trimRight","spacing","_newlines","_breakingSpaces","_token","_char","_nextChar","_index","_fonts","descent","_context","metricsString","METRICS_STRING","BASELINE_SYMBOL","baseline","BASELINE_MULTIPLIER","fillText","imagedata","defaultDestroyOptions","ownCanvas","_ownCanvas","_autoResolution","_text","_style","_styleListener","_font","localStyleID","Text","respectDirty","linePositionX","linePositionY","measured","passesCount","isShadowPass","dsOffsetText","dsOffsetShadow","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","_generateFillStyle","drawLetterSpacing","isStroke","currentPosition","stringArray","previousWidth","currentWidth","currentChar","strokeText","trimmed","setRealSize","updateText","metrics","gradient","dropShadowCorrection","lengthPlus1","createLinearGradient","lastIterationStop","gradStopLineHeight","thisLineTop","globalStop","clampedStop","addColorStop","totalIterations","currentIteration","UPLOADS_PER_FRAME","maxItemsPerFrame","itemsLeft","CountLimiter","findMultipleBaseTextures","_textures","findBaseTexture","findTexture","drawText","_helper","calculateTextStyle","findText","findTextStyle","limiter","uploadHookHelper","addHooks","uploadHooks","completes","ticking","delayedTick","prepareItems","registerFindHook","registerUploadHook","BasePrepare","done","addOnce","tick","UTILITY","beginFrame","allowedToUpload","uploaded","addHook","uploadHook","uploadBaseTextures","uploadGraphics","findGraphics","maxMilliseconds","frameStart","TimeLimiter","resolutionFilename","animations","_updateResolution","_frames","frames","_frameKeys","_batchIndex","_callback","Spritesheet","meta","BATCH_SIZE","_processFrames","_processAnimations","_parseComplete","_nextBatch","initialFrameIndex","frameIndex","maxFrames","sourceSize","rotated","spriteSourceSize","animName","frameName","SpritesheetLoader","imageResourceName","loadOptions","imageMetadata","resourcePath","getResourcePath","spritesheet","tileTransform","uvRespectAnchor","TilingSprite","updateLocalTransform","simpleShader","fragmentSimple","TilingSpriteRenderer","ts","baseTex","uv","H","uMapCoord","uTransform","_bufferUpdateId","_textureUpdateId","MeshBatchUvs","multiplyUvs","tempPolygon","vertexDirty","batchUvs","Mesh","_renderToBatch","_renderDefault","calculateUvs","material","vertexDirtyId","geomUvs","addVertexData","getBuffer","getIndex","step","ind0","ind1","ind2","uTextureMatrix","_colorDirty","MeshMaterial","_alpha","verticesBuffer","uvsBuffer","_updateId","MeshGeometry","info","common","page","kerning","TextFormat","rawData","chars","kernings","attributeList","itemData","strValue","floatValue","BitmapFontData","face","xoffset","yoffset","xadvance","first","second","XMLFormat","XMLDocument","getElementsByTagName","XMLStringFormat","xmlTxt","formats","autoDetectFormat","generateFillStyle","drawGlyph","pageTextures","page_1","_c","xOffset","yOffset","xAdvance","_d","BitmapFont","fontData","available","textStyle","defaultOptions","textureWidth","textureHeight","charsList","startCode","endCode","j_1","resolveCharacters","positionX","positionY","maxCharHeight","textureGlyphWidth","uninstall","ALPHANUMERIC","pageMeshDataPool","charRenderDataPool","_upgradeStyle","BitmapText","styleDefaults","maxWidth","fontName","_activePagesMeshData","_textWidth","_textHeight","_fontName","_maxWidth","_maxLineHeight","_textureCache","textLength","prevCharCode","lastLineWidth","lastBreakPos","lastBreakWidth","spacesRemoved","maxLineHeight","charCode","charData","charRenderData","lineAlignOffsets","alignOffset","lenChars","pagesMeshData","newPagesMeshData","activePagesMeshData","baseTextureUid","pageMeshData","vertexCount","uvsCount","mesh","total_1","xPos","yPos","pageMesh","textureFrame","anchorOffsetX","anchorOffsetY","i_2","textureBuffer","validate","valueSplit","install","BitmapFontLoader","getBaseUrl","pageFile","bitmapFont","bitmapResource","resUrl","dirname","dir","uAlpha","AlphaFilter","vertTemplate","GAUSSIAN_VALUES","5","7","9","11","13","15","horizontal","strength","kernelSize","vertSrc","halfLength","vertSource","blurLoop","blur","generateBlurVertSource","fragSrc","kernel","fragSource","generateBlurFragSource","_quality","BlurFilterPass","passes","renderTarget","getFilterTexture","blurXFilter","blurYFilter","repeatEdgePixels","BlurFilter","xStrength","yStrength","_repeatEdgePixels","updatePadding","defaultFilterVertex","ColorMatrixFilter","multiply","newMatrix","_multiply","_colorMatrix","_loadMatrix","cosR","sinR","sqrW","saturate","desaturation","toned","lightColor","darkColor","lR","lG","lB","dR","dG","dB","intensity","grayscale","greyscale","mapSampler","filterMatrix","DisplacementFilter","lenX","lenY","noise","seed","random","uNoise","uSeed","NoiseFilter","_tempMatrix","_cacheAsBitmap","_cacheData","textureCacheId","originalRender","originalRenderCanvas","originalCalculateBounds","originalGetLocalBounds","originalUpdateTransform","originalDestroy","originalMask","originalFilterArea","originalContainsPoint","cacheAsBitmap","CacheData","renderCanvas","_renderCached","_renderCachedCanvas","_cacheAsBitmapDestroy","_destroyCachedDisplayObject","_initCachedDisplayObject","cacheAlpha","cachedRenderTexture","cachedSourceFrame","cachedProjectionTransform","_calculateCachedBounds","_getCachedLocalBounds","cachedSprite","_initCachedDisplayObjectCanvas","_renderCanvas","cachedRenderTarget","_projTransform","getChildByName","deep","getGlobalPosition","segWidth","segHeight","PlaneGeometry","segmentsX","segmentsY","sizeX","sizeY","totalSub","xpos","ypos","value2","value3","value4","textureScale","RopeGeometry","distance","updateVertices","nextPoint","perpX","perpY","perpLength","ropeGeometry","meshMaterial","SimpleRope","verticesX","verticesY","planeGeometry","SimplePlane","textureUpdated","SimpleMesh","DEFAULT_BORDER_SIZE","leftWidth","topHeight","rightWidth","bottomHeight","_origWidth","_origHeight","_leftWidth","_rightWidth","_topHeight","_bottomHeight","NineSlicePlane","_refresh","_getMinScale","scaleW","scaleH","_uvw","_uvh","updateHorizontalVertices","updateVerticalVertices","_durations","animationSpeed","loop","updateAnchor","onFrameChange","onLoop","_currentTime","_playing","_previousFrame","AnimatedSprite","frameNumber","previousFrame","currentFrame","elapsed","lag","gotoAndStop","images","v5","Prepare","FXAAFilter","_foundShapes","CanvasMaskManager","save","foundShapes","recursiveFindShapes","beginPath","setContextTransform","renderGraphicsShape","clip","graphics","lineTo","closePath","ox","oy","xe","ye","xm","ym","bezierCurveTo","rx","ry","maxRadius","quadraticCurveTo","restore","invalidateBlendMode","createColoredCanvas","canUseNewCanvasBlendModes","magenta","yellow","globalCompositeOperation","imageData","CANVAS","rootContext","refresh","maskManager","smoothProperty","imageSmoothingEnabled","rc","webkitImageSmoothingEnabled","mozImageSmoothingEnabled","oImageSmoothingEnabled","msImageSmoothingEnabled","CanvasRenderer","_activeBlendMode","_outerBlend","rootResolution","_canvasRenderTarget","globalAlpha","tempContext","localResolution","proj","readyForOuterBlend","outerBlend","canvasUtils","getTintedCanvas","stringColor","roundColor","tintCache","cachedCanvas","tintId","tintMethod","convertTintToImage","tintImage","getTintedPattern","patternCache","pattern","createPattern","tintWithMultiply","crop","getDrawableSource","tintWithOverlay","tintWithPerPixel","rgbValues","pixelData","cacheStepsPerColorChannel","canUseMultiply","parentCreate","CanvasMeshRenderer","_renderTriangleMesh","_renderTriangles","_renderDrawTriangle","index0","isTinted","_tintedCanvas","textureSource","u0","u1","u2","v0","v1","v2","canvasPadding","centerX","centerY","normX","normY","deltaA","deltaB","deltaC","deltaD","deltaE","deltaF","MESH_CANVAS_PADDING","_canvasUvs","col","sw","sh","dw","dh","warned","_canvasPadding","canvasRenderer","_svgMatrix","CanvasGraphicsRenderer","setPatternTransform","contextFillStyle","contextStrokeStyle","tintR","tintG","tintB","fillColor","lineColor","fillTint","_calcCanvasStyle","lineTint","lineCap","tempShape","outerArea","innerArea","strokeRect","createElementNS","createSVGMatrix","f","inverse","generateCanvasTexture","cachedGraphicsData","canvasRenderWorldTransform","CanvasSpriteRenderer","smoothingEnabled","CanvasExtract","CANVAS_START_SIZE","prepare","tempPrepare","imageWidth","imageHeight","ctx","CanvasPrepare","baseTextureResolution","modX","tilePosition","tileScale","modY","tempCanvas","_canvasPattern","anchorX","anchorY","isRotated","finalWidth","finalHeight","childTransform","pushMask","popMask","PIXI","TransformStatic","TransformBase","TRANSFORM_MODE","STATIC","DYNAMIC","WebGLRenderer","utils","FilterManager","systems","CanvasTinter","GroupD8","accessibility","extras","fromFrame","frameId","fromImage","imageId","getSvgSize","Plane","Rope","RawMesh","MeshRenderer","particles","loaders","bitmapFontParser","parseBitmapFontData","spritesheetParser","addPixiMiddleware","eventToSignal","toUpperCase","signal","_renderWebGL","renderWebGL","renderAdvancedWebGL","BaseTextureAny","loadSource","baseTextureIdDeprecation","hasLoaded","_id","fromCanvas","fromSVG","copy","setState","getRenderTarget","_clear","returnRenderTarget","calculateScreenSpaceMatrix","calculateNormalizedScreenSpaceMatrix","translateScaleX","translateScaleY","BlurXFilter","BlurYFilter","SpriteAny","TextureAny","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AM,aAQ9C4lF,EAAWxC,UAAY2C,EAAY/lF,KAAK,KAAM,aAO9Cz8B,OAAOy2B,eAAesoF,EAAKx6C,iBAAiBtkE,UAAW,aAAc,CACjEkiC,IAAA,WAKI,OAHAva,GAAY8sF,GAAI,kGAGTnyG,KAAK0I,aAEhBuiB,IAAA,SAAeztB,GAEX6nB,GAAY8sF,GAAI,kGAGhBnyG,KAAK0I,YAAclL,KAS3BC,OAAOy2B,eAAesoF,EAAK75C,SAASjlE,UAAW,iBAAkB,CAC7DkiC,IAAA,WAII,OAFAva,GAAY8sF,GAAI,kFAETnyG,KAAKuvC,WAQpBitE,EAAKO,MAAMoD,OAAS,CAMhB9mF,MAAA,WAEIhU,GAAY8sF,GAAI,4DAOpBiO,WAAA,WAEI/6F,GAAY8sF,GAAI,iEAOpBkO,cAAA,WAEIh7F,GAAY8sF,GAAI,qEASxB10G,OAAOy2B,eAAesoF,EAAKtY,WAAWxmG,UAAW,OAAQ,CACrDkiC,IAAA,WAKI,OAHAva,GAAY,QAAS,iGAGd,CACHra,KAAMhL,KAAKykG,UACXpgF,KAAMrkB,KAAKkyF,UACXnuE,KAAM/jB,KAAK46E,MACXsU,MAAOlvF,KAAKixF,SAGpBhmE,IAAA,SAAsBztB,GAKlB,GAHA6nB,GAAY,QAAS,iGAGhB7nB,EAAL,CAKA,IAAMs8B,EAAa,CAAE+5D,KAAMr2F,GAE3BwC,KAAKikG,cAAcnqE,GAEnBA,EAAMg2D,SAAWh2D,EAAMg2D,UAAY0sB,EAAK3Z,WAAWE,UAAUjpE,EAAMuqE,UAAUhgF,KAE7ErkB,KAAKykG,UAAY3qE,EAAMuqE,SACvBrkG,KAAKkyF,UAAYp4D,EAAMg2D,SAEvB9vF,KAAK8tC,OAAQ"} \ No newline at end of file diff --git a/www/js/libs/pixi-picture.js b/www/js/libs/pixi-picture.js index eebeaa0..6eb8ee6 100644 --- a/www/js/libs/pixi-picture.js +++ b/www/js/libs/pixi-picture.js @@ -1,404 +1,428 @@ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var pixi_picture; -(function (pixi_picture) { - var BackdropFilter = (function (_super) { - __extends(BackdropFilter, _super); - function BackdropFilter() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.backdropUniformName = null; - _this._backdropActive = false; - _this.clearColor = null; - return _this; - } - return BackdropFilter; - }(PIXI.Filter)); - pixi_picture.BackdropFilter = BackdropFilter; - var filterFrag = "\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D uBackdrop;\n\n%UNIFORM_CODE%\n\nvoid main(void)\n{\n vec4 b_src = texture2D(uSampler, vTextureCoord);\n vec4 b_dest = texture2D(uBackdrop, vTextureCoord);\n vec4 b_res = b_dest;\n \n %BLEND_CODE%\n\n gl_FragColor = b_res;\n}"; - var BlendFilter = (function (_super) { - __extends(BlendFilter, _super); - function BlendFilter(shaderParts) { - var _this = this; - var fragCode = filterFrag; - fragCode = fragCode.replace('%UNIFORM_CODE%', shaderParts.uniformCode || ""); - fragCode = fragCode.replace('%BLEND_CODE%', shaderParts.blendCode || ""); - _this = _super.call(this, undefined, fragCode, shaderParts.uniforms) || this; - _this.backdropUniformName = 'uBackdrop'; - return _this; - } - return BlendFilter; - }(BackdropFilter)); - pixi_picture.BlendFilter = BlendFilter; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - function containsRect(rectOut, rectIn) { - var r1 = rectIn.x + rectIn.width; - var b1 = rectIn.y + rectIn.height; - var r2 = rectOut.x + rectOut.width; - var b2 = rectOut.y + rectOut.height; - return (rectIn.x >= rectOut.x) && - (rectIn.x <= r2) && - (rectIn.y >= rectOut.y) && - (rectIn.y <= b2) && - (r1 >= rectOut.x) && - (r1 <= r2) && - (b1 >= rectOut.y) && - (b1 <= b2); - } - PIXI.systems.TextureSystem.prototype.bindForceLocation = function (texture, location) { - if (location === void 0) { location = 0; } - var gl = this.gl; - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - this.bind(texture, location); - }; - function pushWithCheck(target, filters, checkEmptyBounds) { - if (checkEmptyBounds === void 0) { checkEmptyBounds = true; } - var renderer = this.renderer; - var filterStack = this.defaultFilterStack; - var state = this.statePool.pop() || new PIXI.FilterState(); - var resolution = filters[0].resolution; - var padding = filters[0].padding; - var autoFit = filters[0].autoFit; - var legacy = filters[0].legacy; - for (var i = 1; i < filters.length; i++) { - var filter = filters[i]; - resolution = Math.min(resolution, filter.resolution); - padding = this.useMaxPadding - ? Math.max(padding, filter.padding) - : padding + filter.padding; - autoFit = autoFit || filter.autoFit; - legacy = legacy || filter.legacy; - } - if (filterStack.length === 1) { - this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current; - } - filterStack.push(state); - state.resolution = resolution; - state.legacy = legacy; - state.target = target; - state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); - var canUseBackdrop = true; - state.sourceFrame.pad(padding); - if (autoFit) { - state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame); - } - else { - canUseBackdrop = containsRect(this.renderer.renderTexture.sourceFrame, state.sourceFrame); - } - if (checkEmptyBounds && state.sourceFrame.width <= 1 && state.sourceFrame.height <= 1) { - filterStack.pop(); - state.clear(); - this.statePool.push(state); - return false; - } - state.sourceFrame.ceil(resolution); - if (canUseBackdrop) { - var backdrop = null; - for (var i = 0; i < filters.length; i++) { - var bName = filters[i].backdropUniformName; - if (bName) { - if (backdrop === null) { - backdrop = this.prepareBackdrop(state.sourceFrame); - } - filters[i].uniforms[bName] = backdrop; - if (backdrop) { - filters[i]._backdropActive = true; - } - } +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var shaderLib = [ + { + vertUniforms: "", + vertCode: "vTextureCoord = aTextureCoord;", + fragUniforms: "uniform vec4 uTextureClamp;", + fragCode: "vec2 textureCoord = clamp(vTextureCoord, uTextureClamp.xy, uTextureClamp.zw);" + }, + { + vertUniforms: "uniform mat3 uTransform;", + vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;", + fragUniforms: "", + fragCode: "vec2 textureCoord = vTextureCoord;" + }, + { + vertUniforms: "uniform mat3 uTransform;", + vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;", + fragUniforms: "uniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;", + fragCode: "vec2 textureCoord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;" + + "\ntextureCoord = (uMapCoord * vec3(textureCoord, 1.0)).xy;" + + "\ntextureCoord = clamp(textureCoord, uClampFrame.xy, uClampFrame.zw);" } - } - state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution); - state.filters = filters; - state.destinationFrame.width = state.renderTexture.width; - state.destinationFrame.height = state.renderTexture.height; - var destinationFrame = this.tempRect; - destinationFrame.width = state.sourceFrame.width; - destinationFrame.height = state.sourceFrame.height; - state.renderTexture.filterFrame = state.sourceFrame; - renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame); - renderer.renderTexture.clear(filters[filters.length - 1].clearColor); - return true; - } - function push(target, filters) { - return this.pushWithCheck(target, filters, false); - } - function pop() { - var filterStack = this.defaultFilterStack; - var state = filterStack.pop(); - var filters = state.filters; - this.activeState = state; - var globalUniforms = this.globalUniforms.uniforms; - globalUniforms.outputFrame = state.sourceFrame; - globalUniforms.resolution = state.resolution; - var inputSize = globalUniforms.inputSize; - var inputPixel = globalUniforms.inputPixel; - var inputClamp = globalUniforms.inputClamp; - inputSize[0] = state.destinationFrame.width; - inputSize[1] = state.destinationFrame.height; - inputSize[2] = 1.0 / inputSize[0]; - inputSize[3] = 1.0 / inputSize[1]; - inputPixel[0] = inputSize[0] * state.resolution; - inputPixel[1] = inputSize[1] * state.resolution; - inputPixel[2] = 1.0 / inputPixel[0]; - inputPixel[3] = 1.0 / inputPixel[1]; - inputClamp[0] = 0.5 * inputPixel[2]; - inputClamp[1] = 0.5 * inputPixel[3]; - inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); - inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); - if (state.legacy) { - var filterArea = globalUniforms.filterArea; - filterArea[0] = state.destinationFrame.width; - filterArea[1] = state.destinationFrame.height; - filterArea[2] = state.sourceFrame.x; - filterArea[3] = state.sourceFrame.y; - globalUniforms.filterClamp = globalUniforms.inputClamp; - } - this.globalUniforms.update(); - var lastState = filterStack[filterStack.length - 1]; - if (state.renderTexture.framebuffer.multisample > 1) { - this.renderer.framebuffer.blit(); - } - if (filters.length === 1) { - filters[0].apply(this, state.renderTexture, lastState.renderTexture, PIXI.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(state.renderTexture); - } - else { - var flip = state.renderTexture; - var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); - flop.filterFrame = flip.filterFrame; - var i = 0; - for (i = 0; i < filters.length - 1; ++i) { - filters[i].apply(this, flip, flop, PIXI.CLEAR_MODES.CLEAR, state); - var t = flip; - flip = flop; - flop = t; + ]; + var PictureShader = (function (_super) { + __extends(PictureShader, _super); + function PictureShader(gl, vert, frag, tilingMode) { + var lib = shaderLib[tilingMode]; + _super.call(this, gl, vert.replace(/%SPRITE_UNIFORMS%/gi, lib.vertUniforms) + .replace(/%SPRITE_CODE%/gi, lib.vertCode), frag.replace(/%SPRITE_UNIFORMS%/gi, lib.fragUniforms) + .replace(/%SPRITE_CODE%/gi, lib.fragCode)); + this.bind(); + this.tilingMode = tilingMode; + this.tempQuad = new PIXI.Quad(gl); + this.tempQuad.initVao(this); + this.uniforms.uColor = new Float32Array([1, 1, 1, 1]); + this.uniforms.uSampler = [0, 1]; } - filters[i].apply(this, flip, lastState.renderTexture, PIXI.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(flip); - this.returnFilterTexture(flop); - } - var backdropFree = false; - for (var i = 0; i < filters.length; i++) { - if (filters[i]._backdropActive) { - var bName = filters[i].backdropUniformName; - if (!backdropFree) { - this.returnFilterTexture(filters[i].uniforms[bName]); - backdropFree = true; - } - filters[i].uniforms[bName] = null; - filters[i]._backdropActive = false; + PictureShader.blendVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 mapMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n vMapCoord = (mapMatrix * vec3(aVertexPosition, 1.0)).xy;\n}\n"; + return PictureShader; + }(PIXI.Shader)); + extras.PictureShader = PictureShader; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cs2 = Cs * 2.0 - 1.0;\n vec3 screen = Cb + Cs2 - Cb * Cs2;\n vec3 B;\n if (Cb.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cb.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cb.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n"; + var HardLightShader = (function (_super) { + __extends(HardLightShader, _super); + function HardLightShader(gl, tilingMode) { + _super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode); } + return HardLightShader; + }(extras.PictureShader)); + extras.HardLightShader = HardLightShader; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + function mapFilterBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } + array[PIXI.BLEND_MODES.OVERLAY] = [new extras.OverlayShader(gl, 0), new extras.OverlayShader(gl, 1), new extras.OverlayShader(gl, 2)]; + array[PIXI.BLEND_MODES.HARD_LIGHT] = [new extras.HardLightShader(gl, 0), new extras.HardLightShader(gl, 1), new extras.HardLightShader(gl, 2)]; + return array; } - state.clear(); - this.statePool.push(state); - } - var hadBackbufferError = false; - function prepareBackdrop(bounds) { - var renderer = this.renderer; - var renderTarget = renderer.renderTexture.current; - var fr = this.renderer.renderTexture.sourceFrame; - if (!renderTarget) { - if (!hadBackbufferError) { - hadBackbufferError = true; - console.warn('pixi-picture: you are trying to use Blend Filter on main framebuffer! That wont work.'); + extras.mapFilterBlendModesToPixi = mapFilterBlendModesToPixi; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var normalFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n\n vec4 sample = texture2D(uSampler[0], textureCoord);\n gl_FragColor = sample * uColor;\n}\n"; + var normalVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n}\n"; + var NormalShader = (function (_super) { + __extends(NormalShader, _super); + function NormalShader(gl, tilingMode) { + _super.call(this, gl, normalVert, normalFrag, tilingMode); } - return null; + return NormalShader; + }(extras.PictureShader)); + extras.NormalShader = NormalShader; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cb2 = Cb * 2.0 - 1.0;\n vec3 screen = Cb2 + Cs - Cb2 * Cs;\n vec3 B;\n if (Cs.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cs.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cs.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n"; + var OverlayShader = (function (_super) { + __extends(OverlayShader, _super); + function OverlayShader(gl, tilingMode) { + _super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode); + } + return OverlayShader; + }(extras.PictureShader)); + extras.OverlayShader = OverlayShader; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + function nextPow2(v) { + v += (v === 0) ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; } - var resolution = renderTarget.baseTexture.resolution; - var x = (bounds.x - fr.x) * resolution; - var y = (bounds.y - fr.y) * resolution; - var w = (bounds.width) * resolution; - var h = (bounds.height) * resolution; - var gl = renderer.gl; - var rt = this.getOptimalFilterTexture(w, h, 1); - rt.filterFrame = fr; - renderer.texture.bindForceLocation(rt.baseTexture, 0); - gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, w, h); - return rt; - } - PIXI.systems.FilterSystem.prototype.push = push; - PIXI.systems.FilterSystem.prototype.pushWithCheck = pushWithCheck; - PIXI.systems.FilterSystem.prototype.pop = pop; - PIXI.systems.FilterSystem.prototype.prepareBackdrop = prepareBackdrop; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - var MASK_CHANNEL; - (function (MASK_CHANNEL) { - MASK_CHANNEL[MASK_CHANNEL["RED"] = 0] = "RED"; - MASK_CHANNEL[MASK_CHANNEL["GREEN"] = 1] = "GREEN"; - MASK_CHANNEL[MASK_CHANNEL["BLUE"] = 2] = "BLUE"; - MASK_CHANNEL[MASK_CHANNEL["ALPHA"] = 3] = "ALPHA"; - })(MASK_CHANNEL = pixi_picture.MASK_CHANNEL || (pixi_picture.MASK_CHANNEL = {})); - var MaskConfig = (function () { - function MaskConfig(maskBefore, channel) { - if (maskBefore === void 0) { maskBefore = false; } - if (channel === void 0) { channel = MASK_CHANNEL.ALPHA; } - this.maskBefore = maskBefore; - this.uniformCode = 'uniform vec4 uChannel;'; - this.uniforms = { - uChannel: new Float32Array([0, 0, 0, 0]), + var PictureRenderer = (function (_super) { + __extends(PictureRenderer, _super); + function PictureRenderer(renderer) { + _super.call(this, renderer); + } + PictureRenderer.prototype.onContextChange = function () { + var gl = this.renderer.gl; + this.drawModes = extras.mapFilterBlendModesToPixi(gl); + this.normalShader = [new extras.NormalShader(gl, 0), new extras.NormalShader(gl, 1), new extras.NormalShader(gl, 2)]; + this._tempClamp = new Float32Array(4); + this._tempColor = new Float32Array(4); + this._tempRect = new PIXI.Rectangle(); + this._tempRect2 = new PIXI.Rectangle(); + this._tempRect3 = new PIXI.Rectangle(); + this._tempMatrix = new PIXI.Matrix(); + this._tempMatrix2 = new PIXI.Matrix(); + this._bigBuf = new Uint8Array(1 << 20); + this._renderTexture = new PIXI.BaseRenderTexture(1024, 1024); }; - this.blendCode = "b_res = dot(b_src, uChannel) * b_dest;"; - this.uniforms.uChannel[channel] = 1.0; - } - return MaskConfig; - }()); - pixi_picture.MaskConfig = MaskConfig; - var MaskFilter = (function (_super) { - __extends(MaskFilter, _super); - function MaskFilter(baseFilter, config) { - if (config === void 0) { config = new MaskConfig(); } - var _this = _super.call(this, config) || this; - _this.baseFilter = baseFilter; - _this.config = config; - _this.padding = baseFilter.padding; - return _this; - } - MaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { - var target = filterManager.getFilterTexture(input); - if (this.config.maskBefore) { - var blendMode = this.state.blendMode; - this.state.blendMode = PIXI.BLEND_MODES.NONE; - filterManager.applyFilter(this, input, target, PIXI.CLEAR_MODES.YES); - this.baseFilter.blendMode = blendMode; - this.baseFilter.apply(filterManager, target, output, clearMode); - this.state.blendMode = blendMode; - } - else { - var uBackdrop = this.uniforms.uBackdrop; - this.baseFilter.apply(filterManager, uBackdrop, target, PIXI.CLEAR_MODES.YES); - this.uniforms.uBackdrop = target; - filterManager.applyFilter(this, input, output, clearMode); - this.uniforms.uBackdrop = uBackdrop; - } - filterManager.returnFilterTexture(target); - }; - return MaskFilter; - }(pixi_picture.BlendFilter)); - pixi_picture.MaskFilter = MaskFilter; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - var blends; - (function (blends) { - blends.NPM_BLEND = "if (b_src.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n}\nvec3 Cb = b_src.rgb / b_src.a, Cs;\nif (b_dest.a > 0.0) {\n Cs = b_dest.rgb / b_dest.a;\n}\n%NPM_BLEND%\nb_res.a = b_src.a + b_dest.a * (1.0-b_src.a);\nb_res.rgb = (1.0 - b_src.a) * Cs + b_src.a * B;\nb_res.rgb *= b_res.a;\n"; - blends.OVERLAY_PART = "vec3 multiply = Cb * Cs * 2.0;\nvec3 Cb2 = Cb * 2.0 - 1.0;\nvec3 screen = Cb2 + Cs - Cb2 * Cs;\nvec3 B;\nif (Cs.r <= 0.5) {\n B.r = multiply.r;\n} else {\n B.r = screen.r;\n}\nif (Cs.g <= 0.5) {\n B.g = multiply.g;\n} else {\n B.g = screen.g;\n}\nif (Cs.b <= 0.5) {\n B.b = multiply.b;\n} else {\n B.b = screen.b;\n}\n"; - blends.HARDLIGHT_PART = "vec3 multiply = Cb * Cs * 2.0;\nvec3 Cs2 = Cs * 2.0 - 1.0;\nvec3 screen = Cb + Cs2 - Cb * Cs2;\nvec3 B;\nif (Cb.r <= 0.5) {\n B.r = multiply.r;\n} else {\n B.r = screen.r;\n}\nif (Cb.g <= 0.5) {\n B.g = multiply.g;\n} else {\n B.g = screen.g;\n}\nif (Cb.b <= 0.5) {\n B.b = multiply.b;\n} else {\n B.b = screen.b;\n}\n"; - blends.SOFTLIGHT_PART = "vec3 first = Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb);\nvec3 B;\nvec3 D;\nif (Cs.r <= 0.5)\n{\n B.r = first.r;\n}\nelse\n{\n if (Cb.r <= 0.25)\n {\n D.r = ((16.0 * Cb.r - 12.0) * Cb.r + 4.0) * Cb.r; \n }\n else\n {\n D.r = sqrt(Cb.r);\n }\n B.r = Cb.r + (2.0 * Cs.r - 1.0) * (D.r - Cb.r);\n}\nif (Cs.g <= 0.5)\n{\n B.g = first.g;\n}\nelse\n{\n if (Cb.g <= 0.25)\n {\n D.g = ((16.0 * Cb.g - 12.0) * Cb.g + 4.0) * Cb.g; \n }\n else\n {\n D.g = sqrt(Cb.g);\n }\n B.g = Cb.g + (2.0 * Cs.g - 1.0) * (D.g - Cb.g);\n}\nif (Cs.b <= 0.5)\n{\n B.b = first.b;\n}\nelse\n{\n if (Cb.b <= 0.25)\n {\n D.b = ((16.0 * Cb.b - 12.0) * Cb.b + 4.0) * Cb.b; \n }\n else\n {\n D.b = sqrt(Cb.b);\n }\n B.b = Cb.b + (2.0 * Cs.b - 1.0) * (D.b - Cb.b);\n}\n"; - blends.MULTIPLY_FULL = "if (b_dest.a > 0.0) {\n vec4 mult;\nmult.a = min(b_src.a + b_dest.a - b_src.a * b_dest.a, 1.0);\n mult.rgb = (b_dest.rgb / b_dest.a) * ((1.0 - b_src.a) + b_src.rgb);\n b_res.rgb = (b_dest.rgb / b_dest.a) * ((1.0 - b_src.a) + b_src.rgb);\n b_res.a = min(b_src.a + b_dest.a - b_src.a * b_dest.a, 1.0);\n b_res.rgb *= mult.a;\n}\n"; - blends.OVERLAY_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.OVERLAY_PART); - blends.HARDLIGHT_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.HARDLIGHT_PART); - blends.SOFTLIGHT_FULL = blends.NPM_BLEND.replace("%NPM_BLEND%", blends.SOFTLIGHT_PART); - blends.blendFullArray = []; - blends.blendFullArray[PIXI.BLEND_MODES.MULTIPLY] = blends.MULTIPLY_FULL; - blends.blendFullArray[PIXI.BLEND_MODES.OVERLAY] = blends.OVERLAY_FULL; - blends.blendFullArray[PIXI.BLEND_MODES.HARD_LIGHT] = blends.HARDLIGHT_FULL; - blends.blendFullArray[PIXI.BLEND_MODES.SOFT_LIGHT] = blends.SOFTLIGHT_FULL; - })(blends = pixi_picture.blends || (pixi_picture.blends = {})); - var filterCache = []; - var filterCacheArray = []; - function getBlendFilter(blendMode) { - if (!blends.blendFullArray[blendMode]) { - return null; - } - if (!filterCache[blendMode]) { - filterCache[blendMode] = new pixi_picture.BlendFilter({ blendCode: blends.blendFullArray[blendMode] }); - } - return filterCache[blendMode]; - } - pixi_picture.getBlendFilter = getBlendFilter; - function getBlendFilterArray(blendMode) { - if (!blends.blendFullArray[blendMode]) { - return null; - } - if (!filterCacheArray[blendMode]) { - filterCacheArray[blendMode] = [this.getBlendFilter(blendMode)]; - } - return filterCacheArray[blendMode]; - } - pixi_picture.getBlendFilterArray = getBlendFilterArray; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - var Sprite = (function (_super) { - __extends(Sprite, _super); - function Sprite() { - return _super !== null && _super.apply(this, arguments) || this; - } - Sprite.prototype._render = function (renderer) { - var texture = this._texture; - if (!texture || !texture.valid) { - return; - } - var blendFilterArray = pixi_picture.getBlendFilterArray(this.blendMode); - if (blendFilterArray) { - renderer.batch.flush(); - if (!renderer.filter.pushWithCheck(this, blendFilterArray)) { + PictureRenderer.prototype.start = function () { + }; + PictureRenderer.prototype.flush = function () { + }; + PictureRenderer.prototype._getRenderTexture = function (minWidth, minHeight) { + if (this._renderTexture.width < minWidth || + this._renderTexture.height < minHeight) { + minHeight = nextPow2(minWidth); + minHeight = nextPow2(minHeight); + this._renderTexture.resize(minWidth, minHeight); + } + return this._renderTexture; + }; + PictureRenderer.prototype._getBuf = function (size) { + var buf = this._bigBuf; + if (buf.length < size) { + size = nextPow2(size); + buf = new Uint8Array(size); + this._bigBuf = buf; + } + return buf; + }; + PictureRenderer.prototype.render = function (sprite) { + if (!sprite.texture.valid) { return; } - } - this.calculateVertices(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - if (blendFilterArray) { - renderer.batch.flush(); - renderer.filter.pop(); - } - }; - return Sprite; - }(PIXI.Sprite)); - pixi_picture.Sprite = Sprite; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - var TilingSprite = (function (_super) { - __extends(TilingSprite, _super); - function TilingSprite() { - return _super !== null && _super.apply(this, arguments) || this; - } - TilingSprite.prototype._render = function (renderer) { - var texture = this._texture; - if (!texture || !texture.valid) { - return; - } - var blendFilterArray = pixi_picture.getBlendFilterArray(this.blendMode); - if (blendFilterArray) { - renderer.batch.flush(); - if (!renderer.filter.pushWithCheck(this, blendFilterArray)) { + var tilingMode = 0; + if (sprite.tileTransform) { + tilingMode = this._isSimpleSprite(sprite) ? 1 : 2; + } + var blendShader = this.drawModes[sprite.blendMode]; + if (blendShader) { + this._renderBlend(sprite, blendShader[tilingMode]); + } + else { + this._renderNormal(sprite, this.normalShader[tilingMode]); + } + }; + PictureRenderer.prototype._renderNormal = function (sprite, shader) { + var renderer = this.renderer; + renderer.bindShader(shader); + renderer.state.setBlendMode(sprite.blendMode); + this._renderInner(sprite, shader); + }; + PictureRenderer.prototype._renderBlend = function (sprite, shader) { + var renderer = this.renderer; + var spriteBounds = sprite.getBounds(); + var renderTarget = renderer._activeRenderTarget; + var matrix = renderTarget.projectionMatrix; + var flipX = matrix.a < 0; + var flipY = matrix.d < 0; + var resolution = renderTarget.resolution; + var screen = this._tempRect; + var fr = renderTarget.sourceFrame || renderTarget.destinationFrame; + screen.x = 0; + screen.y = 0; + screen.width = fr.width; + screen.height = fr.height; + var bounds = this._tempRect2; + var fbw = fr.width * resolution, fbh = fr.height * resolution; + bounds.x = (spriteBounds.x + matrix.tx / matrix.a) * resolution + fbw / 2; + bounds.y = (spriteBounds.y + matrix.ty / matrix.d) * resolution + fbh / 2; + bounds.width = spriteBounds.width * resolution; + bounds.height = spriteBounds.height * resolution; + if (flipX) { + bounds.y = fbw - bounds.width - bounds.x; + } + if (flipY) { + bounds.y = fbh - bounds.height - bounds.y; + } + var screenBounds = this._tempRect3; + var x_1 = Math.floor(Math.max(screen.x, bounds.x)); + var x_2 = Math.ceil(Math.min(screen.x + screen.width, bounds.x + bounds.width)); + var y_1 = Math.floor(Math.max(screen.y, bounds.y)); + var y_2 = Math.ceil(Math.min(screen.y + screen.height, bounds.y + bounds.height)); + var pixelsWidth = x_2 - x_1; + var pixelsHeight = y_2 - y_1; + if (pixelsWidth <= 0 || pixelsHeight <= 0) { return; } + var rt = this._getRenderTexture(pixelsWidth, pixelsHeight); + renderer.bindTexture(rt, 1, true); + var gl = renderer.gl; + if (renderer.renderingToScreen && renderTarget.root) { + var buf = this._getBuf(pixelsWidth * pixelsHeight * 4); + gl.readPixels(x_1, y_1, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf); + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf); + } + else { + gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x_1, y_1, pixelsWidth, pixelsHeight); + } + renderer.bindShader(shader); + renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL); + if (shader.uniforms.mapMatrix) { + var mapMatrix = this._tempMatrix; + mapMatrix.a = bounds.width / rt.width / spriteBounds.width; + if (flipX) { + mapMatrix.a = -mapMatrix.a; + mapMatrix.tx = (bounds.x - x_1) / rt.width - (spriteBounds.x + spriteBounds.width) * mapMatrix.a; + } + else { + mapMatrix.tx = (bounds.x - x_1) / rt.width - spriteBounds.x * mapMatrix.a; + } + mapMatrix.d = bounds.height / rt.height / spriteBounds.height; + if (flipY) { + mapMatrix.d = -mapMatrix.d; + mapMatrix.ty = (bounds.y - y_1) / rt.height - (spriteBounds.y + spriteBounds.height) * mapMatrix.d; + } + else { + mapMatrix.ty = (bounds.y - y_1) / rt.height - spriteBounds.y * mapMatrix.d; + } + shader.uniforms.mapMatrix = mapMatrix.toArray(true); + } + this._renderInner(sprite, shader); + }; + PictureRenderer.prototype._renderInner = function (sprite, shader) { + var renderer = this.renderer; + if (shader.tilingMode > 0) { + this._renderWithShader(sprite, shader.tilingMode === 1, shader); + } + else { + this._renderSprite(sprite, shader); + } + }; + PictureRenderer.prototype._renderWithShader = function (ts, isSimple, shader) { + var quad = shader.tempQuad; + var renderer = this.renderer; + renderer.bindVao(quad.vao); + var vertices = quad.vertices; + var _width = ts._width; + var _height = ts._height; + var _anchorX = ts._anchor._x; + var _anchorY = ts._anchor._y; + var w0 = _width * (1 - _anchorX); + var w1 = _width * -_anchorX; + var h0 = _height * (1 - _anchorY); + var h1 = _height * -_anchorY; + var wt = ts.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + vertices[0] = (a * w1) + (c * h1) + tx; + vertices[1] = (d * h1) + (b * w1) + ty; + vertices[2] = (a * w0) + (c * h1) + tx; + vertices[3] = (d * h1) + (b * w0) + ty; + vertices[4] = (a * w0) + (c * h0) + tx; + vertices[5] = (d * h0) + (b * w0) + ty; + vertices[6] = (a * w1) + (c * h0) + tx; + vertices[7] = (d * h0) + (b * w1) + ty; + vertices = quad.uvs; + vertices[0] = vertices[6] = -ts.anchor.x; + vertices[1] = vertices[3] = -ts.anchor.y; + vertices[2] = vertices[4] = 1.0 - ts.anchor.x; + vertices[5] = vertices[7] = 1.0 - ts.anchor.y; + quad.upload(); + var tex = ts._texture; + var lt = ts.tileTransform.localTransform; + var uv = ts.uvTransform; + var mapCoord = uv.mapCoord; + var uClampFrame = uv.uClampFrame; + var uClampOffset = uv.uClampOffset; + var w = tex.width; + var h = tex.height; + var W = _width; + var H = _height; + var tempMat = this._tempMatrix2; + tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); + tempMat.invert(); + if (isSimple) { + tempMat.append(mapCoord); + } + else { + shader.uniforms.uMapCoord = mapCoord.toArray(true); + shader.uniforms.uClampFrame = uClampFrame; + shader.uniforms.uClampOffset = uClampOffset; + } + shader.uniforms.uTransform = tempMat.toArray(true); + var color = this._tempColor; + var alpha = ts.worldAlpha; + PIXI.utils.hex2rgb(ts.tint, color); + color[0] *= alpha; + color[1] *= alpha; + color[2] *= alpha; + color[3] = alpha; + shader.uniforms.uColor = color; + renderer.bindTexture(tex, 0, true); + quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0); + }; + PictureRenderer.prototype._renderSprite = function (sprite, shader) { + var renderer = this.renderer; + var quad = shader.tempQuad; + renderer.bindVao(quad.vao); + var uvs = sprite.texture._uvs; + var vertices = quad.vertices; + var vd = sprite.vertexData; + for (var i = 0; i < 8; i++) { + quad.vertices[i] = vd[i]; + } + quad.uvs[0] = uvs.x0; + quad.uvs[1] = uvs.y0; + quad.uvs[2] = uvs.x1; + quad.uvs[3] = uvs.y1; + quad.uvs[4] = uvs.x2; + quad.uvs[5] = uvs.y2; + quad.uvs[6] = uvs.x3; + quad.uvs[7] = uvs.y3; + quad.upload(); + var frame = sprite.texture.frame; + var base = sprite.texture.baseTexture; + var clamp = this._tempClamp; + var eps = 0.5 / base.resolution; + clamp[0] = (frame.x + eps) / base.width; + clamp[1] = (frame.y + eps) / base.height; + clamp[2] = (frame.x + frame.width - eps) / base.width; + clamp[3] = (frame.y + frame.height - eps) / base.height; + shader.uniforms.uTextureClamp = clamp; + var color = this._tempColor; + PIXI.utils.hex2rgb(sprite.tint, color); + var alpha = sprite.worldAlpha; + color[0] *= alpha; + color[1] *= alpha; + color[2] *= alpha; + color[3] = alpha; + shader.uniforms.uColor = color; + renderer.bindTexture(base, 0, true); + quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0); + }; + PictureRenderer.prototype._isSimpleSprite = function (ts) { + var renderer = this.renderer; + var tex = ts._texture; + var baseTex = tex.baseTexture; + var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; + if (isSimple) { + if (!baseTex._glTextures[renderer.CONTEXT_UID]) { + if (baseTex.wrapMode === PIXI.WRAP_MODES.CLAMP) { + baseTex.wrapMode = PIXI.WRAP_MODES.REPEAT; + } + } + else { + isSimple = baseTex.wrapMode !== PIXI.WRAP_MODES.CLAMP; + } + } + return isSimple; + }; + return PictureRenderer; + }(PIXI.ObjectRenderer)); + extras.PictureRenderer = PictureRenderer; + PIXI.WebGLRenderer.registerPlugin('picture', PictureRenderer); + PIXI.CanvasRenderer.registerPlugin('picture', PIXI.CanvasSpriteRenderer); + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var PictureSprite = (function (_super) { + __extends(PictureSprite, _super); + function PictureSprite(texture) { + _super.call(this, texture); + this.pluginName = 'picture'; } - this.tileTransform.updateLocalTransform(); - this.uvMatrix.update(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - if (blendFilterArray) { - renderer.batch.flush(); - renderer.filter.pop(); + return PictureSprite; + }(PIXI.Sprite)); + extras.PictureSprite = PictureSprite; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var extras; + (function (extras) { + var PictureTilingSprite = (function (_super) { + __extends(PictureTilingSprite, _super); + function PictureTilingSprite(texture) { + _super.call(this, texture); + this.pluginName = 'picture'; } - }; - return TilingSprite; - }(PIXI.TilingSprite)); - pixi_picture.TilingSprite = TilingSprite; -})(pixi_picture || (pixi_picture = {})); -var pixi_picture; -(function (pixi_picture) { - PIXI.picture = pixi_picture; -})(pixi_picture || (pixi_picture = {})); + return PictureTilingSprite; + }(extras.TilingSprite)); + extras.PictureTilingSprite = PictureTilingSprite; + })(extras = PIXI.extras || (PIXI.extras = {})); +})(PIXI || (PIXI = {})); //# sourceMappingURL=pixi-picture.js.map \ No newline at end of file diff --git a/www/js/libs/pixi-tilemap.js b/www/js/libs/pixi-tilemap.js index f4634e1..9ede4f7 100644 --- a/www/js/libs/pixi-tilemap.js +++ b/www/js/libs/pixi-tilemap.js @@ -1,973 +1,887 @@ -/* eslint-disable */ - -/*! - * pixi-tilemap - v2.1.3 - * Compiled Sun, 18 Oct 2020 17:08:58 UTC - * - * pixi-tilemap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - * - * Copyright 2019-2020, Ivan Popelyshev, All Rights Reserved - */ -this.PIXI = this.PIXI || {}; -this.PIXI.tilemap = this.PIXI.tilemap || {}; -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pixi/display'), require('@pixi/core'), require('@pixi/constants'), require('@pixi/math'), require('@pixi/graphics'), require('@pixi/sprite')) : - typeof define === 'function' && define.amd ? define(['exports', '@pixi/display', '@pixi/core', '@pixi/constants', '@pixi/math', '@pixi/graphics', '@pixi/sprite'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pixi_tilemap = {}, global.PIXI, global.PIXI, global.PIXI, global.PIXI, global.PIXI, global.PIXI)); -}(this, (function (exports, display, core, constants, math, graphics, sprite) { - 'use strict'; - - class CanvasTileRenderer { - constructor(renderer) { - this.tileAnim = [0, 0]; - this.dontUseTransform = false; - this.renderer = renderer; - this.tileAnim = [0, 0]; - } - } - const cr = PIXI.CanvasRenderer; - if (cr) { - cr.registerPlugin('tilemap', CanvasTileRenderer); - } - - const Constant = { - maxTextures: 16, - bufferSize: 2048, - boundSize: 1024, - boundCountPerBuffer: 1, - use32bitIndex: false, - SCALE_MODE: constants.SCALE_MODES.LINEAR, - DO_CLEAR: true +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var CanvasTileRenderer = (function () { + function CanvasTileRenderer(renderer) { + this.tileAnim = [0, 0]; + this.dontUseTransform = false; + this.renderer = renderer; + this.tileAnim = [0, 0]; + } + return CanvasTileRenderer; + }()); + tilemap.CanvasTileRenderer = CanvasTileRenderer; + PIXI.CanvasRenderer.registerPlugin('tilemap', CanvasTileRenderer); + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - - const POINT_STRUCT_SIZE = 12; - class RectTileLayer extends display.Container { - constructor(zIndex, texture) { - super(); - this.zIndex = 0; - this.modificationMarker = 0; - this._$_localBounds = new display.Bounds(); - this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - this._globalMat = null; - this.pointsBuf = []; - this.hasAnim = false; - this.offsetX = 0; - this.offsetY = 0; - this.compositeParent = false; - this.tileAnim = null; - this.vbId = 0; - this.vb = null; - this.vbBuffer = null; - this.vbArray = null; - this.vbInts = null; - this.initialize(zIndex, texture); - } - initialize(zIndex, textures) { - if (!textures) { - textures = []; +})(); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var CompositeRectTileLayer = (function (_super) { + __extends(CompositeRectTileLayer, _super); + function CompositeRectTileLayer(zIndex, bitmaps, useSquare, texPerChild) { + var _this = _super.call(this) || this; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this.modificationMarker = 0; + _this._globalMat = null; + _this._tempScale = null; + _this.initialize.apply(_this, arguments); + return _this; } - else if (!(textures instanceof Array) && textures.baseTexture) { - textures = [textures]; - } - this.textures = textures; - this.zIndex = zIndex; - } - clear() { - this.pointsBuf.length = 0; - this.modificationMarker = 0; - this._$_localBounds.clear(); - this.hasAnim = false; - } - addFrame(texture_, x, y, animX, animY) { - let texture; - let textureIndex = 0; - if (typeof texture_ === "number") { - textureIndex = texture_; - texture = this.textures[textureIndex]; - } - else { - if (typeof texture_ === "string") { - texture = core.Texture.from(texture_); + CompositeRectTileLayer.prototype.updateTransform = function () { + _super.prototype.displayObjectUpdateTransform.call(this); + }; + CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, useSquare, texPerChild) { + this.z = this.zIndex = zIndex; + this.useSquare = useSquare; + this.texPerChild = texPerChild || 16; + if (bitmaps) { + this.setBitmaps(bitmaps); } - else { - texture = texture_; + }; + CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) { + var texPerChild = this.texPerChild; + var len1 = this.children.length; + var len2 = Math.ceil(bitmaps.length / texPerChild); + var i; + for (i = 0; i < len1; i++) { + this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); } - let found = false; - let textureList = this.textures; - for (let i = 0; i < textureList.length; i++) { - if (textureList[i].baseTexture === texture.baseTexture) { - textureIndex = i; - found = true; - break; - } + for (i = len1; i < len2; i++) { + this.addChild(new tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild))); } - if (!found) { - return false; - } - } - this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); - return true; - } - addRect(textureIndex, u, v, x, y, tileWidth, tileHeight, animX = 0, animY = 0, rotate = 0, animCountX = 1024, animCountY = 1024) { - let pb = this.pointsBuf; - this.hasAnim = this.hasAnim || animX > 0 || animY > 0; - pb.push(u); - pb.push(v); - pb.push(x); - pb.push(y); - pb.push(tileWidth); - pb.push(tileHeight); - pb.push(rotate); - pb.push(animX | 0); - pb.push(animY | 0); - pb.push(textureIndex); - pb.push(animCountX); - pb.push(animCountY); - this._$_localBounds.addFramePad(x, y, x + tileWidth, y + tileHeight, 0, 0); - return this; - } - tileRotate(rotate) { - const pb = this.pointsBuf; - pb[pb.length - 3] = rotate; - } - tileAnimX(offset, count) { - const pb = this.pointsBuf; - pb[pb.length - 5] = offset; - pb[pb.length - 2] = count; - } - tileAnimY(offset, count) { - const pb = this.pointsBuf; - pb[pb.length - 4] = offset; - pb[pb.length - 1] = count; - } - renderCanvas(renderer) { - let plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - let wt = this.worldTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - } - this.renderCanvasCore(renderer); - } - renderCanvasCore(renderer) { - if (this.textures.length === 0) - return; - let points = this.pointsBuf; - const tileAnim = this.tileAnim || renderer.plugins.tilemap.tileAnim; - renderer.context.fillStyle = '#000000'; - for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { - let x1 = points[i], y1 = points[i + 1]; - let x2 = points[i + 2], y2 = points[i + 3]; - let w = points[i + 4]; - let h = points[i + 5]; - var rotate = points[i + 6]; - x1 += points[i + 7] * tileAnim[0]; - y1 += points[i + 8] * tileAnim[1]; - let textureIndex = points[i + 9]; - if (textureIndex >= 0) { - renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h); - } - else { - renderer.context.globalAlpha = 0.5; - renderer.context.fillRect(x2, y2, w, h); - renderer.context.globalAlpha = 1; - } - } - } - destroyVb() { - if (this.vb) { - this.vb.destroy(); - this.vb = null; - } - } - render(renderer) { - let plugin = renderer.plugins['tilemap']; - let shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = this.tileAnim || plugin.tileAnim; - this.renderWebGLCore(renderer, plugin); - } - renderWebGLCore(renderer, plugin) { - let points = this.pointsBuf; - if (points.length === 0) - return; - let rectsCount = points.length / POINT_STRUCT_SIZE; - let shader = plugin.getShader(); - let textures = this.textures; - if (textures.length === 0) - return; - plugin.bindTextures(renderer, shader, textures); - renderer.shader.bind(shader, false); - let vb = this.vb; - if (!vb) { - vb = plugin.createVb(); - this.vb = vb; - this.vbId = vb.id; - this.vbBuffer = null; + }; + CompositeRectTileLayer.prototype.clear = function () { + for (var i = 0; i < this.children.length; i++) + this.children[i].clear(); this.modificationMarker = 0; - } - plugin.checkIndexBuffer(rectsCount, vb); - const boundCountPerBuffer = Constant.boundCountPerBuffer; - let vertexBuf = vb.getBuffer('aVertexPosition'); - let vertices = rectsCount * vb.vertPerQuad; - if (vertices === 0) - return; - if (this.modificationMarker !== vertices) { - this.modificationMarker = vertices; - let vs = vb.stride * vertices; - if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { - let bk = vb.stride; - while (bk < vs) { - bk *= 2; - } - this.vbBuffer = new ArrayBuffer(bk); - this.vbArray = new Float32Array(this.vbBuffer); - this.vbInts = new Uint32Array(this.vbBuffer); - vertexBuf.update(this.vbBuffer); - } - let arr = this.vbArray, ints = this.vbInts; - let sz = 0; - let textureId = 0; - let shiftU = this.offsetX; - let shiftV = this.offsetY; - let tint = -1; - for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) { - let eps = 0.5; - if (this.compositeParent) { - if (boundCountPerBuffer > 1) { - textureId = (points[i + 9] >> 2); - shiftU = this.offsetX * (points[i + 9] & 1); - shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); - } - else { - textureId = points[i + 9]; - shiftU = 0; - shiftV = 0; - } - } - let x = points[i + 2], y = points[i + 3]; - let w = points[i + 4], h = points[i + 5]; - let u = points[i] + shiftU, v = points[i + 1] + shiftV; - let rotate = points[i + 6]; - const animX = points[i + 7], animY = points[i + 8]; - const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; - const animXEncoded = animX + (animWidth * 2048); - const animYEncoded = animY + (animHeight * 2048); - let u0, v0, u1, v1, u2, v2, u3, v3; - if (rotate === 0) { - u0 = u; - v0 = v; - u1 = u + w; - v1 = v; - u2 = u + w; - v2 = v + h; - u3 = u; - v3 = v + h; - } - else { - let w2 = w / 2; - let h2 = h / 2; - if (rotate % 4 !== 0) { - w2 = h / 2; - h2 = w / 2; - } - const cX = u + w2; - const cY = v + h2; - rotate = math.groupD8.add(rotate, math.groupD8.NW); - u0 = cX + (w2 * math.groupD8.uX(rotate)); - v0 = cY + (h2 * math.groupD8.uY(rotate)); - rotate = math.groupD8.add(rotate, 2); - u1 = cX + (w2 * math.groupD8.uX(rotate)); - v1 = cY + (h2 * math.groupD8.uY(rotate)); - rotate = math.groupD8.add(rotate, 2); - u2 = cX + (w2 * math.groupD8.uX(rotate)); - v2 = cY + (h2 * math.groupD8.uY(rotate)); - rotate = math.groupD8.add(rotate, 2); - u3 = cX + (w2 * math.groupD8.uX(rotate)); - v3 = cY + (h2 * math.groupD8.uY(rotate)); - } - arr[sz++] = x; - arr[sz++] = y; - arr[sz++] = u0; - arr[sz++] = v0; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y; - arr[sz++] = u1; - arr[sz++] = v1; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y + h; - arr[sz++] = u2; - arr[sz++] = v2; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x; - arr[sz++] = y + h; - arr[sz++] = u3; - arr[sz++] = v3; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - } - vertexBuf.update(arr); - } - renderer.geometry.bind(vb, shader); - renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES, rectsCount * 6, 0); - } - isModified(anim) { - if (this.modificationMarker !== this.pointsBuf.length || - anim && this.hasAnim) { - return true; - } - return false; - } - clearModify() { - this.modificationMarker = this.pointsBuf.length; - } - _calculateBounds() { - const { minX, minY, maxX, maxY } = this._$_localBounds; - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); - } - getLocalBounds(rect) { - if (this.children.length === 0) { - return this._$_localBounds.getRectangle(rect); - } - return super.getLocalBounds.call(this, rect); - } - destroy(options) { - super.destroy(options); - this.destroyVb(); - } - } - - class CompositeRectTileLayer extends display.Container { - constructor(zIndex, bitmaps, texPerChild) { - super(); - this.modificationMarker = 0; - this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - this._globalMat = null; - this._lastLayer = null; - this.tileAnim = null; - this.initialize.apply(this, arguments); - } - initialize(zIndex, bitmaps, texPerChild) { - if (texPerChild === true) { - texPerChild = 0; - } - this.z = this.zIndex = zIndex; - this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; - if (bitmaps) { - this.setBitmaps(bitmaps); - } - } - setBitmaps(bitmaps) { - for (let i = 0; i < bitmaps.length; i++) { - if (bitmaps[i] && !bitmaps[i].baseTexture) { - throw new Error(`pixi-tilemap cannot use destroyed textures. ` + - `Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there.`); - } - } - let texPerChild = this.texPerChild; - let len1 = this.children.length; - let len2 = Math.ceil(bitmaps.length / texPerChild); - let i; - for (i = 0; i < len1; i++) { - this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); - } - for (i = len1; i < len2; i++) { - let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); - layer.compositeParent = true; - layer.offsetX = Constant.boundSize; - layer.offsetY = Constant.boundSize; - this.addChild(layer); - } - } - clear() { - for (let i = 0; i < this.children.length; i++) { - this.children[i].clear(); - } - this.modificationMarker = 0; - } - addRect(textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) { - const childIndex = textureIndex / this.texPerChild >> 0; - const textureId = textureIndex % this.texPerChild; - if (this.children[childIndex] && this.children[childIndex].textures) { - this._lastLayer = this.children[childIndex]; - this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); - } - else { - this._lastLayer = null; - } - return this; - } - tileRotate(rotate) { - if (this._lastLayer) { - this._lastLayer.tileRotate(rotate); - } - return this; - } - tileAnimX(offset, count) { - if (this._lastLayer) { - this._lastLayer.tileAnimX(offset, count); - } - return this; - } - tileAnimY(offset, count) { - if (this._lastLayer) { - this._lastLayer.tileAnimY(offset, count); - } - return this; - } - addFrame(texture_, x, y, animX, animY, animWidth, animHeight) { - let texture; - let layer = null; - let ind = 0; - let children = this.children; - this._lastLayer = null; - if (typeof texture_ === "number") { - let childIndex = texture_ / this.texPerChild >> 0; - layer = children[childIndex]; - if (!layer) { - layer = children[0]; + }; + CompositeRectTileLayer.prototype.addRect = function (num, u, v, x, y, tileWidth, tileHeight) { + if (this.children[num] && this.children[num].textures) + this.children[num].addRect(0, u, v, x, y, tileWidth, tileHeight); + }; + CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) { + var texture; + var layer = null, ind = 0; + var children = this.children; + if (typeof texture_ === "number") { + var childIndex = texture_ / this.texPerChild >> 0; + layer = children[childIndex]; if (!layer) { - return this; - } - ind = 0; - } - else { - ind = texture_ % this.texPerChild; - } - texture = layer.textures[ind]; - } - else { - if (typeof texture_ === "string") { - texture = core.Texture.from(texture_); - } - else { - texture = texture_; - } - for (let i = 0; i < children.length; i++) { - let child = children[i]; - let tex = child.textures; - for (let j = 0; j < tex.length; j++) { - if (tex[j].baseTexture === texture.baseTexture) { - layer = child; - ind = j; - break; + layer = children[0]; + if (!layer) { + return false; } - } - if (layer) { - break; - } - } - if (!layer) { - for (let i = 0; i < children.length; i++) { - let child = children[i]; - if (child.textures.length < this.texPerChild) { - layer = child; - ind = child.textures.length; - child.textures.push(texture); - break; - } - } - if (!layer) { - layer = new RectTileLayer(this.zIndex, texture); - layer.compositeParent = true; - layer.offsetX = Constant.boundSize; - layer.offsetY = Constant.boundSize; - this.addChild(layer); ind = 0; } + else { + ind = texture_ % this.texPerChild; + } + texture = layer.textures[ind]; } - } - this._lastLayer = layer; - layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); - return this; - } - renderCanvas(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - let plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - let wt = this.worldTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - } - let layers = this.children; - for (let i = 0; i < layers.length; i++) { - const layer = layers[i]; - layer.tileAnim = this.tileAnim; - layer.renderCanvasCore(renderer); - } - } - render(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - let plugin = renderer.plugins['tilemap']; - let shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = this.tileAnim || plugin.tileAnim; - renderer.shader.bind(shader, false); - let layers = this.children; - for (let i = 0; i < layers.length; i++) { - const layer = layers[i]; - layer.renderWebGLCore(renderer, plugin); - } - } - isModified(anim) { - let layers = this.children; - if (this.modificationMarker !== layers.length) { - return true; - } - for (let i = 0; i < layers.length; i++) { - if (layers[i].isModified(anim)) { - return true; + else if (typeof texture_ === "string") { + texture = PIXI.Texture.fromImage(texture_); } - } - return false; - } - clearModify() { - let layers = this.children; - this.modificationMarker = layers.length; - for (let i = 0; i < layers.length; i++) { - layers[i].clearModify(); - } - } - } - - class GraphicsLayer extends graphics.Graphics { - constructor(zIndex) { - super(); - this.zIndex = zIndex; - } - renderCanvas(renderer) { - let wt = null; - if (renderer.plugins.tilemap.dontUseTransform) { - wt = this.transform.worldTransform; - this.transform.worldTransform = math.Matrix.IDENTITY; - } - renderer.plugins.graphics.render(this); - if (renderer.plugins.tilemap.dontUseTransform) { - this.transform.worldTransform = wt; - } - renderer.context.globalAlpha = 1.0; - } - isModified(anim) { - return false; - } - clearModify() { - } - } - - class MultiTextureResource extends core.resources.Resource { - constructor(options) { - super(options.bufferSize, options.bufferSize); - this.DO_CLEAR = false; - this.boundSize = 0; - this._clearBuffer = null; - this.baseTex = null; - this.boundSprites = []; - this.dirties = []; - const bounds = this.boundSprites; - const dirties = this.dirties; - this.boundSize = options.boundSize; - for (let j = 0; j < options.boundCountPerBuffer; j++) { - const spr = new sprite.Sprite(); - spr.position.x = options.boundSize * (j & 1); - spr.position.y = options.boundSize * (j >> 1); - bounds.push(spr); - dirties.push(0); - } - this.DO_CLEAR = !!options.DO_CLEAR; - } - bind(baseTexture) { - if (this.baseTex) { - throw new Error('Only one baseTexture is allowed for this resource!'); - } - this.baseTex = baseTexture; - super.bind(baseTexture); - } - setTexture(ind, texture) { - const spr = this.boundSprites[ind]; - if (spr.texture.baseTexture === texture.baseTexture) { - return; - } - spr.texture = texture; - this.baseTex.update(); - this.dirties[ind] = this.baseTex.dirtyId; - } - upload(renderer, texture, glTexture) { - const { gl } = renderer; - const { width, height } = this; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || - texture.alphaMode === constants.ALPHA_MODES.UNPACK); - if (glTexture.dirtyId < 0) { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null); - } - const doClear = this.DO_CLEAR; - if (doClear && !this._clearBuffer) { - this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); - } - const bounds = this.boundSprites; - for (let i = 0; i < bounds.length; i++) { - const spr = bounds[i]; - const tex = spr.texture.baseTexture; - if (glTexture.dirtyId >= this.dirties[i]) { - continue; - } - const res = tex.resource; - if (!tex.valid || !res || !res.source) { - continue; - } - if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) { - gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer); - } - gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source); - } - return true; - } - } - - function fillSamplers(shader, maxTextures) { - let sampleValues = []; - for (let i = 0; i < maxTextures; i++) { - sampleValues[i] = i; - } - shader.uniforms.uSamplers = sampleValues; - let samplerSize = []; - for (let i = 0; i < maxTextures; i++) { - samplerSize.push(1.0 / Constant.bufferSize); - samplerSize.push(1.0 / Constant.bufferSize); - } - shader.uniforms.uSamplerSize = samplerSize; - } - function generateFragmentSrc(maxTextures, fragmentSrc) { - return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, generateSampleSrc(maxTextures)); - } - function generateSampleSrc(maxTextures) { - let src = ''; - src += '\n'; - src += '\n'; - src += 'if(vTextureId <= -1.0) {'; - src += '\n\tcolor = shadowColor;'; - src += '\n}'; - for (let i = 0; i < maxTextures; i++) { - src += '\nelse '; - if (i < maxTextures - 1) { - src += 'if(textureId == ' + i + '.0)'; - } - src += '\n{'; - src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; - src += '\n}'; - } - src += '\n'; - src += '\n'; - return src; - } - - let rectShaderFrag = ` -varying vec2 vTextureCoord; -varying vec4 vFrame; -varying float vTextureId; -uniform vec4 shadowColor; -uniform sampler2D uSamplers[%count%]; -uniform vec2 uSamplerSize[%count%]; - -void main(void){ - vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw); - float textureId = floor(vTextureId + 0.5); - - vec4 color; - %forloop% - gl_FragColor = color; -} -`; - let rectShaderVert = ` -attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; -attribute vec4 aFrame; -attribute vec2 aAnim; -attribute float aTextureId; - -uniform mat3 projTransMatrix; -uniform vec2 animationFrame; - -varying vec2 vTextureCoord; -varying float vTextureId; -varying vec4 vFrame; - -void main(void){ - gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vec2 animCount = floor((aAnim + 0.5) / 2048.0); - vec2 animFrameOffset = aAnim - animCount * 2048.0; - vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount)); - - vTextureCoord = aTextureCoord + animOffset; - vFrame = aFrame + vec4(animOffset, animOffset); - vTextureId = aTextureId; -} -`; - class TilemapShader extends core.Shader { - constructor(maxTextures, shaderVert, shaderFrag) { - super(new core.Program(shaderVert, shaderFrag), { - animationFrame: new Float32Array(2), - uSamplers: [], - uSamplerSize: [], - projTransMatrix: new math.Matrix() - }); - this.maxTextures = 0; - this.maxTextures = maxTextures; - fillSamplers(this, this.maxTextures); - } - } - class RectTileShader extends TilemapShader { - constructor(maxTextures) { - super(maxTextures, rectShaderVert, generateFragmentSrc(maxTextures, rectShaderFrag)); - fillSamplers(this, this.maxTextures); - } - } - class RectTileGeom extends core.Geometry { - constructor() { - super(); - this.vertSize = 11; - this.vertPerQuad = 4; - this.stride = this.vertSize * 4; - this.lastTimeAccess = 0; - const buf = this.buf = new core.Buffer(new Float32Array(2), true, false); - this.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0) - .addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4) - .addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4) - .addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4) - .addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4); - } - } - - class TileRenderer extends core.ObjectRenderer { - constructor(renderer) { - super(renderer); - this.sn = -1; - this.indexBuffer = null; - this.ibLen = 0; - this.tileAnim = [0, 0]; - this.texLoc = []; - this.texResources = []; - this.rectShader = new RectTileShader(Constant.maxTextures); - this.indexBuffer = new core.Buffer(undefined, true, true); - this.checkIndexBuffer(2000); - this.initBounds(); - } - initBounds() { - if (Constant.boundCountPerBuffer <= 1) { - return; - } - const maxTextures = Constant.maxTextures; - for (let i = 0; i < maxTextures; i++) { - const resource = new MultiTextureResource(Constant); - const baseTex = new core.BaseTexture(resource); - baseTex.scaleMode = Constant.SCALE_MODE; - baseTex.wrapMode = constants.WRAP_MODES.CLAMP; - this.texResources.push(resource); - } - } - bindTexturesWithoutRT(renderer, shader, textures) { - let samplerSize = shader.uniforms.uSamplerSize; - this.texLoc.length = 0; - for (let i = 0; i < textures.length; i++) { - const texture = textures[i]; - if (!texture || !texture.valid) { - return; - } - renderer.texture.bind(textures[i], i); - samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; - samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; - } - shader.uniforms.uSamplerSize = samplerSize; - } - bindTextures(renderer, shader, textures) { - const len = textures.length; - const maxTextures = Constant.maxTextures; - if (len > Constant.boundCountPerBuffer * maxTextures) { - return; - } - if (Constant.boundCountPerBuffer <= 1) { - this.bindTexturesWithoutRT(renderer, shader, textures); - return; - } - let i = 0; - for (; i < len; i++) { - const texture = textures[i]; - if (!texture || !texture.valid) - continue; - const multi = this.texResources[i >> 2]; - multi.setTexture(i & 3, texture); - } - let gltsUsed = (i + 3) >> 2; - for (i = 0; i < gltsUsed; i++) { - renderer.texture.bind(this.texResources[i].baseTex, i); - } - } - start() { - } - createVb() { - const geom = new RectTileGeom(); - geom.addIndex(this.indexBuffer); - geom.lastTimeAccess = Date.now(); - return geom; - } - checkIndexBuffer(size, vb = null) { - const totalIndices = size * 6; - if (totalIndices <= this.ibLen) { - return; - } - let len = totalIndices; - while (len < totalIndices) { - len <<= 1; - } - this.ibLen = totalIndices; - this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); - } - getShader() { - return this.rectShader; - } - destroy() { - super.destroy(); - this.rectShader = null; - } - } - core.Renderer.registerPlugin('tilemap', TileRenderer); - - class ZLayer extends display.Container { - constructor(tilemap, zIndex) { - super(); - this._lastAnimationFrame = -1; - this.tilemap = tilemap; - this.z = zIndex; - } - clear() { - let layers = this.children; - for (let i = 0; i < layers.length; i++) - layers[i].clear(); - this._previousLayers = 0; - } - cacheIfDirty() { - let tilemap = this.tilemap; - let layers = this.children; - let modified = this._previousLayers !== layers.length; - this._previousLayers = layers.length; - let buf = this.canvasBuffer; - let tempRender = this._tempRender; - if (!buf) { - buf = this.canvasBuffer = document.createElement('canvas'); - tempRender = this._tempRender = new PIXI.CanvasRenderer({ width: 100, height: 100, view: buf }); - tempRender.context = tempRender.rootContext; - tempRender.plugins.tilemap.dontUseTransform = true; - } - if (buf.width !== tilemap._layerWidth || - buf.height !== tilemap._layerHeight) { - buf.width = tilemap._layerWidth; - buf.height = tilemap._layerHeight; - modified = true; - } - let i; - if (!modified) { - for (i = 0; i < layers.length; i++) { - if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { - modified = true; - break; + else { + texture = texture_; + for (var i = 0; i < children.length; i++) { + var child = children[i]; + var tex = child.textures; + for (var j = 0; j < tex.length; j++) { + if (tex[j].baseTexture == texture.baseTexture) { + layer = child; + ind = j; + break; + } + } + if (layer) { + break; + } + } + if (!layer) { + for (i = 0; i < children.length; i++) { + var child = children[i]; + if (child.textures.length < this.texPerChild) { + layer = child; + ind = child.textures.length; + child.textures.push(texture); + break; + } + } + if (!layer) { + children.push(layer = new tilemap.RectTileLayer(this.zIndex, texture)); + ind = 0; + } } } - } - this._lastAnimationFrame = tilemap.animationFrame; - if (modified) { - if (tilemap._hackRenderer) { - tilemap._hackRenderer(tempRender); + layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.frame.width, texture.frame.height, animX, animY); + return true; + }; + ; + CompositeRectTileLayer.prototype.renderCanvas = function (renderer) { + if (!renderer.plugins.tilemap.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); } - tempRender.context.clearRect(0, 0, buf.width, buf.height); + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].renderCanvas(renderer); + }; + ; + CompositeRectTileLayer.prototype.renderWebGL = function (renderer) { + var gl = renderer.gl; + var shader = renderer.plugins.tilemap.getShader(this.useSquare); + renderer.setObjectRenderer(renderer.plugins.tilemap); + renderer.bindShader(shader); + this._globalMat = this._globalMat || new PIXI.Matrix(); + renderer._activeRenderTarget.projectionMatrix.copy(this._globalMat).append(this.worldTransform); + shader.uniforms.projectionMatrix = this._globalMat.toArray(true); + shader.uniforms.shadowColor = this.shadowColor; + if (this.useSquare) { + var tempScale = this._tempScale = (this._tempScale || [0, 0]); + tempScale[0] = this._globalMat.a >= 0 ? 1 : -1; + tempScale[1] = this._globalMat.d < 0 ? 1 : -1; + var ps = shader.uniforms.pointScale = tempScale; + shader.uniforms.projectionScale = Math.abs(this.worldTransform.a) * renderer.resolution; + } + var af = shader.uniforms.animationFrame = renderer.plugins.tilemap.tileAnim; + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].renderWebGL(renderer, this.useSquare); + }; + CompositeRectTileLayer.prototype.isModified = function (anim) { + var layers = this.children; + if (this.modificationMarker != layers.length) { + return true; + } + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + if (layer.modificationMarker != layer.pointsBuf.length || + anim && layer.hasAnim) { + return true; + } + } + return false; + }; + CompositeRectTileLayer.prototype.clearModify = function () { + var layers = this.children; + this.modificationMarker = layers.length; + for (var i = 0; i < layers.length; i++) { + var layer = layers[i]; + layer.modificationMarker = layer.pointsBuf.length; + } + }; + return CompositeRectTileLayer; + }(PIXI.Container)); + tilemap.CompositeRectTileLayer = CompositeRectTileLayer; + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var GraphicsLayer = (function (_super) { + __extends(GraphicsLayer, _super); + function GraphicsLayer(zIndex) { + var _this = _super.call(this) || this; + _this.z = _this.zIndex = zIndex; + return _this; + } + GraphicsLayer.prototype.renderCanvas = function (renderer) { + var wt = null; + if (renderer.plugins.tilemap.dontUseTransform) { + wt = this.transform.worldTransform; + this.transform.worldTransform = PIXI.Matrix.IDENTITY; + } + renderer.plugins.graphics.render(this); + if (renderer.plugins.tilemap.dontUseTransform) { + this.transform.worldTransform = wt; + } + renderer.context.globalAlpha = 1.0; + }; + GraphicsLayer.prototype.renderWebGL = function (renderer) { + if (!this._webGL[renderer.CONTEXT_UID]) + this.dirty = true; + _super.prototype.renderWebGL.call(this, renderer); + }; + GraphicsLayer.prototype.isModified = function (anim) { + return false; + }; + GraphicsLayer.prototype.clearModify = function () { + }; + return GraphicsLayer; + }(PIXI.Graphics)); + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var RectTileLayer = (function (_super) { + __extends(RectTileLayer, _super); + function RectTileLayer(zIndex, texture) { + var _this = _super.call(this) || this; + _this.z = 0; + _this.zIndex = 0; + _this.pointsBuf = []; + _this._tempSize = new Float32Array([0, 0]); + _this._tempTexSize = 1; + _this.modificationMarker = 0; + _this.hasAnim = false; + _this.vbId = 0; + _this.vbBuffer = null; + _this.vbArray = null; + _this.vbInts = null; + _this.initialize(zIndex, texture); + return _this; + } + RectTileLayer.prototype.initialize = function (zIndex, textures) { + if (!textures) { + textures = []; + } + else if (!(textures instanceof Array) && textures.baseTexture) { + textures = [textures]; + } + this.textures = textures; + this.z = this.zIndex = zIndex; + this.visible = false; + }; + RectTileLayer.prototype.clear = function () { + this.pointsBuf.length = 0; + this.modificationMarker = 0; + this.hasAnim = false; + }; + RectTileLayer.prototype.renderCanvas = function (renderer) { + if (this.textures.length === 0) + return; + var points = this.pointsBuf; + renderer.context.fillStyle = '#000000'; + for (var i = 0, n = points.length; i < n; i += 9) { + var x1 = points[i], y1 = points[i + 1]; + var x2 = points[i + 2], y2 = points[i + 3]; + var w = points[i + 4]; + var h = points[i + 5]; + x1 += points[i + 6] * renderer.plugins.tilemap.tileAnim[0]; + y1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[1]; + var textureId = points[i + 8]; + if (textureId >= 0 && this.textures[textureId] !== undefined) { + renderer.context.drawImage(this.textures[textureId].baseTexture.source, x1, y1, w, h, x2, y2, w, h); + } + else { + renderer.context.globalAlpha = 0.5; + renderer.context.fillRect(x2, y2, w, h); + renderer.context.globalAlpha = 1; + } + } + }; + RectTileLayer.prototype.addRect = function (textureId, u, v, x, y, tileWidth, tileHeight, animX, animY) { + if (animX === void 0) { animX = 0; } + if (animY === void 0) { animY = 0; } + var pb = this.pointsBuf; + this.hasAnim = this.hasAnim || animX > 0 || animY > 0; + if (tileWidth == tileHeight) { + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureId); + } + else { + var i; + if (tileWidth % tileHeight === 0) { + for (i = 0; i < tileWidth / tileHeight; i++) { + pb.push(u + i * tileHeight); + pb.push(v); + pb.push(x + i * tileHeight); + pb.push(y); + pb.push(tileHeight); + pb.push(tileHeight); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureId); + } + } + else if (tileHeight % tileWidth === 0) { + for (i = 0; i < tileHeight / tileWidth; i++) { + pb.push(u); + pb.push(v + i * tileWidth); + pb.push(x); + pb.push(y + i * tileWidth); + pb.push(tileWidth); + pb.push(tileWidth); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureId); + } + } + else { + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureId); + } + } + }; + ; + RectTileLayer.prototype.renderWebGL = function (renderer, useSquare) { + if (useSquare === void 0) { useSquare = false; } + var points = this.pointsBuf; + if (points.length === 0) + return; + var rectsCount = points.length / 9; + var tile = renderer.plugins.tilemap; + var gl = renderer.gl; + if (!useSquare) { + tile.checkIndexBuffer(rectsCount); + } + var shader = tile.getShader(useSquare); + var textures = this.textures; + if (textures.length === 0) + return; + var len = textures.length; + if (this._tempTexSize < shader.maxTextures) { + this._tempTexSize = shader.maxTextures; + this._tempSize = new Float32Array(2 * shader.maxTextures); + } + for (var i = 0; i < len; i++) { + if (!textures[i] || !textures[i].valid) + return; + var texture = textures[i].baseTexture; + } + tile.bindTextures(renderer, shader, textures); + var vb = tile.getVb(this.vbId); + if (!vb) { + vb = tile.createVb(useSquare); + this.vbId = vb.id; + this.vbBuffer = null; + this.modificationMarker = 0; + } + var vao = vb.vao; + renderer.bindVao(vao); + var vertexBuf = vb.vb; + vertexBuf.bind(); + var vertices = rectsCount * shader.vertPerQuad; + if (vertices === 0) + return; + if (this.modificationMarker != vertices) { + this.modificationMarker = vertices; + var vs = shader.stride * vertices; + if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { + var bk = shader.stride; + while (bk < vs) { + bk *= 2; + } + this.vbBuffer = new ArrayBuffer(bk); + this.vbArray = new Float32Array(this.vbBuffer); + this.vbInts = new Uint32Array(this.vbBuffer); + vertexBuf.upload(this.vbBuffer, 0, true); + } + var arr = this.vbArray, ints = this.vbInts; + var sz = 0; + var textureId, shiftU, shiftV; + if (useSquare) { + for (i = 0; i < points.length; i += 9) { + textureId = (points[i + 8] >> 2); + shiftU = 1024 * (points[i + 8] & 1); + shiftV = 1024 * ((points[i + 8] >> 1) & 1); + arr[sz++] = points[i + 2]; + arr[sz++] = points[i + 3]; + arr[sz++] = points[i + 0] + shiftU; + arr[sz++] = points[i + 1] + shiftV; + arr[sz++] = points[i + 4]; + arr[sz++] = points[i + 6]; + arr[sz++] = points[i + 7]; + arr[sz++] = textureId; + } + } + else { + var tint = -1; + for (i = 0; i < points.length; i += 9) { + var eps = 0.5; + textureId = (points[i + 8] >> 2); + shiftU = 1024 * (points[i + 8] & 1); + shiftV = 1024 * ((points[i + 8] >> 1) & 1); + var x = points[i + 2], y = points[i + 3]; + var w = points[i + 4], h = points[i + 5]; + var u = points[i] + shiftU, v = points[i + 1] + shiftV; + var animX = points[i + 6], animY = points[i + 7]; + arr[sz++] = x; + arr[sz++] = y; + arr[sz++] = u; + arr[sz++] = v; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animX; + arr[sz++] = animY; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y; + arr[sz++] = u + w; + arr[sz++] = v; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animX; + arr[sz++] = animY; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y + h; + arr[sz++] = u + w; + arr[sz++] = v + h; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animX; + arr[sz++] = animY; + arr[sz++] = textureId; + arr[sz++] = x; + arr[sz++] = y + h; + arr[sz++] = u; + arr[sz++] = v + h; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animX; + arr[sz++] = animY; + arr[sz++] = textureId; + } + } + vertexBuf.upload(arr, 0, true); + } + if (useSquare) + gl.drawArrays(gl.POINTS, 0, vertices); + else + gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0); + }; + return RectTileLayer; + }(PIXI.Container)); + tilemap.RectTileLayer = RectTileLayer; + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var rectShaderFrag = "varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}"; + var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 anim = aAnim * animationFrame;\n vTextureCoord = aTextureCoord + anim;\n vFrame = aFrame + vec4(anim, anim);\n vTextureId = aTextureId;\n}\n"; + var TilemapShader = (function (_super) { + __extends(TilemapShader, _super); + function TilemapShader(gl, maxTextures, shaderVert, shaderFrag) { + var _this = _super.call(this, gl, shaderVert, shaderFrag) || this; + _this.maxTextures = 0; + _this.maxTextures = maxTextures; + tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures); + return _this; + } + return TilemapShader; + }(PIXI.Shader)); + tilemap.TilemapShader = TilemapShader; + var RectTileShader = (function (_super) { + __extends(RectTileShader, _super); + function RectTileShader(gl, maxTextures) { + var _this = _super.call(this, gl, maxTextures, rectShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)) || this; + _this.vertSize = 11; + _this.vertPerQuad = 4; + _this.stride = _this.vertSize * 4; + tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures); + return _this; + } + RectTileShader.prototype.createVao = function (renderer, vb) { + var gl = renderer.gl; + return renderer.createVao() + .addIndex(this.indexBuffer) + .addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0) + .addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4) + .addAttribute(vb, this.attributes.aFrame, gl.FLOAT, false, this.stride, 4 * 4) + .addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 8 * 4) + .addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 10 * 4); + }; + return RectTileShader; + }(TilemapShader)); + tilemap.RectTileShader = RectTileShader; + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var shaderGenerator; + (function (shaderGenerator) { + function fillSamplers(shader, maxTextures) { + var sampleValues = []; + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + shader.bind(); + shader.uniforms.uSamplers = sampleValues; + var samplerSize = []; + for (i = 0; i < maxTextures; i++) { + samplerSize.push(1.0 / 2048); + samplerSize.push(1.0 / 2048); + } + shader.uniforms.uSamplerSize = samplerSize; + } + shaderGenerator.fillSamplers = fillSamplers; + function generateFragmentSrc(maxTextures, fragmentSrc) { + return fragmentSrc.replace(/%count%/gi, maxTextures + "") + .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + } + shaderGenerator.generateFragmentSrc = generateFragmentSrc; + function generateSampleSrc(maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + src += 'if(vTextureId <= -1.0) {'; + src += '\n\tcolor = shadowColor;'; + src += '\n}'; + for (var i = 0; i < maxTextures; i++) { + src += '\nelse '; + if (i < maxTextures - 1) { + src += 'if(textureId == ' + i + '.0)'; + } + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + } + shaderGenerator.generateSampleSrc = generateSampleSrc; + })(shaderGenerator = tilemap.shaderGenerator || (tilemap.shaderGenerator = {})); + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var squareShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n gl_PointSize = aSize * projectionScale;\n vTextureCoord = aTextureCoord + aAnim * animationFrame;\n vTextureId = aTextureId;\n vSize = aSize;\n}\n"; + var squareShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n float margin = 0.5 / vSize;\n vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n float textureId = vTextureId;\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n\n"; + var SquareTileShader = (function (_super) { + __extends(SquareTileShader, _super); + function SquareTileShader(gl, maxTextures) { + var _this = _super.call(this, gl, maxTextures, squareShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, squareShaderFrag)) || this; + _this.vertSize = 8; + _this.vertPerQuad = 1; + _this.stride = _this.vertSize * 4; + _this.maxTextures = maxTextures; + tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures); + return _this; + } + SquareTileShader.prototype.createVao = function (renderer, vb) { + var gl = renderer.gl; + return renderer.createVao() + .addIndex(this.indexBuffer) + .addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0) + .addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4) + .addAttribute(vb, this.attributes.aSize, gl.FLOAT, false, this.stride, 4 * 4) + .addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 5 * 4) + .addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 7 * 4); + }; + ; + return SquareTileShader; + }(tilemap.TilemapShader)); + tilemap.SquareTileShader = SquareTileShader; + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap) { + var glCore = PIXI.glCore; + function _hackSubImage(tex, sprite, clearBuffer, clearWidth, clearHeight) { + var gl = tex.gl; + var baseTex = sprite.texture.baseTexture; + if (clearBuffer && clearWidth > 0 && clearHeight > 0) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, clearWidth, clearHeight, tex.format, tex.type, clearBuffer); + } + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); + gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, tex.format, tex.type, baseTex.source); + } + var TileRenderer = (function (_super) { + __extends(TileRenderer, _super); + function TileRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.vbs = {}; + _this.indices = new Uint16Array(0); + _this.lastTimeCheck = 0; + _this.tileAnim = [0, 0]; + _this.maxTextures = 4; + _this.texLoc = []; + return _this; + } + TileRenderer.prototype.onContextChange = function () { + var gl = this.renderer.gl; + var maxTextures = this.maxTextures; + this.rectShader = new tilemap.RectTileShader(gl, maxTextures); + this.squareShader = new tilemap.SquareTileShader(gl, maxTextures); + this.checkIndexBuffer(2000); + this.rectShader.indexBuffer = this.indexBuffer; + this.squareShader.indexBuffer = this.indexBuffer; + this.vbs = {}; + this.glTextures = []; + this.boundSprites = []; + this.initBounds(); + }; + TileRenderer.prototype.initBounds = function () { + var gl = this.renderer.gl; + var tempCanvas = document.createElement('canvas'); + tempCanvas.width = 2048; + tempCanvas.height = 2048; + for (var i = 0; i < this.maxTextures; i++) { + var rt = PIXI.RenderTexture.create(2048, 2048); + rt.baseTexture.premultipliedAlpha = true; + rt.baseTexture.scaleMode = TileRenderer.SCALE_MODE; + rt.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP; + this.renderer.textureManager.updateTexture(rt); + this.glTextures.push(rt); + var bs = []; + for (var j = 0; j < 4; j++) { + var spr = new PIXI.Sprite(); + spr.position.x = 1024 * (j & 1); + spr.position.y = 1024 * (j >> 1); + bs.push(spr); + } + this.boundSprites.push(bs); + } + }; + TileRenderer.prototype.bindTextures = function (renderer, shader, textures) { + var bounds = this.boundSprites; + var glts = this.glTextures; + var len = textures.length; + var maxTextures = this.maxTextures; + if (len > 4 * maxTextures) { + return; + } + var doClear = TileRenderer.DO_CLEAR; + if (doClear && !this._clearBuffer) { + this._clearBuffer = new Uint8Array(1024 * 1024 * 4); + } + var i; + for (i = 0; i < len; i++) { + var texture = textures[i]; + if (!texture || !textures[i].valid) + continue; + var bs = bounds[i >> 2][i & 3]; + if (!bs.texture || + bs.texture.baseTexture !== texture.baseTexture) { + bs.texture = texture; + var glt = glts[i >> 2]; + renderer.bindTexture(glt, 0, true); + if (doClear) { + _hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs, this._clearBuffer, 1024, 1024); + } + else { + _hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs); + } + } + } + this.texLoc.length = 0; + for (i = 0; i < maxTextures; i++) { + this.texLoc.push(renderer.bindTexture(glts[i], i, true)); + } + shader.uniforms.uSamplers = this.texLoc; + }; + TileRenderer.prototype.checkLeaks = function () { + var now = Date.now(); + var old = now - 10000; + if (this.lastTimeCheck < old || + this.lastTimeCheck > now) { + this.lastTimeCheck = now; + var vbs = this.vbs; + for (var key in vbs) { + if (vbs[key].lastTimeAccess < old) { + this.removeVb(key); + } + } + } + }; + ; + TileRenderer.prototype.start = function () { + this.renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL); + }; + TileRenderer.prototype.getVb = function (id) { + this.checkLeaks(); + var vb = this.vbs[id]; + if (vb) { + vb.lastTimeAccess = Date.now(); + return vb; + } + return null; + }; + TileRenderer.prototype.createVb = function (useSquare) { + var id = ++TileRenderer.vbAutoincrement; + var shader = this.getShader(useSquare); + var gl = this.renderer.gl; + var vb = PIXI.glCore.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW); + var stuff = { + id: id, + vb: vb, + vao: shader.createVao(this.renderer, vb), + lastTimeAccess: Date.now(), + useSquare: useSquare, + shader: shader + }; + this.vbs[id] = stuff; + return stuff; + }; + TileRenderer.prototype.removeVb = function (id) { + if (this.vbs[id]) { + this.vbs[id].vb.destroy(); + this.vbs[id].vao.destroy(); + delete this.vbs[id]; + } + }; + TileRenderer.prototype.checkIndexBuffer = function (size) { + var totalIndices = size * 6; + var indices = this.indices; + if (totalIndices <= indices.length) { + return; + } + var len = indices.length || totalIndices; + while (len < totalIndices) { + len <<= 1; + } + indices = new Uint16Array(len); + this.indices = indices; + for (var i = 0, j = 0; i + 5 < indices.length; i += 6, j += 4) { + indices[i + 0] = j + 0; + indices[i + 1] = j + 1; + indices[i + 2] = j + 2; + indices[i + 3] = j + 0; + indices[i + 4] = j + 2; + indices[i + 5] = j + 3; + } + if (this.indexBuffer) { + this.indexBuffer.upload(indices); + } + else { + var gl = this.renderer.gl; + this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW); + } + }; + TileRenderer.prototype.getShader = function (useSquare) { + return useSquare ? this.squareShader : this.rectShader; + }; + TileRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.rectShader.destroy(); + this.squareShader.destroy(); + this.rectShader = null; + this.squareShader = null; + }; + ; + return TileRenderer; + }(PIXI.ObjectRenderer)); + TileRenderer.vbAutoincrement = 0; + TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.LINEAR; + TileRenderer.DO_CLEAR = false; + tilemap.TileRenderer = TileRenderer; + PIXI.WebGLRenderer.registerPlugin('tilemap', TileRenderer); + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +var PIXI; +(function (PIXI) { + var tilemap; + (function (tilemap_1) { + var ZLayer = (function (_super) { + __extends(ZLayer, _super); + function ZLayer(tilemap, zIndex) { + var _this = _super.call(this) || this; + _this._lastAnimationFrame = -1; + _this.tilemap = tilemap; + _this.z = zIndex; + return _this; + } + ZLayer.prototype.clear = function () { + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].clear(); + this._previousLayers = 0; + }; + ZLayer.prototype.cacheIfDirty = function () { + var tilemap = this.tilemap; + var layers = this.children; + var modified = this._previousLayers != layers.length; + this._previousLayers = layers.length; + var buf = this.canvasBuffer; + var tempRender = this._tempRender; + if (!buf) { + buf = this.canvasBuffer = document.createElement('canvas'); + tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf }); + tempRender.context = tempRender.rootContext; + tempRender.plugins.tilemap.dontUseTransform = true; + } + if (buf.width != tilemap._layerWidth || + buf.height != tilemap._layerHeight) { + buf.width = tilemap._layerWidth; + buf.height = tilemap._layerHeight; + modified = true; + } + var i; + if (!modified) { + for (i = 0; i < layers.length; i++) { + if (layers[i].isModified(this._lastAnimationFrame != tilemap.animationFrame)) { + modified = true; + break; + } + } + } + this._lastAnimationFrame = tilemap.animationFrame; + if (modified) { + if (tilemap._hackRenderer) { + tilemap._hackRenderer(tempRender); + } + tempRender.context.clearRect(0, 0, buf.width, buf.height); + for (i = 0; i < layers.length; i++) { + layers[i].clearModify(); + layers[i].renderCanvas(tempRender); + } + } + this.layerTransform = this.worldTransform; for (i = 0; i < layers.length; i++) { - layers[i].clearModify(); - layers[i].renderCanvas(tempRender); + this.layerTransform = layers[i].worldTransform; + break; } - } - this.layerTransform = this.worldTransform; - for (i = 0; i < layers.length; i++) { - this.layerTransform = layers[i].worldTransform; - break; - } - } - renderCanvas(renderer) { - this.cacheIfDirty(); - let wt = this.layerTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - let tilemap = this.tilemap; - renderer.context.drawImage(this.canvasBuffer, 0, 0); - } - } - - const pixi_tilemap = { - CanvasTileRenderer, - CompositeRectTileLayer, - Constant, - GraphicsLayer, - MultiTextureResource, - RectTileLayer, - TilemapShader, - RectTileShader, - RectTileGeom, - TileRenderer, - ZLayer, - }; - - exports.CanvasTileRenderer = CanvasTileRenderer; - exports.CompositeRectTileLayer = CompositeRectTileLayer; - exports.Constant = Constant; - exports.GraphicsLayer = GraphicsLayer; - exports.MultiTextureResource = MultiTextureResource; - exports.POINT_STRUCT_SIZE = POINT_STRUCT_SIZE; - exports.RectTileGeom = RectTileGeom; - exports.RectTileLayer = RectTileLayer; - exports.RectTileShader = RectTileShader; - exports.TileRenderer = TileRenderer; - exports.TilemapShader = TilemapShader; - exports.ZLayer = ZLayer; - exports.fillSamplers = fillSamplers; - exports.generateFragmentSrc = generateFragmentSrc; - exports.generateSampleSrc = generateSampleSrc; - exports.pixi_tilemap = pixi_tilemap; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -if (typeof pixi_tilemap !== 'undefined') { Object.assign(this.PIXI.tilemap, pixi_tilemap); } -//# sourceMappingURL=pixi-tilemap.umd.js.map + }; + ; + ZLayer.prototype.renderCanvas = function (renderer) { + this.cacheIfDirty(); + var wt = this.layerTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + var tilemap = this.tilemap; + renderer.context.drawImage(this.canvasBuffer, 0, 0); + }; + ; + return ZLayer; + }(PIXI.Container)); + tilemap_1.ZLayer = ZLayer; + })(tilemap = PIXI.tilemap || (PIXI.tilemap = {})); +})(PIXI || (PIXI = {})); +//# sourceMappingURL=pixi-tilemap.js.map \ No newline at end of file diff --git a/www/js/libs/pixi.js b/www/js/libs/pixi.js index 633978e..9bb5cdc 100644 --- a/www/js/libs/pixi.js +++ b/www/js/libs/pixi.js @@ -1,41981 +1,41929 @@ /*! - * pixi.js - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC + * pixi.js - v4.8.9 + * Compiled Thu, 16 Jan 2020 21:43:07 UTC * * pixi.js is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ -var PIXI = (function (exports) { - 'use strict'; - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); - } - - function unwrapExports (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - function getCjsExportFromNamespace (n) { - return n && n['default'] || n; - } - - var promise = createCommonjsModule(function (module, exports) { - (function(global){ - - // - // Check for native Promise and it has correct interface - // - - var NativePromise = global['Promise']; - var nativePromiseSupported = - NativePromise && - // Some of these methods are missing from - // Firefox/Chrome experimental implementations - 'resolve' in NativePromise && - 'reject' in NativePromise && - 'all' in NativePromise && - 'race' in NativePromise && - // Older version of the spec had a resolver object - // as the arg rather than a function - (function(){ - var resolve; - new NativePromise(function(r){ resolve = r; }); - return typeof resolve === 'function'; - })(); - - - // - // export if necessary - // - - if ('object' !== 'undefined' && exports) - { - // node.js - exports.Promise = nativePromiseSupported ? NativePromise : Promise; - exports.Polyfill = Promise; - } - else - { - // AMD - if (typeof undefined == 'function' && undefined.amd) - { - undefined(function(){ - return nativePromiseSupported ? NativePromise : Promise; - }); - } - else - { - // in browser add to global - if (!nativePromiseSupported) - { global['Promise'] = Promise; } - } - } - - - // - // Polyfill - // - - var PENDING = 'pending'; - var SEALED = 'sealed'; - var FULFILLED = 'fulfilled'; - var REJECTED = 'rejected'; - var NOOP = function(){}; - - function isArray(value) { - return Object.prototype.toString.call(value) === '[object Array]'; - } - - // async calls - var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout; - var asyncQueue = []; - var asyncTimer; - - function asyncFlush(){ - // run promise callbacks - for (var i = 0; i < asyncQueue.length; i++) - { asyncQueue[i][0](asyncQueue[i][1]); } - - // reset async asyncQueue - asyncQueue = []; - asyncTimer = false; - } - - function asyncCall(callback, arg){ - asyncQueue.push([callback, arg]); - - if (!asyncTimer) - { - asyncTimer = true; - asyncSetTimer(asyncFlush, 0); - } - } - - - function invokeResolver(resolver, promise) { - function resolvePromise(value) { - resolve(promise, value); - } - - function rejectPromise(reason) { - reject(promise, reason); - } - - try { - resolver(resolvePromise, rejectPromise); - } catch(e) { - rejectPromise(e); - } - } - - function invokeCallback(subscriber){ - var owner = subscriber.owner; - var settled = owner.state_; - var value = owner.data_; - var callback = subscriber[settled]; - var promise = subscriber.then; - - if (typeof callback === 'function') - { - settled = FULFILLED; - try { - value = callback(value); - } catch(e) { - reject(promise, e); - } - } - - if (!handleThenable(promise, value)) - { - if (settled === FULFILLED) - { resolve(promise, value); } - - if (settled === REJECTED) - { reject(promise, value); } - } - } - - function handleThenable(promise, value) { - var resolved; - - try { - if (promise === value) - { throw new TypeError('A promises callback cannot return that same promise.'); } - - if (value && (typeof value === 'function' || typeof value === 'object')) - { - var then = value.then; // then should be retrived only once - - if (typeof then === 'function') - { - then.call(value, function(val){ - if (!resolved) - { - resolved = true; - - if (value !== val) - { resolve(promise, val); } - else - { fulfill(promise, val); } - } - }, function(reason){ - if (!resolved) - { - resolved = true; - - reject(promise, reason); - } - }); - - return true; - } - } - } catch (e) { - if (!resolved) - { reject(promise, e); } - - return true; - } - - return false; - } - - function resolve(promise, value){ - if (promise === value || !handleThenable(promise, value)) - { fulfill(promise, value); } - } - - function fulfill(promise, value){ - if (promise.state_ === PENDING) - { - promise.state_ = SEALED; - promise.data_ = value; - - asyncCall(publishFulfillment, promise); - } - } - - function reject(promise, reason){ - if (promise.state_ === PENDING) - { - promise.state_ = SEALED; - promise.data_ = reason; - - asyncCall(publishRejection, promise); - } - } - - function publish(promise) { - var callbacks = promise.then_; - promise.then_ = undefined; - - for (var i = 0; i < callbacks.length; i++) { - invokeCallback(callbacks[i]); - } - } - - function publishFulfillment(promise){ - promise.state_ = FULFILLED; - publish(promise); - } - - function publishRejection(promise){ - promise.state_ = REJECTED; - publish(promise); - } - - /** - * @class - */ - function Promise(resolver){ - if (typeof resolver !== 'function') - { throw new TypeError('Promise constructor takes a function argument'); } - - if (this instanceof Promise === false) - { throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); } - - this.then_ = []; - - invokeResolver(resolver, this); - } - - Promise.prototype = { - constructor: Promise, - - state_: PENDING, - then_: null, - data_: undefined, - - then: function(onFulfillment, onRejection){ - var subscriber = { - owner: this, - then: new this.constructor(NOOP), - fulfilled: onFulfillment, - rejected: onRejection - }; - - if (this.state_ === FULFILLED || this.state_ === REJECTED) - { - // already resolved, call callback async - asyncCall(invokeCallback, subscriber); - } - else - { - // subscribe - this.then_.push(subscriber); - } - - return subscriber.then; - }, - - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - - Promise.all = function(promises){ - var Class = this; - - if (!isArray(promises)) - { throw new TypeError('You must pass an array to Promise.all().'); } - - return new Class(function(resolve, reject){ - var results = []; - var remaining = 0; - - function resolver(index){ - remaining++; - return function(value){ - results[index] = value; - if (!--remaining) - { resolve(results); } - }; - } - - for (var i = 0, promise; i < promises.length; i++) - { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') - { promise.then(resolver(i), reject); } - else - { results[i] = promise; } - } - - if (!remaining) - { resolve(results); } - }); - }; - - Promise.race = function(promises){ - var Class = this; - - if (!isArray(promises)) - { throw new TypeError('You must pass an array to Promise.race().'); } - - return new Class(function(resolve, reject) { - for (var i = 0, promise; i < promises.length; i++) - { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') - { promise.then(resolve, reject); } - else - { resolve(promise); } - } - }); - }; - - Promise.resolve = function(value){ - var Class = this; - - if (value && typeof value === 'object' && value.constructor === Class) - { return value; } - - return new Class(function(resolve){ - resolve(value); - }); - }; - - Promise.reject = function(reason){ - var Class = this; - - return new Class(function(resolve, reject){ - reject(reason); - }); - }; - - })(typeof window != 'undefined' ? window : typeof commonjsGlobal != 'undefined' ? commonjsGlobal : typeof self != 'undefined' ? self : commonjsGlobal); - }); - var promise_1 = promise.Promise; - var promise_2 = promise.Polyfill; - - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - - 'use strict'; - /* eslint-disable no-unused-vars */ - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { - var arguments$1 = arguments; - - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments$1[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - - /*! - * @pixi/polyfill - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/polyfill is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - // Support for IE 9 - 11 which does not include Promises - if (!window.Promise) { - window.Promise = promise_2; - } - - // References: - if (!Object.assign) { - Object.assign = objectAssign; - } - - // References: - // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - // https://gist.github.com/1579671 - // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision - // https://gist.github.com/timhall/4078614 - // https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame - // Expected to be used with Browserfiy - // Browserify automatically detects the use of `global` and passes the - // correct reference of `global`, `self`, and finally `window` - var ONE_FRAME_TIME = 16; - // Date.now - if (!(Date.now && Date.prototype.getTime)) { - Date.now = function now() { - return new Date().getTime(); - }; - } - // performance.now - if (!(window.performance && window.performance.now)) { - var startTime_1 = Date.now(); - if (!window.performance) { - window.performance = {}; - } - window.performance.now = function () { return Date.now() - startTime_1; }; - } - // requestAnimationFrame - var lastTime = Date.now(); - var vendors = ['ms', 'moz', 'webkit', 'o']; - for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - var p = vendors[x]; - window.requestAnimationFrame = window[p + "RequestAnimationFrame"]; - window.cancelAnimationFrame = window[p + "CancelAnimationFrame"] - || window[p + "CancelRequestAnimationFrame"]; - } - if (!window.requestAnimationFrame) { - window.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') { - throw new TypeError(callback + "is not a function"); - } - var currentTime = Date.now(); - var delay = ONE_FRAME_TIME + lastTime - currentTime; - if (delay < 0) { - delay = 0; - } - lastTime = currentTime; - return window.setTimeout(function () { - lastTime = Date.now(); - callback(performance.now()); - }, delay); - }; - } - if (!window.cancelAnimationFrame) { - window.cancelAnimationFrame = function (id) { return clearTimeout(id); }; - } - - // References: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - if (!Math.sign) { - Math.sign = function mathSign(x) { - x = Number(x); - if (x === 0 || isNaN(x)) { - return x; - } - return x > 0 ? 1 : -1; - }; - } - - // References: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger - if (!Number.isInteger) { - Number.isInteger = function numberIsInteger(value) { - return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; - }; - } - - if (!window.ArrayBuffer) { - window.ArrayBuffer = Array; - } - if (!window.Float32Array) { - window.Float32Array = Array; - } - if (!window.Uint32Array) { - window.Uint32Array = Array; - } - if (!window.Uint16Array) { - window.Uint16Array = Array; - } - if (!window.Uint8Array) { - window.Uint8Array = Array; - } - if (!window.Int32Array) { - window.Int32Array = Array; - } - - var appleIphone = /iPhone/i; - var appleIpod = /iPod/i; - var appleTablet = /iPad/i; - var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; - var androidPhone = /\bAndroid(?:.+)Mobile\b/i; - var androidTablet = /Android/i; - var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; - var amazonTablet = /Silk/i; - var windowsPhone = /Windows Phone/i; - var windowsTablet = /\bWindows(?:.+)ARM\b/i; - var otherBlackBerry = /BlackBerry/i; - var otherBlackBerry10 = /BB10/i; - var otherOpera = /Opera Mini/i; - var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; - var otherFirefox = /Mobile(?:.+)Firefox\b/i; - var isAppleTabletOnIos13 = function (navigator) { - return (typeof navigator !== 'undefined' && - navigator.platform === 'MacIntel' && - typeof navigator.maxTouchPoints === 'number' && - navigator.maxTouchPoints > 1 && - typeof MSStream === 'undefined'); - }; - function createMatch(userAgent) { - return function (regex) { return regex.test(userAgent); }; - } - function isMobile(param) { - var nav = { - userAgent: '', - platform: '', - maxTouchPoints: 0 - }; - if (!param && typeof navigator !== 'undefined') { - nav = { - userAgent: navigator.userAgent, - platform: navigator.platform, - maxTouchPoints: navigator.maxTouchPoints || 0 - }; - } - else if (typeof param === 'string') { - nav.userAgent = param; - } - else if (param && param.userAgent) { - nav = { - userAgent: param.userAgent, - platform: param.platform, - maxTouchPoints: param.maxTouchPoints || 0 - }; - } - var userAgent = nav.userAgent; - var tmp = userAgent.split('[FBAN'); - if (typeof tmp[1] !== 'undefined') { - userAgent = tmp[0]; - } - tmp = userAgent.split('Twitter'); - if (typeof tmp[1] !== 'undefined') { - userAgent = tmp[0]; - } - var match = createMatch(userAgent); - var result = { - apple: { - phone: match(appleIphone) && !match(windowsPhone), - ipod: match(appleIpod), - tablet: !match(appleIphone) && - (match(appleTablet) || isAppleTabletOnIos13(nav)) && - !match(windowsPhone), - universal: match(appleUniversal), - device: (match(appleIphone) || - match(appleIpod) || - match(appleTablet) || - match(appleUniversal) || - isAppleTabletOnIos13(nav)) && - !match(windowsPhone) - }, - amazon: { - phone: match(amazonPhone), - tablet: !match(amazonPhone) && match(amazonTablet), - device: match(amazonPhone) || match(amazonTablet) - }, - android: { - phone: (!match(windowsPhone) && match(amazonPhone)) || - (!match(windowsPhone) && match(androidPhone)), - tablet: !match(windowsPhone) && - !match(amazonPhone) && - !match(androidPhone) && - (match(amazonTablet) || match(androidTablet)), - device: (!match(windowsPhone) && - (match(amazonPhone) || - match(amazonTablet) || - match(androidPhone) || - match(androidTablet))) || - match(/\bokhttp\b/i) - }, - windows: { - phone: match(windowsPhone), - tablet: match(windowsTablet), - device: match(windowsPhone) || match(windowsTablet) - }, - other: { - blackberry: match(otherBlackBerry), - blackberry10: match(otherBlackBerry10), - opera: match(otherOpera), - firefox: match(otherFirefox), - chrome: match(otherChrome), - device: match(otherBlackBerry) || - match(otherBlackBerry10) || - match(otherOpera) || - match(otherFirefox) || - match(otherChrome) - }, - any: false, - phone: false, - tablet: false - }; - result.any = - result.apple.device || - result.android.device || - result.windows.device || - result.other.device; - result.phone = - result.apple.phone || result.android.phone || result.windows.phone; - result.tablet = - result.apple.tablet || result.android.tablet || result.windows.tablet; - return result; - } - - /*! - * @pixi/settings - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/settings is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - // The ESM/CJS versions of ismobilejs only - var isMobile$1 = isMobile(window.navigator); - - /** - * The maximum recommended texture units to use. - * In theory the bigger the better, and for desktop we'll use as many as we can. - * But some mobile devices slow down if there is to many branches in the shader. - * So in practice there seems to be a sweet spot size that varies depending on the device. - * - * In v4, all mobile devices were limited to 4 texture units because for this. - * In v5, we allow all texture units to be used on modern Apple or Android devices. - * - * @private - * @param {number} max - * @returns {number} - */ - function maxRecommendedTextures(max) { - var allowMax = true; - if (isMobile$1.tablet || isMobile$1.phone) { - if (isMobile$1.apple.device) { - var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); - if (match) { - var majorVersion = parseInt(match[1], 10); - // Limit texture units on devices below iOS 11, which will be older hardware - if (majorVersion < 11) { - allowMax = false; - } - } - } - if (isMobile$1.android.device) { - var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); - if (match) { - var majorVersion = parseInt(match[1], 10); - // Limit texture units on devices below Android 7 (Nougat), which will be older hardware - if (majorVersion < 7) { - allowMax = false; - } - } - } - } - return allowMax ? max : 4; - } - - /** - * Uploading the same buffer multiple times in a single frame can cause performance issues. - * Apparent on iOS so only check for that at the moment - * This check may become more complex if this issue pops up elsewhere. - * - * @private - * @returns {boolean} - */ - function canUploadSameBuffer() { - return !isMobile$1.apple.device; - } - - /** - * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float precision, etc. - * @example - * // Use the native window resolution as the default resolution - * // will support high-density displays when rendering - * PIXI.settings.RESOLUTION = window.devicePixelRatio; - * - * // Disable interpolation when scaling, will make texture be pixelated - * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; - * @namespace PIXI.settings - */ - var settings = { - /** - * If set to true WebGL will attempt make textures mimpaped by default. - * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. - * - * @static - * @name MIPMAP_TEXTURES - * @memberof PIXI.settings - * @type {PIXI.MIPMAP_MODES} - * @default PIXI.MIPMAP_MODES.POW2 - */ - MIPMAP_TEXTURES: 1, - /** - * Default anisotropic filtering level of textures. - * Usually from 0 to 16 - * - * @static - * @name ANISOTROPIC_LEVEL - * @memberof PIXI.settings - * @type {number} - * @default 0 - */ - ANISOTROPIC_LEVEL: 0, - /** - * Default resolution / device pixel ratio of the renderer. - * - * @static - * @name RESOLUTION - * @memberof PIXI.settings - * @type {number} - * @default 1 - */ - RESOLUTION: 1, - /** - * Default filter resolution. - * - * @static - * @name FILTER_RESOLUTION - * @memberof PIXI.settings - * @type {number} - * @default 1 - */ - FILTER_RESOLUTION: 1, - /** - * The maximum textures that this device supports. - * - * @static - * @name SPRITE_MAX_TEXTURES - * @memberof PIXI.settings - * @type {number} - * @default 32 - */ - SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), - // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 - // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - /** - * The default sprite batch size. - * - * The default aims to balance desktop and mobile devices. - * - * @static - * @name SPRITE_BATCH_SIZE - * @memberof PIXI.settings - * @type {number} - * @default 4096 - */ - SPRITE_BATCH_SIZE: 4096, - /** - * The default render options if none are supplied to {@link PIXI.Renderer} - * or {@link PIXI.CanvasRenderer}. - * - * @static - * @name RENDER_OPTIONS - * @memberof PIXI.settings - * @type {object} - * @property {HTMLCanvasElement} view=null - * @property {number} resolution=1 - * @property {boolean} antialias=false - * @property {boolean} autoDensity=false - * @property {boolean} transparent=false - * @property {number} backgroundColor=0x000000 - * @property {boolean} clearBeforeRender=true - * @property {boolean} preserveDrawingBuffer=false - * @property {number} width=800 - * @property {number} height=600 - * @property {boolean} legacy=false - */ - RENDER_OPTIONS: { - view: null, - antialias: false, - autoDensity: false, - transparent: false, - backgroundColor: 0x000000, - clearBeforeRender: true, - preserveDrawingBuffer: false, - width: 800, - height: 600, - legacy: false, - }, - /** - * Default Garbage Collection mode. - * - * @static - * @name GC_MODE - * @memberof PIXI.settings - * @type {PIXI.GC_MODES} - * @default PIXI.GC_MODES.AUTO - */ - GC_MODE: 0, - /** - * Default Garbage Collection max idle. - * - * @static - * @name GC_MAX_IDLE - * @memberof PIXI.settings - * @type {number} - * @default 3600 - */ - GC_MAX_IDLE: 60 * 60, - /** - * Default Garbage Collection maximum check count. - * - * @static - * @name GC_MAX_CHECK_COUNT - * @memberof PIXI.settings - * @type {number} - * @default 600 - */ - GC_MAX_CHECK_COUNT: 60 * 10, - /** - * Default wrap modes that are supported by pixi. - * - * @static - * @name WRAP_MODE - * @memberof PIXI.settings - * @type {PIXI.WRAP_MODES} - * @default PIXI.WRAP_MODES.CLAMP - */ - WRAP_MODE: 33071, - /** - * Default scale mode for textures. - * - * @static - * @name SCALE_MODE - * @memberof PIXI.settings - * @type {PIXI.SCALE_MODES} - * @default PIXI.SCALE_MODES.LINEAR - */ - SCALE_MODE: 1, - /** - * Default specify float precision in vertex shader. - * - * @static - * @name PRECISION_VERTEX - * @memberof PIXI.settings - * @type {PIXI.PRECISION} - * @default PIXI.PRECISION.HIGH - */ - PRECISION_VERTEX: 'highp', - /** - * Default specify float precision in fragment shader. - * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 - * - * @static - * @name PRECISION_FRAGMENT - * @memberof PIXI.settings - * @type {PIXI.PRECISION} - * @default PIXI.PRECISION.MEDIUM - */ - PRECISION_FRAGMENT: isMobile$1.apple.device ? 'highp' : 'mediump', - /** - * Can we upload the same buffer in a single frame? - * - * @static - * @name CAN_UPLOAD_SAME_BUFFER - * @memberof PIXI.settings - * @type {boolean} - */ - CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), - /** - * Enables bitmap creation before image load. This feature is experimental. - * - * @static - * @name CREATE_IMAGE_BITMAP - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - CREATE_IMAGE_BITMAP: false, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * - * @static - * @constant - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - ROUND_PIXELS: false, - }; - - var eventemitter3 = createCommonjsModule(function (module) { - 'use strict'; - - var has = Object.prototype.hasOwnProperty - , prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) { prefix = false; } - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) { emitter._events[evt] = listener, emitter._eventsCount++; } - else if (!emitter._events[evt].fn) { emitter._events[evt].push(listener); } - else { emitter._events[evt] = [emitter._events[evt], listener]; } - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) { emitter._events = new Events(); } - else { delete emitter._events[evt]; } - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) { return names; } - - for (name in (events = this._events)) { - if (has.call(events, name)) { names.push(prefix ? name.slice(1) : name); } - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) { return []; } - if (handlers.fn) { return [handlers.fn]; } - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) { return 0; } - if (listeners.fn) { return 1; } - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var arguments$1 = arguments; - - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) { return false; } - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) { this.removeListener(event, listeners.fn, undefined, true); } - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments$1[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) { this.removeListener(event, listeners[i].fn, undefined, true); } - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) { for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments$1[j]; - } } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) { return this; } - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) { this._events[evt] = events.length === 1 ? events[0] : events; } - else { clearEvent(this, evt); } - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) { clearEvent(this, evt); } - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - if ('undefined' !== 'object') { - module.exports = EventEmitter; - } - }); - - 'use strict'; - - var earcut_1 = earcut; - var default_1 = earcut; - - function earcut(data, holeIndices, dim) { - - dim = dim || 2; - - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; - - if (!outerNode || outerNode.next === outerNode.prev) { return triangles; } - - var minX, minY, maxX, maxY, x, y, invSize; - - if (hasHoles) { outerNode = eliminateHoles(data, holeIndices, outerNode, dim); } - - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) { minX = x; } - if (y < minY) { minY = y; } - if (x > maxX) { maxX = x; } - if (y > maxY) { maxY = y; } - } - - // minX, minY and invSize are later used to transform coords into integers for z-order calculation - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 1 / invSize : 0; - } - - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); - - return triangles; - } - - // create a circular doubly linked list from polygon points in the specified winding order - function linkedList(data, start, end, dim, clockwise) { - var i, last; - - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) { last = insertNode(i, data[i], data[i + 1], last); } - } else { - for (i = end - dim; i >= start; i -= dim) { last = insertNode(i, data[i], data[i + 1], last); } - } - - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - - return last; - } - - // eliminate colinear or duplicate points - function filterPoints(start, end) { - if (!start) { return start; } - if (!end) { end = start; } - - var p = start, - again; - do { - again = false; - - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) { break; } - again = true; - - } else { - p = p.next; - } - } while (again || p !== end); - - return end; - } - - // main ear slicing loop which triangulates a polygon (given as a linked list) - function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) { return; } - - // interlink polygon nodes in z-order - if (!pass && invSize) { indexCurve(ear, minX, minY, invSize); } - - var stop = ear, - prev, next; - - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); - - removeNode(ear); - - // skipping the next vertex leads to less sliver triangles - ear = next.next; - stop = next.next; - - continue; - } - - ear = next; - - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } - - break; - } - } - } - - // check whether a polygon node forms a valid ear with adjacent nodes - function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear - - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; - - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.next; - } - - return true; - } - - function isEarHashed(ear, minX, minY, invSize) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear - - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); - - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - - var p = ear.prevZ, - n = ear.nextZ; - - // look for points inside the triangle in both directions - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.prevZ; - - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) { return false; } - n = n.nextZ; - } - - // look for remaining points in decreasing z-order - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) { return false; } - p = p.prevZ; - } - - // look for remaining points in increasing z-order - while (n && n.z <= maxZ) { - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) { return false; } - n = n.nextZ; - } - - return true; - } - - // go through all polygon nodes and cure small local self-intersections - function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; - - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); - - // remove two nodes involved - removeNode(p); - removeNode(p.next); - - p = start = b; - } - p = p.next; - } while (p !== start); - - return filterPoints(p); - } - - // try splitting polygon into two and triangulate them independently - function splitEarcut(start, triangles, dim, minX, minY, invSize) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); - - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, invSize); - earcutLinked(c, triangles, dim, minX, minY, invSize); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); - } - - // link every hole into the outer loop, producing a single-ring polygon without holes - function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) { list.steiner = true; } - queue.push(getLeftmost(list)); - } - - queue.sort(compareX); - - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } - - return outerNode; - } - - function compareX(a, b) { - return a.x - b.x; - } - - // find a bridge between vertices that connects hole with an outer ring and and link it - function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - - // filter collinear points around the cuts - filterPoints(outerNode, outerNode.next); - filterPoints(b, b.next); - } - } - - // David Eberly's algorithm for finding a bridge between hole and outer polygon - function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; - - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) { return p; } - if (hy === p.next.y) { return p.next; } - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); - - if (!m) { return null; } - - if (hx === qx) { return m; } // hole touches outer segment; pick leftmost endpoint - - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; - - p = m; - - do { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - - if (locallyInside(p, hole) && - (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { - m = p; - tanMin = tan; - } - } - - p = p.next; - } while (p !== stop); - - return m; - } - - // whether sector in vertex m contains sector in vertex p in the same coordinates - function sectorContainsSector(m, p) { - return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; - } - - // interlink polygon nodes in z-order - function indexCurve(start, minX, minY, invSize) { - var p = start; - do { - if (p.z === null) { p.z = zOrder(p.x, p.y, minX, minY, invSize); } - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - - p.prevZ.nextZ = null; - p.prevZ = null; - - sortLinked(p); - } - - // Simon Tatham's linked list merge sort algorithm - // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html - function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; - - do { - p = list; - list = null; - tail = null; - numMerges = 0; - - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) { break; } - } - qSize = inSize; - - while (pSize > 0 || (qSize > 0 && q)) { - - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - - if (tail) { tail.nextZ = e; } - else { list = e; } - - e.prevZ = tail; - tail = e; - } - - p = q; - } - - tail.nextZ = null; - inSize *= 2; - - } while (numMerges > 1); - - return list; - } - - // z-order of a point given coords and inverse of the longer side of data bbox - function zOrder(x, y, minX, minY, invSize) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) * invSize; - y = 32767 * (y - minY) * invSize; - - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; - - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; - - return x | (y << 1); - } - - // find the leftmost node of a polygon ring - function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) { leftmost = p; } - p = p.next; - } while (p !== start); - - return leftmost; - } - - // check if a point lies within a convex triangle - function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; - } - - // check if a diagonal between two polygon nodes is valid (lies in polygon interior) - function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges - (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible - (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors - equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case - } - - // signed area of a triangle - function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); - } - - // check if two points are equal - function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; - } - - // check if two segments intersect - function intersects(p1, q1, p2, q2) { - var o1 = sign(area(p1, q1, p2)); - var o2 = sign(area(p1, q1, q2)); - var o3 = sign(area(p2, q2, p1)); - var o4 = sign(area(p2, q2, q1)); - - if (o1 !== o2 && o3 !== o4) { return true; } // general case - - if (o1 === 0 && onSegment(p1, p2, q1)) { return true; } // p1, q1 and p2 are collinear and p2 lies on p1q1 - if (o2 === 0 && onSegment(p1, q2, q1)) { return true; } // p1, q1 and q2 are collinear and q2 lies on p1q1 - if (o3 === 0 && onSegment(p2, p1, q2)) { return true; } // p2, q2 and p1 are collinear and p1 lies on p2q2 - if (o4 === 0 && onSegment(p2, q1, q2)) { return true; } // p2, q2 and q1 are collinear and q1 lies on p2q2 - - return false; - } - - // for collinear points p, q, r, check if point q lies on segment pr - function onSegment(p, q, r) { - return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); - } - - function sign(num) { - return num > 0 ? 1 : num < 0 ? -1 : 0; - } - - // check if a polygon diagonal intersects any polygon segments - function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) { return true; } - p = p.next; - } while (p !== a); - - return false; - } - - // check if a polygon diagonal is locally inside the polygon - function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; - } - - // check if the middle point of a polygon diagonal is inside the polygon - function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - { inside = !inside; } - p = p.next; - } while (p !== a); - - return inside; - } - - // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; - // if one belongs to the outer ring and another to a hole, it merges it into a single ring - function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; - - a.next = b; - b.prev = a; - - a2.next = an; - an.prev = a2; - - b2.next = a2; - a2.prev = b2; - - bp.next = b2; - b2.prev = bp; - - return b2; - } - - // create a node and optionally link it with previous one (in a circular doubly linked list) - function insertNode(i, x, y, last) { - var p = new Node(i, x, y); - - if (!last) { - p.prev = p; - p.next = p; - - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; - } - - function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - - if (p.prevZ) { p.prevZ.nextZ = p.nextZ; } - if (p.nextZ) { p.nextZ.prevZ = p.prevZ; } - } - - function Node(i, x, y) { - // vertex index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertex nodes in a polygon ring - this.prev = null; - this.next = null; - - // z-order curve value - this.z = null; - - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; - - // indicates whether this is a steiner point - this.steiner = false; - } - - // return a percentage difference between the polygon area and its triangulation area; - // used to verify correctness of triangulation - earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; - - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } - - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } - - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); - }; - - function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; - } - - // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts - earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; - - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) { result.vertices.push(data[i][j][d]); } - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - return result; - }; - earcut_1.default = default_1; - - var punycode = createCommonjsModule(function (module, exports) { - /*! https://mths.be/punycode v1.3.2 by @mathias */ - ;(function(root) { - - /** Detect free variables */ - var freeExports = 'object' == 'object' && exports && - !exports.nodeType && exports; - var freeModule = 'object' == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * http://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.3.2', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof undefined == 'function' && - typeof undefined.amd == 'object' && - undefined.amd - ) { - undefined('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { // in Rhino or a web browser - root.punycode = punycode; - } - - }(commonjsGlobal)); - }); - - 'use strict'; - - var util = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } - }; - var util_1 = util.isString; - var util_2 = util.isObject; - var util_3 = util.isNull; - var util_4 = util.isNullOrUndefined; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - // If obj.hasOwnProperty has been overridden, then calling - // obj.hasOwnProperty(prop) will break. - // See: https://github.com/joyent/node/issues/1707 - function hasOwnProperty$1(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - - var decode = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty$1(obj, k)) { - obj[k] = v; - } else if (Array.isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; - }; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } - }; - - var encode = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return Object.keys(obj).map(function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (Array.isArray(obj[k])) { - return obj[k].map(function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) { return ''; } - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); - }; - - var querystring = createCommonjsModule(function (module, exports) { - 'use strict'; - - exports.decode = exports.parse = decode; - exports.encode = exports.stringify = encode; - }); - var querystring_1 = querystring.decode; - var querystring_2 = querystring.parse; - var querystring_3 = querystring.encode; - var querystring_4 = querystring.stringify; - - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - 'use strict'; - - - - - var parse = urlParse; - var resolve = urlResolve; - var resolveObject = urlResolveObject; - var format = urlFormat; - - var Url_1 = Url; - - function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; - } - - // Reference: RFC 3986, RFC 1808, RFC 2396 - - // define these here so at least they only have to be - // compiled once on the first module load. - var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }; - - function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) { return url; } - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; - } - - Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - { hostEnd = hec; } - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - { hostEnd = hec; } - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - { hostEnd = rest.length; } - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) { continue; } - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - { continue; } - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) { this.pathname = rest; } - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; - }; - - // format a parsed object into a url string - function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) { obj = urlParse(obj); } - if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); } - return obj.format(); - } - - Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; } - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; } - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; } - if (search && search.charAt(0) !== '?') { search = '?' + search; } - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; - }; - - function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); - } - - Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); - }; - - function urlResolveObject(source, relative) { - if (!source) { return relative; } - return urlParse(source, false, true).resolveObject(relative); - } - - Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - { result[rkey] = relative[rkey]; } - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())){ ; } - if (!relative.host) { relative.host = ''; } - if (!relative.hostname) { relative.hostname = ''; } - if (relPath[0] !== '') { relPath.unshift(''); } - if (relPath.length < 2) { relPath.unshift(''); } - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') { srcPath[0] = result.host; } - else { srcPath.unshift(result.host); } - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') { relPath[0] = relative.host; } - else { relPath.unshift(relative.host); } - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) { srcPath = []; } - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - }; - - Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) { this.hostname = host; } - }; - - var url = { - parse: parse, - resolve: resolve, - resolveObject: resolveObject, - format: format, - Url: Url_1 - }; - - /*! - * @pixi/constants - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/constants is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * Different types of environments for WebGL. - * - * @static - * @memberof PIXI - * @name ENV - * @enum {number} - * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experience unexplained flickering prefer this environment. - * @property {number} WEBGL - Version 1 of WebGL - * @property {number} WEBGL2 - Version 2 of WebGL - */ - - (function (ENV) { - ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; - ENV[ENV["WEBGL"] = 1] = "WEBGL"; - ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; - })(exports.ENV || (exports.ENV = {})); - /** - * Constant to identify the Renderer Type. - * - * @static - * @memberof PIXI - * @name RENDERER_TYPE - * @enum {number} - * @property {number} UNKNOWN - Unknown render type. - * @property {number} WEBGL - WebGL render type. - * @property {number} CANVAS - Canvas render type. - */ - - (function (RENDERER_TYPE) { - RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; - RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; - RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; - })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {})); - /** - * Bitwise OR of masks that indicate the buffers to be cleared. - * - * @static - * @memberof PIXI - * @name BUFFER_BITS - * @enum {number} - * @property {number} COLOR - Indicates the buffers currently enabled for color writing. - * @property {number} DEPTH - Indicates the depth buffer. - * @property {number} STENCIL - Indicates the stencil buffer. - */ - - (function (BUFFER_BITS) { - BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; - BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; - BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; - })(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); - /** - * Various blend modes supported by PIXI. - * - * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. - * Anything else will silently act like NORMAL. - * - * @memberof PIXI - * @name BLEND_MODES - * @enum {number} - * @property {number} NORMAL - * @property {number} ADD - * @property {number} MULTIPLY - * @property {number} SCREEN - * @property {number} OVERLAY - * @property {number} DARKEN - * @property {number} LIGHTEN - * @property {number} COLOR_DODGE - * @property {number} COLOR_BURN - * @property {number} HARD_LIGHT - * @property {number} SOFT_LIGHT - * @property {number} DIFFERENCE - * @property {number} EXCLUSION - * @property {number} HUE - * @property {number} SATURATION - * @property {number} COLOR - * @property {number} LUMINOSITY - * @property {number} NORMAL_NPM - * @property {number} ADD_NPM - * @property {number} SCREEN_NPM - * @property {number} NONE - * @property {number} SRC_IN - * @property {number} SRC_OUT - * @property {number} SRC_ATOP - * @property {number} DST_OVER - * @property {number} DST_IN - * @property {number} DST_OUT - * @property {number} DST_ATOP - * @property {number} SUBTRACT - * @property {number} SRC_OVER - * @property {number} ERASE - * @property {number} XOR - */ - - (function (BLEND_MODES) { - BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; - BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; - BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; - BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; - BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; - BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; - BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; - BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; - BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; - BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; - BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; - BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; - BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; - BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; - BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; - BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; - BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; - BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; - BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; - BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; - BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; - BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; - BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; - BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; - BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; - BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; - BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; - BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; - BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; - BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; - BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; - BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; - })(exports.BLEND_MODES || (exports.BLEND_MODES = {})); - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @memberof PIXI - * @static - * @name DRAW_MODES - * @enum {number} - * @property {number} POINTS - * @property {number} LINES - * @property {number} LINE_LOOP - * @property {number} LINE_STRIP - * @property {number} TRIANGLES - * @property {number} TRIANGLE_STRIP - * @property {number} TRIANGLE_FAN - */ - - (function (DRAW_MODES) { - DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; - DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; - DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; - DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; - DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; - })(exports.DRAW_MODES || (exports.DRAW_MODES = {})); - /** - * Various GL texture/resources formats. - * - * @memberof PIXI - * @static - * @name FORMATS - * @enum {number} - * @property {number} RGBA=6408 - * @property {number} RGB=6407 - * @property {number} ALPHA=6406 - * @property {number} LUMINANCE=6409 - * @property {number} LUMINANCE_ALPHA=6410 - * @property {number} DEPTH_COMPONENT=6402 - * @property {number} DEPTH_STENCIL=34041 - */ - - (function (FORMATS) { - FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; - FORMATS[FORMATS["RGB"] = 6407] = "RGB"; - FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; - FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; - FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; - FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; - FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; - })(exports.FORMATS || (exports.FORMATS = {})); - /** - * Various GL target types. - * - * @memberof PIXI - * @static - * @name TARGETS - * @enum {number} - * @property {number} TEXTURE_2D=3553 - * @property {number} TEXTURE_CUBE_MAP=34067 - * @property {number} TEXTURE_2D_ARRAY=35866 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 - */ - - (function (TARGETS) { - TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; - TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; - })(exports.TARGETS || (exports.TARGETS = {})); - /** - * Various GL data format types. - * - * @memberof PIXI - * @static - * @name TYPES - * @enum {number} - * @property {number} UNSIGNED_BYTE=5121 - * @property {number} UNSIGNED_SHORT=5123 - * @property {number} UNSIGNED_SHORT_5_6_5=33635 - * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 - * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 - * @property {number} FLOAT=5126 - * @property {number} HALF_FLOAT=36193 - */ - - (function (TYPES) { - TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; - TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; - TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; - TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; - TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; - TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; - TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; - })(exports.TYPES || (exports.TYPES = {})); - /** - * The scale modes that are supported by pixi. - * - * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @memberof PIXI - * @static - * @name SCALE_MODES - * @enum {number} - * @property {number} LINEAR Smooth scaling - * @property {number} NEAREST Pixelating scaling - */ - - (function (SCALE_MODES) { - SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; - SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; - })(exports.SCALE_MODES || (exports.SCALE_MODES = {})); - /** - * The wrap modes that are supported by pixi. - * - * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as WebGL can - * only use REPEAT if the texture is po2. - * - * This property only affects WebGL. - * - * @name WRAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} CLAMP - The textures uvs are clamped - * @property {number} REPEAT - The texture uvs tile and repeat - * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring - */ - - (function (WRAP_MODES) { - WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; - WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; - WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; - })(exports.WRAP_MODES || (exports.WRAP_MODES = {})); - /** - * Mipmap filtering modes that are supported by pixi. - * - * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. - * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, - * or its `POW2` and texture dimensions are powers of 2. - * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. - * - * This property only affects WebGL. - * - * @name MIPMAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} OFF - No mipmaps - * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 - * @property {number} ON - Always generate mipmaps - */ - - (function (MIPMAP_MODES) { - MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; - MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; - MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; - })(exports.MIPMAP_MODES || (exports.MIPMAP_MODES = {})); - /** - * How to treat textures with premultiplied alpha - * - * @name ALPHA_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. - * Option for compressed and data textures that are created from typed arrays. - * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. - * Default option, used for all loaded images. - * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied - * Example: spine atlases with `_pma` suffix. - * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. - * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. - * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. - */ - - (function (ALPHA_MODES) { - ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; - ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; - ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; - ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; - })(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); - /** - * How to clear renderTextures in filter - * - * @name CLEAR_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} BLEND - Preserve the information in the texture, blend above - * @property {number} CLEAR - Must use `gl.clear` operation - * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia - * @property {number} NO - Alias for BLEND, same as `false` in earlier versions - * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions - * @property {number} AUTO - Alias for BLIT - */ - - (function (CLEAR_MODES) { - CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; - CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; - CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; - CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; - CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; - CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; - })(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); - /** - * The gc modes that are supported by pixi. - * - * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO - * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not - * used for a specified period of time they will be removed from the GPU. They will of course - * be uploaded again when they are required. This is a silent behind the scenes process that - * should ensure that the GPU does not get filled up. - * - * Handy for mobile devices! - * This property only affects WebGL. - * - * @name GC_MODES - * @enum {number} - * @static - * @memberof PIXI - * @property {number} AUTO - Garbage collection will happen periodically automatically - * @property {number} MANUAL - Garbage collection will need to be called manually - */ - - (function (GC_MODES) { - GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; - GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; - })(exports.GC_MODES || (exports.GC_MODES = {})); - /** - * Constants that specify float precision in shaders. - * - * @name PRECISION - * @memberof PIXI - * @constant - * @static - * @enum {string} - * @property {string} LOW='lowp' - * @property {string} MEDIUM='mediump' - * @property {string} HIGH='highp' - */ - - (function (PRECISION) { - PRECISION["LOW"] = "lowp"; - PRECISION["MEDIUM"] = "mediump"; - PRECISION["HIGH"] = "highp"; - })(exports.PRECISION || (exports.PRECISION = {})); - /** - * Constants for mask implementations. - * We use `type` suffix because it leads to very different behaviours - * - * @name MASK_TYPES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - Mask is ignored - * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap - * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil - * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture - */ - - (function (MASK_TYPES) { - MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; - MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; - MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; - MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; - })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); - /** - * Constants for multi-sampling antialiasing. - * - * @see PIXI.Framebuffer#multisample - * - * @name MSAA_QUALITY - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - No multisampling for this renderTexture - * @property {number} LOW - Try 2 samples - * @property {number} MEDIUM - Try 4 samples - * @property {number} HIGH - Try 8 samples - */ - - (function (MSAA_QUALITY) { - MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; - MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; - MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; - MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; - })(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); - - /*! - * @pixi/utils - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/utils is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The prefix that denotes a URL is for a retina asset. - * - * @static - * @name RETINA_PREFIX - * @memberof PIXI.settings - * @type {RegExp} - * @default /@([0-9\.]+)x/ - * @example `@2x` - */ - settings.RETINA_PREFIX = /@([0-9\.]+)x/; - /** - * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. - * For most scenarios this should be left as true, as otherwise the user may have a poor experience. - * However, it can be useful to disable under certain scenarios, such as headless unit tests. - * - * @static - * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT - * @memberof PIXI.settings - * @type {boolean} - * @default true - */ - settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true; - - var saidHello = false; - var VERSION = '5.3.8'; - /** - * Skips the hello message of renderers that are created after this is run. - * - * @function skipHello - * @memberof PIXI.utils - */ - function skipHello() { - saidHello = true; - } - /** - * Logs out the version and renderer information for this running instance of PIXI. - * If you don't want to see this message you can run `PIXI.utils.skipHello()` before - * creating your renderer. Keep in mind that doing that will forever make you a jerk face. - * - * @static - * @function sayHello - * @memberof PIXI.utils - * @param {string} type - The string renderer type to log. - */ - function sayHello(type) { - var _a; - if (saidHello) { - return; - } - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { - var args = [ - "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", - 'background: #ff66a5; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff66a5; background: #030307; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'background: #ffc3dc; padding:5px 0;', - 'background: #ff66a5; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;', - 'color: #ff2424; background: #fff; padding:5px 0;' ]; - (_a = window.console).log.apply(_a, args); - } - else if (window.console) { - window.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); - } - saidHello = true; - } - - var supported; - /** - * Helper for checking for WebGL support. - * - * @memberof PIXI.utils - * @function isWebGLSupported - * @return {boolean} Is WebGL supported. - */ - function isWebGLSupported() { - if (typeof supported === 'undefined') { - supported = (function supported() { - var contextOptions = { - stencil: true, - failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, - }; - try { - if (!window.WebGLRenderingContext) { - return false; - } - var canvas = document.createElement('canvas'); - var gl = (canvas.getContext('webgl', contextOptions) - || canvas.getContext('experimental-webgl', contextOptions)); - var success = !!(gl && gl.getContextAttributes().stencil); - if (gl) { - var loseContext = gl.getExtension('WEBGL_lose_context'); - if (loseContext) { - loseContext.loseContext(); - } - } - gl = null; - return success; - } - catch (e) { - return false; - } - })(); - } - return supported; - } - - /** - * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). - * - * @example - * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] - * @memberof PIXI.utils - * @function hex2rgb - * @param {number} hex - The hexadecimal number to convert - * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one - * @return {number[]} An array representing the [R, G, B] of the color where all values are floats. - */ - function hex2rgb(hex, out) { - if (out === void 0) { out = []; } - out[0] = ((hex >> 16) & 0xFF) / 255; - out[1] = ((hex >> 8) & 0xFF) / 255; - out[2] = (hex & 0xFF) / 255; - return out; - } - /** - * Converts a hexadecimal color number to a string. - * - * @example - * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" - * @memberof PIXI.utils - * @function hex2string - * @param {number} hex - Number in hex (e.g., `0xffffff`) - * @return {string} The string color (e.g., `"#ffffff"`). - */ - function hex2string(hex) { - var hexString = hex.toString(16); - hexString = '000000'.substr(0, 6 - hexString.length) + hexString; - return "#" + hexString; - } - /** - * Converts a hexadecimal string to a hexadecimal color number. - * - * @example - * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff - * @memberof PIXI.utils - * @function string2hex - * @param {string} string - The string color (e.g., `"#ffffff"`) - * @return {number} Number in hexadecimal. - */ - function string2hex(string) { - if (typeof string === 'string' && string[0] === '#') { - string = string.substr(1); - } - return parseInt(string, 16); - } - /** - * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. - * - * @example - * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff - * @memberof PIXI.utils - * @function rgb2hex - * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. - * @return {number} Number in hexadecimal. - */ - function rgb2hex(rgb) { - return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); - } - - /** - * Corrects PixiJS blend, takes premultiplied alpha into account - * - * @memberof PIXI.utils - * @function mapPremultipliedBlendModes - * @private - * @return {Array} Mapped modes. - */ - function mapPremultipliedBlendModes() { - var pm = []; - var npm = []; - for (var i = 0; i < 32; i++) { - pm[i] = i; - npm[i] = i; - } - pm[exports.BLEND_MODES.NORMAL_NPM] = exports.BLEND_MODES.NORMAL; - pm[exports.BLEND_MODES.ADD_NPM] = exports.BLEND_MODES.ADD; - pm[exports.BLEND_MODES.SCREEN_NPM] = exports.BLEND_MODES.SCREEN; - npm[exports.BLEND_MODES.NORMAL] = exports.BLEND_MODES.NORMAL_NPM; - npm[exports.BLEND_MODES.ADD] = exports.BLEND_MODES.ADD_NPM; - npm[exports.BLEND_MODES.SCREEN] = exports.BLEND_MODES.SCREEN_NPM; - var array = []; - array.push(npm); - array.push(pm); - return array; - } - /** - * maps premultiply flag and blendMode to adjusted blendMode - * @memberof PIXI.utils - * @const premultiplyBlendMode - * @type {Array} - */ - var premultiplyBlendMode = mapPremultipliedBlendModes(); - /** - * changes blendMode according to texture format - * - * @memberof PIXI.utils - * @function correctBlendMode - * @param {number} blendMode - supposed blend mode - * @param {boolean} premultiplied - whether source is premultiplied - * @returns {number} true blend mode for this texture - */ - function correctBlendMode(blendMode, premultiplied) { - return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; - } - /** - * combines rgb and alpha to out array - * - * @memberof PIXI.utils - * @function premultiplyRgba - * @param {Float32Array|number[]} rgb - input rgb - * @param {number} alpha - alpha param - * @param {Float32Array} [out] - output - * @param {boolean} [premultiply=true] - do premultiply it - * @returns {Float32Array} vec4 rgba - */ - function premultiplyRgba(rgb, alpha, out, premultiply) { - out = out || new Float32Array(4); - if (premultiply || premultiply === undefined) { - out[0] = rgb[0] * alpha; - out[1] = rgb[1] * alpha; - out[2] = rgb[2] * alpha; - } - else { - out[0] = rgb[0]; - out[1] = rgb[1]; - out[2] = rgb[2]; - } - out[3] = alpha; - return out; - } - /** - * premultiplies tint - * - * @memberof PIXI.utils - * @function premultiplyTint - * @param {number} tint - integer RGB - * @param {number} alpha - floating point alpha (0.0-1.0) - * @returns {number} tint multiplied by alpha - */ - function premultiplyTint(tint, alpha) { - if (alpha === 1.0) { - return (alpha * 255 << 24) + tint; - } - if (alpha === 0.0) { - return 0; - } - var R = ((tint >> 16) & 0xFF); - var G = ((tint >> 8) & 0xFF); - var B = (tint & 0xFF); - R = ((R * alpha) + 0.5) | 0; - G = ((G * alpha) + 0.5) | 0; - B = ((B * alpha) + 0.5) | 0; - return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; - } - /** - * converts integer tint and float alpha to vec4 form, premultiplies by default - * - * @memberof PIXI.utils - * @function premultiplyTintToRgba - * @param {number} tint - input tint - * @param {number} alpha - alpha param - * @param {Float32Array} [out] output - * @param {boolean} [premultiply=true] - do premultiply it - * @returns {Float32Array} vec4 rgba - */ - function premultiplyTintToRgba(tint, alpha, out, premultiply) { - out = out || new Float32Array(4); - out[0] = ((tint >> 16) & 0xFF) / 255.0; - out[1] = ((tint >> 8) & 0xFF) / 255.0; - out[2] = (tint & 0xFF) / 255.0; - if (premultiply || premultiply === undefined) { - out[0] *= alpha; - out[1] *= alpha; - out[2] *= alpha; - } - out[3] = alpha; - return out; - } - - /** - * Generic Mask Stack data structure - * - * @memberof PIXI.utils - * @function createIndicesForQuads - * @param {number} size - Number of quads - * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` - * @return {Uint16Array|Uint32Array} - Resulting index buffer - */ - function createIndicesForQuads(size, outBuffer) { - if (outBuffer === void 0) { outBuffer = null; } - // the total number of indices in our array, there are 6 points per quad. - var totalIndices = size * 6; - outBuffer = outBuffer || new Uint16Array(totalIndices); - if (outBuffer.length !== totalIndices) { - throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); - } - // fill the indices with the quads to draw - for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { - outBuffer[i + 0] = j + 0; - outBuffer[i + 1] = j + 1; - outBuffer[i + 2] = j + 2; - outBuffer[i + 3] = j + 0; - outBuffer[i + 4] = j + 2; - outBuffer[i + 5] = j + 3; - } - return outBuffer; - } - - function getBufferType(array) { - if (array.BYTES_PER_ELEMENT === 4) { - if (array instanceof Float32Array) { - return 'Float32Array'; - } - else if (array instanceof Uint32Array) { - return 'Uint32Array'; - } - return 'Int32Array'; - } - else if (array.BYTES_PER_ELEMENT === 2) { - if (array instanceof Uint16Array) { - return 'Uint16Array'; - } - } - else if (array.BYTES_PER_ELEMENT === 1) { - if (array instanceof Uint8Array) { - return 'Uint8Array'; - } - } - // TODO map out the rest of the array elements! - return null; - } - - /* eslint-disable object-shorthand */ - var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; - function interleaveTypedArrays(arrays, sizes) { - var outSize = 0; - var stride = 0; - var views = {}; - for (var i = 0; i < arrays.length; i++) { - stride += sizes[i]; - outSize += arrays[i].length; - } - var buffer = new ArrayBuffer(outSize * 4); - var out = null; - var littleOffset = 0; - for (var i = 0; i < arrays.length; i++) { - var size = sizes[i]; - var array = arrays[i]; - /* - @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way - or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? - */ - var type = getBufferType(array); - if (!views[type]) { - views[type] = new map[type](buffer); - } - out = views[type]; - for (var j = 0; j < array.length; j++) { - var indexStart = ((j / size | 0) * stride) + littleOffset; - var index = j % size; - out[indexStart + index] = array[j]; - } - littleOffset += size; - } - return new Float32Array(buffer); - } - - // Taken from the bit-twiddle package - /** - * Rounds to next power of two. - * - * @function nextPow2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {number} - */ - function nextPow2(v) { - v += v === 0 ? 1 : 0; - --v; - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - return v + 1; - } - /** - * Checks if a number is a power of two. - * - * @function isPow2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {boolean} `true` if value is power of two - */ - function isPow2(v) { - return !(v & (v - 1)) && (!!v); - } - /** - * Computes ceil of log base 2 - * - * @function log2 - * @memberof PIXI.utils - * @param {number} v - input value - * @return {number} logarithm base 2 - */ - function log2(v) { - var r = (v > 0xFFFF ? 1 : 0) << 4; - v >>>= r; - var shift = (v > 0xFF ? 1 : 0) << 3; - v >>>= shift; - r |= shift; - shift = (v > 0xF ? 1 : 0) << 2; - v >>>= shift; - r |= shift; - shift = (v > 0x3 ? 1 : 0) << 1; - v >>>= shift; - r |= shift; - return r | (v >> 1); - } - - /** - * Remove items from a javascript array without generating garbage - * - * @function removeItems - * @memberof PIXI.utils - * @param {Array} arr - Array to remove elements from - * @param {number} startIdx - starting index - * @param {number} removeCount - how many to remove - */ - function removeItems(arr, startIdx, removeCount) { - var length = arr.length; - var i; - if (startIdx >= length || removeCount === 0) { - return; - } - removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); - var len = length - removeCount; - for (i = startIdx; i < len; ++i) { - arr[i] = arr[i + removeCount]; - } - arr.length = len; - } - - /** - * Returns sign of number - * - * @memberof PIXI.utils - * @function sign - * @param {number} n - the number to check the sign of - * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive - */ - function sign$1(n) { - if (n === 0) - { return 0; } - return n < 0 ? -1 : 1; - } - - var nextUid = 0; - /** - * Gets the next unique identifier - * - * @memberof PIXI.utils - * @function uid - * @return {number} The next unique identifier to use. - */ - function uid() { - return ++nextUid; - } - - // A map of warning messages already fired - var warnings = {}; - /** - * Helper for warning developers about deprecated features & settings. - * A stack track for warnings is given; useful for tracking-down where - * deprecated methods/properties/classes are being used within the code. - * - * @memberof PIXI.utils - * @function deprecation - * @param {string} version - The version where the feature became deprecated - * @param {string} message - Message should include what is deprecated, where, and the new solution - * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack - * this is mostly to ignore internal deprecation calls. - */ - function deprecation(version, message, ignoreDepth) { - if (ignoreDepth === void 0) { ignoreDepth = 3; } - // Ignore duplicat - if (warnings[message]) { - return; - } - /* eslint-disable no-console */ - var stack = new Error().stack; - // Handle IE < 10 and Safari < 6 - if (typeof stack === 'undefined') { - console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); - } - else { - // chop off the stack trace which includes PixiJS internal calls - stack = stack.split('\n').splice(ignoreDepth).join('\n'); - if (console.groupCollapsed) { - console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); - console.warn(stack); - console.groupEnd(); - } - else { - console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); - console.warn(stack); - } - } - /* eslint-enable no-console */ - warnings[message] = true; - } - - /** - * @todo Describe property usage - * - * @static - * @name ProgramCache - * @memberof PIXI.utils - * @type {Object} - */ - var ProgramCache = {}; - /** - * @todo Describe property usage - * - * @static - * @name TextureCache - * @memberof PIXI.utils - * @type {Object} - */ - var TextureCache = Object.create(null); - /** - * @todo Describe property usage - * - * @static - * @name BaseTextureCache - * @memberof PIXI.utils - * @type {Object} - */ - var BaseTextureCache = Object.create(null); - /** - * Destroys all texture in the cache - * - * @memberof PIXI.utils - * @function destroyTextureCache - */ - function destroyTextureCache() { - var key; - for (key in TextureCache) { - TextureCache[key].destroy(); - } - for (key in BaseTextureCache) { - BaseTextureCache[key].destroy(); - } - } - /** - * Removes all textures from cache, but does not destroy them - * - * @memberof PIXI.utils - * @function clearTextureCache - */ - function clearTextureCache() { - var key; - for (key in TextureCache) { - delete TextureCache[key]; - } - for (key in BaseTextureCache) { - delete BaseTextureCache[key]; - } - } - - /** - * Creates a Canvas element of the given size to be used as a target for rendering to. - * - * @class - * @memberof PIXI.utils - */ - var CanvasRenderTarget = /** @class */ (function () { - /** - * @param {number} width - the width for the newly created canvas - * @param {number} height - the height for the newly created canvas - * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas - */ - function CanvasRenderTarget(width, height, resolution) { - /** - * The Canvas object that belongs to this CanvasRenderTarget. - * - * @member {HTMLCanvasElement} - */ - this.canvas = document.createElement('canvas'); - /** - * A CanvasRenderingContext2D object representing a two-dimensional rendering context. - * - * @member {CanvasRenderingContext2D} - */ - this.context = this.canvas.getContext('2d'); - this.resolution = resolution || settings.RESOLUTION; - this.resize(width, height); - } - /** - * Clears the canvas that was created by the CanvasRenderTarget class. - * - * @private - */ - CanvasRenderTarget.prototype.clear = function () { - this.context.setTransform(1, 0, 0, 1, 0, 0); - this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); - }; - /** - * Resizes the canvas to the specified width and height. - * - * @param {number} width - the new width of the canvas - * @param {number} height - the new height of the canvas - */ - CanvasRenderTarget.prototype.resize = function (width, height) { - this.canvas.width = width * this.resolution; - this.canvas.height = height * this.resolution; - }; - /** - * Destroys this canvas. - * - */ - CanvasRenderTarget.prototype.destroy = function () { - this.context = null; - this.canvas = null; - }; - Object.defineProperty(CanvasRenderTarget.prototype, "width", { - /** - * The width of the canvas buffer in pixels. - * - * @member {number} - */ - get: function () { - return this.canvas.width; - }, - set: function (val) { - this.canvas.width = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(CanvasRenderTarget.prototype, "height", { - /** - * The height of the canvas buffer in pixels. - * - * @member {number} - */ - get: function () { - return this.canvas.height; - }, - set: function (val) { - this.canvas.height = val; - }, - enumerable: false, - configurable: true - }); - return CanvasRenderTarget; - }()); - - /** - * Trim transparent borders from a canvas - * - * @memberof PIXI.utils - * @function trimCanvas - * @param {HTMLCanvasElement} canvas - the canvas to trim - * @returns {object} Trim data - */ - function trimCanvas(canvas) { - // https://gist.github.com/remy/784508 - var width = canvas.width; - var height = canvas.height; - var context = canvas.getContext('2d'); - var imageData = context.getImageData(0, 0, width, height); - var pixels = imageData.data; - var len = pixels.length; - var bound = { - top: null, - left: null, - right: null, - bottom: null, - }; - var data = null; - var i; - var x; - var y; - for (i = 0; i < len; i += 4) { - if (pixels[i + 3] !== 0) { - x = (i / 4) % width; - y = ~~((i / 4) / width); - if (bound.top === null) { - bound.top = y; - } - if (bound.left === null) { - bound.left = x; - } - else if (x < bound.left) { - bound.left = x; - } - if (bound.right === null) { - bound.right = x + 1; - } - else if (bound.right < x) { - bound.right = x + 1; - } - if (bound.bottom === null) { - bound.bottom = y; - } - else if (bound.bottom < y) { - bound.bottom = y; - } - } - } - if (bound.top !== null) { - width = bound.right - bound.left; - height = bound.bottom - bound.top + 1; - data = context.getImageData(bound.left, bound.top, width, height); - } - return { - height: height, - width: width, - data: data, - }; - } - - /** - * Regexp for data URI. - * Based on: {@link https://github.com/ragingwind/data-uri-regex} - * - * @static - * @constant {RegExp|string} DATA_URI - * @memberof PIXI - * @example data:image/png;base64 - */ - var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; - - /** - * @memberof PIXI.utils - * @interface DecomposedDataUri - */ - /** - * type, eg. `image` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} mediaType - */ - /** - * Sub type, eg. `png` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} subType - */ - /** - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} charset - */ - /** - * Data encoding, eg. `base64` - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} encoding - */ - /** - * The actual data - * @memberof PIXI.utils.DecomposedDataUri# - * @member {string} data - */ - /** - * Split a data URI into components. Returns undefined if - * parameter `dataUri` is not a valid data URI. - * - * @memberof PIXI.utils - * @function decomposeDataUri - * @param {string} dataUri - the data URI to check - * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined - */ - function decomposeDataUri(dataUri) { - var dataUriMatch = DATA_URI.exec(dataUri); - if (dataUriMatch) { - return { - mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, - subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, - charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, - encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, - data: dataUriMatch[5], - }; - } - return undefined; - } - - var tempAnchor; - /** - * Sets the `crossOrigin` property for this resource based on if the url - * for this resource is cross-origin. If crossOrigin was manually set, this - * function does nothing. - * Nipped from the resource loader! - * - * @ignore - * @param {string} url - The url to test. - * @param {object} [loc=window.location] - The location object to test against. - * @return {string} The crossOrigin value to use (or empty string for none). - */ - function determineCrossOrigin(url, loc) { - if (loc === void 0) { loc = window.location; } - // data: and javascript: urls are considered same-origin - if (url.indexOf('data:') === 0) { - return ''; - } - // default is window.location - loc = loc || window.location; - if (!tempAnchor) { - tempAnchor = document.createElement('a'); - } - // let the browser determine the full href for the url of this resource and then - // parse with the node url lib, we can't use the properties of the anchor element - // because they don't work in IE9 :( - tempAnchor.href = url; - var parsedUrl = parse(tempAnchor.href); - var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); - // if cross origin - if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { - return 'anonymous'; - } - return ''; - } - - /** - * get the resolution / device pixel ratio of an asset by looking for the prefix - * used by spritesheets and image urls - * - * @memberof PIXI.utils - * @function getResolutionOfUrl - * @param {string} url - the image path - * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. - * @return {number} resolution / device pixel ratio of an asset - */ - function getResolutionOfUrl(url, defaultValue) { - var resolution = settings.RETINA_PREFIX.exec(url); - if (resolution) { - return parseFloat(resolution[1]); - } - return defaultValue !== undefined ? defaultValue : 1; - } - - var utils_es = ({ - BaseTextureCache: BaseTextureCache, - CanvasRenderTarget: CanvasRenderTarget, - DATA_URI: DATA_URI, - ProgramCache: ProgramCache, - TextureCache: TextureCache, - clearTextureCache: clearTextureCache, - correctBlendMode: correctBlendMode, - createIndicesForQuads: createIndicesForQuads, - decomposeDataUri: decomposeDataUri, - deprecation: deprecation, - destroyTextureCache: destroyTextureCache, - determineCrossOrigin: determineCrossOrigin, - getBufferType: getBufferType, - getResolutionOfUrl: getResolutionOfUrl, - hex2rgb: hex2rgb, - hex2string: hex2string, - interleaveTypedArrays: interleaveTypedArrays, - isPow2: isPow2, - isWebGLSupported: isWebGLSupported, - log2: log2, - nextPow2: nextPow2, - premultiplyBlendMode: premultiplyBlendMode, - premultiplyRgba: premultiplyRgba, - premultiplyTint: premultiplyTint, - premultiplyTintToRgba: premultiplyTintToRgba, - removeItems: removeItems, - rgb2hex: rgb2hex, - sayHello: sayHello, - sign: sign$1, - skipHello: skipHello, - string2hex: string2hex, - trimCanvas: trimCanvas, - uid: uid, - isMobile: isMobile$1, - EventEmitter: eventemitter3, - earcut: earcut_1, - url: url - }); - - /*! - * @pixi/math - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/math is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * Two Pi. - * - * @static - * @constant {number} PI_2 - * @memberof PIXI - */ - var PI_2 = Math.PI * 2; - /** - * Conversion factor for converting radians to degrees. - * - * @static - * @constant {number} RAD_TO_DEG - * @memberof PIXI - */ - var RAD_TO_DEG = 180 / Math.PI; - /** - * Conversion factor for converting degrees to radians. - * - * @static - * @constant {number} DEG_TO_RAD - * @memberof PIXI - */ - var DEG_TO_RAD = Math.PI / 180; - - (function (SHAPES) { - SHAPES[SHAPES["POLY"] = 0] = "POLY"; - SHAPES[SHAPES["RECT"] = 1] = "RECT"; - SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; - SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; - SHAPES[SHAPES["RREC"] = 4] = "RREC"; - })(exports.SHAPES || (exports.SHAPES = {})); - /** - * Constants that identify shapes, mainly to prevent `instanceof` calls. - * - * @static - * @constant - * @name SHAPES - * @memberof PIXI - * @type {enum} - * @property {number} POLY Polygon - * @property {number} RECT Rectangle - * @property {number} CIRC Circle - * @property {number} ELIP Ellipse - * @property {number} RREC Rounded Rectangle - * @enum {number} - */ - - /** - * Size object, contains width and height - * - * @memberof PIXI - * @typedef {object} ISize - * @property {number} width - Width component - * @property {number} height - Height component - */ - /** - * Rectangle object is an area defined by its position, as indicated by its top-left corner - * point (x, y) and by its width and its height. - * - * @class - * @memberof PIXI - */ - var Rectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle - * @param {number} [width=0] - The overall width of this rectangle - * @param {number} [height=0] - The overall height of this rectangle - */ - function Rectangle(x, y, width, height) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = Number(x); - /** - * @member {number} - * @default 0 - */ - this.y = Number(y); - /** - * @member {number} - * @default 0 - */ - this.width = Number(width); - /** - * @member {number} - * @default 0 - */ - this.height = Number(height); - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.RECT - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RECT; - } - Object.defineProperty(Rectangle.prototype, "left", { - /** - * returns the left edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "right", { - /** - * returns the right edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x + this.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "top", { - /** - * returns the top edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "bottom", { - /** - * returns the bottom edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y + this.height; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Rectangle, "EMPTY", { - /** - * A constant empty rectangle. - * - * @static - * @constant - * @member {PIXI.Rectangle} - * @return {PIXI.Rectangle} An empty rectangle - */ - get: function () { - return new Rectangle(0, 0, 0, 0); - }, - enumerable: false, - configurable: true - }); - /** - * Creates a clone of this Rectangle - * - * @return {PIXI.Rectangle} a copy of the rectangle - */ - Rectangle.prototype.clone = function () { - return new Rectangle(this.x, this.y, this.width, this.height); - }; - /** - * Copies another rectangle to this one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy from. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.copyFrom = function (rectangle) { - this.x = rectangle.x; - this.y = rectangle.y; - this.width = rectangle.width; - this.height = rectangle.height; - return this; - }; - /** - * Copies this rectangle to another one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy to. - * @return {PIXI.Rectangle} Returns given parameter. - */ - Rectangle.prototype.copyTo = function (rectangle) { - rectangle.x = this.x; - rectangle.y = this.y; - rectangle.width = this.width; - rectangle.height = this.height; - return rectangle; - }; - /** - * Checks whether the x and y coordinates given are contained within this Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rectangle - */ - Rectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x < this.x + this.width) { - if (y >= this.y && y < this.y + this.height) { - return true; - } - } - return false; - }; - /** - * Pads the rectangle making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.pad = function (paddingX, paddingY) { - if (paddingX === void 0) { paddingX = 0; } - if (paddingY === void 0) { paddingY = paddingX; } - this.x -= paddingX; - this.y -= paddingY; - this.width += paddingX * 2; - this.height += paddingY * 2; - return this; - }; - /** - * Fits this rectangle around the passed one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to fit. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.fit = function (rectangle) { - var x1 = Math.max(this.x, rectangle.x); - var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.max(this.y, rectangle.y); - var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = Math.max(x2 - x1, 0); - this.y = y1; - this.height = Math.max(y2 - y1, 0); - return this; - }; - /** - * Enlarges rectangle that way its corners lie on grid - * - * @param {number} [resolution=1] resolution - * @param {number} [eps=0.001] precision - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.ceil = function (resolution, eps) { - if (resolution === void 0) { resolution = 1; } - if (eps === void 0) { eps = 0.001; } - var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; - var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; - this.x = Math.floor((this.x + eps) * resolution) / resolution; - this.y = Math.floor((this.y + eps) * resolution) / resolution; - this.width = x2 - this.x; - this.height = y2 - this.y; - return this; - }; - /** - * Enlarges this rectangle to include the passed rectangle. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to include. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.enlarge = function (rectangle) { - var x1 = Math.min(this.x, rectangle.x); - var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.min(this.y, rectangle.y); - var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = x2 - x1; - this.y = y1; - this.height = y2 - y1; - return this; - }; - return Rectangle; - }()); - - /** - * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Circle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this circle - * @param {number} [y=0] - The Y coordinate of the center of this circle - * @param {number} [radius=0] - The radius of the circle - */ - function Circle(x, y, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (radius === void 0) { radius = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.CIRC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.CIRC; - } - /** - * Creates a clone of this Circle instance - * - * @return {PIXI.Circle} a copy of the Circle - */ - Circle.prototype.clone = function () { - return new Circle(this.x, this.y, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this circle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Circle - */ - Circle.prototype.contains = function (x, y) { - if (this.radius <= 0) { - return false; - } - var r2 = this.radius * this.radius; - var dx = (this.x - x); - var dy = (this.y - y); - dx *= dx; - dy *= dy; - return (dx + dy <= r2); - }; - /** - * Returns the framing rectangle of the circle as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Circle.prototype.getBounds = function () { - return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); - }; - return Circle; - }()); - - /** - * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Ellipse = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this ellipse - * @param {number} [y=0] - The Y coordinate of the center of this ellipse - * @param {number} [halfWidth=0] - The half width of this ellipse - * @param {number} [halfHeight=0] - The half height of this ellipse - */ - function Ellipse(x, y, halfWidth, halfHeight) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (halfWidth === void 0) { halfWidth = 0; } - if (halfHeight === void 0) { halfHeight = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = halfWidth; - /** - * @member {number} - * @default 0 - */ - this.height = halfHeight; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.ELIP - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.ELIP; - } - /** - * Creates a clone of this Ellipse instance - * - * @return {PIXI.Ellipse} a copy of the ellipse - */ - Ellipse.prototype.clone = function () { - return new Ellipse(this.x, this.y, this.width, this.height); - }; - /** - * Checks whether the x and y coordinates given are contained within this ellipse - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coords are within this ellipse - */ - Ellipse.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - // normalize the coords to an ellipse with center 0,0 - var normx = ((x - this.x) / this.width); - var normy = ((y - this.y) / this.height); - normx *= normx; - normy *= normy; - return (normx + normy <= 1); - }; - /** - * Returns the framing rectangle of the ellipse as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Ellipse.prototype.getBounds = function () { - return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); - }; - return Ellipse; - }()); - - /** - * A class to define a shape via user defined co-orinates. - * - * @class - * @memberof PIXI - */ - var Polygon = /** @class */ (function () { - /** - * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points - * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or - * the arguments passed can be all the points of the polygon e.g. - * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat - * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. - */ - function Polygon() { - var arguments$1 = arguments; - - var points = []; - for (var _i = 0; _i < arguments.length; _i++) { - points[_i] = arguments$1[_i]; - } - var flat = Array.isArray(points[0]) ? points[0] : points; - // if this is an array of points, convert it to a flat array of numbers - if (typeof flat[0] !== 'number') { - var p = []; - for (var i = 0, il = flat.length; i < il; i++) { - p.push(flat[i].x, flat[i].y); - } - flat = p; - } - /** - * An array of the points of this polygon - * - * @member {number[]} - */ - this.points = flat; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.POLY - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.POLY; - /** - * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. - * @member {boolean} - * @default true - */ - this.closeStroke = true; - } - /** - * Creates a clone of this polygon - * - * @return {PIXI.Polygon} a copy of the polygon - */ - Polygon.prototype.clone = function () { - var points = this.points.slice(); - var polygon = new Polygon(points); - polygon.closeStroke = this.closeStroke; - return polygon; - }; - /** - * Checks whether the x and y coordinates passed to this function are contained within this polygon - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this polygon - */ - Polygon.prototype.contains = function (x, y) { - var inside = false; - // use some raycasting to test hits - // https://github.com/substack/point-in-polygon/blob/master/index.js - var length = this.points.length / 2; - for (var i = 0, j = length - 1; i < length; j = i++) { - var xi = this.points[i * 2]; - var yi = this.points[(i * 2) + 1]; - var xj = this.points[j * 2]; - var yj = this.points[(j * 2) + 1]; - var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); - if (intersect) { - inside = !inside; - } - } - return inside; - }; - return Polygon; - }()); - - /** - * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its - * top-left corner point (x, y) and by its width and its height and its radius. - * - * @class - * @memberof PIXI - */ - var RoundedRectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle - * @param {number} [width=0] - The overall width of this rounded rectangle - * @param {number} [height=0] - The overall height of this rounded rectangle - * @param {number} [radius=20] - Controls the radius of the rounded corners - */ - function RoundedRectangle(x, y, width, height, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - if (radius === void 0) { radius = 20; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = width; - /** - * @member {number} - * @default 0 - */ - this.height = height; - /** - * @member {number} - * @default 20 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readonly - * @default PIXI.SHAPES.RREC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RREC; - } - /** - * Creates a clone of this Rounded Rectangle - * - * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle - */ - RoundedRectangle.prototype.clone = function () { - return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this Rounded Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle - */ - RoundedRectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x <= this.x + this.width) { - if (y >= this.y && y <= this.y + this.height) { - if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius) - || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) { - return true; - } - var dx = x - (this.x + this.radius); - var dy = y - (this.y + this.radius); - var radius2 = this.radius * this.radius; - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.width - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dy = y - (this.y + this.height - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - } - } - return false; - }; - return RoundedRectangle; - }()); - - /** - * Common interface for points. Both Point and ObservablePoint implement it - * @memberof PIXI - * @interface IPointData - */ - /** - * X coord - * @memberof PIXI.IPointData# - * @member {number} x - */ - /** - * Y coord - * @memberof PIXI.IPointData# - * @member {number} y - */ - - /** - * Common interface for points. Both Point and ObservablePoint implement it - * @memberof PIXI - * @interface IPoint - * @extends PIXI.IPointData - */ - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @method set - * @memberof PIXI.IPoint# - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - */ - /** - * Copies x and y from the given point - * @method copyFrom - * @memberof PIXI.IPoint# - * @param {PIXI.IPointData} p - The point to copy from - * @returns {this} Returns itself. - */ - /** - * Copies x and y into the given point - * @method copyTo - * @memberof PIXI.IPoint# - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - /** - * Returns true if the given point is equal to this point - * - * @method equals - * @memberof PIXI.IPoint# - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - - /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. - * - * @class - * @memberof PIXI - * @implements IPoint - */ - var Point = /** @class */ (function () { - /** - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=0] - position of the point on the y axis - */ - function Point(x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - } - /** - * Creates a clone of this point - * - * @return {PIXI.Point} a copy of the point - */ - Point.prototype.clone = function () { - return new Point(this.x, this.y); - }; - /** - * Copies x and y from the given point - * - * @param {PIXI.IPointData} p - The point to copy from - * @returns {this} Returns itself. - */ - Point.prototype.copyFrom = function (p) { - this.set(p.x, p.y); - return this; - }; - /** - * Copies x and y into the given point - * - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - Point.prototype.copyTo = function (p) { - p.set(this.x, this.y); - return p; - }; - /** - * Returns true if the given point is equal to this point - * - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - Point.prototype.equals = function (p) { - return (p.x === this.x) && (p.y === this.y); - }; - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - * @returns {this} Returns itself. - */ - Point.prototype.set = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = x; } - this.x = x; - this.y = y; - return this; - }; - return Point; - }()); - - /** - * The Point object represents a location in a two-dimensional coordinate system, where x represents - * the horizontal axis and y represents the vertical axis. - * - * An ObservablePoint is a point that triggers a callback when the point's position is changed. - * - * @class - * @memberof PIXI - * @implements IPoint - */ - var ObservablePoint = /** @class */ (function () { - /** - * @param {Function} cb - callback when changed - * @param {object} scope - owner of callback - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=0] - position of the point on the y axis - */ - function ObservablePoint(cb, scope, x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - this._x = x; - this._y = y; - this.cb = cb; - this.scope = scope; - } - /** - * Creates a clone of this point. - * The callback and scope params can be overidden otherwise they will default - * to the clone object's values. - * - * @override - * @param {Function} [cb=null] - callback when changed - * @param {object} [scope=null] - owner of callback - * @return {PIXI.ObservablePoint} a copy of the point - */ - ObservablePoint.prototype.clone = function (cb, scope) { - if (cb === void 0) { cb = this.cb; } - if (scope === void 0) { scope = this.scope; } - return new ObservablePoint(cb, scope, this._x, this._y); - }; - /** - * Sets the point to a new x and y position. - * If y is omitted, both x and y will be set to x. - * - * @param {number} [x=0] - position of the point on the x axis - * @param {number} [y=x] - position of the point on the y axis - * @returns {this} Returns itself. - */ - ObservablePoint.prototype.set = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = x; } - if (this._x !== x || this._y !== y) { - this._x = x; - this._y = y; - this.cb.call(this.scope); - } - return this; - }; - /** - * Copies x and y from the given point - * - * @param {PIXI.IPointData} p - The point to copy from. - * @returns {this} Returns itself. - */ - ObservablePoint.prototype.copyFrom = function (p) { - if (this._x !== p.x || this._y !== p.y) { - this._x = p.x; - this._y = p.y; - this.cb.call(this.scope); - } - return this; - }; - /** - * Copies x and y into the given point - * - * @param {PIXI.IPoint} p - The point to copy. - * @returns {PIXI.IPoint} Given point with values updated - */ - ObservablePoint.prototype.copyTo = function (p) { - p.set(this._x, this._y); - return p; - }; - /** - * Returns true if the given point is equal to this point - * - * @param {PIXI.IPointData} p - The point to check - * @returns {boolean} Whether the given point equal to this point - */ - ObservablePoint.prototype.equals = function (p) { - return (p.x === this._x) && (p.y === this._y); - }; - Object.defineProperty(ObservablePoint.prototype, "x", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * - * @member {number} - */ - get: function () { - return this._x; - }, - set: function (value) { - if (this._x !== value) { - this._x = value; - this.cb.call(this.scope); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ObservablePoint.prototype, "y", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * - * @member {number} - */ - get: function () { - return this._y; - }, - set: function (value) { - if (this._y !== value) { - this._y = value; - this.cb.call(this.scope); - } - }, - enumerable: false, - configurable: true - }); - return ObservablePoint; - }()); - - /** - * The PixiJS Matrix as a class makes it a lot faster. - * - * Here is a representation of it: - * ```js - * | a | c | tx| - * | b | d | ty| - * | 0 | 0 | 1 | - * ``` - * @class - * @memberof PIXI - */ - var Matrix = /** @class */ (function () { - /** - * @param {number} [a=1] - x scale - * @param {number} [b=0] - x skew - * @param {number} [c=0] - y skew - * @param {number} [d=1] - y scale - * @param {number} [tx=0] - x translation - * @param {number} [ty=0] - y translation - */ - function Matrix(a, b, c, d, tx, ty) { - if (a === void 0) { a = 1; } - if (b === void 0) { b = 0; } - if (c === void 0) { c = 0; } - if (d === void 0) { d = 1; } - if (tx === void 0) { tx = 0; } - if (ty === void 0) { ty = 0; } - this.array = null; - /** - * @member {number} - * @default 1 - */ - this.a = a; - /** - * @member {number} - * @default 0 - */ - this.b = b; - /** - * @member {number} - * @default 0 - */ - this.c = c; - /** - * @member {number} - * @default 1 - */ - this.d = d; - /** - * @member {number} - * @default 0 - */ - this.tx = tx; - /** - * @member {number} - * @default 0 - */ - this.ty = ty; - } - /** - * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: - * - * a = array[0] - * b = array[1] - * c = array[3] - * d = array[4] - * tx = array[2] - * ty = array[5] - * - * @param {number[]} array - The array that the matrix will be populated from. - */ - Matrix.prototype.fromArray = function (array) { - this.a = array[0]; - this.b = array[1]; - this.c = array[3]; - this.d = array[4]; - this.tx = array[2]; - this.ty = array[5]; - }; - /** - * sets the matrix properties - * - * @param {number} a - Matrix component - * @param {number} b - Matrix component - * @param {number} c - Matrix component - * @param {number} d - Matrix component - * @param {number} tx - Matrix component - * @param {number} ty - Matrix component - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.set = function (a, b, c, d, tx, ty) { - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.tx = tx; - this.ty = ty; - return this; - }; - /** - * Creates an array from the current Matrix object. - * - * @param {boolean} transpose - Whether we need to transpose the matrix or not - * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out - * @return {number[]} the newly created array which contains the matrix - */ - Matrix.prototype.toArray = function (transpose, out) { - if (!this.array) { - this.array = new Float32Array(9); - } - var array = out || this.array; - if (transpose) { - array[0] = this.a; - array[1] = this.b; - array[2] = 0; - array[3] = this.c; - array[4] = this.d; - array[5] = 0; - array[6] = this.tx; - array[7] = this.ty; - array[8] = 1; - } - else { - array[0] = this.a; - array[1] = this.c; - array[2] = this.tx; - array[3] = this.b; - array[4] = this.d; - array[5] = this.ty; - array[6] = 0; - array[7] = 0; - array[8] = 1; - } - return array; - }; - /** - * Get a new position with the current transformation applied. - * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) - * - * @param {PIXI.IPointData} pos - The origin - * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) - * @return {PIXI.Point} The new point, transformed through this matrix - */ - Matrix.prototype.apply = function (pos, newPos) { - newPos = (newPos || new Point()); - var x = pos.x; - var y = pos.y; - newPos.x = (this.a * x) + (this.c * y) + this.tx; - newPos.y = (this.b * x) + (this.d * y) + this.ty; - return newPos; - }; - /** - * Get a new position with the inverse of the current transformation applied. - * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) - * - * @param {PIXI.IPointData} pos - The origin - * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) - * @return {PIXI.Point} The new point, inverse-transformed through this matrix - */ - Matrix.prototype.applyInverse = function (pos, newPos) { - newPos = (newPos || new Point()); - var id = 1 / ((this.a * this.d) + (this.c * -this.b)); - var x = pos.x; - var y = pos.y; - newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); - newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); - return newPos; - }; - /** - * Translates the matrix on the x and y. - * - * @param {number} x - How much to translate x by - * @param {number} y - How much to translate y by - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.translate = function (x, y) { - this.tx += x; - this.ty += y; - return this; - }; - /** - * Applies a scale transformation to the matrix. - * - * @param {number} x - The amount to scale horizontally - * @param {number} y - The amount to scale vertically - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.scale = function (x, y) { - this.a *= x; - this.d *= y; - this.c *= x; - this.b *= y; - this.tx *= x; - this.ty *= y; - return this; - }; - /** - * Applies a rotation transformation to the matrix. - * - * @param {number} angle - The angle in radians. - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.rotate = function (angle) { - var cos = Math.cos(angle); - var sin = Math.sin(angle); - var a1 = this.a; - var c1 = this.c; - var tx1 = this.tx; - this.a = (a1 * cos) - (this.b * sin); - this.b = (a1 * sin) + (this.b * cos); - this.c = (c1 * cos) - (this.d * sin); - this.d = (c1 * sin) + (this.d * cos); - this.tx = (tx1 * cos) - (this.ty * sin); - this.ty = (tx1 * sin) + (this.ty * cos); - return this; - }; - /** - * Appends the given Matrix to this Matrix. - * - * @param {PIXI.Matrix} matrix - The matrix to append. - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.append = function (matrix) { - var a1 = this.a; - var b1 = this.b; - var c1 = this.c; - var d1 = this.d; - this.a = (matrix.a * a1) + (matrix.b * c1); - this.b = (matrix.a * b1) + (matrix.b * d1); - this.c = (matrix.c * a1) + (matrix.d * c1); - this.d = (matrix.c * b1) + (matrix.d * d1); - this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; - this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; - return this; - }; - /** - * Sets the matrix based on all the available properties - * - * @param {number} x - Position on the x axis - * @param {number} y - Position on the y axis - * @param {number} pivotX - Pivot on the x axis - * @param {number} pivotY - Pivot on the y axis - * @param {number} scaleX - Scale on the x axis - * @param {number} scaleY - Scale on the y axis - * @param {number} rotation - Rotation in radians - * @param {number} skewX - Skew on the x axis - * @param {number} skewY - Skew on the y axis - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { - this.a = Math.cos(rotation + skewY) * scaleX; - this.b = Math.sin(rotation + skewY) * scaleX; - this.c = -Math.sin(rotation - skewX) * scaleY; - this.d = Math.cos(rotation - skewX) * scaleY; - this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); - this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); - return this; - }; - /** - * Prepends the given Matrix to this Matrix. - * - * @param {PIXI.Matrix} matrix - The matrix to prepend - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.prepend = function (matrix) { - var tx1 = this.tx; - if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { - var a1 = this.a; - var c1 = this.c; - this.a = (a1 * matrix.a) + (this.b * matrix.c); - this.b = (a1 * matrix.b) + (this.b * matrix.d); - this.c = (c1 * matrix.a) + (this.d * matrix.c); - this.d = (c1 * matrix.b) + (this.d * matrix.d); - } - this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; - this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; - return this; - }; - /** - * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. - * - * @param {PIXI.Transform} transform - The transform to apply the properties to. - * @return {PIXI.Transform} The transform with the newly applied properties - */ - Matrix.prototype.decompose = function (transform) { - // sort out rotation / skew.. - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var skewX = -Math.atan2(-c, d); - var skewY = Math.atan2(b, a); - var delta = Math.abs(skewX + skewY); - if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { - transform.rotation = skewY; - transform.skew.x = transform.skew.y = 0; - } - else { - transform.rotation = 0; - transform.skew.x = skewX; - transform.skew.y = skewY; - } - // next set scale - transform.scale.x = Math.sqrt((a * a) + (b * b)); - transform.scale.y = Math.sqrt((c * c) + (d * d)); - // next set position - transform.position.x = this.tx; - transform.position.y = this.ty; - return transform; - }; - /** - * Inverts this matrix - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.invert = function () { - var a1 = this.a; - var b1 = this.b; - var c1 = this.c; - var d1 = this.d; - var tx1 = this.tx; - var n = (a1 * d1) - (b1 * c1); - this.a = d1 / n; - this.b = -b1 / n; - this.c = -c1 / n; - this.d = a1 / n; - this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; - this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; - return this; - }; - /** - * Resets this Matrix to an identity (default) matrix. - * - * @return {PIXI.Matrix} This matrix. Good for chaining method calls. - */ - Matrix.prototype.identity = function () { - this.a = 1; - this.b = 0; - this.c = 0; - this.d = 1; - this.tx = 0; - this.ty = 0; - return this; - }; - /** - * Creates a new Matrix object with the same values as this one. - * - * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls. - */ - Matrix.prototype.clone = function () { - var matrix = new Matrix(); - matrix.a = this.a; - matrix.b = this.b; - matrix.c = this.c; - matrix.d = this.d; - matrix.tx = this.tx; - matrix.ty = this.ty; - return matrix; - }; - /** - * Changes the values of the given matrix to be the same as the ones in this matrix - * - * @param {PIXI.Matrix} matrix - The matrix to copy to. - * @return {PIXI.Matrix} The matrix given in parameter with its values updated. - */ - Matrix.prototype.copyTo = function (matrix) { - matrix.a = this.a; - matrix.b = this.b; - matrix.c = this.c; - matrix.d = this.d; - matrix.tx = this.tx; - matrix.ty = this.ty; - return matrix; - }; - /** - * Changes the values of the matrix to be the same as the ones in given matrix - * - * @param {PIXI.Matrix} matrix - The matrix to copy from. - * @return {PIXI.Matrix} this - */ - Matrix.prototype.copyFrom = function (matrix) { - this.a = matrix.a; - this.b = matrix.b; - this.c = matrix.c; - this.d = matrix.d; - this.tx = matrix.tx; - this.ty = matrix.ty; - return this; - }; - Object.defineProperty(Matrix, "IDENTITY", { - /** - * A default (identity) matrix - * - * @static - * @const - * @member {PIXI.Matrix} - */ - get: function () { - return new Matrix(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Matrix, "TEMP_MATRIX", { - /** - * A temp matrix - * - * @static - * @const - * @member {PIXI.Matrix} - */ - get: function () { - return new Matrix(); - }, - enumerable: false, - configurable: true - }); - return Matrix; - }()); - - // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group - /* - * Transform matrix for operation n is: - * | ux | vx | - * | uy | vy | - */ - var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; - var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; - var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; - var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; - /** - * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} - * for the composition of each rotation in the dihederal group D8. - * - * @type number[][] - * @private - */ - var rotationCayley = []; - /** - * Matrices for each `GD8Symmetry` rotation. - * - * @type Matrix[] - * @private - */ - var rotationMatrices = []; - /* - * Alias for {@code Math.sign}. - */ - var signum = Math.sign; - /* - * Initializes `rotationCayley` and `rotationMatrices`. It is called - * only once below. - */ - function init() { - for (var i = 0; i < 16; i++) { - var row = []; - rotationCayley.push(row); - for (var j = 0; j < 16; j++) { - /* Multiplies rotation matrices i and j. */ - var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); - var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); - var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); - var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); - /* Finds rotation matrix matching the product and pushes it. */ - for (var k = 0; k < 16; k++) { - if (ux[k] === _ux && uy[k] === _uy - && vx[k] === _vx && vy[k] === _vy) { - row.push(k); - break; - } - } - } - } - for (var i = 0; i < 16; i++) { - var mat = new Matrix(); - mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); - rotationMatrices.push(mat); - } - } - init(); - /** - * @memberof PIXI - * @typedef {number} GD8Symmetry - * @see PIXI.groupD8 - */ - /** - * Implements the dihedral group D8, which is similar to - * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; - * D8 is the same but with diagonals, and it is used for texture - * rotations. - * - * The directions the U- and V- axes after rotation - * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` - * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. - * - * **Origin:**
- * This is the small part of gameofbombs.com portal system. It works. - * - * @see PIXI.groupD8.E - * @see PIXI.groupD8.SE - * @see PIXI.groupD8.S - * @see PIXI.groupD8.SW - * @see PIXI.groupD8.W - * @see PIXI.groupD8.NW - * @see PIXI.groupD8.N - * @see PIXI.groupD8.NE - * @author Ivan @ivanpopelyshev - * @namespace PIXI.groupD8 - * @memberof PIXI - */ - var groupD8 = { - /** - * | Rotation | Direction | - * |----------|-----------| - * | 0° | East | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - E: 0, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 45°↻ | Southeast | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - SE: 1, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 90°↻ | South | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - S: 2, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 135°↻ | Southwest | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - SW: 3, - /** - * | Rotation | Direction | - * |----------|-----------| - * | 180° | West | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - W: 4, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -135°/225°↻ | Northwest | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - NW: 5, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -90°/270°↻ | North | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - N: 6, - /** - * | Rotation | Direction | - * |-------------|--------------| - * | -45°/315°↻ | Northeast | - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - NE: 7, - /** - * Reflection about Y-axis. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MIRROR_VERTICAL: 8, - /** - * Reflection about the main diagonal. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MAIN_DIAGONAL: 10, - /** - * Reflection about X-axis. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - MIRROR_HORIZONTAL: 12, - /** - * Reflection about reverse diagonal. - * - * @memberof PIXI.groupD8 - * @constant {PIXI.GD8Symmetry} - */ - REVERSE_DIAGONAL: 14, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The X-component of the U-axis - * after rotating the axes. - */ - uX: function (ind) { return ux[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The Y-component of the U-axis - * after rotating the axes. - */ - uY: function (ind) { return uy[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The X-component of the V-axis - * after rotating the axes. - */ - vX: function (ind) { return vx[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. - * @return {PIXI.GD8Symmetry} The Y-component of the V-axis - * after rotating the axes. - */ - vY: function (ind) { return vy[ind]; }, - /** - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite - * is needed. Only rotations have opposite symmetries while - * reflections don't. - * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation` - */ - inv: function (rotation) { - if (rotation & 8) // true only if between 8 & 15 (reflections) - { - return rotation & 15; // or rotation % 16 - } - return (-rotation) & 7; // or (8 - rotation) % 8 - }, - /** - * Composes the two D8 operations. - * - * Taking `^` as reflection: - * - * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | - * |-------|-----|-----|-----|-----|------|-------|-------|-------| - * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | - * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | - * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | - * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | - * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | - * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | - * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | - * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | - * - * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which - * is the row in the above cayley table. - * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which - * is the column in the above cayley table. - * @return {PIXI.GD8Symmetry} Composed operation - */ - add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, - /** - * Reverse of `add`. - * - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotationSecond - Second operation - * @param {PIXI.GD8Symmetry} rotationFirst - First operation - * @return {PIXI.GD8Symmetry} Result - */ - sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, - /** - * Adds 180 degrees to rotation, which is a commutative - * operation. - * - * @memberof PIXI.groupD8 - * @param {number} rotation - The number to rotate. - * @returns {number} Rotated number - */ - rotate180: function (rotation) { return rotation ^ 4; }, - /** - * Checks if the rotation angle is vertical, i.e. south - * or north. It doesn't work for reflections. - * - * @memberof PIXI.groupD8 - * @param {PIXI.GD8Symmetry} rotation - The number to check. - * @returns {boolean} Whether or not the direction is vertical - */ - isVertical: function (rotation) { return (rotation & 3) === 2; }, - /** - * Approximates the vector `V(dx,dy)` into one of the - * eight directions provided by `groupD8`. - * - * @memberof PIXI.groupD8 - * @param {number} dx - X-component of the vector - * @param {number} dy - Y-component of the vector - * @return {PIXI.GD8Symmetry} Approximation of the vector into - * one of the eight symmetries. - */ - byDirection: function (dx, dy) { - if (Math.abs(dx) * 2 <= Math.abs(dy)) { - if (dy >= 0) { - return groupD8.S; - } - return groupD8.N; - } - else if (Math.abs(dy) * 2 <= Math.abs(dx)) { - if (dx > 0) { - return groupD8.E; - } - return groupD8.W; - } - else if (dy > 0) { - if (dx > 0) { - return groupD8.SE; - } - return groupD8.SW; - } - else if (dx > 0) { - return groupD8.NE; - } - return groupD8.NW; - }, - /** - * Helps sprite to compensate texture packer rotation. - * - * @memberof PIXI.groupD8 - * @param {PIXI.Matrix} matrix - sprite world matrix - * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. - * @param {number} tx - sprite anchoring - * @param {number} ty - sprite anchoring - */ - matrixAppendRotationInv: function (matrix, rotation, tx, ty) { - if (tx === void 0) { tx = 0; } - if (ty === void 0) { ty = 0; } - // Packer used "rotation", we use "inv(rotation)" - var mat = rotationMatrices[groupD8.inv(rotation)]; - mat.tx = tx; - mat.ty = ty; - matrix.append(mat); - }, - }; - - /** - * Transform that takes care about its versions - * - * @class - * @memberof PIXI - */ - var Transform = /** @class */ (function () { - function Transform() { - /** - * The world transformation matrix. - * - * @member {PIXI.Matrix} - */ - this.worldTransform = new Matrix(); - /** - * The local transformation matrix. - * - * @member {PIXI.Matrix} - */ - this.localTransform = new Matrix(); - /** - * The coordinate of the object relative to the local coordinates of the parent. - * - * @member {PIXI.ObservablePoint} - */ - this.position = new ObservablePoint(this.onChange, this, 0, 0); - /** - * The scale factor of the object. - * - * @member {PIXI.ObservablePoint} - */ - this.scale = new ObservablePoint(this.onChange, this, 1, 1); - /** - * The pivot point of the displayObject that it rotates around. - * - * @member {PIXI.ObservablePoint} - */ - this.pivot = new ObservablePoint(this.onChange, this, 0, 0); - /** - * The skew amount, on the x and y axis. - * - * @member {PIXI.ObservablePoint} - */ - this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); - /** - * The rotation amount. - * - * @protected - * @member {number} - */ - this._rotation = 0; - /** - * The X-coordinate value of the normalized local X axis, - * the first column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._cx = 1; - /** - * The Y-coordinate value of the normalized local X axis, - * the first column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._sx = 0; - /** - * The X-coordinate value of the normalized local Y axis, - * the second column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._cy = 0; - /** - * The Y-coordinate value of the normalized local Y axis, - * the second column of the local transformation matrix without a scale. - * - * @protected - * @member {number} - */ - this._sy = 1; - /** - * The locally unique ID of the local transform. - * - * @protected - * @member {number} - */ - this._localID = 0; - /** - * The locally unique ID of the local transform - * used to calculate the current local transformation matrix. - * - * @protected - * @member {number} - */ - this._currentLocalID = 0; - /** - * The locally unique ID of the world transform. - * - * @protected - * @member {number} - */ - this._worldID = 0; - /** - * The locally unique ID of the parent's world transform - * used to calculate the current world transformation matrix. - * - * @protected - * @member {number} - */ - this._parentID = 0; - } - /** - * Called when a value changes. - * - * @protected - */ - Transform.prototype.onChange = function () { - this._localID++; - }; - /** - * Called when the skew or the rotation changes. - * - * @protected - */ - Transform.prototype.updateSkew = function () { - this._cx = Math.cos(this._rotation + this.skew.y); - this._sx = Math.sin(this._rotation + this.skew.y); - this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 - this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 - this._localID++; - }; - /** - * Updates the local transformation matrix. - */ - Transform.prototype.updateLocalTransform = function () { - var lt = this.localTransform; - if (this._localID !== this._currentLocalID) { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cx * this.scale.x; - lt.b = this._sx * this.scale.x; - lt.c = this._cy * this.scale.y; - lt.d = this._sy * this.scale.y; - lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); - lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); - this._currentLocalID = this._localID; - // force an update.. - this._parentID = -1; - } - }; - /** - * Updates the local and the world transformation matrices. - * - * @param {PIXI.Transform} parentTransform - The parent transform - */ - Transform.prototype.updateTransform = function (parentTransform) { - var lt = this.localTransform; - if (this._localID !== this._currentLocalID) { - // get the matrix values of the displayobject based on its transform properties.. - lt.a = this._cx * this.scale.x; - lt.b = this._sx * this.scale.x; - lt.c = this._cy * this.scale.y; - lt.d = this._sy * this.scale.y; - lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); - lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); - this._currentLocalID = this._localID; - // force an update.. - this._parentID = -1; - } - if (this._parentID !== parentTransform._worldID) { - // concat the parent matrix with the objects transform. - var pt = parentTransform.worldTransform; - var wt = this.worldTransform; - wt.a = (lt.a * pt.a) + (lt.b * pt.c); - wt.b = (lt.a * pt.b) + (lt.b * pt.d); - wt.c = (lt.c * pt.a) + (lt.d * pt.c); - wt.d = (lt.c * pt.b) + (lt.d * pt.d); - wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx; - wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty; - this._parentID = parentTransform._worldID; - // update the id of the transform.. - this._worldID++; - } - }; - /** - * Decomposes a matrix and sets the transforms properties based on it. - * - * @param {PIXI.Matrix} matrix - The matrix to decompose - */ - Transform.prototype.setFromMatrix = function (matrix) { - matrix.decompose(this); - this._localID++; - }; - Object.defineProperty(Transform.prototype, "rotation", { - /** - * The rotation of the object in radians. - * - * @member {number} - */ - get: function () { - return this._rotation; - }, - set: function (value) { - if (this._rotation !== value) { - this._rotation = value; - this.updateSkew(); - } - }, - enumerable: false, - configurable: true - }); - /** - * A default (identity) transform - * - * @static - * @constant - * @member {PIXI.Transform} - */ - Transform.IDENTITY = new Transform(); - return Transform; - }()); - - /*! - * @pixi/display - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/display is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Sets the default value for the container property 'sortableChildren'. - * If set to true, the container will sort its children by zIndex value - * when updateTransform() is called, or manually if sortChildren() is called. - * - * This actually changes the order of elements in the array, so should be treated - * as a basic solution that is not performant compared to other solutions, - * such as @link https://github.com/pixijs/pixi-display - * - * Also be aware of that this may not work nicely with the addChildAt() function, - * as the zIndex sorting may cause the child to automatically sorted to another position. - * - * @static - * @constant - * @name SORTABLE_CHILDREN - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - settings.SORTABLE_CHILDREN = false; - - /** - * 'Builder' pattern for bounds rectangles. - * - * This could be called an Axis-Aligned Bounding Box. - * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. - * - * @class - * @memberof PIXI - */ - var Bounds = /** @class */ (function () { - function Bounds() { - /** - * @member {number} - * @default 0 - */ - this.minX = Infinity; - /** - * @member {number} - * @default 0 - */ - this.minY = Infinity; - /** - * @member {number} - * @default 0 - */ - this.maxX = -Infinity; - /** - * @member {number} - * @default 0 - */ - this.maxY = -Infinity; - this.rect = null; - /** - * It is updated to _boundsID of corresponding object to keep bounds in sync with content. - * Updated from outside, thus public modifier. - * - * @member {number} - * @public - */ - this.updateID = -1; - } - /** - * Checks if bounds are empty. - * - * @return {boolean} True if empty. - */ - Bounds.prototype.isEmpty = function () { - return this.minX > this.maxX || this.minY > this.maxY; - }; - /** - * Clears the bounds and resets. - * - */ - Bounds.prototype.clear = function () { - this.minX = Infinity; - this.minY = Infinity; - this.maxX = -Infinity; - this.maxY = -Infinity; - }; - /** - * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle - * It is not guaranteed that it will return tempRect - * - * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty - * @returns {PIXI.Rectangle} A rectangle of the bounds - */ - Bounds.prototype.getRectangle = function (rect) { - if (this.minX > this.maxX || this.minY > this.maxY) { - return Rectangle.EMPTY; - } - rect = rect || new Rectangle(0, 0, 1, 1); - rect.x = this.minX; - rect.y = this.minY; - rect.width = this.maxX - this.minX; - rect.height = this.maxY - this.minY; - return rect; - }; - /** - * This function should be inlined when its possible. - * - * @param {PIXI.IPointData} point - The point to add. - */ - Bounds.prototype.addPoint = function (point) { - this.minX = Math.min(this.minX, point.x); - this.maxX = Math.max(this.maxX, point.x); - this.minY = Math.min(this.minY, point.y); - this.maxY = Math.max(this.maxY, point.y); - }; - /** - * Adds a quad, not transformed - * - * @param {Float32Array} vertices - The verts to add. - */ - Bounds.prototype.addQuad = function (vertices) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - var x = vertices[0]; - var y = vertices[1]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[2]; - y = vertices[3]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[4]; - y = vertices[5]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = vertices[6]; - y = vertices[7]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds sprite frame, transformed. - * - * @param {PIXI.Transform} transform - transform to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { - this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); - }; - /** - * Adds sprite frame, multiplied by matrix - * - * @param {PIXI.Matrix} matrix - matrix to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - var x = (a * x0) + (c * y0) + tx; - var y = (b * x0) + (d * y0) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x1) + (c * y0) + tx; - y = (b * x1) + (d * y0) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x0) + (c * y1) + tx; - y = (b * x0) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - x = (a * x1) + (c * y1) + tx; - y = (b * x1) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds screen vertices from array - * - * @param {Float32Array} vertexData - calculated vertices - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - for (var i = beginOffset; i < endOffset; i += 2) { - var x = vertexData[i]; - var y = vertexData[i + 1]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Add an array of mesh vertices - * - * @param {PIXI.Transform} transform - mesh transform - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { - this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); - }; - /** - * Add an array of mesh vertices. - * - * @param {PIXI.Matrix} matrix - mesh matrix - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - * @param {number} [padX=0] - x padding - * @param {number} [padY=0] - y padding - */ - Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { - if (padX === void 0) { padX = 0; } - if (padY === void 0) { padY = padX; } - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - for (var i = beginOffset; i < endOffset; i += 2) { - var rawX = vertices[i]; - var rawY = vertices[i + 1]; - var x = (a * rawX) + (c * rawY) + tx; - var y = (d * rawY) + (b * rawX) + ty; - minX = Math.min(minX, x - padX); - maxX = Math.max(maxX, x + padX); - minY = Math.min(minY, y - padY); - maxY = Math.max(maxY, y + padY); - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - /** - * Adds other Bounds. - * - * @param {PIXI.Bounds} bounds - The Bounds to be added - */ - Bounds.prototype.addBounds = function (bounds) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = bounds.minX < minX ? bounds.minX : minX; - this.minY = bounds.minY < minY ? bounds.minY : minY; - this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; - this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; - }; - /** - * Adds other Bounds, masked with Bounds. - * - * @param {PIXI.Bounds} bounds - The Bounds to be added. - * @param {PIXI.Bounds} mask - TODO - */ - Bounds.prototype.addBoundsMask = function (bounds, mask) { - var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; - var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; - var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; - var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; - if (_minX <= _maxX && _minY <= _maxY) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - /** - * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. - * - * @param {PIXI.Bounds} bounds - other bounds - * @param {PIXI.Matrix} matrix - multiplicator - */ - Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { - this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); - }; - /** - * Adds other Bounds, masked with Rectangle. - * - * @param {PIXI.Bounds} bounds - TODO - * @param {PIXI.Rectangle} area - TODO - */ - Bounds.prototype.addBoundsArea = function (bounds, area) { - var _minX = bounds.minX > area.x ? bounds.minX : area.x; - var _minY = bounds.minY > area.y ? bounds.minY : area.y; - var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); - var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); - if (_minX <= _maxX && _minY <= _maxY) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - /** - * Pads bounds object, making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - */ - Bounds.prototype.pad = function (paddingX, paddingY) { - if (paddingX === void 0) { paddingX = 0; } - if (paddingY === void 0) { paddingY = paddingX; } - if (!this.isEmpty()) { - this.minX -= paddingX; - this.maxX += paddingX; - this.minY -= paddingY; - this.maxY += paddingY; - } - }; - /** - * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) - * - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - * @param {number} padX - padding X - * @param {number} padY - padding Y - */ - Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { - x0 -= padX; - y0 -= padY; - x1 += padX; - y1 += padY; - this.minX = this.minX < x0 ? this.minX : x0; - this.maxX = this.maxX > x1 ? this.maxX : x1; - this.minY = this.minY < y0 ? this.minY : y0; - this.maxY = this.maxY > y1 ? this.maxY : y1; - }; - return Bounds; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * The base class for all objects that are rendered on the screen. - * - * This is an abstract class and should not be used on its own; rather it should b e extended. - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var DisplayObject = /** @class */ (function (_super) { - __extends(DisplayObject, _super); - function DisplayObject() { - var _this = _super.call(this) || this; - _this.tempDisplayObjectParent = null; - // TODO: need to create Transform from factory - /** - * World transform and local transform of this object. - * This will become read-only later, please do not assign anything there unless you know what are you doing. - * - * @member {PIXI.Transform} - */ - _this.transform = new Transform(); - /** - * The opacity of the object. - * - * @member {number} - */ - _this.alpha = 1; - /** - * The visibility of the object. If false the object will not be drawn, and - * the updateTransform function will not be called. - * - * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually. - * - * @member {boolean} - */ - _this.visible = true; - /** - * Can this object be rendered, if false the object will not be drawn but the updateTransform - * methods will still be called. - * - * Only affects recursive calls from parent. You can ask for bounds manually. - * - * @member {boolean} - */ - _this.renderable = true; - /** - * The display object container that contains this display object. - * - * @member {PIXI.Container} - */ - _this.parent = null; - /** - * The multiplied alpha of the displayObject. - * - * @member {number} - * @readonly - */ - _this.worldAlpha = 1; - /** - * Which index in the children array the display component was before the previous zIndex sort. - * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. - * - * @member {number} - * @protected - */ - _this._lastSortedIndex = 0; - /** - * The zIndex of the displayObject. - * A higher value will mean it will be rendered on top of other displayObjects within the same container. - * - * @member {number} - * @protected - */ - _this._zIndex = 0; - /** - * The area the filter is applied to. This is used as more of an optimization - * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle. - * - * Also works as an interaction mask. - * - * @member {?PIXI.Rectangle} - */ - _this.filterArea = null; - /** - * Sets the filters for the displayObject. - * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * To remove filters simply set this property to `'null'`. - * - * @member {?PIXI.Filter[]} - */ - _this.filters = null; - /** - * Currently enabled filters - * @member {PIXI.Filter[]} - * @protected - */ - _this._enabledFilters = null; - /** - * The bounds object, this is used to calculate and store the bounds of the displayObject. - * - * @member {PIXI.Bounds} - */ - _this._bounds = new Bounds(); - /** - * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. - * - * @member {PIXI.Bounds} - */ - _this._localBounds = null; - /** - * Flags the cached bounds as dirty. - * - * @member {number} - * @protected - */ - _this._boundsID = 0; - /** - * Cache of this display-object's bounds-rectangle. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._boundsRect = null; - /** - * Cache of this display-object's local-bounds rectangle. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._localBoundsRect = null; - /** - * The original, cached mask of the object. - * - * @member {PIXI.Container|PIXI.MaskData|null} - * @protected - */ - _this._mask = null; - /** - * Fired when this DisplayObject is added to a Container. - * - * @event PIXI.DisplayObject#added - * @param {PIXI.Container} container - The container added to. - */ - /** - * Fired when this DisplayObject is removed from a Container. - * - * @event PIXI.DisplayObject#removed - * @param {PIXI.Container} container - The container removed from. - */ - /** - * If the object has been destroyed via destroy(). If true, it should not be used. - * - * @member {boolean} - * @protected - */ - _this._destroyed = false; - /** - * used to fast check if a sprite is.. a sprite! - * @member {boolean} - */ - _this.isSprite = false; - /** - * Does any other displayObject use this object as a mask? - * @member {boolean} - */ - _this.isMask = false; - return _this; - } - /** - * Mixes all enumerable properties and methods from a source object to DisplayObject. - * - * @param {object} source - The source of properties and methods to mix in. - */ - DisplayObject.mixin = function (source) { - // in ES8/ES2017, this would be really easy: - // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); - // get all the enumerable property keys - var keys = Object.keys(source); - // loop through properties - for (var i = 0; i < keys.length; ++i) { - var propertyName = keys[i]; - // Set the property using the property descriptor - this works for accessors and normal value properties - Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); - } - }; - /** - * Recursively updates transform of all objects from the root to this one - * internal function for toLocal() - */ - DisplayObject.prototype._recursivePostUpdateTransform = function () { - if (this.parent) { - this.parent._recursivePostUpdateTransform(); - this.transform.updateTransform(this.parent.transform); - } - else { - this.transform.updateTransform(this._tempDisplayObjectParent.transform); - } - }; - /** - * Updates the object transform for rendering. - * - * TODO - Optimization pass! - */ - DisplayObject.prototype.updateTransform = function () { - this._boundsID++; - this.transform.updateTransform(this.parent.transform); - // multiply the alphas.. - this.worldAlpha = this.alpha * this.parent.worldAlpha; - }; - /** - * Retrieves the bounds of the displayObject as a rectangle object. - * - * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from - * being updated. This means the calculation returned MAY be out of date BUT will give you a - * nice performance boost. - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - DisplayObject.prototype.getBounds = function (skipUpdate, rect) { - if (!skipUpdate) { - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.updateTransform(); - this.parent = null; - } - else { - this._recursivePostUpdateTransform(); - this.updateTransform(); - } - } - if (this._bounds.updateID !== this._boundsID) { - this.calculateBounds(); - this._bounds.updateID = this._boundsID; - } - if (!rect) { - if (!this._boundsRect) { - this._boundsRect = new Rectangle(); - } - rect = this._boundsRect; - } - return this._bounds.getRectangle(rect); - }; - /** - * Retrieves the local bounds of the displayObject as a rectangle object. - * - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - DisplayObject.prototype.getLocalBounds = function (rect) { - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - if (!this._localBounds) { - this._localBounds = new Bounds(); - } - var transformRef = this.transform; - var parentRef = this.parent; - this.parent = null; - this.transform = this._tempDisplayObjectParent.transform; - var worldBounds = this._bounds; - var worldBoundsID = this._boundsID; - this._bounds = this._localBounds; - var bounds = this.getBounds(false, rect); - this.parent = parentRef; - this.transform = transformRef; - this._bounds = worldBounds; - this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects - return bounds; - }; - /** - * Calculates the global position of the display object. - * - * @param {PIXI.IPointData} position - The world origin to calculate from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional - * (otherwise will create a new Point). - * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.Point} A point object representing the position of this object. - */ - DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { - if (skipUpdate === void 0) { skipUpdate = false; } - if (!skipUpdate) { - this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. - // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly - // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.displayObjectUpdateTransform(); - this.parent = null; - } - else { - this.displayObjectUpdateTransform(); - } - } - // don't need to update the lot - return this.worldTransform.apply(position, point); - }; - /** - * Calculates the local position of the display object relative to another point. - * - * @param {PIXI.IPointData} position - The world origin to calculate from. - * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional - * (otherwise will create a new Point). - * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.Point} A point object representing the position of this object - */ - DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { - if (from) { - position = from.toGlobal(position, point, skipUpdate); - } - if (!skipUpdate) { - this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. - // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly - // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) { - this.parent = this._tempDisplayObjectParent; - this.displayObjectUpdateTransform(); - this.parent = null; - } - else { - this.displayObjectUpdateTransform(); - } - } - // simply apply the matrix.. - return this.worldTransform.applyInverse(position, point); - }; - /** - * Set the parent Container of this DisplayObject. - * - * @param {PIXI.Container} container - The Container to add this DisplayObject to. - * @return {PIXI.Container} The Container that this DisplayObject was added to. - */ - DisplayObject.prototype.setParent = function (container) { - if (!container || !container.addChild) { - throw new Error('setParent: Argument must be a Container'); - } - container.addChild(this); - return container; - }; - /** - * Convenience function to set the position, scale, skew and pivot at once. - * - * @param {number} [x=0] - The X position - * @param {number} [y=0] - The Y position - * @param {number} [scaleX=1] - The X scale value - * @param {number} [scaleY=1] - The Y scale value - * @param {number} [rotation=0] - The rotation - * @param {number} [skewX=0] - The X skew value - * @param {number} [skewY=0] - The Y skew value - * @param {number} [pivotX=0] - The X pivot value - * @param {number} [pivotY=0] - The Y pivot value - * @return {PIXI.DisplayObject} The DisplayObject instance - */ - DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (scaleX === void 0) { scaleX = 1; } - if (scaleY === void 0) { scaleY = 1; } - if (rotation === void 0) { rotation = 0; } - if (skewX === void 0) { skewX = 0; } - if (skewY === void 0) { skewY = 0; } - if (pivotX === void 0) { pivotX = 0; } - if (pivotY === void 0) { pivotY = 0; } - this.position.x = x; - this.position.y = y; - this.scale.x = !scaleX ? 1 : scaleX; - this.scale.y = !scaleY ? 1 : scaleY; - this.rotation = rotation; - this.skew.x = skewX; - this.skew.y = skewY; - this.pivot.x = pivotX; - this.pivot.y = pivotY; - return this; - }; - /** - * Base destroy method for generic display objects. This will automatically - * remove the display object from its parent Container as well as remove - * all current event listeners and internal references. Do not use a DisplayObject - * after calling `destroy()`. - * - */ - DisplayObject.prototype.destroy = function (_options) { - if (this.parent) { - this.parent.removeChild(this); - } - this.removeAllListeners(); - this.transform = null; - this.parent = null; - this._bounds = null; - this._mask = null; - this.filters = null; - this.filterArea = null; - this.hitArea = null; - this.interactive = false; - this.interactiveChildren = false; - this._destroyed = true; - }; - Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { - /** - * @protected - * @member {PIXI.Container} - */ - get: function () { - if (this.tempDisplayObjectParent === null) { - // eslint-disable-next-line no-use-before-define - this.tempDisplayObjectParent = new TemporaryDisplayObject(); - } - return this.tempDisplayObjectParent; - }, - enumerable: false, - configurable: true - }); - /** - * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root - * - * ``` - * const cacheParent = elem.enableTempParent(); - * elem.updateTransform(); - * elem.disableTempParent(cacheParent); - * ``` - * - * @returns {PIXI.DisplayObject} current parent - */ - DisplayObject.prototype.enableTempParent = function () { - var myParent = this.parent; - this.parent = this._tempDisplayObjectParent; - return myParent; - }; - /** - * Pair method for `enableTempParent` - * @param {PIXI.DisplayObject} cacheParent actual parent of element - */ - DisplayObject.prototype.disableTempParent = function (cacheParent) { - this.parent = cacheParent; - }; - Object.defineProperty(DisplayObject.prototype, "x", { - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * An alias to position.x - * - * @member {number} - */ - get: function () { - return this.position.x; - }, - set: function (value) { - this.transform.position.x = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "y", { - /** - * The position of the displayObject on the y axis relative to the local coordinates of the parent. - * An alias to position.y - * - * @member {number} - */ - get: function () { - return this.position.y; - }, - set: function (value) { - this.transform.position.y = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "worldTransform", { - /** - * Current transform of the object based on world (parent) factors. - * - * @member {PIXI.Matrix} - * @readonly - */ - get: function () { - return this.transform.worldTransform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "localTransform", { - /** - * Current transform of the object based on local factors: position, scale, other stuff. - * - * @member {PIXI.Matrix} - * @readonly - */ - get: function () { - return this.transform.localTransform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "position", { - /** - * The coordinate of the object relative to the local coordinates of the parent. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.position; - }, - set: function (value) { - this.transform.position.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "scale", { - /** - * The scale factor of the object. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.scale; - }, - set: function (value) { - this.transform.scale.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "pivot", { - /** - * The pivot point of the displayObject that it rotates around. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.pivot; - }, - set: function (value) { - this.transform.pivot.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "skew", { - /** - * The skew factor for the object in radians. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.transform.skew; - }, - set: function (value) { - this.transform.skew.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "rotation", { - /** - * The rotation of the object in radians. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - get: function () { - return this.transform.rotation; - }, - set: function (value) { - this.transform.rotation = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "angle", { - /** - * The angle of the object in degrees. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - get: function () { - return this.transform.rotation * RAD_TO_DEG; - }, - set: function (value) { - this.transform.rotation = value * DEG_TO_RAD; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "zIndex", { - /** - * The zIndex of the displayObject. - * If a container has the sortableChildren property set to true, children will be automatically - * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, - * and thus rendered on top of other displayObjects within the same container. - * - * @member {number} - */ - get: function () { - return this._zIndex; - }, - set: function (value) { - this._zIndex = value; - if (this.parent) { - this.parent.sortDirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "worldVisible", { - /** - * Indicates if the object is globally visible. - * - * @member {boolean} - * @readonly - */ - get: function () { - var item = this; - do { - if (!item.visible) { - return false; - } - item = item.parent; - } while (item); - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DisplayObject.prototype, "mask", { - /** - * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PixiJS a regular mask must be a - * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it - * utilities shape clipping. To remove a mask, set this property to `null`. - * - * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. - * @example - * const graphics = new PIXI.Graphics(); - * graphics.beginFill(0xFF3300); - * graphics.drawRect(50, 250, 100, 100); - * graphics.endFill(); - * - * const sprite = new PIXI.Sprite(texture); - * sprite.mask = graphics; - * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. - * - * @member {PIXI.Container|PIXI.MaskData|null} - */ - get: function () { - return this._mask; - }, - set: function (value) { - if (this._mask) { - var maskObject = (this._mask.maskObject || this._mask); - maskObject.renderable = true; - maskObject.isMask = false; - } - this._mask = value; - if (this._mask) { - var maskObject = (this._mask.maskObject || this._mask); - maskObject.renderable = false; - maskObject.isMask = true; - } - }, - enumerable: false, - configurable: true - }); - return DisplayObject; - }(eventemitter3)); - var TemporaryDisplayObject = /** @class */ (function (_super) { - __extends(TemporaryDisplayObject, _super); - function TemporaryDisplayObject() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.sortDirty = null; - return _this; - } - return TemporaryDisplayObject; - }(DisplayObject)); - /** - * DisplayObject default updateTransform, does not update children of container. - * Will crash if there's no parent element. - * - * @memberof PIXI.DisplayObject# - * @function displayObjectUpdateTransform - */ - DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; - - function sortChildren(a, b) { - if (a.zIndex === b.zIndex) { - return a._lastSortedIndex - b._lastSortedIndex; - } - return a.zIndex - b.zIndex; - } - /** - * A Container represents a collection of display objects. - * - * It is the base class of all display objects that act as a container for other objects (like Sprites). - * - *```js - * let container = new PIXI.Container(); - * container.addChild(sprite); - * ``` - * - * @class - * @extends PIXI.DisplayObject - * @memberof PIXI - */ - var Container = /** @class */ (function (_super) { - __extends(Container, _super); - function Container() { - var _this = _super.call(this) || this; - /** - * The array of children of this container. - * - * @member {PIXI.DisplayObject[]} - * @readonly - */ - _this.children = []; - /** - * If set to true, the container will sort its children by zIndex value - * when updateTransform() is called, or manually if sortChildren() is called. - * - * This actually changes the order of elements in the array, so should be treated - * as a basic solution that is not performant compared to other solutions, - * such as @link https://github.com/pixijs/pixi-display - * - * Also be aware of that this may not work nicely with the addChildAt() function, - * as the zIndex sorting may cause the child to automatically sorted to another position. - * - * @see PIXI.settings.SORTABLE_CHILDREN - * - * @member {boolean} - */ - _this.sortableChildren = settings.SORTABLE_CHILDREN; - /** - * Should children be sorted by zIndex at the next updateTransform call. - * Will get automatically set to true if a new child is added, or if a child's zIndex changes. - * - * @member {boolean} - */ - _this.sortDirty = false; - return _this; - /** - * Fired when a DisplayObject is added to this Container. - * - * @event PIXI.Container#childAdded - * @param {PIXI.DisplayObject} child - The child added to the Container. - * @param {PIXI.Container} container - The container that added the child. - * @param {number} index - The children's index of the added child. - */ - /** - * Fired when a DisplayObject is removed from this Container. - * - * @event PIXI.DisplayObject#removedFrom - * @param {PIXI.DisplayObject} child - The child removed from the Container. - * @param {PIXI.Container} container - The container that removed removed the child. - * @param {number} index - The former children's index of the removed child - */ - } - /** - * Overridable method that can be used by Container subclasses whenever the children array is modified - * - * @protected - */ - Container.prototype.onChildrenChange = function (_length) { - /* empty */ - }; - /** - * Adds one or more children to the container. - * - * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` - * - * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container - * @return {PIXI.DisplayObject} The first child that was added. - */ - Container.prototype.addChild = function () { - var arguments$1 = arguments; - - var children = []; - for (var _i = 0; _i < arguments.length; _i++) { - children[_i] = arguments$1[_i]; - } - // if there is only one argument we can bypass looping through the them - if (children.length > 1) { - // loop through the array and add all children - for (var i = 0; i < children.length; i++) { - // eslint-disable-next-line prefer-rest-params - this.addChild(children[i]); - } - } - else { - var child = children[0]; - // if the child has a parent then lets remove it as PixiJS objects can only exist in one place - if (child.parent) { - child.parent.removeChild(child); - } - child.parent = this; - this.sortDirty = true; - // ensure child transform will be recalculated - child.transform._parentID = -1; - this.children.push(child); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(this.children.length - 1); - this.emit('childAdded', child, this, this.children.length - 1); - child.emit('added', this); - } - return children[0]; - }; - /** - * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown - * - * @param {PIXI.DisplayObject} child - The child to add - * @param {number} index - The index to place the child in - * @return {PIXI.DisplayObject} The child that was added. - */ - Container.prototype.addChildAt = function (child, index) { - if (index < 0 || index > this.children.length) { - throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); - } - if (child.parent) { - child.parent.removeChild(child); - } - child.parent = this; - this.sortDirty = true; - // ensure child transform will be recalculated - child.transform._parentID = -1; - this.children.splice(index, 0, child); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('added', this); - this.emit('childAdded', child, this, index); - return child; - }; - /** - * Swaps the position of 2 Display Objects within this container. - * - * @param {PIXI.DisplayObject} child - First display object to swap - * @param {PIXI.DisplayObject} child2 - Second display object to swap - */ - Container.prototype.swapChildren = function (child, child2) { - if (child === child2) { - return; - } - var index1 = this.getChildIndex(child); - var index2 = this.getChildIndex(child2); - this.children[index1] = child2; - this.children[index2] = child; - this.onChildrenChange(index1 < index2 ? index1 : index2); - }; - /** - * Returns the index position of a child DisplayObject instance - * - * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify - * @return {number} The index position of the child display object to identify - */ - Container.prototype.getChildIndex = function (child) { - var index = this.children.indexOf(child); - if (index === -1) { - throw new Error('The supplied DisplayObject must be a child of the caller'); - } - return index; - }; - /** - * Changes the position of an existing child in the display object container - * - * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number - * @param {number} index - The resulting index number for the child display object - */ - Container.prototype.setChildIndex = function (child, index) { - if (index < 0 || index >= this.children.length) { - throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); - } - var currentIndex = this.getChildIndex(child); - removeItems(this.children, currentIndex, 1); // remove from old position - this.children.splice(index, 0, child); // add at new position - this.onChildrenChange(index); - }; - /** - * Returns the child at the specified index - * - * @param {number} index - The index to get the child at - * @return {PIXI.DisplayObject} The child at the given index, if any. - */ - Container.prototype.getChildAt = function (index) { - if (index < 0 || index >= this.children.length) { - throw new Error("getChildAt: Index (" + index + ") does not exist."); - } - return this.children[index]; - }; - /** - * Removes one or more children from the container. - * - * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove - * @return {PIXI.DisplayObject} The first child that was removed. - */ - Container.prototype.removeChild = function () { - var arguments$1 = arguments; - - var children = []; - for (var _i = 0; _i < arguments.length; _i++) { - children[_i] = arguments$1[_i]; - } - // if there is only one argument we can bypass looping through the them - if (children.length > 1) { - // loop through the arguments property and remove all children - for (var i = 0; i < children.length; i++) { - this.removeChild(children[i]); - } - } - else { - var child = children[0]; - var index = this.children.indexOf(child); - if (index === -1) - { return null; } - child.parent = null; - // ensure child transform will be recalculated - child.transform._parentID = -1; - removeItems(this.children, index, 1); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('removed', this); - this.emit('childRemoved', child, this, index); - } - return children[0]; - }; - /** - * Removes a child from the specified index position. - * - * @param {number} index - The index to get the child from - * @return {PIXI.DisplayObject} The child that was removed. - */ - Container.prototype.removeChildAt = function (index) { - var child = this.getChildAt(index); - // ensure child transform will be recalculated.. - child.parent = null; - child.transform._parentID = -1; - removeItems(this.children, index, 1); - // ensure bounds will be recalculated - this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! - this.onChildrenChange(index); - child.emit('removed', this); - this.emit('childRemoved', child, this, index); - return child; - }; - /** - * Removes all children from this container that are within the begin and end indexes. - * - * @param {number} [beginIndex=0] - The beginning position. - * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container. - * @returns {PIXI.DisplayObject[]} List of removed children - */ - Container.prototype.removeChildren = function (beginIndex, endIndex) { - if (beginIndex === void 0) { beginIndex = 0; } - if (endIndex === void 0) { endIndex = this.children.length; } - var begin = beginIndex; - var end = endIndex; - var range = end - begin; - var removed; - if (range > 0 && range <= end) { - removed = this.children.splice(begin, range); - for (var i = 0; i < removed.length; ++i) { - removed[i].parent = null; - if (removed[i].transform) { - removed[i].transform._parentID = -1; - } - } - this._boundsID++; - this.onChildrenChange(beginIndex); - for (var i = 0; i < removed.length; ++i) { - removed[i].emit('removed', this); - this.emit('childRemoved', removed[i], this, i); - } - return removed; - } - else if (range === 0 && this.children.length === 0) { - return []; - } - throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); - }; - /** - * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex. - */ - Container.prototype.sortChildren = function () { - var sortRequired = false; - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - child._lastSortedIndex = i; - if (!sortRequired && child.zIndex !== 0) { - sortRequired = true; - } - } - if (sortRequired && this.children.length > 1) { - this.children.sort(sortChildren); - } - this.sortDirty = false; - }; - /** - * Updates the transform on all children of this container for rendering - */ - Container.prototype.updateTransform = function () { - if (this.sortableChildren && this.sortDirty) { - this.sortChildren(); - } - this._boundsID++; - this.transform.updateTransform(this.parent.transform); - // TODO: check render flags, how to process stuff here - this.worldAlpha = this.alpha * this.parent.worldAlpha; - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - if (child.visible) { - child.updateTransform(); - } - } - }; - /** - * Recalculates the bounds of the container. - * - */ - Container.prototype.calculateBounds = function () { - this._bounds.clear(); - this._calculateBounds(); - for (var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if (!child.visible || !child.renderable) { - continue; - } - child.calculateBounds(); - // TODO: filter+mask, need to mask both somehow - if (child._mask) { - var maskObject = (child._mask.maskObject || child._mask); - maskObject.calculateBounds(); - this._bounds.addBoundsMask(child._bounds, maskObject._bounds); - } - else if (child.filterArea) { - this._bounds.addBoundsArea(child._bounds, child.filterArea); - } - else { - this._bounds.addBounds(child._bounds); - } - } - this._bounds.updateID = this._boundsID; - }; - /** - * Retrieves the local bounds of the displayObject as a rectangle object. - * - * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. - * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms, - * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. - * @return {PIXI.Rectangle} The rectangular bounding area. - */ - Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { - if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } - var result = _super.prototype.getLocalBounds.call(this, rect); - if (!skipChildrenUpdate) { - for (var i = 0, j = this.children.length; i < j; ++i) { - var child = this.children[i]; - if (child.visible) { - child.updateTransform(); - } - } - } - return result; - }; - /** - * Recalculates the bounds of the object. Override this to - * calculate the bounds of the specific object (not including children). - * - * @protected - */ - Container.prototype._calculateBounds = function () { - // FILL IN// - }; - /** - * Renders the object using the WebGL renderer - * - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype.render = function (renderer) { - // if the object is not visible or the alpha is 0 then no need to render this element - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - // do a quick check to see if this element has a mask or a filter. - if (this._mask || (this.filters && this.filters.length)) { - this.renderAdvanced(renderer); - } - else { - this._render(renderer); - // simple render children! - for (var i = 0, j = this.children.length; i < j; ++i) { - this.children[i].render(renderer); - } - } - }; - /** - * Render the object using the WebGL renderer and advanced features. - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype.renderAdvanced = function (renderer) { - renderer.batch.flush(); - var filters = this.filters; - var mask = this._mask; - // push filter first as we need to ensure the stencil buffer is correct for any masking - if (filters) { - if (!this._enabledFilters) { - this._enabledFilters = []; - } - this._enabledFilters.length = 0; - for (var i = 0; i < filters.length; i++) { - if (filters[i].enabled) { - this._enabledFilters.push(filters[i]); - } - } - if (this._enabledFilters.length) { - renderer.filter.push(this, this._enabledFilters); - } - } - if (mask) { - renderer.mask.push(this, this._mask); - } - // add this object to the batch, only rendered if it has a texture. - this._render(renderer); - // now loop through the children and make sure they get rendered - for (var i = 0, j = this.children.length; i < j; i++) { - this.children[i].render(renderer); - } - renderer.batch.flush(); - if (mask) { - renderer.mask.pop(this); - } - if (filters && this._enabledFilters && this._enabledFilters.length) { - renderer.filter.pop(); - } - }; - /** - * To be overridden by the subclasses. - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Container.prototype._render = function (_renderer) { - // this is where content itself gets rendered... - }; - /** - * Removes all internal references and listeners as well as removes children from the display list. - * Do not use a Container after calling `destroy`. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - Container.prototype.destroy = function (options) { - _super.prototype.destroy.call(this); - this.sortDirty = false; - var destroyChildren = typeof options === 'boolean' ? options : options && options.children; - var oldChildren = this.removeChildren(0, this.children.length); - if (destroyChildren) { - for (var i = 0; i < oldChildren.length; ++i) { - oldChildren[i].destroy(options); - } - } - }; - Object.defineProperty(Container.prototype, "width", { - /** - * The width of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this.scale.x * this.getLocalBounds().width; - }, - set: function (value) { - var width = this.getLocalBounds().width; - if (width !== 0) { - this.scale.x = value / width; - } - else { - this.scale.x = 1; - } - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Container.prototype, "height", { - /** - * The height of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this.scale.y * this.getLocalBounds().height; - }, - set: function (value) { - var height = this.getLocalBounds().height; - if (height !== 0) { - this.scale.y = value / height; - } - else { - this.scale.y = 1; - } - this._height = value; - }, - enumerable: false, - configurable: true - }); - return Container; - }(DisplayObject)); - /** - * Container default updateTransform, does update children of container. - * Will crash if there's no parent element. - * - * @memberof PIXI.Container# - * @function containerUpdateTransform - */ - Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; - - /*! - * @pixi/accessibility - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/accessibility is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Default property values of accessible objects - * used by {@link PIXI.AccessibilityManager}. - * - * @private - * @function accessibleTarget - * @memberof PIXI - * @type {Object} - * @example - * function MyObject() {} - * - * Object.assign( - * MyObject.prototype, - * PIXI.accessibleTarget - * ); - */ - var accessibleTarget = { - /** - * Flag for if the object is accessible. If true AccessibilityManager will overlay a - * shadow div with attributes set - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - accessible: false, - /** - * Sets the title attribute of the shadow div - * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' - * - * @member {?string} - * @memberof PIXI.DisplayObject# - */ - accessibleTitle: null, - /** - * Sets the aria-label attribute of the shadow div - * - * @member {string} - * @memberof PIXI.DisplayObject# - */ - accessibleHint: null, - /** - * @member {number} - * @memberof PIXI.DisplayObject# - * @private - * @todo Needs docs. - */ - tabIndex: 0, - /** - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @todo Needs docs. - */ - _accessibleActive: false, - /** - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @todo Needs docs. - */ - _accessibleDiv: null, - /** - * Specify the type of div the accessible layer is. Screen readers treat the element differently - * depending on this type. Defaults to button. - * - * @member {string} - * @memberof PIXI.DisplayObject# - * @default 'button' - */ - accessibleType: 'button', - /** - * Specify the pointer-events the accessible div will use - * Defaults to auto. - * - * @member {string} - * @memberof PIXI.DisplayObject# - * @default 'auto' - */ - accessiblePointerEvents: 'auto', - /** - * Setting to false will prevent any children inside this container to - * be accessible. Defaults to true. - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - * @default true - */ - accessibleChildren: true, - renderId: -1, - }; - - // add some extra variables to the container.. - DisplayObject.mixin(accessibleTarget); - var KEY_CODE_TAB = 9; - var DIV_TOUCH_SIZE = 100; - var DIV_TOUCH_POS_X = 0; - var DIV_TOUCH_POS_Y = 0; - var DIV_TOUCH_ZINDEX = 2; - var DIV_HOOK_SIZE = 1; - var DIV_HOOK_POS_X = -1000; - var DIV_HOOK_POS_Y = -1000; - var DIV_HOOK_ZINDEX = 2; - /** - * The Accessibility manager recreates the ability to tab and have content read by screen readers. - * This is very important as it can possibly help people with disabilities access PixiJS content. - * - * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the - * events as if the mouse was being used, minimizing the effort required to implement. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` - * - * @class - * @memberof PIXI - */ - var AccessibilityManager = /** @class */ (function () { - /** - * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer - */ - function AccessibilityManager(renderer) { - /** - * @type {?HTMLElement} - * @private - */ - this._hookDiv = null; - if (isMobile$1.tablet || isMobile$1.phone) { - this.createTouchHook(); - } - // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. - var div = document.createElement('div'); - div.style.width = DIV_TOUCH_SIZE + "px"; - div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.position = 'absolute'; - div.style.top = DIV_TOUCH_POS_X + "px"; - div.style.left = DIV_TOUCH_POS_Y + "px"; - div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); - /** - * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. - * - * @type {HTMLElement} - * @private - */ - this.div = div; - /** - * A simple pool for storing divs. - * - * @type {*} - * @private - */ - this.pool = []; - /** - * This is a tick used to check if an object is no longer being rendered. - * - * @type {Number} - * @private - */ - this.renderId = 0; - /** - * Setting this to true will visually show the divs. - * - * @type {boolean} - */ - this.debug = false; - /** - * The renderer this accessibility manager works for. - * - * @member {PIXI.AbstractRenderer} - */ - this.renderer = renderer; - /** - * The array of currently active accessible items. - * - * @member {Array<*>} - * @private - */ - this.children = []; - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onKeyDown = this._onKeyDown.bind(this); - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onMouseMove = this._onMouseMove.bind(this); - this._isActive = false; - this._isMobileAccessibility = false; - /** - * count to throttle div updates on android devices - * @type number - * @private - */ - this.androidUpdateCount = 0; - /** - * the frequency to update the div elements () - * @private - */ - this.androidUpdateFrequency = 500; // 2fps - // let listen for tab.. once pressed we can fire up and show the accessibility layer - window.addEventListener('keydown', this._onKeyDown, false); - } - Object.defineProperty(AccessibilityManager.prototype, "isActive", { - /** - * A flag - * @member {boolean} - * @readonly - */ - get: function () { - return this._isActive; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AccessibilityManager.prototype, "isMobileAccessibility", { - /** - * A flag - * @member {boolean} - * @readonly - */ - get: function () { - return this._isMobileAccessibility; - }, - enumerable: false, - configurable: true - }); - /** - * Creates the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.createTouchHook = function () { - var _this = this; - var hookDiv = document.createElement('button'); - hookDiv.style.width = DIV_HOOK_SIZE + "px"; - hookDiv.style.height = DIV_HOOK_SIZE + "px"; - hookDiv.style.position = 'absolute'; - hookDiv.style.top = DIV_HOOK_POS_X + "px"; - hookDiv.style.left = DIV_HOOK_POS_Y + "px"; - hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(); - hookDiv.style.backgroundColor = '#FF0000'; - hookDiv.title = 'select to enable accessability for this content'; - hookDiv.addEventListener('focus', function () { - _this._isMobileAccessibility = true; - _this.activate(); - _this.destroyTouchHook(); - }); - document.body.appendChild(hookDiv); - this._hookDiv = hookDiv; - }; - /** - * Destroys the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.destroyTouchHook = function () { - if (!this._hookDiv) { - return; - } - document.body.removeChild(this._hookDiv); - this._hookDiv = null; - }; - /** - * Activating will cause the Accessibility layer to be shown. - * This is called when a user presses the tab key. - * - * @private - */ - AccessibilityManager.prototype.activate = function () { - if (this._isActive) { - return; - } - this._isActive = true; - window.document.addEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown, false); - // TODO: Remove casting when CanvasRenderer is converted - this.renderer.on('postrender', this.update, this); - if (this.renderer.view.parentNode) { - this.renderer.view.parentNode.appendChild(this.div); - } - }; - /** - * Deactivating will cause the Accessibility layer to be hidden. - * This is called when a user moves the mouse. - * - * @private - */ - AccessibilityManager.prototype.deactivate = function () { - if (!this._isActive || this._isMobileAccessibility) { - return; - } - this._isActive = false; - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.addEventListener('keydown', this._onKeyDown, false); - // TODO: Remove casting when CanvasRenderer is converted - this.renderer.off('postrender', this.update); - if (this.div.parentNode) { - this.div.parentNode.removeChild(this.div); - } - }; - /** - * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. - * - * @private - * @param {PIXI.Container} displayObject - The DisplayObject to check. - */ - AccessibilityManager.prototype.updateAccessibleObjects = function (displayObject) { - if (!displayObject.visible || !displayObject.accessibleChildren) { - return; - } - if (displayObject.accessible && displayObject.interactive) { - if (!displayObject._accessibleActive) { - this.addChild(displayObject); - } - displayObject.renderId = this.renderId; - } - var children = displayObject.children; - for (var i = 0; i < children.length; i++) { - this.updateAccessibleObjects(children[i]); - } - }; - /** - * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. - * - * @private - */ - AccessibilityManager.prototype.update = function () { - /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex, - * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate, - * so I am just running update every half a second, seems to fix it. - */ - var now = performance.now(); - if (isMobile$1.android.device && now < this.androidUpdateCount) { - return; - } - this.androidUpdateCount = now + this.androidUpdateFrequency; - if (!this.renderer.renderingToScreen) { - return; - } - // update children... - if (this.renderer._lastObjectRendered) { - this.updateAccessibleObjects(this.renderer._lastObjectRendered); - } - // TODO: Remove casting when CanvasRenderer is converted - var rect = this.renderer.view.getBoundingClientRect(); - var resolution = this.renderer.resolution; - var sx = (rect.width / this.renderer.width) * resolution; - var sy = (rect.height / this.renderer.height) * resolution; - var div = this.div; - div.style.left = rect.left + "px"; - div.style.top = rect.top + "px"; - div.style.width = this.renderer.width + "px"; - div.style.height = this.renderer.height + "px"; - for (var i = 0; i < this.children.length; i++) { - var child = this.children[i]; - if (child.renderId !== this.renderId) { - child._accessibleActive = false; - removeItems(this.children, i, 1); - this.div.removeChild(child._accessibleDiv); - this.pool.push(child._accessibleDiv); - child._accessibleDiv = null; - i--; - } - else { - // map div to display.. - div = child._accessibleDiv; - var hitArea = child.hitArea; - var wt = child.worldTransform; - if (child.hitArea) { - div.style.left = (wt.tx + (hitArea.x * wt.a)) * sx + "px"; - div.style.top = (wt.ty + (hitArea.y * wt.d)) * sy + "px"; - div.style.width = hitArea.width * wt.a * sx + "px"; - div.style.height = hitArea.height * wt.d * sy + "px"; - } - else { - hitArea = child.getBounds(); - this.capHitArea(hitArea); - div.style.left = hitArea.x * sx + "px"; - div.style.top = hitArea.y * sy + "px"; - div.style.width = hitArea.width * sx + "px"; - div.style.height = hitArea.height * sy + "px"; - // update button titles and hints if they exist and they've changed - if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) { - div.title = child.accessibleTitle; - } - if (div.getAttribute('aria-label') !== child.accessibleHint - && child.accessibleHint !== null) { - div.setAttribute('aria-label', child.accessibleHint); - } - } - // the title or index may have changed, if so lets update it! - if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) { - div.title = child.accessibleTitle; - div.tabIndex = child.tabIndex; - if (this.debug) - { this.updateDebugHTML(div); } - } - } - } - // increment the render id.. - this.renderId++; - }; - /** - * private function that will visually add the information to the - * accessability div - * - * @param {HTMLElement} div - */ - AccessibilityManager.prototype.updateDebugHTML = function (div) { - div.innerHTML = "type: " + div.type + "
title : " + div.title + "
tabIndex: " + div.tabIndex; - }; - /** - * Adjust the hit area based on the bounds of a display object - * - * @param {PIXI.Rectangle} hitArea - Bounds of the child - */ - AccessibilityManager.prototype.capHitArea = function (hitArea) { - if (hitArea.x < 0) { - hitArea.width += hitArea.x; - hitArea.x = 0; - } - if (hitArea.y < 0) { - hitArea.height += hitArea.y; - hitArea.y = 0; - } - // TODO: Remove casting when CanvasRenderer is converted - if (hitArea.x + hitArea.width > this.renderer.width) { - hitArea.width = this.renderer.width - hitArea.x; - } - if (hitArea.y + hitArea.height > this.renderer.height) { - hitArea.height = this.renderer.height - hitArea.y; - } - }; - /** - * Adds a DisplayObject to the accessibility manager - * - * @private - * @param {PIXI.DisplayObject} displayObject - The child to make accessible. - */ - AccessibilityManager.prototype.addChild = function (displayObject) { - // this.activate(); - var div = this.pool.pop(); - if (!div) { - div = document.createElement('button'); - div.style.width = DIV_TOUCH_SIZE + "px"; - div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent'; - div.style.position = 'absolute'; - div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); - div.style.borderStyle = 'none'; - // ARIA attributes ensure that button title and hint updates are announced properly - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { - // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. - div.setAttribute('aria-live', 'off'); - } - else { - div.setAttribute('aria-live', 'polite'); - } - if (navigator.userAgent.match(/rv:.*Gecko\//)) { - // FireFox needs this to announce only the new button name - div.setAttribute('aria-relevant', 'additions'); - } - else { - // required by IE, other browsers don't much care - div.setAttribute('aria-relevant', 'text'); - } - div.addEventListener('click', this._onClick.bind(this)); - div.addEventListener('focus', this._onFocus.bind(this)); - div.addEventListener('focusout', this._onFocusOut.bind(this)); - } - // set pointer events - div.style.pointerEvents = displayObject.accessiblePointerEvents; - // set the type, this defaults to button! - div.type = displayObject.accessibleType; - if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) { - div.title = displayObject.accessibleTitle; - } - else if (!displayObject.accessibleHint - || displayObject.accessibleHint === null) { - div.title = "displayObject " + displayObject.tabIndex; - } - if (displayObject.accessibleHint - && displayObject.accessibleHint !== null) { - div.setAttribute('aria-label', displayObject.accessibleHint); - } - if (this.debug) - { this.updateDebugHTML(div); } - displayObject._accessibleActive = true; - displayObject._accessibleDiv = div; - div.displayObject = displayObject; - this.children.push(displayObject); - this.div.appendChild(displayObject._accessibleDiv); - displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; - }; - /** - * Maps the div button press to pixi's InteractionManager (click) - * - * @private - * @param {MouseEvent} e - The click event. - */ - AccessibilityManager.prototype._onClick = function (e) { - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData); - }; - /** - * Maps the div focus events to pixi's InteractionManager (mouseover) - * - * @private - * @param {FocusEvent} e - The focus event. - */ - AccessibilityManager.prototype._onFocus = function (e) { - if (!e.target.getAttribute('aria-live')) { - e.target.setAttribute('aria-live', 'assertive'); - } - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); - }; - /** - * Maps the div focus events to pixi's InteractionManager (mouseout) - * - * @private - * @param {FocusEvent} e - The focusout event. - */ - AccessibilityManager.prototype._onFocusOut = function (e) { - if (!e.target.getAttribute('aria-live')) { - e.target.setAttribute('aria-live', 'polite'); - } - // TODO: Remove casting when CanvasRenderer is converted - var interactionManager = this.renderer.plugins.interaction; - interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); - }; - /** - * Is called when a key is pressed - * - * @private - * @param {KeyboardEvent} e - The keydown event. - */ - AccessibilityManager.prototype._onKeyDown = function (e) { - if (e.keyCode !== KEY_CODE_TAB) { - return; - } - this.activate(); - }; - /** - * Is called when the mouse moves across the renderer element - * - * @private - * @param {MouseEvent} e - The mouse event. - */ - AccessibilityManager.prototype._onMouseMove = function (e) { - if (e.movementX === 0 && e.movementY === 0) { - return; - } - this.deactivate(); - }; - /** - * Destroys the accessibility manager - * - */ - AccessibilityManager.prototype.destroy = function () { - this.destroyTouchHook(); - this.div = null; - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown); - this.pool = null; - this.children = null; - this.renderer = null; - }; - return AccessibilityManager; - }()); - - /*! - * @pixi/ticker - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/ticker is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Target frames per millisecond. - * - * @static - * @name TARGET_FPMS - * @memberof PIXI.settings - * @type {number} - * @default 0.06 - */ - settings.TARGET_FPMS = 0.06; - - /** - * Represents the update priorities used by internal PIXI classes when registered with - * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower - * priority items, such as render, should go later. - * - * @static - * @constant - * @name UPDATE_PRIORITY - * @memberof PIXI - * @enum {number} - * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager} - * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} - * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}. - * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering. - * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility. - */ - - (function (UPDATE_PRIORITY) { - UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; - UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; - UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; - UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; - UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; - })(exports.UPDATE_PRIORITY || (exports.UPDATE_PRIORITY = {})); - - /** - * Internal class for handling the priority sorting of ticker handlers. - * - * @private - * @class - * @memberof PIXI - */ - var TickerListener = /** @class */ (function () { - /** - * Constructor - * @private - * @param {Function} fn - The listener function to be added for one update - * @param {*} [context=null] - The listener context - * @param {number} [priority=0] - The priority for emitting - * @param {boolean} [once=false] - If the handler should fire once - */ - function TickerListener(fn, context, priority, once) { - if (context === void 0) { context = null; } - if (priority === void 0) { priority = 0; } - if (once === void 0) { once = false; } - /** - * The handler function to execute. - * @private - * @member {Function} - */ - this.fn = fn; - /** - * The calling to execute. - * @private - * @member {*} - */ - this.context = context; - /** - * The current priority. - * @private - * @member {number} - */ - this.priority = priority; - /** - * If this should only execute once. - * @private - * @member {boolean} - */ - this.once = once; - /** - * The next item in chain. - * @private - * @member {TickerListener} - */ - this.next = null; - /** - * The previous item in chain. - * @private - * @member {TickerListener} - */ - this.previous = null; - /** - * `true` if this listener has been destroyed already. - * @member {boolean} - * @private - */ - this._destroyed = false; - } - /** - * Simple compare function to figure out if a function and context match. - * @private - * @param {Function} fn - The listener function to be added for one update - * @param {any} [context] - The listener context - * @return {boolean} `true` if the listener match the arguments - */ - TickerListener.prototype.match = function (fn, context) { - if (context === void 0) { context = null; } - return this.fn === fn && this.context === context; - }; - /** - * Emit by calling the current function. - * @private - * @param {number} deltaTime - time since the last emit. - * @return {TickerListener} Next ticker - */ - TickerListener.prototype.emit = function (deltaTime) { - if (this.fn) { - if (this.context) { - this.fn.call(this.context, deltaTime); - } - else { - this.fn(deltaTime); - } - } - var redirect = this.next; - if (this.once) { - this.destroy(true); - } - // Soft-destroying should remove - // the next reference - if (this._destroyed) { - this.next = null; - } - return redirect; - }; - /** - * Connect to the list. - * @private - * @param {TickerListener} previous - Input node, previous listener - */ - TickerListener.prototype.connect = function (previous) { - this.previous = previous; - if (previous.next) { - previous.next.previous = this; - } - this.next = previous.next; - previous.next = this; - }; - /** - * Destroy and don't use after this. - * @private - * @param {boolean} [hard = false] `true` to remove the `next` reference, this - * is considered a hard destroy. Soft destroy maintains the next reference. - * @return {TickerListener} The listener to redirect while emitting or removing. - */ - TickerListener.prototype.destroy = function (hard) { - if (hard === void 0) { hard = false; } - this._destroyed = true; - this.fn = null; - this.context = null; - // Disconnect, hook up next and previous - if (this.previous) { - this.previous.next = this.next; - } - if (this.next) { - this.next.previous = this.previous; - } - // Redirect to the next item - var redirect = this.next; - // Remove references - this.next = hard ? null : redirect; - this.previous = null; - return redirect; - }; - return TickerListener; - }()); - - /** - * A Ticker class that runs an update loop that other objects listen to. - * - * This class is composed around listeners meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. - * - * @class - * @memberof PIXI - */ - var Ticker = /** @class */ (function () { - function Ticker() { - var _this = this; - /** - * The first listener. All new listeners added are chained on this. - * @private - * @type {TickerListener} - */ - this._head = new TickerListener(null, null, Infinity); - /** - * Internal current frame request ID - * @type {?number} - * @private - */ - this._requestId = null; - /** - * Internal value managed by minFPS property setter and getter. - * This is the maximum allowed milliseconds between updates. - * @type {number} - * @private - */ - this._maxElapsedMS = 100; - /** - * Internal value managed by maxFPS property setter and getter. - * This is the minimum allowed milliseconds between updates. - * @type {number} - * @private - */ - this._minElapsedMS = 0; - /** - * Whether or not this ticker should invoke the method - * {@link PIXI.Ticker#start} automatically - * when a listener is added. - * - * @member {boolean} - * @default false - */ - this.autoStart = false; - /** - * Scalar time value from last frame to this frame. - * This value is capped by setting {@link PIXI.Ticker#minFPS} - * and is scaled with {@link PIXI.Ticker#speed}. - * **Note:** The cap may be exceeded by scaling. - * - * @member {number} - * @default 1 - */ - this.deltaTime = 1; - /** - * Scaler time elapsed in milliseconds from last frame to this frame. - * This value is capped by setting {@link PIXI.Ticker#minFPS} - * and is scaled with {@link PIXI.Ticker#speed}. - * **Note:** The cap may be exceeded by scaling. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * Defaults to target frame time - * - * @member {number} - * @default 16.66 - */ - this.deltaMS = 1 / settings.TARGET_FPMS; - /** - * Time elapsed in milliseconds from last frame to this frame. - * Opposed to what the scalar {@link PIXI.Ticker#deltaTime} - * is based, this value is neither capped nor scaled. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * Defaults to target frame time - * - * @member {number} - * @default 16.66 - */ - this.elapsedMS = 1 / settings.TARGET_FPMS; - /** - * The last time {@link PIXI.Ticker#update} was invoked. - * This value is also reset internally outside of invoking - * update, but only when a new animation frame is requested. - * If the platform supports DOMHighResTimeStamp, - * this value will have a precision of 1 µs. - * - * @member {number} - * @default -1 - */ - this.lastTime = -1; - /** - * Factor of current {@link PIXI.Ticker#deltaTime}. - * @example - * // Scales ticker.deltaTime to what would be - * // the equivalent of approximately 120 FPS - * ticker.speed = 2; - * - * @member {number} - * @default 1 - */ - this.speed = 1; - /** - * Whether or not this ticker has been started. - * `true` if {@link PIXI.Ticker#start} has been called. - * `false` if {@link PIXI.Ticker#stop} has been called. - * While `false`, this value may change to `true` in the - * event of {@link PIXI.Ticker#autoStart} being `true` - * and a listener is added. - * - * @member {boolean} - * @default false - */ - this.started = false; - /** - * If enabled, deleting is disabled. - * @member {boolean} - * @default false - * @private - */ - this._protected = false; - /** - * The last time keyframe was executed. - * Maintains a relatively fixed interval with the previous value. - * @member {number} - * @default -1 - * @private - */ - this._lastFrame = -1; - /** - * Internal tick method bound to ticker instance. - * This is because in early 2015, Function.bind - * is still 60% slower in high performance scenarios. - * Also separating frame requests from update method - * so listeners may be called at any time and with - * any animation API, just invoke ticker.update(time). - * - * @private - * @param {number} time - Time since last tick. - */ - this._tick = function (time) { - _this._requestId = null; - if (_this.started) { - // Invoke listeners now - _this.update(time); - // Listener side effects may have modified ticker state. - if (_this.started && _this._requestId === null && _this._head.next) { - _this._requestId = requestAnimationFrame(_this._tick); - } - } - }; - } - /** - * Conditionally requests a new animation frame. - * If a frame has not already been requested, and if the internal - * emitter has listeners, a new frame is requested. - * - * @private - */ - Ticker.prototype._requestIfNeeded = function () { - if (this._requestId === null && this._head.next) { - // ensure callbacks get correct delta - this.lastTime = performance.now(); - this._lastFrame = this.lastTime; - this._requestId = requestAnimationFrame(this._tick); - } - }; - /** - * Conditionally cancels a pending animation frame. - * - * @private - */ - Ticker.prototype._cancelIfNeeded = function () { - if (this._requestId !== null) { - cancelAnimationFrame(this._requestId); - this._requestId = null; - } - }; - /** - * Conditionally requests a new animation frame. - * If the ticker has been started it checks if a frame has not already - * been requested, and if the internal emitter has listeners. If these - * conditions are met, a new frame is requested. If the ticker has not - * been started, but autoStart is `true`, then the ticker starts now, - * and continues with the previous conditions to request a new frame. - * - * @private - */ - Ticker.prototype._startIfPossible = function () { - if (this.started) { - this._requestIfNeeded(); - } - else if (this.autoStart) { - this.start(); - } - }; - /** - * Register a handler for tick events. Calls continuously unless - * it is removed or the ticker is stopped. - * - * @param {Function} fn - The listener function to be added for updates - * @param {*} [context] - The listener context - * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.add = function (fn, context, priority) { - if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } - return this._addListener(new TickerListener(fn, context, priority)); - }; - /** - * Add a handler for the tick event which is only execute once. - * - * @param {Function} fn - The listener function to be added for one update - * @param {*} [context] - The listener context - * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.addOnce = function (fn, context, priority) { - if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } - return this._addListener(new TickerListener(fn, context, priority, true)); - }; - /** - * Internally adds the event handler so that it can be sorted by priority. - * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run - * before the rendering. - * - * @private - * @param {TickerListener} listener - Current listener being added. - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype._addListener = function (listener) { - // For attaching to head - var current = this._head.next; - var previous = this._head; - // Add the first item - if (!current) { - listener.connect(previous); - } - else { - // Go from highest to lowest priority - while (current) { - if (listener.priority > current.priority) { - listener.connect(previous); - break; - } - previous = current; - current = current.next; - } - // Not yet connected - if (!listener.previous) { - listener.connect(previous); - } - } - this._startIfPossible(); - return this; - }; - /** - * Removes any handlers matching the function and context parameters. - * If no handlers are left after removing, then it cancels the animation frame. - * - * @param {Function} fn - The listener function to be removed - * @param {*} [context] - The listener context to be removed - * @returns {PIXI.Ticker} This instance of a ticker - */ - Ticker.prototype.remove = function (fn, context) { - var listener = this._head.next; - while (listener) { - // We found a match, lets remove it - // no break to delete all possible matches - // incase a listener was added 2+ times - if (listener.match(fn, context)) { - listener = listener.destroy(); - } - else { - listener = listener.next; - } - } - if (!this._head.next) { - this._cancelIfNeeded(); - } - return this; - }; - Object.defineProperty(Ticker.prototype, "count", { - /** - * The number of listeners on this ticker, calculated by walking through linked list - * - * @readonly - * @member {number} - */ - get: function () { - if (!this._head) { - return 0; - } - var count = 0; - var current = this._head; - while ((current = current.next)) { - count++; - } - return count; - }, - enumerable: false, - configurable: true - }); - /** - * Starts the ticker. If the ticker has listeners - * a new animation frame is requested at this point. - */ - Ticker.prototype.start = function () { - if (!this.started) { - this.started = true; - this._requestIfNeeded(); - } - }; - /** - * Stops the ticker. If the ticker has requested - * an animation frame it is canceled at this point. - */ - Ticker.prototype.stop = function () { - if (this.started) { - this.started = false; - this._cancelIfNeeded(); - } - }; - /** - * Destroy the ticker and don't use after this. Calling - * this method removes all references to internal events. - */ - Ticker.prototype.destroy = function () { - if (!this._protected) { - this.stop(); - var listener = this._head.next; - while (listener) { - listener = listener.destroy(true); - } - this._head.destroy(); - this._head = null; - } - }; - /** - * Triggers an update. An update entails setting the - * current {@link PIXI.Ticker#elapsedMS}, - * the current {@link PIXI.Ticker#deltaTime}, - * invoking all listeners with current deltaTime, - * and then finally setting {@link PIXI.Ticker#lastTime} - * with the value of currentTime that was provided. - * This method will be called automatically by animation - * frame callbacks if the ticker instance has been started - * and listeners are added. - * - * @param {number} [currentTime=performance.now()] - the current time of execution - */ - Ticker.prototype.update = function (currentTime) { - if (currentTime === void 0) { currentTime = performance.now(); } - var elapsedMS; - // If the difference in time is zero or negative, we ignore most of the work done here. - // If there is no valid difference, then should be no reason to let anyone know about it. - // A zero delta, is exactly that, nothing should update. - // - // The difference in time can be negative, and no this does not mean time traveling. - // This can be the result of a race condition between when an animation frame is requested - // on the current JavaScript engine event loop, and when the ticker's start method is invoked - // (which invokes the internal _requestIfNeeded method). If a frame is requested before - // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, - // can receive a time argument that can be less than the lastTime value that was set within - // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. - // - // This check covers this browser engine timing issue, as well as if consumers pass an invalid - // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. - if (currentTime > this.lastTime) { - // Save uncapped elapsedMS for measurement - elapsedMS = this.elapsedMS = currentTime - this.lastTime; - // cap the milliseconds elapsed used for deltaTime - if (elapsedMS > this._maxElapsedMS) { - elapsedMS = this._maxElapsedMS; - } - elapsedMS *= this.speed; - // If not enough time has passed, exit the function. - // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS - // adjustment to ensure a relatively stable interval. - if (this._minElapsedMS) { - var delta = currentTime - this._lastFrame | 0; - if (delta < this._minElapsedMS) { - return; - } - this._lastFrame = currentTime - (delta % this._minElapsedMS); - } - this.deltaMS = elapsedMS; - this.deltaTime = this.deltaMS * settings.TARGET_FPMS; - // Cache a local reference, in-case ticker is destroyed - // during the emit, we can still check for head.next - var head = this._head; - // Invoke listeners added to internal emitter - var listener = head.next; - while (listener) { - listener = listener.emit(this.deltaTime); - } - if (!head.next) { - this._cancelIfNeeded(); - } - } - else { - this.deltaTime = this.deltaMS = this.elapsedMS = 0; - } - this.lastTime = currentTime; - }; - Object.defineProperty(Ticker.prototype, "FPS", { - /** - * The frames per second at which this ticker is running. - * The default is approximately 60 in most modern browsers. - * **Note:** This does not factor in the value of - * {@link PIXI.Ticker#speed}, which is specific - * to scaling {@link PIXI.Ticker#deltaTime}. - * - * @member {number} - * @readonly - */ - get: function () { - return 1000 / this.elapsedMS; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker.prototype, "minFPS", { - /** - * Manages the maximum amount of milliseconds allowed to - * elapse between invoking {@link PIXI.Ticker#update}. - * This value is used to cap {@link PIXI.Ticker#deltaTime}, - * but does not effect the measured value of {@link PIXI.Ticker#FPS}. - * When setting this property it is clamped to a value between - * `0` and `PIXI.settings.TARGET_FPMS * 1000`. - * - * @member {number} - * @default 10 - */ - get: function () { - return 1000 / this._maxElapsedMS; - }, - set: function (fps) { - // Minimum must be below the maxFPS - var minFPS = Math.min(this.maxFPS, fps); - // Must be at least 0, but below 1 / settings.TARGET_FPMS - var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS); - this._maxElapsedMS = 1 / minFPMS; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker.prototype, "maxFPS", { - /** - * Manages the minimum amount of milliseconds required to - * elapse between invoking {@link PIXI.Ticker#update}. - * This will effect the measured value of {@link PIXI.Ticker#FPS}. - * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. - * Otherwise it will be at least `minFPS` - * - * @member {number} - * @default 0 - */ - get: function () { - if (this._minElapsedMS) { - return Math.round(1000 / this._minElapsedMS); - } - return 0; - }, - set: function (fps) { - if (fps === 0) { - this._minElapsedMS = 0; - } - else { - // Max must be at least the minFPS - var maxFPS = Math.max(this.minFPS, fps); - this._minElapsedMS = 1 / (maxFPS / 1000); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker, "shared", { - /** - * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by - * {@link PIXI.VideoResource} to update animation frames / video textures. - * - * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. - * - * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. - * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. - * - * @example - * let ticker = PIXI.Ticker.shared; - * // Set this to prevent starting this ticker when listeners are added. - * // By default this is true only for the PIXI.Ticker.shared instance. - * ticker.autoStart = false; - * // FYI, call this to ensure the ticker is stopped. It should be stopped - * // if you have not attempted to render anything yet. - * ticker.stop(); - * // Call this when you are ready for a running shared ticker. - * ticker.start(); - * - * @example - * // You may use the shared ticker to render... - * let renderer = PIXI.autoDetectRenderer(); - * let stage = new PIXI.Container(); - * document.body.appendChild(renderer.view); - * ticker.add(function (time) { - * renderer.render(stage); - * }); - * - * @example - * // Or you can just update it manually. - * ticker.autoStart = false; - * ticker.stop(); - * function animate(time) { - * ticker.update(time); - * renderer.render(stage); - * requestAnimationFrame(animate); - * } - * animate(performance.now()); - * - * @member {PIXI.Ticker} - * @static - */ - get: function () { - if (!Ticker._shared) { - var shared = Ticker._shared = new Ticker(); - shared.autoStart = true; - shared._protected = true; - } - return Ticker._shared; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Ticker, "system", { - /** - * The system ticker instance used by {@link PIXI.InteractionManager} and by - * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, - * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. - * - * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. - * - * @member {PIXI.Ticker} - * @static - */ - get: function () { - if (!Ticker._system) { - var system = Ticker._system = new Ticker(); - system.autoStart = true; - system._protected = true; - } - return Ticker._system; - }, - enumerable: false, - configurable: true - }); - return Ticker; - }()); - - /** - * Middleware for for Application Ticker. - * - * @example - * import {TickerPlugin} from '@pixi/ticker'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(TickerPlugin); - * - * @class - * @memberof PIXI - */ - var TickerPlugin = /** @class */ (function () { - function TickerPlugin() { - } - /** - * Initialize the plugin with scope of application instance - * - * @static - * @private - * @param {object} [options] - See application options - */ - TickerPlugin.init = function (options) { - var _this = this; - // Set default - options = Object.assign({ - autoStart: true, - sharedTicker: false, - }, options); - // Create ticker setter - Object.defineProperty(this, 'ticker', { - set: function (ticker) { - if (this._ticker) { - this._ticker.remove(this.render, this); - } - this._ticker = ticker; - if (ticker) { - ticker.add(this.render, this, exports.UPDATE_PRIORITY.LOW); - } - }, - get: function () { - return this._ticker; - }, - }); - /** - * Convenience method for stopping the render. - * - * @method PIXI.Application#stop - */ - this.stop = function () { - _this._ticker.stop(); - }; - /** - * Convenience method for starting the render. - * - * @method PIXI.Application#start - */ - this.start = function () { - _this._ticker.start(); - }; - /** - * Internal reference to the ticker. - * - * @type {PIXI.Ticker} - * @name _ticker - * @memberof PIXI.Application# - * @private - */ - this._ticker = null; - /** - * Ticker for doing render updates. - * - * @type {PIXI.Ticker} - * @name ticker - * @memberof PIXI.Application# - * @default PIXI.Ticker.shared - */ - this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); - // Start the rendering - if (options.autoStart) { - this.start(); - } - }; - /** - * Clean up the ticker, scoped to application. - * - * @static - * @private - */ - TickerPlugin.destroy = function () { - if (this._ticker) { - var oldTicker = this._ticker; - this.ticker = null; - oldTicker.destroy(); - } - }; - return TickerPlugin; - }()); - - /*! - * @pixi/interaction - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/interaction is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Holds all information related to an Interaction event - * - * @class - * @memberof PIXI - */ - var InteractionData = /** @class */ (function () { - function InteractionData() { - this.pressure = 0; - this.rotationAngle = 0; - this.twist = 0; - this.tangentialPressure = 0; - /** - * This point stores the global coords of where the touch/mouse event happened - * - * @member {PIXI.Point} - */ - this.global = new Point(); - /** - * The target Sprite that was interacted with - * - * @member {PIXI.Sprite} - */ - this.target = null; - /** - * When passed to an event handler, this will be the original DOM Event that was captured - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent - * @member {MouseEvent|TouchEvent|PointerEvent} - */ - this.originalEvent = null; - /** - * Unique identifier for this interaction - * - * @member {number} - */ - this.identifier = null; - /** - * Indicates whether or not the pointer device that created the event is the primary pointer. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary - * @type {Boolean} - */ - this.isPrimary = false; - /** - * Indicates which button was pressed on the mouse or pointer device to trigger the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - * @type {number} - */ - this.button = 0; - /** - * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons - * @type {number} - */ - this.buttons = 0; - /** - * The width of the pointer's contact along the x-axis, measured in CSS pixels. - * radiusX of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width - * @type {number} - */ - this.width = 0; - /** - * The height of the pointer's contact along the y-axis, measured in CSS pixels. - * radiusY of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height - * @type {number} - */ - this.height = 0; - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX - * @type {number} - */ - this.tiltX = 0; - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY - * @type {number} - */ - this.tiltY = 0; - /** - * The type of pointer that triggered the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType - * @type {string} - */ - this.pointerType = null; - /** - * Pressure applied by the pointing device during the event. A Touch's force property - * will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure - * @type {number} - */ - this.pressure = 0; - /** - * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. - * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle - * @type {number} - */ - this.rotationAngle = 0; - /** - * Twist of a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.twist = 0; - /** - * Barrel pressure on a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.tangentialPressure = 0; - } - Object.defineProperty(InteractionData.prototype, "pointerId", { - /** - * The unique identifier of the pointer. It will be the same as `identifier`. - * @readonly - * @member {number} - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId - */ - get: function () { - return this.identifier; - }, - enumerable: false, - configurable: true - }); - /** - * This will return the local coordinates of the specified displayObject for this InteractionData - * - * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local - * coords off - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise - * will create a new point) - * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional - * (otherwise will use the current global coords) - * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative - * to the DisplayObject - */ - InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) { - return displayObject.worldTransform.applyInverse(globalPos || this.global, point); - }; - /** - * Copies properties from normalized event data. - * - * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data - */ - InteractionData.prototype.copyEvent = function (event) { - // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite - // it with "false" on later events when our shim for it on touch events might not be - // accurate - if ('isPrimary' in event && event.isPrimary) { - this.isPrimary = true; - } - this.button = 'button' in event && event.button; - // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard - // event.which property instead, which conveys the same information. - var buttons = 'buttons' in event && event.buttons; - this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which; - this.width = 'width' in event && event.width; - this.height = 'height' in event && event.height; - this.tiltX = 'tiltX' in event && event.tiltX; - this.tiltY = 'tiltY' in event && event.tiltY; - this.pointerType = 'pointerType' in event && event.pointerType; - this.pressure = 'pressure' in event && event.pressure; - this.rotationAngle = 'rotationAngle' in event && event.rotationAngle; - this.twist = ('twist' in event && event.twist) || 0; - this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0; - }; - /** - * Resets the data for pooling. - */ - InteractionData.prototype.reset = function () { - // isPrimary is the only property that we really need to reset - everything else is - // guaranteed to be overwritten - this.isPrimary = false; - }; - return InteractionData; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$1 = function(d, b) { - extendStatics$1 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$1(d, b); - }; - - function __extends$1(d, b) { - extendStatics$1(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Event class that mimics native DOM events. - * - * @class - * @memberof PIXI - */ - var InteractionEvent = /** @class */ (function () { - function InteractionEvent() { - /** - * Whether this event will continue propagating in the tree. - * - * Remaining events for the {@link stopsPropagatingAt} object - * will still be dispatched. - * - * @member {boolean} - */ - this.stopped = false; - /** - * At which object this event stops propagating. - * - * @private - * @member {PIXI.DisplayObject} - */ - this.stopsPropagatingAt = null; - /** - * Whether we already reached the element we want to - * stop propagating at. This is important for delayed events, - * where we start over deeper in the tree again. - * - * @private - * @member {boolean} - */ - this.stopPropagationHint = false; - /** - * The object which caused this event to be dispatched. - * For listener callback see {@link PIXI.InteractionEvent.currentTarget}. - * - * @member {PIXI.DisplayObject} - */ - this.target = null; - /** - * The object whose event listener’s callback is currently being invoked. - * - * @member {PIXI.DisplayObject} - */ - this.currentTarget = null; - /** - * Type of the event - * - * @member {string} - */ - this.type = null; - /** - * InteractionData related to this event - * - * @member {PIXI.InteractionData} - */ - this.data = null; - } - /** - * Prevents event from reaching any objects other than the current object. - * - */ - InteractionEvent.prototype.stopPropagation = function () { - this.stopped = true; - this.stopPropagationHint = true; - this.stopsPropagatingAt = this.currentTarget; - }; - /** - * Resets the event. - */ - InteractionEvent.prototype.reset = function () { - this.stopped = false; - this.stopsPropagatingAt = null; - this.stopPropagationHint = false; - this.currentTarget = null; - this.target = null; - }; - return InteractionEvent; - }()); - - /** - * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions - * - * @class - * @private - * @memberof PIXI - */ - var InteractionTrackingData = /** @class */ (function () { - /** - * @param {number} pointerId - Unique pointer id of the event - * @private - */ - function InteractionTrackingData(pointerId) { - this._pointerId = pointerId; - this._flags = InteractionTrackingData.FLAGS.NONE; - } - /** - * - * @private - * @param {number} flag - The interaction flag to set - * @param {boolean} yn - Should the flag be set or unset - */ - InteractionTrackingData.prototype._doSet = function (flag, yn) { - if (yn) { - this._flags = this._flags | flag; - } - else { - this._flags = this._flags & (~flag); - } - }; - Object.defineProperty(InteractionTrackingData.prototype, "pointerId", { - /** - * Unique pointer id of the event - * - * @readonly - * @private - * @member {number} - */ - get: function () { - return this._pointerId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "flags", { - /** - * State of the tracking data, expressed as bit flags - * - * @private - * @member {number} - */ - get: function () { - return this._flags; - }, - set: function (flags) { - this._flags = flags; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "none", { - /** - * Is the tracked event inactive (not over or down)? - * - * @private - * @member {number} - */ - get: function () { - return this._flags === InteractionTrackingData.FLAGS.NONE; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "over", { - /** - * Is the tracked event over the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.OVER, yn); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "rightDown", { - /** - * Did the right mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionTrackingData.prototype, "leftDown", { - /** - * Did the left mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - get: function () { - return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0; - }, - set: function (yn) { - this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn); - }, - enumerable: false, - configurable: true - }); - InteractionTrackingData.FLAGS = Object.freeze({ - NONE: 0, - OVER: 1 << 0, - LEFT_DOWN: 1 << 1, - RIGHT_DOWN: 1 << 2, - }); - return InteractionTrackingData; - }()); - - /** - * Strategy how to search through stage tree for interactive objects - * - * @private - * @class - * @memberof PIXI - */ - var TreeSearch = /** @class */ (function () { - function TreeSearch() { - this._tempPoint = new Point(); - } - /** - * Recursive implementation for findHit - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @param {boolean} [interactive] - Whether the displayObject is interactive - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.recursiveFindHit = function (interactionEvent, displayObject, func, hitTest, interactive) { - if (!displayObject || !displayObject.visible) { - return false; - } - var point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ - // - // This function will now loop through all objects and then only hit test the objects it HAS - // to, not all of them. MUCH faster.. - // An object will be hit test if the following is true: - // - // 1: It is interactive. - // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // - // As another little optimization once an interactive object has been hit we can carry on - // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimization is that an object is not hit test directly if a child has already been hit. - interactive = displayObject.interactive || interactive; - var hit = false; - var interactiveParent = interactive; - // Flag here can set to false if the event is outside the parents hitArea or mask - var hitTestChildren = true; - // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea - // There is also no longer a need to hitTest children. - if (displayObject.hitArea) { - if (hitTest) { - displayObject.worldTransform.applyInverse(point, this._tempPoint); - if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) { - hitTest = false; - hitTestChildren = false; - } - else { - hit = true; - } - } - interactiveParent = false; - } - // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. - // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. - // https://github.com/pixijs/pixi.js/issues/5135 - else if (displayObject._mask) { - if (hitTest) { - if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) { - hitTest = false; - } - } - } - // ** FREE TIP **! If an object is not interactive or has no buttons in it - // (such as a game scene!) set interactiveChildren to false for that displayObject. - // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. - if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) { - var children = displayObject.children; - for (var i = children.length - 1; i >= 0; i--) { - var child = children[i]; - // time to get recursive.. if this function will return if something is hit.. - var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); - if (childHit) { - // its a good idea to check if a child has lost its parent. - // this means it has been removed whilst looping so its best - if (!child.parent) { - continue; - } - // we no longer need to hit test any more objects in this container as we we - // now know the parent has been hit - interactiveParent = false; - // If the child is interactive , that means that the object hit was actually - // interactive and not just the child of an interactive object. - // This means we no longer need to hit test anything else. We still need to run - // through all objects, but we don't need to perform any hit tests. - if (childHit) { - if (interactionEvent.target) { - hitTest = false; - } - hit = true; - } - } - } - } - // no point running this if the item is not interactive or does not have an interactive parent. - if (interactive) { - // if we are hit testing (as in we have no hit any objects yet) - // We also don't need to worry about hit testing if once of the displayObjects children - // has already been hit - but only if it was interactive, otherwise we need to keep - // looking for an interactive child, just in case we hit one - if (hitTest && !interactionEvent.target) { - // already tested against hitArea if it is defined - if (!displayObject.hitArea && displayObject.containsPoint) { - if (displayObject.containsPoint(point)) { - hit = true; - } - } - } - if (displayObject.interactive) { - if (hit && !interactionEvent.target) { - interactionEvent.target = displayObject; - } - if (func) { - func(interactionEvent, displayObject, !!hit); - } - } - } - return hit; - }; - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.findHit = function (interactionEvent, displayObject, func, hitTest) { - this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); - }; - return TreeSearch; - }()); - - /** - * Interface for classes that represent a hit area. - * - * It is implemented by the following classes: - * - {@link PIXI.Circle} - * - {@link PIXI.Ellipse} - * - {@link PIXI.Polygon} - * - {@link PIXI.RoundedRectangle} - * - * @interface IHitArea - * @memberof PIXI - */ - /** - * Checks whether the x and y coordinates given are contained within this area - * - * @method - * @name contains - * @memberof PIXI.IHitArea# - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this area - */ - /** - * Default property values of interactive objects - * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties - * - * @private - * @name interactiveTarget - * @type {Object} - * @memberof PIXI - * @example - * function MyObject() {} - * - * Object.assign( - * DisplayObject.prototype, - * PIXI.interactiveTarget - * ); - */ - var interactiveTarget = { - /** - * Enable interaction events for the DisplayObject. Touch, pointer and mouse - * events will not be emitted unless `interactive` is set to `true`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.on('tap', (event) => { - * //handle event - * }); - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - interactive: false, - /** - * Determines if the children to the displayObject can be clicked/touched - * Setting this to false allows PixiJS to bypass a recursive `hitTest` function - * - * @member {boolean} - * @memberof PIXI.Container# - */ - interactiveChildren: true, - /** - * Interaction shape. Children will be hit first, then this shape will be checked. - * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); - * @member {PIXI.IHitArea} - * @memberof PIXI.DisplayObject# - */ - hitArea: null, - /** - * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive - * Setting this changes the 'cursor' property to `'pointer'`. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.buttonMode = true; - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - get buttonMode() { - return this.cursor === 'pointer'; - }, - set buttonMode(value) { - if (value) { - this.cursor = 'pointer'; - } - else if (this.cursor === 'pointer') { - this.cursor = null; - } - }, - /** - * This defines what cursor mode is used when the mouse cursor - * is hovered over the displayObject. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.interactive = true; - * sprite.cursor = 'wait'; - * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor - * - * @member {string} - * @memberof PIXI.DisplayObject# - */ - cursor: null, - /** - * Internal set of all active pointers, by identifier - * - * @member {Map} - * @memberof PIXI.DisplayObject# - * @private - */ - get trackedPointers() { - if (this._trackedPointers === undefined) - { this._trackedPointers = {}; } - return this._trackedPointers; - }, - /** - * Map of all tracked pointers, by identifier. Use trackedPointers to access. - * - * @private - * @type {Map} - */ - _trackedPointers: undefined, - }; - - // Mix interactiveTarget into DisplayObject.prototype, - // after deprecation has been handled - DisplayObject.mixin(interactiveTarget); - var MOUSE_POINTER_ID = 1; - // helpers for hitTest() - only used inside hitTest() - var hitTestEvent = { - target: null, - data: { - global: null, - }, - }; - /** - * The interaction manager deals with mouse, touch and pointer events. - * - * Any DisplayObject can be interactive if its `interactive` property is set to true. - * - * This manager also supports multitouch. - * - * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var InteractionManager = /** @class */ (function (_super) { - __extends$1(InteractionManager, _super); - /** - * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer - * @param {object} [options] - The options for the manager. - * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions. - * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked. - * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}. - */ - function InteractionManager(renderer, options) { - var _this = _super.call(this) || this; - options = options || {}; - /** - * The renderer this interaction manager works for. - * - * @member {PIXI.AbstractRenderer} - */ - _this.renderer = renderer; - /** - * Should default browser actions automatically be prevented. - * Does not apply to pointer events for backwards compatibility - * preventDefault on pointer events stops mouse events from firing - * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. - * - * @member {boolean} - * @default true - */ - _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; - /** - * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}. - * - * @member {number} - * @default 10 - */ - _this.interactionFrequency = options.interactionFrequency || 10; - /** - * The mouse data - * - * @member {PIXI.InteractionData} - */ - _this.mouse = new InteractionData(); - _this.mouse.identifier = MOUSE_POINTER_ID; - // setting the mouse to start off far off screen will mean that mouse over does - // not get called before we even move the mouse. - _this.mouse.global.set(-999999); - /** - * Actively tracked InteractionData - * - * @private - * @member {Object.} - */ - _this.activeInteractionData = {}; - _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse; - /** - * Pool of unused InteractionData - * - * @private - * @member {PIXI.InteractionData[]} - */ - _this.interactionDataPool = []; - /** - * An event data object to handle all the event tracking/dispatching - * - * @member {object} - */ - _this.eventData = new InteractionEvent(); - /** - * The DOM element to bind to. - * - * @protected - * @member {HTMLElement} - */ - _this.interactionDOMElement = null; - /** - * This property determines if mousemove and touchmove events are fired only when the cursor - * is over the object. - * Setting to true will make things work more in line with how the DOM version works. - * Setting to false can make things easier for things like dragging - * It is currently set to false as this is how PixiJS used to work. This will be set to true in - * future versions of pixi. - * - * @member {boolean} - * @default false - */ - _this.moveWhenInside = false; - /** - * Have events been attached to the dom element? - * - * @protected - * @member {boolean} - */ - _this.eventsAdded = false; - /** - * Has the system ticker been added? - * - * @protected - * @member {boolean} - */ - _this.tickerAdded = false; - /** - * Is the mouse hovering over the renderer? - * - * @protected - * @member {boolean} - */ - _this.mouseOverRenderer = false; - /** - * Does the device support touch events - * https://www.w3.org/TR/touch-events/ - * - * @readonly - * @member {boolean} - */ - _this.supportsTouchEvents = 'ontouchstart' in window; - /** - * Does the device support pointer events - * https://www.w3.org/Submission/pointer-events/ - * - * @readonly - * @member {boolean} - */ - _this.supportsPointerEvents = !!window.PointerEvent; - // this will make it so that you don't have to call bind all the time - /** - * @private - * @member {Function} - */ - _this.onPointerUp = _this.onPointerUp.bind(_this); - _this.processPointerUp = _this.processPointerUp.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerCancel = _this.onPointerCancel.bind(_this); - _this.processPointerCancel = _this.processPointerCancel.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerDown = _this.onPointerDown.bind(_this); - _this.processPointerDown = _this.processPointerDown.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerMove = _this.onPointerMove.bind(_this); - _this.processPointerMove = _this.processPointerMove.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerOut = _this.onPointerOut.bind(_this); - _this.processPointerOverOut = _this.processPointerOverOut.bind(_this); - /** - * @private - * @member {Function} - */ - _this.onPointerOver = _this.onPointerOver.bind(_this); - /** - * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor - * values, objects are handled as dictionaries of CSS values for interactionDOMElement, - * and functions are called instead of changing the CSS. - * Default CSS cursor values are provided for 'default' and 'pointer' modes. - * @member {Object.} - */ - _this.cursorStyles = { - default: 'inherit', - pointer: 'pointer', - }; - /** - * The mode of the cursor that is being used. - * The value of this is a key from the cursorStyles dictionary. - * - * @member {string} - */ - _this.currentCursorMode = null; - /** - * Internal cached let. - * - * @private - * @member {string} - */ - _this.cursor = null; - /** - * The current resolution / device pixel ratio. - * - * @member {number} - * @default 1 - */ - _this.resolution = 1; - /** - * Delayed pointer events. Used to guarantee correct ordering of over/out events. - * - * @private - * @member {Array} - */ - _this.delayedEvents = []; - /** - * TreeSearch component that is used to hitTest stage tree - * - * @private - * @member {PIXI.TreeSearch} - */ - _this.search = new TreeSearch(); - /** - * Used as a last rendered object in case renderer doesnt have _lastObjectRendered - * @member {DisplayObject} - * @private - */ - _this._tempDisplayObject = new TemporaryDisplayObject(); - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display - * object. - * - * @event PIXI.InteractionManager#mousedown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. - * - * @event PIXI.InteractionManager#rightdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. - * - * @event PIXI.InteractionManager#mouseup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. - * - * @event PIXI.InteractionManager#rightup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. - * - * @event PIXI.InteractionManager#click - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. - * - * @event PIXI.InteractionManager#rightclick - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.InteractionManager#event:mousedown}. - * - * @event PIXI.InteractionManager#mouseupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.InteractionManager#event:rightdown}. - * - * @event PIXI.InteractionManager#rightupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object - * - * @event PIXI.InteractionManager#mousemove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object - * - * @event PIXI.InteractionManager#mouseover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved off the display object - * - * @event PIXI.InteractionManager#mouseout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed on the display object. - * - * @event PIXI.InteractionManager#pointerdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released over the display object. - * Not always fired when some buttons are held down while others are released. In those cases, - * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and - * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead. - * - * @event PIXI.InteractionManager#pointerup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a pointer event - * - * @event PIXI.InteractionManager#pointercancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed and released on the display object. - * - * @event PIXI.InteractionManager#pointertap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}. - * - * @event PIXI.InteractionManager#pointerupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved while over the display object - * - * @event PIXI.InteractionManager#pointermove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved onto the display object - * - * @event PIXI.InteractionManager#pointerover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved off the display object - * - * @event PIXI.InteractionManager#pointerout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed on the display object. - * - * @event PIXI.InteractionManager#touchstart - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed from the display object. - * - * @event PIXI.InteractionManager#touchend - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a touch - * - * @event PIXI.InteractionManager#touchcancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed and removed from the display object. - * - * @event PIXI.InteractionManager#tap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}. - * - * @event PIXI.InteractionManager#touchendoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is moved along the display object. - * - * @event PIXI.InteractionManager#touchmove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousedown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released over the display - * object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is pressed and released on - * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#click - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is pressed - * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightclick - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button (usually a mouse left-button) is released outside the - * display object that initially registered a - * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device secondary button (usually a mouse right-button) is released - * outside the display object that initially registered a - * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#rightupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mousemove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device (usually a mouse) is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#mouseout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerdown - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerup - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a pointer event. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointercancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is pressed and released on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointertap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerupoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved while over the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointermove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved onto the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerover - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a pointer device is moved off the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#pointerout - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed on the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchstart - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchend - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when the operating system cancels a touch. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchcancel - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is placed and removed from the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#tap - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchendoutside - * @param {PIXI.InteractionEvent} event - Interaction event - */ - /** - * Fired when a touch point is moved along the display object. - * DisplayObject's `interactive` property must be set to `true` to fire event. - * - * @event PIXI.DisplayObject#touchmove - * @param {PIXI.InteractionEvent} event - Interaction event - */ - _this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; - _this.setTargetElement(_this.renderer.view, _this.renderer.resolution); - return _this; - } - Object.defineProperty(InteractionManager.prototype, "useSystemTicker", { - /** - * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. - * - * @member {boolean} - * @default true - */ - get: function () { - return this._useSystemTicker; - }, - set: function (useSystemTicker) { - this._useSystemTicker = useSystemTicker; - if (useSystemTicker) { - this.addTickerListener(); - } - else { - this.removeTickerListener(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InteractionManager.prototype, "lastObjectRendered", { - /** - * Last rendered object or temp object - * @readonly - * @protected - * @member {PIXI.DisplayObject} - */ - get: function () { - return this.renderer._lastObjectRendered || this._tempDisplayObject; - }, - enumerable: false, - configurable: true - }); - /** - * Hit tests a point against the display tree, returning the first interactive object that is hit. - * - * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. - * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults - * to the last rendered root of the associated renderer. - * @return {PIXI.DisplayObject} The hit display object, if any. - */ - InteractionManager.prototype.hitTest = function (globalPoint, root) { - // clear the target for our hit test - hitTestEvent.target = null; - // assign the global point - hitTestEvent.data.global = globalPoint; - // ensure safety of the root - if (!root) { - root = this.lastObjectRendered; - } - // run the hit test - this.processInteractive(hitTestEvent, root, null, true); - // return our found object - it'll be null if we didn't hit anything - return hitTestEvent.target; - }; - /** - * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate - * another DOM element to receive those events. - * - * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. - * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). - */ - InteractionManager.prototype.setTargetElement = function (element, resolution) { - if (resolution === void 0) { resolution = 1; } - this.removeTickerListener(); - this.removeEvents(); - this.interactionDOMElement = element; - this.resolution = resolution; - this.addEvents(); - this.addTickerListener(); - }; - /** - * Add the ticker listener - * - * @private - */ - InteractionManager.prototype.addTickerListener = function () { - if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) { - return; - } - Ticker.system.add(this.tickerUpdate, this, exports.UPDATE_PRIORITY.INTERACTION); - this.tickerAdded = true; - }; - /** - * Remove the ticker listener - * - * @private - */ - InteractionManager.prototype.removeTickerListener = function () { - if (!this.tickerAdded) { - return; - } - Ticker.system.remove(this.tickerUpdate, this); - this.tickerAdded = false; - }; - /** - * Registers all the DOM events - * - * @private - */ - InteractionManager.prototype.addEvents = function () { - if (this.eventsAdded || !this.interactionDOMElement) { - return; - } - var style = this.interactionDOMElement.style; - if (window.navigator.msPointerEnabled) { - style.msContentZooming = 'none'; - style.msTouchAction = 'none'; - } - else if (this.supportsPointerEvents) { - style.touchAction = 'none'; - } - /** - * These events are added first, so that if pointer events are normalized, they are fired - * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd - */ - if (this.supportsPointerEvents) { - window.document.addEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); - // pointerout is fired in addition to pointerup (for touch events) and pointercancel - // we already handle those, so for the purposes of what we do in onPointerOut, we only - // care about the pointerleave event - this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); - window.addEventListener('pointercancel', this.onPointerCancel, true); - window.addEventListener('pointerup', this.onPointerUp, true); - } - else { - window.document.addEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); - window.addEventListener('mouseup', this.onPointerUp, true); - } - // always look directly for touch events so that we can provide original data - // In a future version we should change this to being just a fallback and rely solely on - // PointerEvents whenever available - if (this.supportsTouchEvents) { - this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); - } - this.eventsAdded = true; - }; - /** - * Removes all the DOM events that were previously registered - * - * @private - */ - InteractionManager.prototype.removeEvents = function () { - if (!this.eventsAdded || !this.interactionDOMElement) { - return; - } - var style = this.interactionDOMElement.style; - if (window.navigator.msPointerEnabled) { - style.msContentZooming = ''; - style.msTouchAction = ''; - } - else if (this.supportsPointerEvents) { - style.touchAction = ''; - } - if (this.supportsPointerEvents) { - window.document.removeEventListener('pointermove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); - window.removeEventListener('pointercancel', this.onPointerCancel, true); - window.removeEventListener('pointerup', this.onPointerUp, true); - } - else { - window.document.removeEventListener('mousemove', this.onPointerMove, true); - this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); - this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); - window.removeEventListener('mouseup', this.onPointerUp, true); - } - if (this.supportsTouchEvents) { - this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); - this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); - this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); - this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); - } - this.interactionDOMElement = null; - this.eventsAdded = false; - }; - /** - * Updates the state of interactive objects if at least {@link interactionFrequency} - * milliseconds have passed since the last invocation. - * - * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}. - * - * @param {number} deltaTime - time delta since the last call - */ - InteractionManager.prototype.tickerUpdate = function (deltaTime) { - this._deltaTime += deltaTime; - if (this._deltaTime < this.interactionFrequency) { - return; - } - this._deltaTime = 0; - this.update(); - }; - /** - * Updates the state of interactive objects. - */ - InteractionManager.prototype.update = function () { - if (!this.interactionDOMElement) { - return; - } - // if the user move the mouse this check has already been done using the mouse move! - if (this._didMove) { - this._didMove = false; - return; - } - this.cursor = null; - // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, - // but there was a scenario of a display object moving under a static mouse cursor. - // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function - for (var k in this.activeInteractionData) { - // eslint-disable-next-line no-prototype-builtins - if (this.activeInteractionData.hasOwnProperty(k)) { - var interactionData = this.activeInteractionData[k]; - if (interactionData.originalEvent && interactionData.pointerType !== 'touch') { - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData); - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true); - } - } - } - this.setCursorMode(this.cursor); - }; - /** - * Sets the current cursor mode, handling any callbacks or CSS style changes. - * - * @param {string} mode - cursor mode, a key from the cursorStyles dictionary - */ - InteractionManager.prototype.setCursorMode = function (mode) { - mode = mode || 'default'; - // if the mode didn't actually change, bail early - if (this.currentCursorMode === mode) { - return; - } - this.currentCursorMode = mode; - var style = this.cursorStyles[mode]; - // only do things if there is a cursor style for it - if (style) { - switch (typeof style) { - case 'string': - // string styles are handled as cursor CSS - this.interactionDOMElement.style.cursor = style; - break; - case 'function': - // functions are just called, and passed the cursor mode - style(mode); - break; - case 'object': - // if it is an object, assume that it is a dictionary of CSS styles, - // apply it to the interactionDOMElement - Object.assign(this.interactionDOMElement.style, style); - break; - } - } - else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) { - // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry - // for the mode, then assume that the dev wants it to be CSS for the cursor. - this.interactionDOMElement.style.cursor = mode; - } - }; - /** - * Dispatches an event on the display object that was interacted with - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {PIXI.InteractionEvent} eventData - the event data object - * @private - */ - InteractionManager.prototype.dispatchEvent = function (displayObject, eventString, eventData) { - // Even if the event was stopped, at least dispatch any remaining events - // for the same display object. - if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) { - eventData.currentTarget = displayObject; - eventData.type = eventString; - displayObject.emit(eventString, eventData); - if (displayObject[eventString]) { - displayObject[eventString](eventData); - } - } - }; - /** - * Puts a event on a queue to be dispatched later. This is used to guarantee correct - * ordering of over/out events. - * - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question - * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {object} eventData - the event data object - * @private - */ - InteractionManager.prototype.delayDispatchEvent = function (displayObject, eventString, eventData) { - this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); - }; - /** - * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The - * resulting value is stored in the point. This takes into account the fact that the DOM - * element could be scaled and positioned anywhere on the screen. - * - * @param {PIXI.IPointData} point - the point that the result will be stored in - * @param {number} x - the x coord of the position to map - * @param {number} y - the y coord of the position to map - */ - InteractionManager.prototype.mapPositionToPoint = function (point, x, y) { - var rect; - // IE 11 fix - if (!this.interactionDOMElement.parentElement) { - rect = { x: 0, y: 0, width: 0, height: 0 }; - } - else { - rect = this.interactionDOMElement.getBoundingClientRect(); - } - var resolutionMultiplier = 1.0 / this.resolution; - point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; - point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; - }; - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @protected - * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - indicates whether we want to calculate hits - * or just iterate through all interactive objects - */ - InteractionManager.prototype.processInteractive = function (interactionEvent, displayObject, func, hitTest) { - var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); - var delayedEvents = this.delayedEvents; - if (!delayedEvents.length) { - return hit; - } - // Reset the propagation hint, because we start deeper in the tree again. - interactionEvent.stopPropagationHint = false; - var delayedLen = delayedEvents.length; - this.delayedEvents = []; - for (var i = 0; i < delayedLen; i++) { - var _a = delayedEvents[i], displayObject_1 = _a.displayObject, eventString = _a.eventString, eventData = _a.eventData; - // When we reach the object we wanted to stop propagating at, - // set the propagation hint. - if (eventData.stopsPropagatingAt === displayObject_1) { - eventData.stopPropagationHint = true; - } - this.dispatchEvent(displayObject_1, eventString, eventData); - } - return hit; - }; - /** - * Is called when the pointer button is pressed down on the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down - */ - InteractionManager.prototype.onPointerDown = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - /** - * No need to prevent default on natural pointer events, as there are no side effects - * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, - * so still need to be prevented. - */ - // Guaranteed that there will be at least one event in events, and all events must have the same pointer type - if (this.autoPreventDefault && events[0].isNormalized) { - var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); - if (cancelable) { - originalEvent.preventDefault(); - } - } - var eventLen = events.length; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true); - this.emit('pointerdown', interactionEvent); - if (event.pointerType === 'touch') { - this.emit('touchstart', interactionEvent); - } - // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event - else if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - var isRightButton = event.button === 2; - this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); - } - } - }; - /** - * Processes the result of the pointer down check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerDown = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - if (hit) { - if (!displayObject.trackedPointers[id]) { - displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); - if (data.pointerType === 'touch') { - this.dispatchEvent(displayObject, 'touchstart', interactionEvent); - } - else if (data.pointerType === 'mouse' || data.pointerType === 'pen') { - var isRightButton = data.button === 2; - if (isRightButton) { - displayObject.trackedPointers[id].rightDown = true; - } - else { - displayObject.trackedPointers[id].leftDown = true; - } - this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); - } - } - }; - /** - * Is called when the pointer button is released on the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released - * @param {boolean} cancelled - true if the pointer is cancelled - * @param {Function} func - Function passed to {@link processInteractive} - */ - InteractionManager.prototype.onPointerComplete = function (originalEvent, cancelled, func) { - var events = this.normalizeToPointerData(originalEvent); - var eventLen = events.length; - // if the event wasn't targeting our canvas, then consider it to be pointerupoutside - // in all cases (unless it was a pointercancel) - var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - // perform hit testing for events targeting our canvas or cancel events - this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend); - this.emit(cancelled ? 'pointercancel' : "pointerup" + eventAppend, interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - var isRightButton = event.button === 2; - this.emit(isRightButton ? "rightup" + eventAppend : "mouseup" + eventAppend, interactionEvent); - } - else if (event.pointerType === 'touch') { - this.emit(cancelled ? 'touchcancel' : "touchend" + eventAppend, interactionEvent); - this.releaseInteractionDataForPointerId(event.pointerId); - } - } - }; - /** - * Is called when the pointer button is cancelled - * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released - */ - InteractionManager.prototype.onPointerCancel = function (event) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') - { return; } - this.onPointerComplete(event, true, this.processPointerCancel); - }; - /** - * Processes the result of the pointer cancel check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - */ - InteractionManager.prototype.processPointerCancel = function (interactionEvent, displayObject) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - if (displayObject.trackedPointers[id] !== undefined) { - delete displayObject.trackedPointers[id]; - this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); - if (data.pointerType === 'touch') { - this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); - } - } - }; - /** - * Is called when the pointer button is released on the renderer element - * - * @private - * @param {PointerEvent} event - The DOM event of a pointer button being released - */ - InteractionManager.prototype.onPointerUp = function (event) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') - { return; } - this.onPointerComplete(event, false, this.processPointerUp); - }; - /** - * Processes the result of the pointer up check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerUp = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var trackingData = displayObject.trackedPointers[id]; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - // need to track mouse down status in the mouse block so that we can emit - // event in a later block - var isMouseTap = false; - // Mouse only - if (isMouse) { - var isRightButton = data.button === 2; - var flags = InteractionTrackingData.FLAGS; - var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; - var isDown = trackingData !== undefined && (trackingData.flags & test); - if (hit) { - this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); - if (isDown) { - this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); - // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap - isMouseTap = true; - } - } - else if (isDown) { - this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); - } - // update the down state of the tracking data - if (trackingData) { - if (isRightButton) { - trackingData.rightDown = false; - } - else { - trackingData.leftDown = false; - } - } - } - // Pointers and Touches, and Mouse - if (hit) { - this.dispatchEvent(displayObject, 'pointerup', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } - if (trackingData) { - // emit pointertap if not a mouse, or if the mouse block decided it was a tap - if (!isMouse || isMouseTap) { - this.dispatchEvent(displayObject, 'pointertap', interactionEvent); - } - if (isTouch) { - this.dispatchEvent(displayObject, 'tap', interactionEvent); - // touches are no longer over (if they ever were) when we get the touchend - // so we should ensure that we don't keep pretending that they are - trackingData.over = false; - } - } - } - else if (trackingData) { - this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } - } - // Only remove the tracking data if there is no over/down state still associated with it - if (trackingData && trackingData.none) { - delete displayObject.trackedPointers[id]; - } - }; - /** - * Is called when the pointer moves across the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer moving - */ - InteractionManager.prototype.onPointerMove = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') { - this._didMove = true; - this.cursor = null; - } - var eventLen = events.length; - for (var i = 0; i < eventLen; i++) { - var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true); - this.emit('pointermove', interactionEvent); - if (event.pointerType === 'touch') - { this.emit('touchmove', interactionEvent); } - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { this.emit('mousemove', interactionEvent); } - } - if (events[0].pointerType === 'mouse') { - this.setCursorMode(this.cursor); - // TODO BUG for parents interactive object (border order issue) - } - }; - /** - * Processes the result of the pointer move check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerMove = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - if (isMouse) { - this.processPointerOverOut(interactionEvent, displayObject, hit); - } - if (!this.moveWhenInside || hit) { - this.dispatchEvent(displayObject, 'pointermove', interactionEvent); - if (isTouch) - { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } - if (isMouse) - { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } - } - }; - /** - * Is called when the pointer is moved out of the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out - */ - InteractionManager.prototype.onPointerOut = function (originalEvent) { - // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') - { return; } - var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOut, so events will always be length 1 - var event = events[0]; - if (event.pointerType === 'mouse') { - this.mouseOverRenderer = false; - this.setCursorMode(null); - } - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false); - this.emit('pointerout', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - this.emit('mouseout', interactionEvent); - } - else { - // we can get touchleave events after touchend, so we want to make sure we don't - // introduce memory leaks - this.releaseInteractionDataForPointerId(interactionData.identifier); - } - }; - /** - * Processes the result of the pointer over/out check and dispatches the event if need be - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested - * @param {boolean} hit - the result of the hit test on the display object - */ - InteractionManager.prototype.processPointerOverOut = function (interactionEvent, displayObject, hit) { - var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - var trackingData = displayObject.trackedPointers[id]; - // if we just moused over the display object, then we need to track that state - if (hit && !trackingData) { - trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); - } - if (trackingData === undefined) - { return; } - if (hit && this.mouseOverRenderer) { - if (!trackingData.over) { - trackingData.over = true; - this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); - if (isMouse) { - this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); - } - } - // only change the cursor if it has not already been changed (by something deeper in the - // display tree) - if (isMouse && this.cursor === null) { - this.cursor = displayObject.cursor; - } - } - else if (trackingData.over) { - trackingData.over = false; - this.dispatchEvent(displayObject, 'pointerout', this.eventData); - if (isMouse) { - this.dispatchEvent(displayObject, 'mouseout', interactionEvent); - } - // if there is no mouse down information for the pointer, then it is safe to delete - if (trackingData.none) { - delete displayObject.trackedPointers[id]; - } - } - }; - /** - * Is called when the pointer is moved into the renderer element - * - * @private - * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view - */ - InteractionManager.prototype.onPointerOver = function (originalEvent) { - var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOver, so events will always be length 1 - var event = events[0]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - if (event.pointerType === 'mouse') { - this.mouseOverRenderer = true; - } - this.emit('pointerover', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { - this.emit('mouseover', interactionEvent); - } - }; - /** - * Get InteractionData for a given pointerId. Store that data as well - * - * @private - * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData - * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier - */ - InteractionManager.prototype.getInteractionDataForPointerId = function (event) { - var pointerId = event.pointerId; - var interactionData; - if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') { - interactionData = this.mouse; - } - else if (this.activeInteractionData[pointerId]) { - interactionData = this.activeInteractionData[pointerId]; - } - else { - interactionData = this.interactionDataPool.pop() || new InteractionData(); - interactionData.identifier = pointerId; - this.activeInteractionData[pointerId] = interactionData; - } - // copy properties from the event, so that we can make sure that touch/pointer specific - // data is available - interactionData.copyEvent(event); - return interactionData; - }; - /** - * Return unused InteractionData to the pool, for a given pointerId - * - * @private - * @param {number} pointerId - Identifier from a pointer event - */ - InteractionManager.prototype.releaseInteractionDataForPointerId = function (pointerId) { - var interactionData = this.activeInteractionData[pointerId]; - if (interactionData) { - delete this.activeInteractionData[pointerId]; - interactionData.reset(); - this.interactionDataPool.push(interactionData); - } - }; - /** - * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData - * - * @private - * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured - * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent - * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired - * with the InteractionEvent - * @return {PIXI.InteractionEvent} the interaction event that was passed in - */ - InteractionManager.prototype.configureInteractionEventForDOMEvent = function (interactionEvent, pointerEvent, interactionData) { - interactionEvent.data = interactionData; - this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); - // Not really sure why this is happening, but it's how a previous version handled things - if (pointerEvent.pointerType === 'touch') { - pointerEvent.globalX = interactionData.global.x; - pointerEvent.globalY = interactionData.global.y; - } - interactionData.originalEvent = pointerEvent; - interactionEvent.reset(); - return interactionEvent; - }; - /** - * Ensures that the original event object contains all data that a regular pointer event would have - * - * @private - * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event - * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer - * or mouse event, or a multiple normalized pointer events if there are multiple changed touches - */ - InteractionManager.prototype.normalizeToPointerData = function (event) { - var normalizedEvents = []; - if (this.supportsTouchEvents && event instanceof TouchEvent) { - for (var i = 0, li = event.changedTouches.length; i < li; i++) { - var touch = event.changedTouches[i]; - if (typeof touch.button === 'undefined') - { touch.button = event.touches.length ? 1 : 0; } - if (typeof touch.buttons === 'undefined') - { touch.buttons = event.touches.length ? 1 : 0; } - if (typeof touch.isPrimary === 'undefined') { - touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; - } - if (typeof touch.width === 'undefined') - { touch.width = touch.radiusX || 1; } - if (typeof touch.height === 'undefined') - { touch.height = touch.radiusY || 1; } - if (typeof touch.tiltX === 'undefined') - { touch.tiltX = 0; } - if (typeof touch.tiltY === 'undefined') - { touch.tiltY = 0; } - if (typeof touch.pointerType === 'undefined') - { touch.pointerType = 'touch'; } - if (typeof touch.pointerId === 'undefined') - { touch.pointerId = touch.identifier || 0; } - if (typeof touch.pressure === 'undefined') - { touch.pressure = touch.force || 0.5; } - if (typeof touch.twist === 'undefined') - { touch.twist = 0; } - if (typeof touch.tangentialPressure === 'undefined') - { touch.tangentialPressure = 0; } - // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven - // support, and the fill ins are not quite the same - // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top - // left is not 0,0 on the page - if (typeof touch.layerX === 'undefined') - { touch.layerX = touch.offsetX = touch.clientX; } - if (typeof touch.layerY === 'undefined') - { touch.layerY = touch.offsetY = touch.clientY; } - // mark the touch as normalized, just so that we know we did it - touch.isNormalized = true; - normalizedEvents.push(touch); - } - } - // apparently PointerEvent subclasses MouseEvent, so yay - else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) { - var tempEvent = event; - if (typeof tempEvent.isPrimary === 'undefined') - { tempEvent.isPrimary = true; } - if (typeof tempEvent.width === 'undefined') - { tempEvent.width = 1; } - if (typeof tempEvent.height === 'undefined') - { tempEvent.height = 1; } - if (typeof tempEvent.tiltX === 'undefined') - { tempEvent.tiltX = 0; } - if (typeof tempEvent.tiltY === 'undefined') - { tempEvent.tiltY = 0; } - if (typeof tempEvent.pointerType === 'undefined') - { tempEvent.pointerType = 'mouse'; } - if (typeof tempEvent.pointerId === 'undefined') - { tempEvent.pointerId = MOUSE_POINTER_ID; } - if (typeof tempEvent.pressure === 'undefined') - { tempEvent.pressure = 0.5; } - if (typeof tempEvent.twist === 'undefined') - { tempEvent.twist = 0; } - if (typeof tempEvent.tangentialPressure === 'undefined') - { tempEvent.tangentialPressure = 0; } - // mark the mouse event as normalized, just so that we know we did it - tempEvent.isNormalized = true; - normalizedEvents.push(tempEvent); - } - else { - normalizedEvents.push(event); - } - return normalizedEvents; - }; - /** - * Destroys the interaction manager - * - */ - InteractionManager.prototype.destroy = function () { - this.removeEvents(); - this.removeTickerListener(); - this.removeAllListeners(); - this.renderer = null; - this.mouse = null; - this.eventData = null; - this.interactionDOMElement = null; - this.onPointerDown = null; - this.processPointerDown = null; - this.onPointerUp = null; - this.processPointerUp = null; - this.onPointerCancel = null; - this.processPointerCancel = null; - this.onPointerMove = null; - this.processPointerMove = null; - this.onPointerOut = null; - this.processPointerOverOut = null; - this.onPointerOver = null; - this.search = null; - }; - return InteractionManager; - }(eventemitter3)); - - /*! - * @pixi/runner - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/runner is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - /** - * A Runner is a highly performant and simple alternative to signals. Best used in situations - * where events are dispatched to many objects at high frequency (say every frame!) - * - * - * like a signal.. - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myObject = { - * loaded: new Runner('loaded') - * } - * - * const listener = { - * loaded: function(){ - * // thin - * } - * } - * - * myObject.update.add(listener); - * - * myObject.loaded.emit(); - * ``` - * - * Or for handling calling the same function on many items - * ``` - * import { Runner } from '@pixi/runner'; - * - * const myGame = { - * update: new Runner('update') - * } - * - * const gameObject = { - * update: function(time){ - * // update my gamey state - * } - * } - * - * myGame.update.add(gameObject1); - * - * myGame.update.emit(time); - * ``` - * @class - * @memberof PIXI - */ - var Runner = /** @class */ (function () { - /** - * @param {string} name - the function name that will be executed on the listeners added to this Runner. - */ - function Runner(name) { - this.items = []; - this._name = name; - this._aliasCount = 0; - } - /** - * Dispatch/Broadcast Runner to all listeners added to the queue. - * @param {...any} params - optional parameters to pass to each listener - * @return {PIXI.Runner} - */ - Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { - if (arguments.length > 8) { - throw new Error('max arguments reached'); - } - var _a = this, name = _a.name, items = _a.items; - this._aliasCount++; - for (var i = 0, len = items.length; i < len; i++) { - items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); - } - if (items === this.items) { - this._aliasCount--; - } - return this; - }; - Runner.prototype.ensureNonAliasedItems = function () { - if (this._aliasCount > 0 && this.items.length > 1) { - this._aliasCount = 0; - this.items = this.items.slice(0); - } - }; - /** - * Add a listener to the Runner - * - * Runners do not need to have scope or functions passed to them. - * All that is required is to pass the listening object and ensure that it has contains a function that has the same name - * as the name provided to the Runner when it was created. - * - * Eg A listener passed to this Runner will require a 'complete' function. - * - * ``` - * import { Runner } from '@pixi/runner'; - * - * const complete = new Runner('complete'); - * ``` - * - * The scope used will be the object itself. - * - * @param {any} item - The object that will be listening. - * @return {PIXI.Runner} - */ - Runner.prototype.add = function (item) { - if (item[this._name]) { - this.ensureNonAliasedItems(); - this.remove(item); - this.items.push(item); - } - return this; - }; - /** - * Remove a single listener from the dispatch queue. - * @param {any} item - The listenr that you would like to remove. - * @return {PIXI.Runner} - */ - Runner.prototype.remove = function (item) { - var index = this.items.indexOf(item); - if (index !== -1) { - this.ensureNonAliasedItems(); - this.items.splice(index, 1); - } - return this; - }; - /** - * Check to see if the listener is already in the Runner - * @param {any} item - The listener that you would like to check. - */ - Runner.prototype.contains = function (item) { - return this.items.indexOf(item) !== -1; - }; - /** - * Remove all listeners from the Runner - * @return {PIXI.Runner} - */ - Runner.prototype.removeAll = function () { - this.ensureNonAliasedItems(); - this.items.length = 0; - return this; - }; - /** - * Remove all references, don't use after this. - */ - Runner.prototype.destroy = function () { - this.removeAll(); - this.items = null; - this._name = null; - }; - Object.defineProperty(Runner.prototype, "empty", { - /** - * `true` if there are no this Runner contains no listeners - * - * @member {boolean} - * @readonly - */ - get: function () { - return this.items.length === 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Runner.prototype, "name", { - /** - * The name of the runner. - * - * @member {string} - * @readonly - */ - get: function () { - return this._name; - }, - enumerable: false, - configurable: true - }); - return Runner; - }()); - Object.defineProperties(Runner.prototype, { - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method dispatch - * @see PIXI.Runner#emit - */ - dispatch: { value: Runner.prototype.emit }, - /** - * Alias for `emit` - * @memberof PIXI.Runner# - * @method run - * @see PIXI.Runner#emit - */ - run: { value: Runner.prototype.emit }, - }); - - /*! - * @pixi/core - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/core is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The maximum support for using WebGL. If a device does not - * support WebGL version, for instance WebGL 2, it will still - * attempt to fallback support to WebGL 1. If you want to - * explicitly remove feature support to target a more stable - * baseline, prefer a lower environment. - * - * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} - * we disable webgl2 by default for all non-apple mobile devices. - * - * @static - * @name PREFER_ENV - * @memberof PIXI.settings - * @type {number} - * @default PIXI.ENV.WEBGL2 - */ - settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; - /** - * If set to `true`, *only* Textures and BaseTexture objects stored - * in the caches ({@link PIXI.utils.TextureCache TextureCache} and - * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be - * used when calling {@link PIXI.Texture.from Texture.from} or - * {@link PIXI.BaseTexture.from BaseTexture.from}. - * Otherwise, these `from` calls throw an exception. Using this property - * can be useful if you want to enforce preloading all assets with - * {@link PIXI.Loader Loader}. - * - * @static - * @name STRICT_TEXTURE_CACHE - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - settings.STRICT_TEXTURE_CACHE = false; - - /** - * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}. - * @example - * class CustomResource extends PIXI.resources.Resource { - * // MUST have source, options constructor signature - * // for auto-detected resources to be created. - * constructor(source, options) { - * super(); - * } - * upload(renderer, baseTexture, glTexture) { - * // upload with GL - * return true; - * } - * // used to auto-detect resource - * static test(source, extension) { - * return extension === 'xyz'|| source instanceof SomeClass; - * } - * } - * // Install the new resource type - * PIXI.resources.INSTALLED.push(CustomResource); - * - * @name PIXI.resources.INSTALLED - * @type {Array<*>} - * @static - * @readonly - */ - var INSTALLED = []; - /** - * Create a resource element from a single source element. This - * auto-detects which type of resource to create. All resources that - * are auto-detectable must have a static `test` method and a constructor - * with the arguments `(source, options?)`. Currently, the supported - * resources for auto-detection include: - * - {@link PIXI.resources.ImageResource} - * - {@link PIXI.resources.CanvasResource} - * - {@link PIXI.resources.VideoResource} - * - {@link PIXI.resources.SVGResource} - * - {@link PIXI.resources.BufferResource} - * @static - * @function PIXI.resources.autoDetectResource - * @param {string|*} source - Resource source, this can be the URL to the resource, - * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri - * or any other resource that can be auto-detected. If not resource is - * detected, it's assumed to be an ImageResource. - * @param {object} [options] - Pass-through options to use for Resource - * @param {number} [options.width] - Width of BufferResource or SVG rasterization - * @param {number} [options.height] - Height of BufferResource or SVG rasterization - * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading - * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height - * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object - * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin - * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately - * @param {number} [options.updateFPS=0] - Video option to update how many times a second the - * texture should be updated from the video. Leave at 0 to update at every render - * @return {PIXI.resources.Resource} The created resource. - */ - function autoDetectResource(source, options) { - if (!source) { - return null; - } - var extension = ''; - if (typeof source === 'string') { - // search for file extension: period, 3-4 chars, then ?, # or EOL - var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); - if (result) { - extension = result[1].toLowerCase(); - } - } - for (var i = INSTALLED.length - 1; i >= 0; --i) { - var ResourcePlugin = INSTALLED[i]; - if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { - return new ResourcePlugin(source, options); - } - } - throw new Error('Unrecognized source type to auto-detect Resource'); - } - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$2 = function(d, b) { - extendStatics$2 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$2(d, b); - }; - - function __extends$2(d, b) { - extendStatics$2(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Base resource class for textures that manages validation and uploading, depending on its type. - * - * Uploading of a base texture to the GPU is required. - * - * @class - * @memberof PIXI.resources - */ - var Resource = /** @class */ (function () { - /** - * @param {number} [width=0] - Width of the resource - * @param {number} [height=0] - Height of the resource - */ - function Resource(width, height) { - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - /** - * Internal width of the resource - * @member {number} - * @protected - */ - this._width = width; - /** - * Internal height of the resource - * @member {number} - * @protected - */ - this._height = height; - /** - * If resource has been destroyed - * @member {boolean} - * @readonly - * @default false - */ - this.destroyed = false; - /** - * `true` if resource is created by BaseTexture - * useful for doing cleanup with BaseTexture destroy - * and not cleaning up resources that were created - * externally. - * @member {boolean} - * @protected - */ - this.internal = false; - /** - * Mini-runner for handling resize events - * accepts 2 parameters: width, height - * - * @member {Runner} - * @private - */ - this.onResize = new Runner('setRealSize'); - /** - * Mini-runner for handling update events - * - * @member {Runner} - * @private - */ - this.onUpdate = new Runner('update'); - /** - * Handle internal errors, such as loading errors - * accepts 1 param: error - * - * @member {Runner} - * @private - */ - this.onError = new Runner('onError'); - } - /** - * Bind to a parent BaseTexture - * - * @param {PIXI.BaseTexture} baseTexture - Parent texture - */ - Resource.prototype.bind = function (baseTexture) { - this.onResize.add(baseTexture); - this.onUpdate.add(baseTexture); - this.onError.add(baseTexture); - // Call a resize immediate if we already - // have the width and height of the resource - if (this._width || this._height) { - this.onResize.emit(this._width, this._height); - } - }; - /** - * Unbind to a parent BaseTexture - * - * @param {PIXI.BaseTexture} baseTexture - Parent texture - */ - Resource.prototype.unbind = function (baseTexture) { - this.onResize.remove(baseTexture); - this.onUpdate.remove(baseTexture); - this.onError.remove(baseTexture); - }; - /** - * Trigger a resize event - * @param {number} width - X dimension - * @param {number} height - Y dimension - */ - Resource.prototype.resize = function (width, height) { - if (width !== this._width || height !== this._height) { - this._width = width; - this._height = height; - this.onResize.emit(width, height); - } - }; - Object.defineProperty(Resource.prototype, "valid", { - /** - * Has been validated - * @readonly - * @member {boolean} - */ - get: function () { - return !!this._width && !!this._height; - }, - enumerable: false, - configurable: true - }); - /** - * Has been updated trigger event - */ - Resource.prototype.update = function () { - if (!this.destroyed) { - this.onUpdate.emit(); - } - }; - /** - * This can be overridden to start preloading a resource - * or do any other prepare step. - * @protected - * @return {Promise} Handle the validate event - */ - Resource.prototype.load = function () { - return Promise.resolve(this); - }; - Object.defineProperty(Resource.prototype, "width", { - /** - * The width of the resource. - * - * @member {number} - * @readonly - */ - get: function () { - return this._width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resource.prototype, "height", { - /** - * The height of the resource. - * - * @member {number} - * @readonly - */ - get: function () { - return this._height; - }, - enumerable: false, - configurable: true - }); - /** - * Set the style, optional to override - * - * @param {PIXI.Renderer} renderer - yeah, renderer! - * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context - * @returns {boolean} `true` is success - */ - Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { - return false; - }; - /** - * Clean up anything, this happens when destroying is ready. - * - * @protected - */ - Resource.prototype.dispose = function () { - // override - }; - /** - * Call when destroying resource, unbind any BaseTexture object - * before calling this method, as reference counts are maintained - * internally. - */ - Resource.prototype.destroy = function () { - if (!this.destroyed) { - this.destroyed = true; - this.dispose(); - this.onError.removeAll(); - this.onError = null; - this.onResize.removeAll(); - this.onResize = null; - this.onUpdate.removeAll(); - this.onUpdate = null; - } - }; - /** - * Abstract, used to auto-detect resource type - * - * @static - * @param {*} source - The source object - * @param {string} extension - The extension of source, if set - */ - Resource.test = function (_source, _extension) { - return false; - }; - return Resource; - }()); - - /** - * @interface SharedArrayBuffer - */ - /** - * Buffer resource with data of typed array. - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - */ - var BufferResource = /** @class */ (function (_super) { - __extends$2(BufferResource, _super); - /** - * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer - * @param {object} options - Options - * @param {number} options.width - Width of the texture - * @param {number} options.height - Height of the texture - */ - function BufferResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - if (!width || !height) { - throw new Error('BufferResource width or height invalid'); - } - _this = _super.call(this, width, height) || this; - /** - * Source array - * Cannot be ClampedUint8Array because it cant be uploaded to WebGL - * - * @member {Float32Array|Uint8Array|Uint32Array} - */ - _this.data = source; - return _this; - } - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - glTexture - * @returns {boolean} true is success - */ - BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { - var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { - gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); - } - else { - glTexture.width = baseTexture.width; - glTexture.height = baseTexture.height; - gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.width, baseTexture.height, 0, baseTexture.format, glTexture.type, this.data); - } - return true; - }; - /** - * Destroy and don't use after this - * @override - */ - BufferResource.prototype.dispose = function () { - this.data = null; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {*} source - The source object - * @return {boolean} `true` if - */ - BufferResource.test = function (source) { - return source instanceof Float32Array - || source instanceof Uint8Array - || source instanceof Uint32Array; - }; - return BufferResource; - }(Resource)); - - var defaultBufferOptions = { - scaleMode: exports.SCALE_MODES.NEAREST, - format: exports.FORMATS.RGBA, - alphaMode: exports.ALPHA_MODES.NPM, - }; - /** - * A Texture stores the information that represents an image. - * All textures have a base texture, which contains information about the source. - * Therefore you can have many textures all using a single BaseTexture - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - * The current resource to use, for things that aren't Resource objects, will be converted - * into a Resource. - * @param {Object} [options] - Collection of options - * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture - * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture - * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures - * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest - * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type - * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type - * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target - * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha - * @param {number} [options.width=0] - Width of the texture - * @param {number} [options.height=0] - Height of the texture - * @param {number} [options.resolution] - Resolution of the base texture - * @param {object} [options.resourceOptions] - Optional resource options, - * see {@link PIXI.resources.autoDetectResource autoDetectResource} - */ - var BaseTexture = /** @class */ (function (_super) { - __extends$2(BaseTexture, _super); - function BaseTexture(resource, options) { - if (resource === void 0) { resource = null; } - if (options === void 0) { options = null; } - var _this = _super.call(this) || this; - options = options || {}; - var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; - // Convert the resource to a Resource object - if (resource && !(resource instanceof Resource)) { - resource = autoDetectResource(resource, resourceOptions); - resource.internal = true; - } - /** - * The width of the base texture set when the image has loaded - * - * @readonly - * @member {number} - */ - _this.width = width || 0; - /** - * The height of the base texture set when the image has loaded - * - * @readonly - * @member {number} - */ - _this.height = height || 0; - /** - * The resolution / device pixel ratio of the texture - * - * @member {number} - * @default PIXI.settings.RESOLUTION - */ - _this.resolution = resolution || settings.RESOLUTION; - /** - * Mipmap mode of the texture, affects downscaled images - * - * @member {PIXI.MIPMAP_MODES} - * @default PIXI.settings.MIPMAP_TEXTURES - */ - _this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; - /** - * Anisotropic filtering level of texture - * - * @member {number} - * @default PIXI.settings.ANISOTROPIC_LEVEL - */ - _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; - /** - * How the texture wraps - * @member {number} - */ - _this.wrapMode = wrapMode || settings.WRAP_MODE; - /** - * The scale mode to apply when scaling this texture - * - * @member {PIXI.SCALE_MODES} - * @default PIXI.settings.SCALE_MODE - */ - _this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; - /** - * The pixel format of the texture - * - * @member {PIXI.FORMATS} - * @default PIXI.FORMATS.RGBA - */ - _this.format = format || exports.FORMATS.RGBA; - /** - * The type of resource data - * - * @member {PIXI.TYPES} - * @default PIXI.TYPES.UNSIGNED_BYTE - */ - _this.type = type || exports.TYPES.UNSIGNED_BYTE; - /** - * The target type - * - * @member {PIXI.TARGETS} - * @default PIXI.TARGETS.TEXTURE_2D - */ - _this.target = target || exports.TARGETS.TEXTURE_2D; - /** - * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}. - * - * @member {PIXI.ALPHA_MODES} - * @default PIXI.ALPHA_MODES.UNPACK - */ - _this.alphaMode = alphaMode !== undefined ? alphaMode : exports.ALPHA_MODES.UNPACK; - if (options.premultiplyAlpha !== undefined) { - // triggers deprecation - _this.premultiplyAlpha = options.premultiplyAlpha; - } - /** - * Global unique identifier for this BaseTexture - * - * @member {number} - * @protected - */ - _this.uid = uid(); - /** - * Used by automatic texture Garbage Collection, stores last GC tick when it was bound - * - * @member {number} - * @protected - */ - _this.touched = 0; - /** - * Whether or not the texture is a power of two, try to use power of two textures as much - * as you can - * - * @readonly - * @member {boolean} - * @default false - */ - _this.isPowerOfTwo = false; - _this._refreshPOT(); - /** - * The map of render context textures where this is bound - * - * @member {Object} - * @private - */ - _this._glTextures = {}; - /** - * Used by TextureSystem to only update texture to the GPU when needed. - * Please call `update()` to increment it. - * - * @readonly - * @member {number} - */ - _this.dirtyId = 0; - /** - * Used by TextureSystem to only update texture style when needed. - * - * @protected - * @member {number} - */ - _this.dirtyStyleId = 0; - /** - * Currently default cache ID. - * - * @member {string} - */ - _this.cacheId = null; - /** - * Generally speaking means when resource is loaded. - * @readonly - * @member {boolean} - */ - _this.valid = width > 0 && height > 0; - /** - * The collection of alternative cache ids, since some BaseTextures - * can have more than one ID, short name and longer full URL - * - * @member {Array} - * @readonly - */ - _this.textureCacheIds = []; - /** - * Flag if BaseTexture has been destroyed. - * - * @member {boolean} - * @readonly - */ - _this.destroyed = false; - /** - * The resource used by this BaseTexture, there can only - * be one resource per BaseTexture, but textures can share - * resources. - * - * @member {PIXI.resources.Resource} - * @readonly - */ - _this.resource = null; - /** - * Number of the texture batch, used by multi-texture renderers - * - * @member {number} - */ - _this._batchEnabled = 0; - /** - * Location inside texture batch, used by multi-texture renderers - * - * @member {number} - */ - _this._batchLocation = 0; - /** - * Whether its a part of another texture, handled by ArrayResource or CubeResource - * - * @member {PIXI.BaseTexture} - */ - _this.parentTextureArray = null; - /** - * Fired when a not-immediately-available source finishes loading. - * - * @protected - * @event PIXI.BaseTexture#loaded - * @param {PIXI.BaseTexture} baseTexture - Resource loaded. - */ - /** - * Fired when a not-immediately-available source fails to load. - * - * @protected - * @event PIXI.BaseTexture#error - * @param {PIXI.BaseTexture} baseTexture - Resource errored. - * @param {ErrorEvent} event - Load error event. - */ - /** - * Fired when BaseTexture is updated. - * - * @protected - * @event PIXI.BaseTexture#loaded - * @param {PIXI.BaseTexture} baseTexture - Resource loaded. - */ - /** - * Fired when BaseTexture is updated. - * - * @protected - * @event PIXI.BaseTexture#update - * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. - */ - /** - * Fired when BaseTexture is destroyed. - * - * @protected - * @event PIXI.BaseTexture#dispose - * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. - */ - // Set the resource - _this.setResource(resource); - return _this; - } - Object.defineProperty(BaseTexture.prototype, "realWidth", { - /** - * Pixel width of the source of this texture - * - * @readonly - * @member {number} - */ - get: function () { - return Math.ceil((this.width * this.resolution) - 1e-4); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BaseTexture.prototype, "realHeight", { - /** - * Pixel height of the source of this texture - * - * @readonly - * @member {number} - */ - get: function () { - return Math.ceil((this.height * this.resolution) - 1e-4); - }, - enumerable: false, - configurable: true - }); - /** - * Changes style options of BaseTexture - * - * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode - * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { - var dirty; - if (scaleMode !== undefined && scaleMode !== this.scaleMode) { - this.scaleMode = scaleMode; - dirty = true; - } - if (mipmap !== undefined && mipmap !== this.mipmap) { - this.mipmap = mipmap; - dirty = true; - } - if (dirty) { - this.dirtyStyleId++; - } - return this; - }; - /** - * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. - * - * @param {number} width - Visual width - * @param {number} height - Visual height - * @param {number} [resolution] - Optionally set resolution - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setSize = function (width, height, resolution) { - this.resolution = resolution || this.resolution; - this.width = width; - this.height = height; - this._refreshPOT(); - this.update(); - return this; - }; - /** - * Sets real size of baseTexture, preserves current resolution. - * - * @param {number} realWidth - Full rendered width - * @param {number} realHeight - Full rendered height - * @param {number} [resolution] - Optionally set resolution - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { - this.resolution = resolution || this.resolution; - this.width = realWidth / this.resolution; - this.height = realHeight / this.resolution; - this._refreshPOT(); - this.update(); - return this; - }; - /** - * Refresh check for isPowerOfTwo texture based on size - * - * @private - */ - BaseTexture.prototype._refreshPOT = function () { - this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight); - }; - /** - * Changes resolution - * - * @param {number} resolution - res - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setResolution = function (resolution) { - var oldResolution = this.resolution; - if (oldResolution === resolution) { - return this; - } - this.resolution = resolution; - if (this.valid) { - this.width = this.width * oldResolution / resolution; - this.height = this.height * oldResolution / resolution; - this.emit('update', this); - } - this._refreshPOT(); - return this; - }; - /** - * Sets the resource if it wasn't set. Throws error if resource already present - * - * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture - * @returns {PIXI.BaseTexture} this - */ - BaseTexture.prototype.setResource = function (resource) { - if (this.resource === resource) { - return this; - } - if (this.resource) { - throw new Error('Resource can be set only once'); - } - resource.bind(this); - this.resource = resource; - return this; - }; - /** - * Invalidates the object. Texture becomes valid if width and height are greater than zero. - */ - BaseTexture.prototype.update = function () { - if (!this.valid) { - if (this.width > 0 && this.height > 0) { - this.valid = true; - this.emit('loaded', this); - this.emit('update', this); - } - } - else { - this.dirtyId++; - this.dirtyStyleId++; - this.emit('update', this); - } - }; - /** - * Handle errors with resources. - * @private - * @param {ErrorEvent} event - Error event emitted. - */ - BaseTexture.prototype.onError = function (event) { - this.emit('error', this, event); - }; - /** - * Destroys this base texture. - * The method stops if resource doesn't want this texture to be destroyed. - * Removes texture from all caches. - */ - BaseTexture.prototype.destroy = function () { - // remove and destroy the resource - if (this.resource) { - this.resource.unbind(this); - // only destroy resourced created internally - if (this.resource.internal) { - this.resource.destroy(); - } - this.resource = null; - } - if (this.cacheId) { - delete BaseTextureCache[this.cacheId]; - delete TextureCache[this.cacheId]; - this.cacheId = null; - } - // finally let the WebGL renderer know.. - this.dispose(); - BaseTexture.removeFromCache(this); - this.textureCacheIds = null; - this.destroyed = true; - }; - /** - * Frees the texture from WebGL memory without destroying this texture object. - * This means you can still use the texture later which will upload it to GPU - * memory again. - * - * @fires PIXI.BaseTexture#dispose - */ - BaseTexture.prototype.dispose = function () { - this.emit('dispose', this); - }; - /** - * Utility function for BaseTexture|Texture cast - */ - BaseTexture.prototype.castToBaseTexture = function () { - return this; - }; - /** - * Helper function that creates a base texture based on the source you provide. - * The source can be - image url, image element, canvas element. If the - * source is an image url or an image element and not in the base texture - * cache, it will be created and loaded. - * - * @static - * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The - * source to create base texture from. - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. - * @returns {PIXI.BaseTexture} The new base texture. - */ - BaseTexture.from = function (source, options, strict) { - if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } - var isFrame = typeof source === 'string'; - var cacheId = null; - if (isFrame) { - cacheId = source; - } - else { - if (!source._pixiId) { - source._pixiId = "pixiid_" + uid(); - } - cacheId = source._pixiId; - } - var baseTexture = BaseTextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !baseTexture) { - throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); - } - if (!baseTexture) { - baseTexture = new BaseTexture(source, options); - baseTexture.cacheId = cacheId; - BaseTexture.addToCache(baseTexture, cacheId); - } - return baseTexture; - }; - /** - * Create a new BaseTexture with a BufferResource from a Float32Array. - * RGBA values are floats from 0 to 1. - * @static - * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data - * is provided, a new Float32Array is created. - * @param {number} width - Width of the resource - * @param {number} height - Height of the resource - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.BaseTexture} The resulting new BaseTexture - */ - BaseTexture.fromBuffer = function (buffer, width, height, options) { - buffer = buffer || new Float32Array(width * height * 4); - var resource = new BufferResource(buffer, { width: width, height: height }); - var type = buffer instanceof Float32Array ? exports.TYPES.FLOAT : exports.TYPES.UNSIGNED_BYTE; - return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type })); - }; - /** - * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. - * - * @static - * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. - * @param {string} id - The id that the BaseTexture will be stored against. - */ - BaseTexture.addToCache = function (baseTexture, id) { - if (id) { - if (baseTexture.textureCacheIds.indexOf(id) === -1) { - baseTexture.textureCacheIds.push(id); - } - if (BaseTextureCache[id]) { - // eslint-disable-next-line no-console - console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); - } - BaseTextureCache[id] = baseTexture; - } - }; - /** - * Remove a BaseTexture from the global BaseTextureCache. - * - * @static - * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. - * @return {PIXI.BaseTexture|null} The BaseTexture that was removed. - */ - BaseTexture.removeFromCache = function (baseTexture) { - if (typeof baseTexture === 'string') { - var baseTextureFromCache = BaseTextureCache[baseTexture]; - if (baseTextureFromCache) { - var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); - if (index > -1) { - baseTextureFromCache.textureCacheIds.splice(index, 1); - } - delete BaseTextureCache[baseTexture]; - return baseTextureFromCache; - } - } - else if (baseTexture && baseTexture.textureCacheIds) { - for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { - delete BaseTextureCache[baseTexture.textureCacheIds[i]]; - } - baseTexture.textureCacheIds.length = 0; - return baseTexture; - } - return null; - }; - /** - * Global number of the texture batch, used by multi-texture renderers - * - * @static - * @member {number} - */ - BaseTexture._globalBatch = 0; - return BaseTexture; - }(eventemitter3)); - - /** - * Resource that can manage several resource (items) inside. - * All resources need to have the same pixel size. - * Parent class for CubeResource and ArrayResource - * - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - * @param {object} [options] Options to for Resource constructor - * @param {number} [options.width] - Width of the resource - * @param {number} [options.height] - Height of the resource - */ - var AbstractMultiResource = /** @class */ (function (_super) { - __extends$2(AbstractMultiResource, _super); - function AbstractMultiResource(length, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - _this = _super.call(this, width, height) || this; - /** - * Collection of partial baseTextures that correspond to resources - * @member {Array} - * @readonly - */ - _this.items = []; - /** - * Dirty IDs for each part - * @member {Array} - * @readonly - */ - _this.itemDirtyIds = []; - for (var i = 0; i < length; i++) { - var partTexture = new BaseTexture(); - _this.items.push(partTexture); - // -2 - first run of texture array upload - // -1 - texture item was allocated - // >=0 - texture item uploaded , in sync with items[i].dirtyId - _this.itemDirtyIds.push(-2); - } - /** - * Number of elements in array - * - * @member {number} - * @readonly - */ - _this.length = length; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - /** - * Bound baseTexture, there can only be one - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = null; - return _this; - } - /** - * used from ArrayResource and CubeResource constructors - * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. , - * length should be same as constructor length - * @param {object} [options] - detect options for resources - * @protected - */ - AbstractMultiResource.prototype.initFromArray = function (resources, options) { - for (var i = 0; i < this.length; i++) { - if (!resources[i]) { - continue; - } - if (resources[i].castToBaseTexture) { - this.addBaseTextureAt(resources[i].castToBaseTexture(), i); - } - else if (resources[i] instanceof Resource) { - this.addResourceAt(resources[i], i); - } - else { - this.addResourceAt(autoDetectResource(resources[i], options), i); - } - } - }; - /** - * Destroy this BaseImageResource - * @override - */ - AbstractMultiResource.prototype.dispose = function () { - for (var i = 0, len = this.length; i < len; i++) { - this.items[i].destroy(); - } - this.items = null; - this.itemDirtyIds = null; - this._load = null; - }; - /** - * Set a resource by ID - * - * @param {PIXI.resources.Resource} resource - * @param {number} index - Zero-based index of resource to set - * @return {PIXI.resources.ArrayResource} Instance for chaining - */ - AbstractMultiResource.prototype.addResourceAt = function (resource, index) { - if (!this.items[index]) { - throw new Error("Index " + index + " is out of bounds"); - } - // Inherit the first resource dimensions - if (resource.valid && !this.valid) { - this.resize(resource.width, resource.height); - } - this.items[index].setResource(resource); - return this; - }; - /** - * Set the parent base texture - * @member {PIXI.BaseTexture} - * @override - */ - AbstractMultiResource.prototype.bind = function (baseTexture) { - if (this.baseTexture !== null) { - throw new Error('Only one base texture per TextureArray is allowed'); - } - _super.prototype.bind.call(this, baseTexture); - for (var i = 0; i < this.length; i++) { - this.items[i].parentTextureArray = baseTexture; - this.items[i].on('update', baseTexture.update, baseTexture); - } - }; - /** - * Unset the parent base texture - * @member {PIXI.BaseTexture} - * @override - */ - AbstractMultiResource.prototype.unbind = function (baseTexture) { - _super.prototype.unbind.call(this, baseTexture); - for (var i = 0; i < this.length; i++) { - this.items[i].parentTextureArray = null; - this.items[i].off('update', baseTexture.update, baseTexture); - } - }; - /** - * Load all the resources simultaneously - * @override - * @return {Promise} When load is resolved - */ - AbstractMultiResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); - // TODO: also implement load part-by-part strategy - var promises = resources.map(function (item) { return item.load(); }); - this._load = Promise.all(promises) - .then(function () { - var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; - _this.resize(realWidth, realHeight); - return Promise.resolve(_this); - }); - return this._load; - }; - return AbstractMultiResource; - }(Resource)); - - /** - * A resource that contains a number of sources. - * - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - * @param {number|Array<*>} source - Number of items in array or the collection - * of image URLs to use. Can also be resources, image elements, canvas, etc. - * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource} - * @param {number} [options.width] - Width of the resource - * @param {number} [options.height] - Height of the resource - */ - var ArrayResource = /** @class */ (function (_super) { - __extends$2(ArrayResource, _super); - function ArrayResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height; - var urls; - var length; - if (Array.isArray(source)) { - urls = source; - length = source.length; - } - else { - length = source; - } - _this = _super.call(this, length, { width: width, height: height }) || this; - if (urls) { - _this.initFromArray(urls, options); - } - return _this; - } - /** - * Set a baseTexture by ID, - * ArrayResource just takes resource from it, nothing more - * - * @param {PIXI.BaseTexture} baseTexture - * @param {number} index - Zero-based index of resource to set - * @return {PIXI.resources.ArrayResource} Instance for chaining - */ - ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { - if (baseTexture.resource) { - this.addResourceAt(baseTexture.resource, index); - } - else { - throw new Error('ArrayResource does not support RenderTexture'); - } - return this; - }; - /** - * Add binding - * @member {PIXI.BaseTexture} - * @override - */ - ArrayResource.prototype.bind = function (baseTexture) { - _super.prototype.bind.call(this, baseTexture); - baseTexture.target = exports.TARGETS.TEXTURE_2D_ARRAY; - }; - /** - * Upload the resources to the GPU. - * @param {PIXI.Renderer} renderer - * @param {PIXI.BaseTexture} texture - * @param {PIXI.GLTexture} glTexture - * @returns {boolean} whether texture was uploaded - */ - ArrayResource.prototype.upload = function (renderer, texture, glTexture) { - var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; - var gl = renderer.gl; - if (glTexture.dirtyId < 0) { - gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, texture.format, this._width, this._height, length, 0, texture.format, texture.type, null); - } - for (var i = 0; i < length; i++) { - var item = items[i]; - if (itemDirtyIds[i] < item.dirtyId) { - itemDirtyIds[i] = item.dirtyId; - if (item.valid) { - gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset - 0, // yoffset - i, // zoffset - item.resource.width, item.resource.height, 1, texture.format, texture.type, item.resource.source); - } - } - } - return true; - }; - return ArrayResource; - }(AbstractMultiResource)); - - /** - * Base for all the image/canvas resources - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - */ - var BaseImageResource = /** @class */ (function (_super) { - __extends$2(BaseImageResource, _super); - /** - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source - */ - function BaseImageResource(source) { - var _this = this; - var sourceAny = source; - var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; - var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; - _this = _super.call(this, width, height) || this; - /** - * The source element - * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} - * @readonly - */ - _this.source = source; - /** - * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. - * Certain types of media (e.g. video) using `texImage2D` is more performant. - * @member {boolean} - * @default false - * @private - */ - _this.noSubImage = false; - return _this; - } - /** - * Set cross origin based detecting the url and the crossorigin - * @protected - * @param {HTMLElement} element - Element to apply crossOrigin - * @param {string} url - URL to check - * @param {boolean|string} [crossorigin=true] - Cross origin value to use - */ - BaseImageResource.crossOrigin = function (element, url, crossorigin) { - if (crossorigin === undefined && url.indexOf('data:') !== 0) { - element.crossOrigin = determineCrossOrigin(url); - } - else if (crossorigin !== false) { - element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; - } - }; - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) - * @returns {boolean} true is success - */ - BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { - var gl = renderer.gl; - var width = baseTexture.realWidth; - var height = baseTexture.realHeight; - source = source || this.source; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (!this.noSubImage - && baseTexture.target === gl.TEXTURE_2D - && glTexture.width === width - && glTexture.height === height) { - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source); - } - else { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source); - } - return true; - }; - /** - * Checks if source width/height was changed, resize can cause extra baseTexture update. - * Triggers one update in any case. - */ - BaseImageResource.prototype.update = function () { - if (this.destroyed) { - return; - } - var source = this.source; - var width = source.naturalWidth || source.videoWidth || source.width; - var height = source.naturalHeight || source.videoHeight || source.height; - this.resize(width, height); - _super.prototype.update.call(this); - }; - /** - * Destroy this BaseImageResource - * @override - */ - BaseImageResource.prototype.dispose = function () { - this.source = null; - }; - return BaseImageResource; - }(Resource)); - - /** - * @interface OffscreenCanvas - */ - /** - * Resource type for HTMLCanvasElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {HTMLCanvasElement} source - Canvas element to use - */ - var CanvasResource = /** @class */ (function (_super) { - __extends$2(CanvasResource, _super); - function CanvasResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object - * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas - */ - CanvasResource.test = function (source) { - var OffscreenCanvas = window.OffscreenCanvas; - // Check for browsers that don't yet support OffscreenCanvas - if (OffscreenCanvas && source instanceof OffscreenCanvas) { - return true; - } - return source instanceof HTMLCanvasElement; - }; - return CanvasResource; - }(BaseImageResource)); - - /** - * Resource for a CubeTexture which contains six resources. - * - * @class - * @extends PIXI.resources.ArrayResource - * @memberof PIXI.resources - * @param {Array} [source] - Collection of URLs or resources - * to use as the sides of the cube. - * @param {object} [options] - ImageResource options - * @param {number} [options.width] - Width of resource - * @param {number} [options.height] - Height of resource - * @param {number} [options.autoLoad=true] - Whether to auto-load resources - * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, - * whether to copy them or use - */ - var CubeResource = /** @class */ (function (_super) { - __extends$2(CubeResource, _super); - function CubeResource(source, options) { - var _this = this; - var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; - if (source && source.length !== CubeResource.SIDES) { - throw new Error("Invalid length. Got " + source.length + ", expected 6"); - } - _this = _super.call(this, 6, { width: width, height: height }) || this; - for (var i = 0; i < CubeResource.SIDES; i++) { - _this.items[i].target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; - } - /** - * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself - * @member {boolean} - * @protected - */ - _this.linkBaseTexture = linkBaseTexture !== false; - if (source) { - _this.initFromArray(source, options); - } - if (autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * Add binding - * - * @override - * @param {PIXI.BaseTexture} baseTexture - parent base texture - */ - CubeResource.prototype.bind = function (baseTexture) { - _super.prototype.bind.call(this, baseTexture); - baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP; - }; - CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { - if (linkBaseTexture === undefined) { - linkBaseTexture = this.linkBaseTexture; - } - if (!this.items[index]) { - throw new Error("Index " + index + " is out of bounds"); - } - if (!this.linkBaseTexture - || baseTexture.parentTextureArray - || Object.keys(baseTexture._glTextures).length > 0) { - // copy mode - if (baseTexture.resource) { - this.addResourceAt(baseTexture.resource, index); - } - else { - throw new Error("CubeResource does not support copying of renderTexture."); - } - } - else { - // link mode, the difficult one! - baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; - baseTexture.parentTextureArray = this.baseTexture; - this.items[index] = baseTexture; - } - if (baseTexture.valid && !this.valid) { - this.resize(baseTexture.realWidth, baseTexture.realHeight); - } - this.items[index] = baseTexture; - return this; - }; - /** - * Upload the resource - * - * @returns {boolean} true is success - */ - CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { - var dirty = this.itemDirtyIds; - for (var i = 0; i < CubeResource.SIDES; i++) { - var side = this.items[i]; - if (dirty[i] < side.dirtyId) { - if (side.valid && side.resource) { - side.resource.upload(renderer, side, glTexture); - dirty[i] = side.dirtyId; - } - else if (dirty[i] < -1) { - // either item is not valid yet, either its a renderTexture - // allocate the memory - renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); - dirty[i] = -1; - } - } - } - return true; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {object} source - The source object - * @return {boolean} `true` if source is an array of 6 elements - */ - CubeResource.test = function (source) { - return Array.isArray(source) && source.length === CubeResource.SIDES; - }; - /** - * Number of texture sides to store for CubeResources - * - * @name PIXI.resources.CubeResource.SIDES - * @static - * @member {number} - * @default 6 - */ - CubeResource.SIDES = 6; - return CubeResource; - }(AbstractMultiResource)); - - /** - * Resource type for HTMLImageElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - */ - var ImageResource = /** @class */ (function (_super) { - __extends$2(ImageResource, _super); - /** - * @param {HTMLImageElement|string} source - image source or URL - * @param {object} [options] - * @param {boolean} [options.autoLoad=true] - start loading process - * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create - * a bitmap before upload - * @param {boolean} [options.crossorigin=true] - Load image using cross origin - * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap - */ - function ImageResource(source, options) { - var _this = this; - options = options || {}; - if (!(source instanceof HTMLImageElement)) { - var imageElement = new Image(); - BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); - imageElement.src = source; - source = imageElement; - } - _this = _super.call(this, source) || this; - // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height - // to non-zero values before its loading completes if images are in a cache. - // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. - // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). - if (!source.complete && !!_this._width && !!_this._height) { - _this._width = 0; - _this._height = 0; - } - /** - * URL of the image source - * @member {string} - */ - _this.url = source.src; - /** - * When process is completed - * @member {Promise} - * @private - */ - _this._process = null; - /** - * If the image should be disposed after upload - * @member {boolean} - * @default false - */ - _this.preserveBitmap = false; - /** - * If capable, convert the image using createImageBitmap API - * @member {boolean} - * @default PIXI.settings.CREATE_IMAGE_BITMAP - */ - _this.createBitmap = (options.createBitmap !== undefined - ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap; - /** - * Controls texture alphaMode field - * Copies from options - * Default is `null`, copies option from baseTexture - * - * @member {PIXI.ALPHA_MODES|null} - * @readonly - */ - _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; - if (options.premultiplyAlpha !== undefined) { - // triggers deprecation - _this.premultiplyAlpha = options.premultiplyAlpha; - } - /** - * The ImageBitmap element created for HTMLImageElement - * @member {ImageBitmap} - * @default null - */ - _this.bitmap = null; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * returns a promise when image will be loaded and processed - * - * @param {boolean} [createBitmap] - whether process image into bitmap - * @returns {Promise} - */ - ImageResource.prototype.load = function (createBitmap) { - var _this = this; - if (this._load) { - return this._load; - } - if (createBitmap !== undefined) { - this.createBitmap = createBitmap; - } - this._load = new Promise(function (resolve, reject) { - var source = _this.source; - _this.url = source.src; - var completed = function () { - if (_this.destroyed) { - return; - } - source.onload = null; - source.onerror = null; - _this.resize(source.width, source.height); - _this._load = null; - if (_this.createBitmap) { - resolve(_this.process()); - } - else { - resolve(_this); - } - }; - if (source.complete && source.src) { - completed(); - } - else { - source.onload = completed; - source.onerror = function (event) { - // Avoids Promise freezing when resource broken - reject(event); - _this.onError.emit(event); - }; - } - }); - return this._load; - }; - /** - * Called when we need to convert image into BitmapImage. - * Can be called multiple times, real promise is cached inside. - * - * @returns {Promise} cached promise to fill that bitmap - */ - ImageResource.prototype.process = function () { - var _this = this; - var source = this.source; - if (this._process !== null) { - return this._process; - } - if (this.bitmap !== null || !window.createImageBitmap) { - return Promise.resolve(this); - } - this._process = window.createImageBitmap(source, 0, 0, source.width, source.height, { - premultiplyAlpha: this.alphaMode === exports.ALPHA_MODES.UNPACK ? 'premultiply' : 'none', - }) - .then(function (bitmap) { - if (_this.destroyed) { - return Promise.reject(); - } - _this.bitmap = bitmap; - _this.update(); - _this._process = null; - return Promise.resolve(_this); - }); - return this._process; - }; - /** - * Upload the image resource to GPU. - * - * @param {PIXI.Renderer} renderer - Renderer to upload to - * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.GLTexture} glTexture - GLTexture to use - * @returns {boolean} true is success - */ - ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { - if (typeof this.alphaMode === 'number') { - // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it - baseTexture.alphaMode = this.alphaMode; - } - if (!this.createBitmap) { - return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); - } - if (!this.bitmap) { - // yeah, ignore the output - this.process(); - if (!this.bitmap) { - return false; - } - } - _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); - if (!this.preserveBitmap) { - // checks if there are other renderers that possibly need this bitmap - var flag = true; - var glTextures = baseTexture._glTextures; - for (var key in glTextures) { - var otherTex = glTextures[key]; - if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { - flag = false; - break; - } - } - if (flag) { - if (this.bitmap.close) { - this.bitmap.close(); - } - this.bitmap = null; - } - } - return true; - }; - /** - * Destroys this texture - * @override - */ - ImageResource.prototype.dispose = function () { - this.source.onload = null; - this.source.onerror = null; - _super.prototype.dispose.call(this); - if (this.bitmap) { - this.bitmap.close(); - this.bitmap = null; - } - this._process = null; - this._load = null; - }; - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {string|HTMLImageElement} source - The source object - * @return {boolean} `true` if source is string or HTMLImageElement - */ - ImageResource.test = function (source) { - return typeof source === 'string' || source instanceof HTMLImageElement; - }; - return ImageResource; - }(BaseImageResource)); - - /** - * Resource type for SVG elements and graphics. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {string} source - Base64 encoded SVG element or URL for SVG file. - * @param {object} [options] - Options to use - * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... - * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. - * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. - * @param {boolean} [options.autoLoad=true] - Start loading right away. - */ - var SVGResource = /** @class */ (function (_super) { - __extends$2(SVGResource, _super); - function SVGResource(sourceBase64, options) { - var _this = this; - options = options || {}; - _this = _super.call(this, document.createElement('canvas')) || this; - _this._width = 0; - _this._height = 0; - /** - * Base64 encoded SVG element or URL for SVG file - * @readonly - * @member {string} - */ - _this.svg = sourceBase64; - /** - * The source scale to apply when rasterizing on load - * @readonly - * @member {number} - */ - _this.scale = options.scale || 1; - /** - * A width override for rasterization on load - * @readonly - * @member {number} - */ - _this._overrideWidth = options.width; - /** - * A height override for rasterization on load - * @readonly - * @member {number} - */ - _this._overrideHeight = options.height; - /** - * Call when completely loaded - * @private - * @member {function} - */ - _this._resolve = null; - /** - * Cross origin value to use - * @private - * @member {boolean|string} - */ - _this._crossorigin = options.crossorigin; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - SVGResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - this._load = new Promise(function (resolve) { - // Save this until after load is finished - _this._resolve = function () { - _this.resize(_this.source.width, _this.source.height); - resolve(_this); - }; - // Convert SVG inline string to data-uri - if ((/^\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len - return SVGResource; - }(BaseImageResource)); - - /** - * Resource type for HTMLVideoElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {HTMLVideoElement|object|string|Array} source - Video element to use. - * @param {object} [options] - Options to use - * @param {boolean} [options.autoLoad=true] - Start loading the video immediately - * @param {boolean} [options.autoPlay=true] - Start playing video immediately - * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. - * Leave at 0 to update at every render. - * @param {boolean} [options.crossorigin=true] - Load image using cross origin - */ - var VideoResource = /** @class */ (function (_super) { - __extends$2(VideoResource, _super); - function VideoResource(source, options) { - var _this = this; - options = options || {}; - if (!(source instanceof HTMLVideoElement)) { - var videoElement = document.createElement('video'); - // workaround for https://github.com/pixijs/pixi.js/issues/5996 - videoElement.setAttribute('preload', 'auto'); - videoElement.setAttribute('webkit-playsinline', ''); - videoElement.setAttribute('playsinline', ''); - if (typeof source === 'string') { - source = [source]; - } - var firstSrc = source[0].src || source[0]; - BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); - // array of objects or strings - for (var i = 0; i < source.length; ++i) { - var sourceElement = document.createElement('source'); - var _a = source[i], src = _a.src, mime = _a.mime; - src = src || source[i]; - var baseSrc = src.split('?').shift().toLowerCase(); - var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1); - mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; - sourceElement.src = src; - sourceElement.type = mime; - videoElement.appendChild(sourceElement); - } - // Override the source - source = videoElement; - } - _this = _super.call(this, source) || this; - _this.noSubImage = true; - /** - * `true` to use PIXI.Ticker.shared to auto update the base texture. - * - * @type {boolean} - * @default true - * @private - */ - _this._autoUpdate = true; - /** - * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture. - * - * @type {boolean} - * @default false - * @private - */ - _this._isConnectedToTicker = false; - _this._updateFPS = options.updateFPS || 0; - _this._msToNextUpdate = 0; - /** - * When set to true will automatically play videos used by this texture once - * they are loaded. If false, it will not modify the playing state. - * - * @member {boolean} - * @default true - */ - _this.autoPlay = options.autoPlay !== false; - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - _this._load = null; - /** - * Callback when completed with load. - * @member {function} - * @private - */ - _this._resolve = null; - // Bind for listeners - _this._onCanPlay = _this._onCanPlay.bind(_this); - _this._onError = _this._onError.bind(_this); - if (options.autoLoad !== false) { - _this.load(); - } - return _this; - } - /** - * Trigger updating of the texture - * - * @param {number} [deltaTime=0] - time delta since last tick - */ - VideoResource.prototype.update = function (_deltaTime) { - if (_deltaTime === void 0) { _deltaTime = 0; } - if (!this.destroyed) { - // account for if video has had its playbackRate changed - var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate; - this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); - if (!this._updateFPS || this._msToNextUpdate <= 0) { - _super.prototype.update.call(this); - this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; - } - } - }; - /** - * Start preloading the video resource. - * - * @protected - * @return {Promise} Handle the validate event - */ - VideoResource.prototype.load = function () { - var _this = this; - if (this._load) { - return this._load; - } - var source = this.source; - if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) - && source.width && source.height) { - source.complete = true; - } - source.addEventListener('play', this._onPlayStart.bind(this)); - source.addEventListener('pause', this._onPlayStop.bind(this)); - if (!this._isSourceReady()) { - source.addEventListener('canplay', this._onCanPlay); - source.addEventListener('canplaythrough', this._onCanPlay); - source.addEventListener('error', this._onError, true); - } - else { - this._onCanPlay(); - } - this._load = new Promise(function (resolve) { - if (_this.valid) { - resolve(_this); - } - else { - _this._resolve = resolve; - source.load(); - } - }); - return this._load; - }; - /** - * Handle video error events. - * - * @private - */ - VideoResource.prototype._onError = function (event) { - this.source.removeEventListener('error', this._onError, true); - this.onError.emit(event); - }; - /** - * Returns true if the underlying source is playing. - * - * @private - * @return {boolean} True if playing. - */ - VideoResource.prototype._isSourcePlaying = function () { - var source = this.source; - return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2); - }; - /** - * Returns true if the underlying source is ready for playing. - * - * @private - * @return {boolean} True if ready. - */ - VideoResource.prototype._isSourceReady = function () { - var source = this.source; - return source.readyState === 3 || source.readyState === 4; - }; - /** - * Runs the update loop when the video is ready to play - * - * @private - */ - VideoResource.prototype._onPlayStart = function () { - // Just in case the video has not received its can play even yet.. - if (!this.valid) { - this._onCanPlay(); - } - if (this.autoUpdate && !this._isConnectedToTicker) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - }; - /** - * Fired when a pause event is triggered, stops the update loop - * - * @private - */ - VideoResource.prototype._onPlayStop = function () { - if (this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - }; - /** - * Fired when the video is loaded and ready to play - * - * @private - */ - VideoResource.prototype._onCanPlay = function () { - var source = this.source; - source.removeEventListener('canplay', this._onCanPlay); - source.removeEventListener('canplaythrough', this._onCanPlay); - var valid = this.valid; - this.resize(source.videoWidth, source.videoHeight); - // prevent multiple loaded dispatches.. - if (!valid && this._resolve) { - this._resolve(this); - this._resolve = null; - } - if (this._isSourcePlaying()) { - this._onPlayStart(); - } - else if (this.autoPlay) { - source.play(); - } - }; - /** - * Destroys this texture - * @override - */ - VideoResource.prototype.dispose = function () { - if (this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - } - var source = this.source; - if (source) { - source.removeEventListener('error', this._onError, true); - source.pause(); - source.src = ''; - source.load(); - } - _super.prototype.dispose.call(this); - }; - Object.defineProperty(VideoResource.prototype, "autoUpdate", { - /** - * Should the base texture automatically update itself, set to true by default - * - * @member {boolean} - */ - get: function () { - return this._autoUpdate; - }, - set: function (value) { - if (value !== this._autoUpdate) { - this._autoUpdate = value; - if (!this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VideoResource.prototype, "updateFPS", { - /** - * How many times a second to update the texture from the video. Leave at 0 to update at every render. - * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. - * - * @member {number} - */ - get: function () { - return this._updateFPS; - }, - set: function (value) { - if (value !== this._updateFPS) { - this._updateFPS = value; - } - }, - enumerable: false, - configurable: true - }); - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {*} source - The source object - * @param {string} extension - The extension of source, if set - * @return {boolean} `true` if video source - */ - VideoResource.test = function (source, extension) { - return (source instanceof HTMLVideoElement) - || VideoResource.TYPES.indexOf(extension) > -1; - }; - /** - * List of common video file extensions supported by VideoResource. - * @constant - * @member {Array} - * @static - * @readonly - */ - VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; - /** - * Map of video MIME types that can't be directly derived from file extensions. - * @constant - * @member {object} - * @static - * @readonly - */ - VideoResource.MIME_TYPES = { - ogv: 'video/ogg', - mov: 'video/quicktime', - m4v: 'video/mp4', - }; - return VideoResource; - }(BaseImageResource)); - - /** - * Resource type for ImageBitmap. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - * @param {ImageBitmap} source - Image element to use - */ - var ImageBitmapResource = /** @class */ (function (_super) { - __extends$2(ImageBitmapResource, _super); - function ImageBitmapResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Used to auto-detect the type of resource. - * - * @static - * @param {ImageBitmap} source - The source object - * @return {boolean} `true` if source is an ImageBitmap - */ - ImageBitmapResource.test = function (source) { - return !!window.createImageBitmap && source instanceof ImageBitmap; - }; - return ImageBitmapResource; - }(BaseImageResource)); - - INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); - - var index = ({ - Resource: Resource, - BaseImageResource: BaseImageResource, - INSTALLED: INSTALLED, - autoDetectResource: autoDetectResource, - AbstractMultiResource: AbstractMultiResource, - ArrayResource: ArrayResource, - BufferResource: BufferResource, - CanvasResource: CanvasResource, - CubeResource: CubeResource, - ImageResource: ImageResource, - SVGResource: SVGResource, - VideoResource: VideoResource, - ImageBitmapResource: ImageBitmapResource - }); - - /** - * System is a base class used for extending systems used by the {@link PIXI.Renderer} - * - * @see PIXI.Renderer#addSystem - * @class - * @memberof PIXI - */ - var System = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. - */ - function System(renderer) { - /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} - */ - this.renderer = renderer; - } - /** - * Generic destroy methods to be overridden by the subclass - */ - System.prototype.destroy = function () { - this.renderer = null; - }; - return System; - }()); - - /** - * Resource type for DepthTexture. - * @class - * @extends PIXI.resources.BufferResource - * @memberof PIXI.resources - */ - var DepthResource = /** @class */ (function (_super) { - __extends$2(DepthResource, _super); - function DepthResource() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer - Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture - * @param {PIXI.GLTexture} glTexture - glTexture - * @returns {boolean} true is success - */ - DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { - var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { - gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); - } - else { - glTexture.width = baseTexture.width; - glTexture.height = baseTexture.height; - gl.texImage2D(baseTexture.target, 0, - // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0 - renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, baseTexture.width, baseTexture.height, 0, baseTexture.format, baseTexture.type, this.data); - } - return true; - }; - return DepthResource; - }(BufferResource)); - - /** - * Frame buffer used by the BaseRenderTexture - * - * @class - * @memberof PIXI - */ - var Framebuffer = /** @class */ (function () { - /** - * @param {number} width - Width of the frame buffer - * @param {number} height - Height of the frame buffer - */ - function Framebuffer(width, height) { - /** - * Width of framebuffer in pixels - * @member {number} - */ - this.width = Math.ceil(width || 100); - /** - * Height of framebuffer in pixels - * @member {number} - */ - this.height = Math.ceil(height || 100); - this.stencil = false; - this.depth = false; - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - this.depthTexture = null; - this.colorTextures = []; - this.glFramebuffers = {}; - this.disposeRunner = new Runner('disposeFramebuffer'); - /** - * Desired number of samples for antialiasing. 0 means AA should not be used. - * - * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. - * Antialiasing is the same as for main buffer with renderer `antialias:true` options. - * Seriously affects GPU memory consumption and GPU performance. - * - *```js - * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH; - * //... - * renderer.render(renderTexture, myContainer); - * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture - * ``` - * - * @member {PIXI.MSAA_QUALITY} - * @default PIXI.MSAA_QUALITY.NONE - */ - this.multisample = exports.MSAA_QUALITY.NONE; - } - Object.defineProperty(Framebuffer.prototype, "colorTexture", { - /** - * Reference to the colorTexture. - * - * @member {PIXI.BaseTexture[]} - * @readonly - */ - get: function () { - return this.colorTextures[0]; - }, - enumerable: false, - configurable: true - }); - /** - * Add texture to the colorTexture array - * - * @param {number} [index=0] - Index of the array to add the texture to - * @param {PIXI.BaseTexture} [texture] - Texture to add to the array - */ - Framebuffer.prototype.addColorTexture = function (index, texture) { - if (index === void 0) { index = 0; } - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index] = texture || new BaseTexture(null, { - scaleMode: exports.SCALE_MODES.NEAREST, - resolution: 1, - mipmap: exports.MIPMAP_MODES.OFF, - width: this.width, - height: this.height, - }); - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Add a depth texture to the frame buffer - * - * @param {PIXI.BaseTexture} [texture] - Texture to add - */ - Framebuffer.prototype.addDepthTexture = function (texture) { - /* eslint-disable max-len */ - this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { - scaleMode: exports.SCALE_MODES.NEAREST, - resolution: 1, - width: this.width, - height: this.height, - mipmap: exports.MIPMAP_MODES.OFF, - format: exports.FORMATS.DEPTH_COMPONENT, - type: exports.TYPES.UNSIGNED_SHORT, - }); - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Enable depth on the frame buffer - */ - Framebuffer.prototype.enableDepth = function () { - this.depth = true; - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Enable stencil on the frame buffer - */ - Framebuffer.prototype.enableStencil = function () { - this.stencil = true; - this.dirtyId++; - this.dirtyFormat++; - return this; - }; - /** - * Resize the frame buffer - * - * @param {number} width - Width of the frame buffer to resize to - * @param {number} height - Height of the frame buffer to resize to - */ - Framebuffer.prototype.resize = function (width, height) { - width = Math.ceil(width); - height = Math.ceil(height); - if (width === this.width && height === this.height) - { return; } - this.width = width; - this.height = height; - this.dirtyId++; - this.dirtySize++; - for (var i = 0; i < this.colorTextures.length; i++) { - var texture = this.colorTextures[i]; - var resolution = texture.resolution; - // take into acount the fact the texture may have a different resolution.. - texture.setSize(width / resolution, height / resolution); - } - if (this.depthTexture) { - var resolution = this.depthTexture.resolution; - this.depthTexture.setSize(width / resolution, height / resolution); - } - }; - /** - * Disposes WebGL resources that are connected to this geometry - */ - Framebuffer.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys and removes the depth texture added to this framebuffer. - */ - Framebuffer.prototype.destroyDepthTexture = function () { - if (this.depthTexture) { - this.depthTexture.destroy(); - this.depthTexture = null; - ++this.dirtyId; - ++this.dirtyFormat; - } - }; - return Framebuffer; - }()); - - /** - * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. - * - * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded - * otherwise black rectangles will be drawn instead. - * - * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position - * and rotation of the given Display Objects is ignored. For example: - * - * ```js - * let renderer = PIXI.autoDetectRenderer(); - * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); - * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); - * let sprite = PIXI.Sprite.from("spinObj_01.png"); - * - * sprite.position.x = 800/2; - * sprite.position.y = 600/2; - * sprite.anchor.x = 0.5; - * sprite.anchor.y = 0.5; - * - * renderer.render(sprite, renderTexture); - * ``` - * - * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 - * you can clear the transform - * - * ```js - * - * sprite.setTransform() - * - * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); - * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); - * - * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture - * ``` - * - * @class - * @extends PIXI.BaseTexture - * @memberof PIXI - */ - var BaseRenderTexture = /** @class */ (function (_super) { - __extends$2(BaseRenderTexture, _super); - /** - * @param {object} [options] - * @param {number} [options.width=100] - The width of the base render texture. - * @param {number} [options.height=100] - The height of the base render texture. - * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated. - */ - function BaseRenderTexture(options) { - var _this = this; - if (typeof options === 'number') { - /* eslint-disable prefer-rest-params */ - // Backward compatibility of signature - var width_1 = arguments[0]; - var height_1 = arguments[1]; - var scaleMode = arguments[2]; - var resolution = arguments[3]; - options = { width: width_1, height: height_1, scaleMode: scaleMode, resolution: resolution }; - /* eslint-enable prefer-rest-params */ - } - _this = _super.call(this, null, options) || this; - var _a = options || {}, width = _a.width, height = _a.height; - // Set defaults - _this.mipmap = 0; - _this.width = Math.ceil(width) || 100; - _this.height = Math.ceil(height) || 100; - _this.valid = true; - _this.clearColor = [0, 0, 0, 0]; - _this.framebuffer = new Framebuffer(_this.width * _this.resolution, _this.height * _this.resolution) - .addColorTexture(0, _this); - // TODO - could this be added the systems? - /** - * The data structure for the stencil masks. - * - * @member {PIXI.MaskData[]} - */ - _this.maskStack = []; - /** - * The data structure for the filters. - * - * @member {Object[]} - */ - _this.filterStack = [{}]; - return _this; - } - /** - * Resizes the BaseRenderTexture. - * - * @param {number} width - The width to resize to. - * @param {number} height - The height to resize to. - */ - BaseRenderTexture.prototype.resize = function (width, height) { - width = Math.ceil(width); - height = Math.ceil(height); - this.framebuffer.resize(width * this.resolution, height * this.resolution); - }; - /** - * Frees the texture and framebuffer from WebGL memory without destroying this texture object. - * This means you can still use the texture later which will upload it to GPU - * memory again. - * - * @fires PIXI.BaseTexture#dispose - */ - BaseRenderTexture.prototype.dispose = function () { - this.framebuffer.dispose(); - _super.prototype.dispose.call(this); - }; - /** - * Destroys this texture. - */ - BaseRenderTexture.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.framebuffer.destroyDepthTexture(); - this.framebuffer = null; - }; - return BaseRenderTexture; - }(BaseTexture)); - - /** - * Stores a texture's frame in UV coordinates, in - * which everything lies in the rectangle `[(0,0), (1,0), - * (1,1), (0,1)]`. - * - * | Corner | Coordinates | - * |--------------|-------------| - * | Top-Left | `(x0,y0)` | - * | Top-Right | `(x1,y1)` | - * | Bottom-Right | `(x2,y2)` | - * | Bottom-Left | `(x3,y3)` | - * - * @class - * @protected - * @memberof PIXI - */ - var TextureUvs = /** @class */ (function () { - function TextureUvs() { - /** - * X-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.x0 = 0; - /** - * Y-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.y0 = 0; - /** - * X-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.x1 = 1; - /** - * Y-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.y1 = 0; - /** - * X-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.x2 = 1; - /** - * Y-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.y2 = 1; - /** - * X-component of bottom-left corner `(x3,y3)`. - * - * @member {number} - */ - this.x3 = 0; - /** - * Y-component of bottom-right corner `(x3,y3)`. - * - * @member {number} - */ - this.y3 = 1; - this.uvsFloat32 = new Float32Array(8); - } - /** - * Sets the texture Uvs based on the given frame information. - * - * @protected - * @param {PIXI.Rectangle} frame - The frame of the texture - * @param {PIXI.Rectangle} baseFrame - The base frame of the texture - * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8} - */ - TextureUvs.prototype.set = function (frame, baseFrame, rotate) { - var tw = baseFrame.width; - var th = baseFrame.height; - if (rotate) { - // width and height div 2 div baseFrame size - var w2 = frame.width / 2 / tw; - var h2 = frame.height / 2 / th; - // coordinates of center - var cX = (frame.x / tw) + w2; - var cY = (frame.y / th) + h2; - rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner - this.x0 = cX + (w2 * groupD8.uX(rotate)); - this.y0 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise - this.x1 = cX + (w2 * groupD8.uX(rotate)); - this.y1 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - this.x2 = cX + (w2 * groupD8.uX(rotate)); - this.y2 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - this.x3 = cX + (w2 * groupD8.uX(rotate)); - this.y3 = cY + (h2 * groupD8.uY(rotate)); - } - else { - this.x0 = frame.x / tw; - this.y0 = frame.y / th; - this.x1 = (frame.x + frame.width) / tw; - this.y1 = frame.y / th; - this.x2 = (frame.x + frame.width) / tw; - this.y2 = (frame.y + frame.height) / th; - this.x3 = frame.x / tw; - this.y3 = (frame.y + frame.height) / th; - } - this.uvsFloat32[0] = this.x0; - this.uvsFloat32[1] = this.y0; - this.uvsFloat32[2] = this.x1; - this.uvsFloat32[3] = this.y1; - this.uvsFloat32[4] = this.x2; - this.uvsFloat32[5] = this.y2; - this.uvsFloat32[6] = this.x3; - this.uvsFloat32[7] = this.y3; - }; - return TextureUvs; - }()); - - var DEFAULT_UVS = new TextureUvs(); - /** - * A texture stores the information that represents an image or part of an image. - * - * It cannot be added to the display list directly; instead use it as the texture for a Sprite. - * If no frame is provided for a texture, then the whole image is used. - * - * You can directly create a texture from an image and then reuse it multiple times like this : - * - * ```js - * let texture = PIXI.Texture.from('assets/image.png'); - * let sprite1 = new PIXI.Sprite(texture); - * let sprite2 = new PIXI.Sprite(texture); - * ``` - * - * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: - * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. - * - * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. - * You can check for this by checking the sprite's _textureID property. - * ```js - * var texture = PIXI.Texture.from('assets/image.svg'); - * var sprite1 = new PIXI.Sprite(texture); - * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file - * ``` - * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. - * - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var Texture = /** @class */ (function (_super) { - __extends$2(Texture, _super); - /** - * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from - * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show - * @param {PIXI.Rectangle} [orig] - The area of original texture - * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture - * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} - * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation - */ - function Texture(baseTexture, frame, orig, trim, rotate, anchor) { - var _this = _super.call(this) || this; - /** - * Does this Texture have any frame data assigned to it? - * - * This mode is enabled automatically if no frame was passed inside constructor. - * - * In this mode texture is subscribed to baseTexture events, and fires `update` on any change. - * - * Beware, after loading or resize of baseTexture event can fired two times! - * If you want more control, subscribe on baseTexture itself. - * - * ```js - * texture.on('update', () => {}); - * ``` - * - * Any assignment of `frame` switches off `noFrame` mode. - * - * @member {boolean} - */ - _this.noFrame = false; - if (!frame) { - _this.noFrame = true; - frame = new Rectangle(0, 0, 1, 1); - } - if (baseTexture instanceof Texture) { - baseTexture = baseTexture.baseTexture; - } - /** - * The base texture that this texture uses. - * - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = baseTexture; - /** - * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, - * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) - * - * @member {PIXI.Rectangle} - */ - _this._frame = frame; - /** - * This is the trimmed area of original texture, before it was put in atlas - * Please call `updateUvs()` after you change coordinates of `trim` manually. - * - * @member {PIXI.Rectangle} - */ - _this.trim = trim; - /** - * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. - * - * @member {boolean} - */ - _this.valid = false; - /** - * The WebGL UV data cache. Can be used as quad UV - * - * @member {PIXI.TextureUvs} - * @protected - */ - _this._uvs = DEFAULT_UVS; - /** - * Default TextureMatrix instance for this texture - * By default that object is not created because its heavy - * - * @member {PIXI.TextureMatrix} - */ - _this.uvMatrix = null; - /** - * This is the area of original texture, before it was put in atlas - * - * @member {PIXI.Rectangle} - */ - _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); - _this._rotate = Number(rotate || 0); - if (rotate === true) { - // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures - _this._rotate = 2; - } - else if (_this._rotate % 2 !== 0) { - throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); - } - /** - * Anchor point that is used as default if sprite is created with this texture. - * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. - * @member {PIXI.Point} - * @default {0,0} - */ - _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); - /** - * Update ID is observed by sprites and TextureMatrix instances. - * Call updateUvs() to increment it. - * - * @member {number} - * @protected - */ - _this._updateID = 0; - /** - * The ids under which this Texture has been added to the texture cache. This is - * automatically set as long as Texture.addToCache is used, but may not be set if a - * Texture is added directly to the TextureCache array. - * - * @member {string[]} - */ - _this.textureCacheIds = []; - if (!baseTexture.valid) { - baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); - } - else if (_this.noFrame) { - // if there is no frame we should monitor for any base texture changes.. - if (baseTexture.valid) { - _this.onBaseTextureUpdated(baseTexture); - } - } - else { - _this.frame = frame; - } - if (_this.noFrame) { - baseTexture.on('update', _this.onBaseTextureUpdated, _this); - } - return _this; - } - /** - * Updates this texture on the gpu. - * - * Calls the TextureResource update. - * - * If you adjusted `frame` manually, please call `updateUvs()` instead. - * - */ - Texture.prototype.update = function () { - if (this.baseTexture.resource) { - this.baseTexture.resource.update(); - } - }; - /** - * Called when the base texture is updated - * - * @protected - * @param {PIXI.BaseTexture} baseTexture - The base texture. - */ - Texture.prototype.onBaseTextureUpdated = function (baseTexture) { - if (this.noFrame) { - if (!this.baseTexture.valid) { - return; - } - this._frame.width = baseTexture.width; - this._frame.height = baseTexture.height; - this.valid = true; - this.updateUvs(); - } - else { - // TODO this code looks confusing.. boo to abusing getters and setters! - // if user gave us frame that has bigger size than resized texture it can be a problem - this.frame = this._frame; - } - this.emit('update', this); - }; - /** - * Destroys this texture - * - * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well - */ - Texture.prototype.destroy = function (destroyBase) { - if (this.baseTexture) { - if (destroyBase) { - var resource = this.baseTexture; - // delete the texture if it exists in the texture cache.. - // this only needs to be removed if the base texture is actually destroyed too.. - if (resource && resource.url && TextureCache[resource.url]) { - Texture.removeFromCache(resource.url); - } - this.baseTexture.destroy(); - } - this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); - this.baseTexture.off('update', this.onBaseTextureUpdated, this); - this.baseTexture = null; - } - this._frame = null; - this._uvs = null; - this.trim = null; - this.orig = null; - this.valid = false; - Texture.removeFromCache(this); - this.textureCacheIds = null; - }; - /** - * Creates a new texture object that acts the same as this one. - * - * @return {PIXI.Texture} The new texture - */ - Texture.prototype.clone = function () { - return new Texture(this.baseTexture, this.frame.clone(), this.orig.clone(), this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); - }; - /** - * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. - * Call it after changing the frame - */ - Texture.prototype.updateUvs = function () { - if (this._uvs === DEFAULT_UVS) { - this._uvs = new TextureUvs(); - } - this._uvs.set(this._frame, this.baseTexture, this.rotate); - this._updateID++; - }; - /** - * Helper function that creates a new Texture based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - * Source to create texture from - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. - * @return {PIXI.Texture} The newly created texture - */ - Texture.from = function (source, options, strict) { - if (options === void 0) { options = {}; } - if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } - var isFrame = typeof source === 'string'; - var cacheId = null; - if (isFrame) { - cacheId = source; - } - else { - if (!source._pixiId) { - source._pixiId = "pixiid_" + uid(); - } - cacheId = source._pixiId; - } - var texture = TextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !texture) { - throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); - } - if (!texture) { - if (!options.resolution) { - options.resolution = getResolutionOfUrl(source); - } - texture = new Texture(new BaseTexture(source, options)); - texture.baseTexture.cacheId = cacheId; - BaseTexture.addToCache(texture.baseTexture, cacheId); - Texture.addToCache(texture, cacheId); - } - // lets assume its a base texture! - return texture; - }; - /** - * Useful for loading textures via URLs. Use instead of `Texture.from` because - * it does a better job of handling failed URLs more effectively. This also ignores - * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. - * @param {string} url The remote URL to load. - * @param {object} [options] Optional options to include - * @return {Promise} A Promise that resolves to a Texture. - */ - Texture.fromURL = function (url, options) { - var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); - var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); - var resource = texture.baseTexture.resource; - // The texture was already loaded - if (texture.baseTexture.valid) { - return Promise.resolve(texture); - } - // Manually load the texture, this should allow users to handle load errors - return resource.load().then(function () { return Promise.resolve(texture); }); - }; - /** - * Create a new Texture with a BufferResource from a Float32Array. - * RGBA values are floats from 0 to 1. - * @static - * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data - * is provided, a new Float32Array is created. - * @param {number} width - Width of the resource - * @param {number} height - Height of the resource - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.Texture} The resulting new BaseTexture - */ - Texture.fromBuffer = function (buffer, width, height, options) { - return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); - }; - /** - * Create a texture from a source and add to the cache. - * - * @static - * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. - * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readable name for the texture cache. If no name is - * specified, only `imageUrl` will be used as the cache ID. - * @return {PIXI.Texture} Output texture - */ - Texture.fromLoader = function (source, imageUrl, name) { - var resource = new ImageResource(source); - resource.url = imageUrl; - var baseTexture = new BaseTexture(resource, { - scaleMode: settings.SCALE_MODE, - resolution: getResolutionOfUrl(imageUrl), - }); - var texture = new Texture(baseTexture); - // No name, use imageUrl instead - if (!name) { - name = imageUrl; - } - // lets also add the frame to pixi's global cache for 'fromLoader' function - BaseTexture.addToCache(texture.baseTexture, name); - Texture.addToCache(texture, name); - // also add references by url if they are different. - if (name !== imageUrl) { - BaseTexture.addToCache(texture.baseTexture, imageUrl); - Texture.addToCache(texture, imageUrl); - } - return texture; - }; - /** - * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. - * - * @static - * @param {PIXI.Texture} texture - The Texture to add to the cache. - * @param {string} id - The id that the Texture will be stored against. - */ - Texture.addToCache = function (texture, id) { - if (id) { - if (texture.textureCacheIds.indexOf(id) === -1) { - texture.textureCacheIds.push(id); - } - if (TextureCache[id]) { - // eslint-disable-next-line no-console - console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); - } - TextureCache[id] = texture; - } - }; - /** - * Remove a Texture from the global TextureCache. - * - * @static - * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself - * @return {PIXI.Texture|null} The Texture that was removed - */ - Texture.removeFromCache = function (texture) { - if (typeof texture === 'string') { - var textureFromCache = TextureCache[texture]; - if (textureFromCache) { - var index = textureFromCache.textureCacheIds.indexOf(texture); - if (index > -1) { - textureFromCache.textureCacheIds.splice(index, 1); - } - delete TextureCache[texture]; - return textureFromCache; - } - } - else if (texture && texture.textureCacheIds) { - for (var i = 0; i < texture.textureCacheIds.length; ++i) { - // Check that texture matches the one being passed in before deleting it from the cache. - if (TextureCache[texture.textureCacheIds[i]] === texture) { - delete TextureCache[texture.textureCacheIds[i]]; - } - } - texture.textureCacheIds.length = 0; - return texture; - } - return null; - }; - Object.defineProperty(Texture.prototype, "resolution", { - /** - * Returns resolution of baseTexture - * - * @member {number} - * @readonly - */ - get: function () { - return this.baseTexture.resolution; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "frame", { - /** - * The frame specifies the region of the base texture that this texture uses. - * Please call `updateUvs()` after you change coordinates of `frame` manually. - * - * @member {PIXI.Rectangle} - */ - get: function () { - return this._frame; - }, - set: function (frame) { - this._frame = frame; - this.noFrame = false; - var x = frame.x, y = frame.y, width = frame.width, height = frame.height; - var xNotFit = x + width > this.baseTexture.width; - var yNotFit = y + height > this.baseTexture.height; - if (xNotFit || yNotFit) { - var relationship = xNotFit && yNotFit ? 'and' : 'or'; - var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; - var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; - throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' - + (errorX + " " + relationship + " " + errorY)); - } - this.valid = width && height && this.baseTexture.valid; - if (!this.trim && !this.rotate) { - this.orig = frame; - } - if (this.valid) { - this.updateUvs(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "rotate", { - /** - * Indicates whether the texture is rotated inside the atlas - * set to 2 to compensate for texture packer rotation - * set to 6 to compensate for spine packer rotation - * can be used to rotate or mirror sprites - * See {@link PIXI.groupD8} for explanation - * - * @member {number} - */ - get: function () { - return this._rotate; - }, - set: function (rotate) { - this._rotate = rotate; - if (this.valid) { - this.updateUvs(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "width", { - /** - * The width of the Texture in pixels. - * - * @member {number} - */ - get: function () { - return this.orig.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Texture.prototype, "height", { - /** - * The height of the Texture in pixels. - * - * @member {number} - */ - get: function () { - return this.orig.height; - }, - enumerable: false, - configurable: true - }); - /** - * Utility function for BaseTexture|Texture cast - */ - Texture.prototype.castToBaseTexture = function () { - return this.baseTexture; - }; - return Texture; - }(eventemitter3)); - function createWhiteTexture() { - var canvas = document.createElement('canvas'); - canvas.width = 16; - canvas.height = 16; - var context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 0, 16, 16); - return new Texture(new BaseTexture(new CanvasResource(canvas))); - } - function removeAllHandlers(tex) { - tex.destroy = function _emptyDestroy() { }; - tex.on = function _emptyOn() { }; - tex.once = function _emptyOnce() { }; - tex.emit = function _emptyEmit() { }; - } - /** - * An empty texture, used often to not have to create multiple empty textures. - * Can not be destroyed. - * - * @static - * @constant - * @member {PIXI.Texture} - */ - Texture.EMPTY = new Texture(new BaseTexture()); - removeAllHandlers(Texture.EMPTY); - removeAllHandlers(Texture.EMPTY.baseTexture); - /** - * A white texture of 16x16 size, used for graphics and other things - * Can not be destroyed. - * - * @static - * @constant - * @member {PIXI.Texture} - */ - Texture.WHITE = createWhiteTexture(); - removeAllHandlers(Texture.WHITE); - removeAllHandlers(Texture.WHITE.baseTexture); - - /** - * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. - * - * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded - * otherwise black rectangles will be drawn instead. - * - * __Hint-2__: The actual memory allocation will happen on first render. - * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. - * - * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: - * - * ```js - * let renderer = PIXI.autoDetectRenderer(); - * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); - * let sprite = PIXI.Sprite.from("spinObj_01.png"); - * - * sprite.position.x = 800/2; - * sprite.position.y = 600/2; - * sprite.anchor.x = 0.5; - * sprite.anchor.y = 0.5; - * - * renderer.render(sprite, renderTexture); - * ``` - * - * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 - * you can clear the transform - * - * ```js - * - * sprite.setTransform() - * - * let renderTexture = new PIXI.RenderTexture.create(100, 100); - * - * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture - * ``` - * - * @class - * @extends PIXI.Texture - * @memberof PIXI - */ - var RenderTexture = /** @class */ (function (_super) { - __extends$2(RenderTexture, _super); - /** - * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses - * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show - */ - function RenderTexture(baseRenderTexture, frame) { - var _this = this; - // support for legacy.. - var _legacyRenderer = null; - if (!(baseRenderTexture instanceof BaseRenderTexture)) { - /* eslint-disable prefer-rest-params, no-console */ - var width = arguments[1]; - var height = arguments[2]; - var scaleMode = arguments[3]; - var resolution = arguments[4]; - // we have an old render texture.. - console.warn("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly."); - _legacyRenderer = arguments[0]; - /* eslint-enable prefer-rest-params, no-console */ - frame = null; - baseRenderTexture = new BaseRenderTexture({ - width: width, - height: height, - scaleMode: scaleMode, - resolution: resolution, - }); - } - /** - * The base texture object that this texture uses - * - * @member {PIXI.BaseTexture} - */ - _this = _super.call(this, baseRenderTexture, frame) || this; - _this.legacyRenderer = _legacyRenderer; - /** - * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. - * - * @member {boolean} - */ - _this.valid = true; - /** - * Stores `sourceFrame` when this texture is inside current filter stack. - * You can read it inside filters. - * - * @readonly - * @member {PIXI.Rectangle} - */ - _this.filterFrame = null; - /** - * The key for pooled texture of FilterSystem - * @protected - * @member {string} - */ - _this.filterPoolKey = null; - _this.updateUvs(); - return _this; - } - Object.defineProperty(RenderTexture.prototype, "framebuffer", { - /** - * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. - * @member {PIXI.Framebuffer} - * @readonly - */ - get: function () { - return this.baseTexture.framebuffer; - }, - enumerable: false, - configurable: true - }); - /** - * Resizes the RenderTexture. - * - * @param {number} width - The width to resize to. - * @param {number} height - The height to resize to. - * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well? - */ - RenderTexture.prototype.resize = function (width, height, resizeBaseTexture) { - if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } - width = Math.ceil(width); - height = Math.ceil(height); - // TODO - could be not required.. - this.valid = (width > 0 && height > 0); - this._frame.width = this.orig.width = width; - this._frame.height = this.orig.height = height; - if (resizeBaseTexture) { - this.baseTexture.resize(width, height); - } - this.updateUvs(); - }; - /** - * Changes the resolution of baseTexture, but does not change framebuffer size. - * - * @param {number} resolution - The new resolution to apply to RenderTexture - */ - RenderTexture.prototype.setResolution = function (resolution) { - var baseTexture = this.baseTexture; - if (baseTexture.resolution === resolution) { - return; - } - baseTexture.setResolution(resolution); - this.resize(baseTexture.width, baseTexture.height, false); - }; - /** - * A short hand way of creating a render texture. - * - * @param {object} [options] - Options - * @param {number} [options.width=100] - The width of the render texture - * @param {number} [options.height=100] - The height of the render texture - * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated - * @return {PIXI.RenderTexture} The new render texture - */ - RenderTexture.create = function (options) { - // fallback, old-style: create(width, height, scaleMode, resolution) - if (typeof options === 'number') { - /* eslint-disable prefer-rest-params */ - options = { - width: options, - height: arguments[1], - scaleMode: arguments[2], - resolution: arguments[3], - }; - /* eslint-enable prefer-rest-params */ - } - return new RenderTexture(new BaseRenderTexture(options)); - }; - return RenderTexture; - }(Texture)); - - /** - * Experimental! - * - * Texture pool, used by FilterSystem and plugins - * Stores collection of temporary pow2 or screen-sized renderTextures - * - * If you use custom RenderTexturePool for your filters, you can use methods - * `getFilterTexture` and `returnFilterTexture` same as in - * - * @class - * @memberof PIXI - */ - var RenderTexturePool = /** @class */ (function () { - /** - * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor - * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. - */ - function RenderTexturePool(textureOptions) { - this.texturePool = {}; - this.textureOptions = textureOptions || {}; - /** - * Allow renderTextures of the same size as screen, not just pow2 - * - * Automatically sets to true after `setScreenSize` - * - * @member {boolean} - * @default false - */ - this.enableFullScreen = false; - this._pixelsWidth = 0; - this._pixelsHeight = 0; - } - /** - * creates of texture with params that were specified in pool constructor - * - * @param {number} realWidth - width of texture in pixels - * @param {number} realHeight - height of texture in pixels - * @returns {RenderTexture} - */ - RenderTexturePool.prototype.createTexture = function (realWidth, realHeight) { - var baseRenderTexture = new BaseRenderTexture(Object.assign({ - width: realWidth, - height: realHeight, - resolution: 1, - }, this.textureOptions)); - return new RenderTexture(baseRenderTexture); - }; - /** - * Gets a Power-of-Two render texture or fullScreen texture - * - * @protected - * @param {number} minWidth - The minimum width of the render texture in real pixels. - * @param {number} minHeight - The minimum height of the render texture in real pixels. - * @param {number} [resolution=1] - The resolution of the render texture. - * @return {PIXI.RenderTexture} The new render texture. - */ - RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution) { - if (resolution === void 0) { resolution = 1; } - var key = RenderTexturePool.SCREEN_KEY; - minWidth *= resolution; - minHeight *= resolution; - if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { - minWidth = nextPow2(minWidth); - minHeight = nextPow2(minHeight); - key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF); - } - if (!this.texturePool[key]) { - this.texturePool[key] = []; - } - var renderTexture = this.texturePool[key].pop(); - if (!renderTexture) { - renderTexture = this.createTexture(minWidth, minHeight); - } - renderTexture.filterPoolKey = key; - renderTexture.setResolution(resolution); - return renderTexture; - }; - /** - * Gets extra texture of the same size as input renderTexture - * - * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` - * - * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied - * @param {number} [resolution] - override resolution of the renderTexture - * It overrides, it does not multiply - * @returns {PIXI.RenderTexture} - */ - RenderTexturePool.prototype.getFilterTexture = function (input, resolution) { - var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution); - filterTexture.filterFrame = input.filterFrame; - return filterTexture; - }; - /** - * Place a render texture back into the pool. - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnTexture = function (renderTexture) { - var key = renderTexture.filterPoolKey; - renderTexture.filterFrame = null; - this.texturePool[key].push(renderTexture); - }; - /** - * Alias for returnTexture, to be compliant with FilterSystem interface - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { - this.returnTexture(renderTexture); - }; - /** - * Clears the pool - * - * @param {boolean} [destroyTextures=true] - destroy all stored textures - */ - RenderTexturePool.prototype.clear = function (destroyTextures) { - destroyTextures = destroyTextures !== false; - if (destroyTextures) { - for (var i in this.texturePool) { - var textures = this.texturePool[i]; - if (textures) { - for (var j = 0; j < textures.length; j++) { - textures[j].destroy(true); - } - } - } - } - this.texturePool = {}; - }; - /** - * If screen size was changed, drops all screen-sized textures, - * sets new screen size, sets `enableFullScreen` to true - * - * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` - * - * @param {PIXI.ISize} size - Initial size of screen - */ - RenderTexturePool.prototype.setScreenSize = function (size) { - if (size.width === this._pixelsWidth - && size.height === this._pixelsHeight) { - return; - } - var screenKey = RenderTexturePool.SCREEN_KEY; - var textures = this.texturePool[screenKey]; - this.enableFullScreen = size.width > 0 && size.height > 0; - if (textures) { - for (var j = 0; j < textures.length; j++) { - textures[j].destroy(true); - } - } - this.texturePool[screenKey] = []; - this._pixelsWidth = size.width; - this._pixelsHeight = size.height; - }; - /** - * Key that is used to store fullscreen renderTextures in a pool - * - * @static - * @const {string} - */ - RenderTexturePool.SCREEN_KEY = 'screen'; - return RenderTexturePool; - }()); - - /* eslint-disable max-len */ - /** - * Holds the information for a single attribute structure required to render geometry. - * - * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc. - * - * @class - * @memberof PIXI - */ - var Attribute = /** @class */ (function () { - /** - * @param {string} buffer - the id of the buffer that this attribute will look for - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) - * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data) - */ - function Attribute(buffer, size, normalized, type, stride, start, instance) { - if (size === void 0) { size = 0; } - if (normalized === void 0) { normalized = false; } - if (type === void 0) { type = 5126; } - this.buffer = buffer; - this.size = size; - this.normalized = normalized; - this.type = type; - this.stride = stride; - this.start = start; - this.instance = instance; - } - /** - * Destroys the Attribute. - */ - Attribute.prototype.destroy = function () { - this.buffer = null; - }; - /** - * Helper function that creates an Attribute based on the information provided - * - * @static - * @param {string} buffer - the id of the buffer that this attribute will look for - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) - * - * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided - */ - Attribute.from = function (buffer, size, normalized, type, stride) { - return new Attribute(buffer, size, normalized, type, stride); - }; - return Attribute; - }()); - - var UID = 0; - /** - * A wrapper for data so that it can be used and uploaded by WebGL - * - * @class - * @memberof PIXI - */ - var Buffer = /** @class */ (function () { - /** - * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer. - * @param {boolean} [_static=true] - `true` for static buffer - * @param {boolean} [index=false] - `true` for index buffer - */ - function Buffer(data, _static, index) { - if (_static === void 0) { _static = true; } - if (index === void 0) { index = false; } - /** - * The data in the buffer, as a typed array - * - * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView} - */ - this.data = (data || new Float32Array(1)); - /** - * A map of renderer IDs to webgl buffer - * - * @private - * @member {object} - */ - this._glBuffers = {}; - this._updateID = 0; - this.index = index; - this.static = _static; - this.id = UID++; - this.disposeRunner = new Runner('disposeBuffer'); - } - // TODO could explore flagging only a partial upload? - /** - * flags this buffer as requiring an upload to the GPU - * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer. - */ - Buffer.prototype.update = function (data) { - this.data = data || this.data; - this._updateID++; - }; - /** - * disposes WebGL resources that are connected to this geometry - */ - Buffer.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys the buffer - */ - Buffer.prototype.destroy = function () { - this.dispose(); - this.data = null; - }; - /** - * Helper function that creates a buffer based on an array or TypedArray - * - * @static - * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. - * @return {PIXI.Buffer} A new Buffer based on the data provided. - */ - Buffer.from = function (data) { - if (data instanceof Array) { - data = new Float32Array(data); - } - return new Buffer(data); - }; - return Buffer; - }()); - - function getBufferType$1(array) { - if (array.BYTES_PER_ELEMENT === 4) { - if (array instanceof Float32Array) { - return 'Float32Array'; - } - else if (array instanceof Uint32Array) { - return 'Uint32Array'; - } - return 'Int32Array'; - } - else if (array.BYTES_PER_ELEMENT === 2) { - if (array instanceof Uint16Array) { - return 'Uint16Array'; - } - } - else if (array.BYTES_PER_ELEMENT === 1) { - if (array instanceof Uint8Array) { - return 'Uint8Array'; - } - } - // TODO map out the rest of the array elements! - return null; - } - - /* eslint-disable object-shorthand */ - var map$1 = { - Float32Array: Float32Array, - Uint32Array: Uint32Array, - Int32Array: Int32Array, - Uint8Array: Uint8Array, - }; - function interleaveTypedArrays$1(arrays, sizes) { - var outSize = 0; - var stride = 0; - var views = {}; - for (var i = 0; i < arrays.length; i++) { - stride += sizes[i]; - outSize += arrays[i].length; - } - var buffer = new ArrayBuffer(outSize * 4); - var out = null; - var littleOffset = 0; - for (var i = 0; i < arrays.length; i++) { - var size = sizes[i]; - var array = arrays[i]; - var type = getBufferType$1(array); - if (!views[type]) { - views[type] = new map$1[type](buffer); - } - out = views[type]; - for (var j = 0; j < array.length; j++) { - var indexStart = ((j / size | 0) * stride) + littleOffset; - var index = j % size; - out[indexStart + index] = array[j]; - } - littleOffset += size; - } - return new Float32Array(buffer); - } - - var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; - var UID$1 = 0; - /* eslint-disable object-shorthand */ - var map$1$1 = { - Float32Array: Float32Array, - Uint32Array: Uint32Array, - Int32Array: Int32Array, - Uint8Array: Uint8Array, - Uint16Array: Uint16Array, - }; - /* eslint-disable max-len */ - /** - * The Geometry represents a model. It consists of two components: - * - GeometryStyle - The structure of the model such as the attributes layout - * - GeometryData - the data of the model - this consists of buffers. - * This can include anything from positions, uvs, normals, colors etc. - * - * Geometry can be defined without passing in a style or data if required (thats how I prefer!) - * - * ```js - * let geometry = new PIXI.Geometry(); - * - * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); - * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) - * geometry.addIndex([0,1,2,1,3,2]) - * - * ``` - * @class - * @memberof PIXI - */ - var Geometry = /** @class */ (function () { - /** - * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional. - * @param {object} [attributes] - of the geometry, optional structure of the attributes layout - */ - function Geometry(buffers, attributes) { - if (buffers === void 0) { buffers = []; } - if (attributes === void 0) { attributes = {}; } - this.buffers = buffers; - this.indexBuffer = null; - this.attributes = attributes; - /** - * A map of renderer IDs to webgl VAOs - * - * @protected - * @type {object} - */ - this.glVertexArrayObjects = {}; - this.id = UID$1++; - this.instanced = false; - /** - * Number of instances in this geometry, pass it to `GeometrySystem.draw()` - * @member {number} - * @default 1 - */ - this.instanceCount = 1; - this.disposeRunner = new Runner('disposeGeometry'); - /** - * Count of existing (not destroyed) meshes that reference this geometry - * @member {number} - */ - this.refCount = 0; - } - /** - * - * Adds an attribute to the geometry - * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! - * - * @param {String} id - the name of the attribute (matching up to a shader) - * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] - should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available - * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data) - * @param {Number} [start] - How far into the array to start reading values (used for interleaving data) - * @param {boolean} [instance=false] - Instancing flag - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { - if (size === void 0) { size = 0; } - if (normalized === void 0) { normalized = false; } - if (instance === void 0) { instance = false; } - if (!buffer) { - throw new Error('You must pass a buffer when creating an attribute'); - } - // check if this is a buffer! - if (!(buffer instanceof Buffer)) { - // its an array! - if (buffer instanceof Array) { - buffer = new Float32Array(buffer); - } - buffer = new Buffer(buffer); - } - var ids = id.split('|'); - if (ids.length > 1) { - for (var i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalized, type); - } - return this; - } - var bufferIndex = this.buffers.indexOf(buffer); - if (bufferIndex === -1) { - this.buffers.push(buffer); - bufferIndex = this.buffers.length - 1; - } - this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); - // assuming that if there is instanced data then this will be drawn with instancing! - this.instanced = this.instanced || instance; - return this; - }; - /** - * returns the requested attribute - * - * @param {String} id - the name of the attribute required - * @return {PIXI.Attribute} the attribute requested. - */ - Geometry.prototype.getAttribute = function (id) { - return this.attributes[id]; - }; - /** - * returns the requested buffer - * - * @param {String} id - the name of the buffer required - * @return {PIXI.Buffer} the buffer requested. - */ - Geometry.prototype.getBuffer = function (id) { - return this.buffers[this.getAttribute(id).buffer]; - }; - /** - * - * Adds an index buffer to the geometry - * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. - * - * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addIndex = function (buffer) { - if (!(buffer instanceof Buffer)) { - // its an array! - if (buffer instanceof Array) { - buffer = new Uint16Array(buffer); - } - buffer = new Buffer(buffer); - } - buffer.index = true; - this.indexBuffer = buffer; - if (this.buffers.indexOf(buffer) === -1) { - this.buffers.push(buffer); - } - return this; - }; - /** - * returns the index buffer - * - * @return {PIXI.Buffer} the index buffer. - */ - Geometry.prototype.getIndex = function () { - return this.indexBuffer; - }; - /** - * this function modifies the structure so that all current attributes become interleaved into a single buffer - * This can be useful if your model remains static as it offers a little performance boost - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.interleave = function () { - // a simple check to see if buffers are already interleaved.. - if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) - { return this; } - // assume already that no buffers are interleaved - var arrays = []; - var sizes = []; - var interleavedBuffer = new Buffer(); - var i; - for (i in this.attributes) { - var attribute = this.attributes[i]; - var buffer = this.buffers[attribute.buffer]; - arrays.push(buffer.data); - sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4); - attribute.buffer = 0; - } - interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); - for (i = 0; i < this.buffers.length; i++) { - if (this.buffers[i] !== this.indexBuffer) { - this.buffers[i].destroy(); - } - } - this.buffers = [interleavedBuffer]; - if (this.indexBuffer) { - this.buffers.push(this.indexBuffer); - } - return this; - }; - Geometry.prototype.getSize = function () { - for (var i in this.attributes) { - var attribute = this.attributes[i]; - var buffer = this.buffers[attribute.buffer]; - return buffer.data.length / ((attribute.stride / 4) || attribute.size); - } - return 0; - }; - /** - * disposes WebGL resources that are connected to this geometry - */ - Geometry.prototype.dispose = function () { - this.disposeRunner.emit(this, false); - }; - /** - * Destroys the geometry. - */ - Geometry.prototype.destroy = function () { - this.dispose(); - this.buffers = null; - this.indexBuffer = null; - this.attributes = null; - }; - /** - * returns a clone of the geometry - * - * @returns {PIXI.Geometry} a new clone of this geometry - */ - Geometry.prototype.clone = function () { - var geometry = new Geometry(); - for (var i = 0; i < this.buffers.length; i++) { - geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); - } - for (var i in this.attributes) { - var attrib = this.attributes[i]; - geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); - } - if (this.indexBuffer) { - geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; - geometry.indexBuffer.index = true; - } - return geometry; - }; - /** - * merges an array of geometries into a new single one - * geometry attribute styles must match for this operation to work - * - * @param {PIXI.Geometry[]} geometries - array of geometries to merge - * @returns {PIXI.Geometry} shiny new geometry! - */ - Geometry.merge = function (geometries) { - // todo add a geometry check! - // also a size check.. cant be too big!] - var geometryOut = new Geometry(); - var arrays = []; - var sizes = []; - var offsets = []; - var geometry; - // pass one.. get sizes.. - for (var i = 0; i < geometries.length; i++) { - geometry = geometries[i]; - for (var j = 0; j < geometry.buffers.length; j++) { - sizes[j] = sizes[j] || 0; - sizes[j] += geometry.buffers[j].data.length; - offsets[j] = 0; - } - } - // build the correct size arrays.. - for (var i = 0; i < geometry.buffers.length; i++) { - // TODO types! - arrays[i] = new map$1$1[getBufferType$1(geometry.buffers[i].data)](sizes[i]); - geometryOut.buffers[i] = new Buffer(arrays[i]); - } - // pass to set data.. - for (var i = 0; i < geometries.length; i++) { - geometry = geometries[i]; - for (var j = 0; j < geometry.buffers.length; j++) { - arrays[j].set(geometry.buffers[j].data, offsets[j]); - offsets[j] += geometry.buffers[j].data.length; - } - } - geometryOut.attributes = geometry.attributes; - if (geometry.indexBuffer) { - geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; - geometryOut.indexBuffer.index = true; - var offset = 0; - var stride = 0; - var offset2 = 0; - var bufferIndexToCount = 0; - // get a buffer - for (var i = 0; i < geometry.buffers.length; i++) { - if (geometry.buffers[i] !== geometry.indexBuffer) { - bufferIndexToCount = i; - break; - } - } - // figure out the stride of one buffer.. - for (var i in geometry.attributes) { - var attribute = geometry.attributes[i]; - if ((attribute.buffer | 0) === bufferIndexToCount) { - stride += ((attribute.size * byteSizeMap[attribute.type]) / 4); - } - } - // time to off set all indexes.. - for (var i = 0; i < geometries.length; i++) { - var indexBufferData = geometries[i].indexBuffer.data; - for (var j = 0; j < indexBufferData.length; j++) { - geometryOut.indexBuffer.data[j + offset2] += offset; - } - offset += geometry.buffers[bufferIndexToCount].data.length / (stride); - offset2 += indexBufferData.length; - } - } - return geometryOut; - }; - return Geometry; - }()); - - /** - * Helper class to create a quad - * - * @class - * @memberof PIXI - */ - var Quad = /** @class */ (function (_super) { - __extends$2(Quad, _super); - function Quad() { - var _this = _super.call(this) || this; - _this.addAttribute('aVertexPosition', new Float32Array([ - 0, 0, - 1, 0, - 1, 1, - 0, 1 ])) - .addIndex([0, 1, 3, 2]); - return _this; - } - return Quad; - }(Geometry)); - - /** - * Helper class to create a quad with uvs like in v4 - * - * @class - * @memberof PIXI - * @extends PIXI.Geometry - */ - var QuadUv = /** @class */ (function (_super) { - __extends$2(QuadUv, _super); - function QuadUv() { - var _this = _super.call(this) || this; - /** - * An array of vertices - * - * @member {Float32Array} - */ - _this.vertices = new Float32Array([ - -1, -1, - 1, -1, - 1, 1, - -1, 1 ]); - /** - * The Uvs of the quad - * - * @member {Float32Array} - */ - _this.uvs = new Float32Array([ - 0, 0, - 1, 0, - 1, 1, - 0, 1 ]); - _this.vertexBuffer = new Buffer(_this.vertices); - _this.uvBuffer = new Buffer(_this.uvs); - _this.addAttribute('aVertexPosition', _this.vertexBuffer) - .addAttribute('aTextureCoord', _this.uvBuffer) - .addIndex([0, 1, 2, 0, 2, 3]); - return _this; - } - /** - * Maps two Rectangle to the quad. - * - * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle - * @param {PIXI.Rectangle} destinationFrame - the second rectangle - * @return {PIXI.Quad} Returns itself. - */ - QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { - var x = 0; // destinationFrame.x / targetTextureFrame.width; - var y = 0; // destinationFrame.y / targetTextureFrame.height; - this.uvs[0] = x; - this.uvs[1] = y; - this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); - this.uvs[3] = y; - this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); - this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); - this.uvs[6] = x; - this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); - x = destinationFrame.x; - y = destinationFrame.y; - this.vertices[0] = x; - this.vertices[1] = y; - this.vertices[2] = x + destinationFrame.width; - this.vertices[3] = y; - this.vertices[4] = x + destinationFrame.width; - this.vertices[5] = y + destinationFrame.height; - this.vertices[6] = x; - this.vertices[7] = y + destinationFrame.height; - this.invalidate(); - return this; - }; - /** - * legacy upload method, just marks buffers dirty - * @returns {PIXI.QuadUv} Returns itself. - */ - QuadUv.prototype.invalidate = function () { - this.vertexBuffer._updateID++; - this.uvBuffer._updateID++; - return this; - }; - return QuadUv; - }(Geometry)); - - var UID$2 = 0; - /** - * Uniform group holds uniform map and some ID's for work - * - * @class - * @memberof PIXI - */ - var UniformGroup = /** @class */ (function () { - /** - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - * @param {boolean} [_static] - Uniforms wont be changed after creation - */ - function UniformGroup(uniforms, _static) { - /** - * uniform values - * @member {object} - * @readonly - */ - this.uniforms = uniforms; - /** - * Its a group and not a single uniforms - * @member {boolean} - * @readonly - * @default true - */ - this.group = true; - // lets generate this when the shader ? - this.syncUniforms = {}; - /** - * dirty version - * @protected - * @member {number} - */ - this.dirtyId = 0; - /** - * unique id - * @protected - * @member {number} - */ - this.id = UID$2++; - /** - * Uniforms wont be changed after creation - * @member {boolean} - */ - this.static = !!_static; - } - UniformGroup.prototype.update = function () { - this.dirtyId++; - }; - UniformGroup.prototype.add = function (name, uniforms, _static) { - this.uniforms[name] = new UniformGroup(uniforms, _static); - }; - UniformGroup.from = function (uniforms, _static) { - return new UniformGroup(uniforms, _static); - }; - return UniformGroup; - }()); - - /** - * System plugin to the renderer to manage filter states. - * - * @class - * @private - */ - var FilterState = /** @class */ (function () { - function FilterState() { - this.renderTexture = null; - /** - * Target of the filters - * We store for case when custom filter wants to know the element it was applied on - * @member {PIXI.DisplayObject} - * @private - */ - this.target = null; - /** - * Compatibility with PixiJS v4 filters - * @member {boolean} - * @default false - * @private - */ - this.legacy = false; - /** - * Resolution of filters - * @member {number} - * @default 1 - * @private - */ - this.resolution = 1; - // next three fields are created only for root - // re-assigned for everything else - /** - * Source frame - * @member {PIXI.Rectangle} - * @private - */ - this.sourceFrame = new Rectangle(); - /** - * Destination frame - * @member {PIXI.Rectangle} - * @private - */ - this.destinationFrame = new Rectangle(); - /** - * Collection of filters - * @member {PIXI.Filter[]} - * @private - */ - this.filters = []; - } - /** - * clears the state - * @private - */ - FilterState.prototype.clear = function () { - this.target = null; - this.filters = null; - this.renderTexture = null; - }; - return FilterState; - }()); - - /** - * System plugin to the renderer to manage the filters. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var FilterSystem = /** @class */ (function (_super) { - __extends$2(FilterSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function FilterSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * List of filters for the FilterSystem - * @member {Object[]} - * @readonly - */ - _this.defaultFilterStack = [{}]; - /** - * stores a bunch of PO2 textures used for filtering - * @member {Object} - */ - _this.texturePool = new RenderTexturePool(); - _this.texturePool.setScreenSize(renderer.view); - /** - * a pool for storing filter states, save us creating new ones each tick - * @member {Object[]} - */ - _this.statePool = []; - /** - * A very simple geometry used when drawing a filter effect to the screen - * @member {PIXI.Quad} - */ - _this.quad = new Quad(); - /** - * Quad UVs - * @member {PIXI.QuadUv} - */ - _this.quadUv = new QuadUv(); - /** - * Temporary rect for maths - * @type {PIXI.Rectangle} - */ - _this.tempRect = new Rectangle(); - /** - * Active state - * @member {object} - */ - _this.activeState = {}; - /** - * This uniform group is attached to filter uniforms when used - * @member {PIXI.UniformGroup} - * @property {PIXI.Rectangle} outputFrame - * @property {Float32Array} inputSize - * @property {Float32Array} inputPixel - * @property {Float32Array} inputClamp - * @property {Number} resolution - * @property {Float32Array} filterArea - * @property {Fload32Array} filterClamp - */ - _this.globalUniforms = new UniformGroup({ - outputFrame: _this.tempRect, - inputSize: new Float32Array(4), - inputPixel: new Float32Array(4), - inputClamp: new Float32Array(4), - resolution: 1, - // legacy variables - filterArea: new Float32Array(4), - filterClamp: new Float32Array(4), - }, true); - /** - * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES} - * @member {boolean} - */ - _this.forceClear = false; - /** - * Old padding behavior is to use the max amount instead of sum padding. - * Use this flag if you need the old behavior. - * @member {boolean} - * @default false - */ - _this.useMaxPadding = false; - return _this; - } - /** - * Adds a new filter to the System. - * - * @param {PIXI.DisplayObject} target - The target of the filter to render. - * @param {PIXI.Filter[]} filters - The filters to apply. - */ - FilterSystem.prototype.push = function (target, filters) { - var renderer = this.renderer; - var filterStack = this.defaultFilterStack; - var state = this.statePool.pop() || new FilterState(); - var resolution = filters[0].resolution; - var padding = filters[0].padding; - var autoFit = filters[0].autoFit; - var legacy = filters[0].legacy; - for (var i = 1; i < filters.length; i++) { - var filter = filters[i]; - // lets use the lowest resolution.. - resolution = Math.min(resolution, filter.resolution); - // figure out the padding required for filters - padding = this.useMaxPadding - // old behavior: use largest amount of padding! - ? Math.max(padding, filter.padding) - // new behavior: sum the padding - : padding + filter.padding; - // only auto fit if all filters are autofit - autoFit = autoFit && filter.autoFit; - legacy = legacy || filter.legacy; - } - if (filterStack.length === 1) { - this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current; - } - filterStack.push(state); - state.resolution = resolution; - state.legacy = legacy; - state.target = target; - state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); - state.sourceFrame.pad(padding); - if (autoFit) { - state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame); - } - // round to whole number based on resolution - state.sourceFrame.ceil(resolution); - state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution); - state.filters = filters; - state.destinationFrame.width = state.renderTexture.width; - state.destinationFrame.height = state.renderTexture.height; - var destinationFrame = this.tempRect; - destinationFrame.width = state.sourceFrame.width; - destinationFrame.height = state.sourceFrame.height; - state.renderTexture.filterFrame = state.sourceFrame; - renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame); - renderer.renderTexture.clear(); - }; - /** - * Pops off the filter and applies it. - * - */ - FilterSystem.prototype.pop = function () { - var filterStack = this.defaultFilterStack; - var state = filterStack.pop(); - var filters = state.filters; - this.activeState = state; - var globalUniforms = this.globalUniforms.uniforms; - globalUniforms.outputFrame = state.sourceFrame; - globalUniforms.resolution = state.resolution; - var inputSize = globalUniforms.inputSize; - var inputPixel = globalUniforms.inputPixel; - var inputClamp = globalUniforms.inputClamp; - inputSize[0] = state.destinationFrame.width; - inputSize[1] = state.destinationFrame.height; - inputSize[2] = 1.0 / inputSize[0]; - inputSize[3] = 1.0 / inputSize[1]; - inputPixel[0] = inputSize[0] * state.resolution; - inputPixel[1] = inputSize[1] * state.resolution; - inputPixel[2] = 1.0 / inputPixel[0]; - inputPixel[3] = 1.0 / inputPixel[1]; - inputClamp[0] = 0.5 * inputPixel[2]; - inputClamp[1] = 0.5 * inputPixel[3]; - inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); - inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); - // only update the rect if its legacy.. - if (state.legacy) { - var filterArea = globalUniforms.filterArea; - filterArea[0] = state.destinationFrame.width; - filterArea[1] = state.destinationFrame.height; - filterArea[2] = state.sourceFrame.x; - filterArea[3] = state.sourceFrame.y; - globalUniforms.filterClamp = globalUniforms.inputClamp; - } - this.globalUniforms.update(); - var lastState = filterStack[filterStack.length - 1]; - if (state.renderTexture.framebuffer.multisample > 1) { - this.renderer.framebuffer.blit(); - } - if (filters.length === 1) { - filters[0].apply(this, state.renderTexture, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(state.renderTexture); - } - else { - var flip = state.renderTexture; - var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); - flop.filterFrame = flip.filterFrame; - var i = 0; - for (i = 0; i < filters.length - 1; ++i) { - filters[i].apply(this, flip, flop, exports.CLEAR_MODES.CLEAR, state); - var t = flip; - flip = flop; - flop = t; - } - filters[i].apply(this, flip, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); - this.returnFilterTexture(flip); - this.returnFilterTexture(flop); - } - state.clear(); - this.statePool.push(state); - }; - /** - * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. - * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack - * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} - */ - FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { - if (clearMode === void 0) { clearMode = exports.CLEAR_MODES.CLEAR; } - if (filterTexture && filterTexture.filterFrame) { - var destinationFrame = this.tempRect; - destinationFrame.width = filterTexture.filterFrame.width; - destinationFrame.height = filterTexture.filterFrame.height; - this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame); - } - else { - this.renderer.renderTexture.bind(filterTexture); - } - // TODO: remove in next major version - if (typeof clearMode === 'boolean') { - clearMode = clearMode ? exports.CLEAR_MODES.CLEAR : exports.CLEAR_MODES.BLEND; - // get deprecation function from utils - deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option'); - } - if (clearMode === exports.CLEAR_MODES.CLEAR - || (clearMode === exports.CLEAR_MODES.BLIT && this.forceClear)) { - this.renderer.renderTexture.clear(); - } - }; - /** - * Draws a filter. - * - * @param {PIXI.Filter} filter - The filter to draw. - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it - */ - FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { - var renderer = this.renderer; - this.bindAndClear(output, clearMode); - // set the uniforms.. - filter.uniforms.uSampler = input; - filter.uniforms.filterGlobals = this.globalUniforms; - // TODO make it so that the order of this does not matter.. - // because it does at the moment cos of global uniforms. - // they need to get resynced - renderer.state.set(filter.state); - renderer.shader.bind(filter); - if (filter.legacy) { - this.quadUv.map(input._frame, input.filterFrame); - renderer.geometry.bind(this.quadUv); - renderer.geometry.draw(exports.DRAW_MODES.TRIANGLES); - } - else { - renderer.geometry.bind(this.quad); - renderer.geometry.draw(exports.DRAW_MODES.TRIANGLE_STRIP); - } - }; - /** - * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. - * - * Use `outputMatrix * vTextureCoord` in the shader. - * - * @param {PIXI.Matrix} outputMatrix - The matrix to output to. - * @param {PIXI.Sprite} sprite - The sprite to map to. - * @return {PIXI.Matrix} The mapped matrix. - */ - FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var orig = sprite._texture.orig; - var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); - var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX); - worldTransform.invert(); - mappedMatrix.prepend(worldTransform); - mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); - mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); - return mappedMatrix; - }; - /** - * Destroys this Filter System. - */ - FilterSystem.prototype.destroy = function () { - // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem - this.texturePool.clear(false); - }; - /** - * Gets a Power-of-Two render texture or fullScreen texture - * - * @protected - * @param {number} minWidth - The minimum width of the render texture in real pixels. - * @param {number} minHeight - The minimum height of the render texture in real pixels. - * @param {number} [resolution=1] - The resolution of the render texture. - * @return {PIXI.RenderTexture} The new render texture. - */ - FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution) { - if (resolution === void 0) { resolution = 1; } - return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution); - }; - /** - * Gets extra render texture to use inside current filter - * To be compliant with older filters, you can use params in any order - * - * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied - * @param {number} [resolution] - override resolution of the renderTexture - * @returns {PIXI.RenderTexture} - */ - FilterSystem.prototype.getFilterTexture = function (input, resolution) { - if (typeof input === 'number') { - var swap = input; - input = resolution; - resolution = swap; - } - input = input || this.activeState.renderTexture; - var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution); - filterTexture.filterFrame = input.filterFrame; - return filterTexture; - }; - /** - * Frees a render texture back into the pool. - * - * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free - */ - FilterSystem.prototype.returnFilterTexture = function (renderTexture) { - this.texturePool.returnTexture(renderTexture); - }; - /** - * Empties the texture pool. - */ - FilterSystem.prototype.emptyPool = function () { - this.texturePool.clear(true); - }; - /** - * calls `texturePool.resize()`, affects fullScreen renderTextures - */ - FilterSystem.prototype.resize = function () { - this.texturePool.setScreenSize(this.renderer.view); - }; - return FilterSystem; - }(System)); - - /** - * Base for a common object renderer that can be used as a - * system renderer plugin. - * - * @class - * @extends PIXI.System - * @memberof PIXI - */ - var ObjectRenderer = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. - */ - function ObjectRenderer(renderer) { - /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} - */ - this.renderer = renderer; - } - /** - * Stub method that should be used to empty the current - * batch by rendering objects now. - */ - ObjectRenderer.prototype.flush = function () { - // flush! - }; - /** - * Generic destruction method that frees all resources. This - * should be called by subclasses. - */ - ObjectRenderer.prototype.destroy = function () { - this.renderer = null; - }; - /** - * Stub method that initializes any state required before - * rendering starts. It is different from the `prerender` - * signal, which occurs every frame, in that it is called - * whenever an object requests _this_ renderer specifically. - */ - ObjectRenderer.prototype.start = function () { - // set the shader.. - }; - /** - * Stops the renderer. It should free up any state and - * become dormant. - */ - ObjectRenderer.prototype.stop = function () { - this.flush(); - }; - /** - * Keeps the object to render. It doesn't have to be - * rendered immediately. - * - * @param {PIXI.DisplayObject} object - The object to render. - */ - ObjectRenderer.prototype.render = function (_object) { - // render the object - }; - return ObjectRenderer; - }()); - - /** - * System plugin to the renderer to manage batching. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var BatchSystem = /** @class */ (function (_super) { - __extends$2(BatchSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function BatchSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * An empty renderer. - * - * @member {PIXI.ObjectRenderer} - */ - _this.emptyRenderer = new ObjectRenderer(renderer); - /** - * The currently active ObjectRenderer. - * - * @member {PIXI.ObjectRenderer} - */ - _this.currentRenderer = _this.emptyRenderer; - return _this; - } - /** - * Changes the current renderer to the one given in parameter - * - * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use. - */ - BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { - if (this.currentRenderer === objectRenderer) { - return; - } - this.currentRenderer.stop(); - this.currentRenderer = objectRenderer; - this.currentRenderer.start(); - }; - /** - * This should be called if you wish to do some custom rendering - * It will basically render anything that may be batched up such as sprites - */ - BatchSystem.prototype.flush = function () { - this.setObjectRenderer(this.emptyRenderer); - }; - /** - * Reset the system to an empty renderer - */ - BatchSystem.prototype.reset = function () { - this.setObjectRenderer(this.emptyRenderer); - }; - /** - * Handy function for batch renderers: copies bound textures in first maxTextures locations to array - * sets actual _batchLocation for them - * - * @param {PIXI.BaseTexture[]} - arr copy destination - * @param {number} maxTextures - number of copied elements - */ - BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { - var boundTextures = this.renderer.texture.boundTextures; - for (var i = maxTextures - 1; i >= 0; --i) { - arr[i] = boundTextures[i] || null; - if (arr[i]) { - arr[i]._batchLocation = i; - } - } - }; - /** - * Assigns batch locations to textures in array based on boundTextures state. - * All textures in texArray should have `_batchEnabled = _batchId`, - * and their count should be less than `maxTextures`. - * - * @param {PIXI.BatchTextureArray} texArray - textures to bound - * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures - * @param {number} batchId - marker for _batchEnabled param of textures in texArray - * @param {number} maxTextures - number of texture locations to manipulate - */ - BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { - var elements = texArray.elements, ids = texArray.ids, count = texArray.count; - var j = 0; - for (var i = 0; i < count; i++) { - var tex = elements[i]; - var loc = tex._batchLocation; - if (loc >= 0 && loc < maxTextures - && boundTextures[loc] === tex) { - ids[i] = loc; - continue; - } - while (j < maxTextures) { - var bound = boundTextures[j]; - if (bound && bound._batchEnabled === batchId - && bound._batchLocation === j) { - j++; - continue; - } - ids[i] = j; - tex._batchLocation = j; - boundTextures[j] = tex; - break; - } - } - }; - return BatchSystem; - }(System)); - - var CONTEXT_UID_COUNTER = 0; - /** - * System plugin to the renderer to manage the context. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ContextSystem = /** @class */ (function (_super) { - __extends$2(ContextSystem, _super); - /* eslint-enable camelcase */ - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ContextSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Either 1 or 2 to reflect the WebGL version being used - * @member {number} - * @readonly - */ - _this.webGLVersion = 1; - /** - * Extensions being used - * @member {object} - * @readonly - * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension - * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension - * @property {OES_texture_float} floatTexture - WebGL v1 extension - * @property {WEBGL_lose_context} loseContext - WebGL v1 extension - * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension - * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension - */ - _this.extensions = {}; - /** - * Features supported by current context - * @member {object} - * @private - * @readonly - * @property {boolean} uint32Indices - Supports of 32-bit indices buffer - */ - _this.supports = { - uint32Indices: false, - }; - // Bind functions - _this.handleContextLost = _this.handleContextLost.bind(_this); - _this.handleContextRestored = _this.handleContextRestored.bind(_this); - renderer.view.addEventListener('webglcontextlost', _this.handleContextLost, false); - renderer.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false); - return _this; - } - Object.defineProperty(ContextSystem.prototype, "isLost", { - /** - * `true` if the context is lost - * @member {boolean} - * @readonly - */ - get: function () { - return (!this.gl || this.gl.isContextLost()); - }, - enumerable: false, - configurable: true - }); - /** - * Handle the context change event - * @param {WebGLRenderingContext} gl - new webgl context - */ - ContextSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; - // restore a context if it was previously lost - if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) { - gl.getExtension('WEBGL_lose_context').restoreContext(); - } - }; - /** - * Initialize the context - * - * @protected - * @param {WebGLRenderingContext} gl - WebGL context - */ - ContextSystem.prototype.initFromContext = function (gl) { - this.gl = gl; - this.validateContext(gl); - this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; - this.renderer.runners.contextChange.emit(gl); - }; - /** - * Initialize from context options - * - * @protected - * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext - * @param {object} options - context attributes - */ - ContextSystem.prototype.initFromOptions = function (options) { - var gl = this.createContext(this.renderer.view, options); - this.initFromContext(gl); - }; - /** - * Helper class to create a WebGL Context - * - * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from - * @param options {object} An options object that gets passed in to the canvas element containing the context attributes - * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext - * @return {WebGLRenderingContext} the WebGL context - */ - ContextSystem.prototype.createContext = function (canvas, options) { - var gl; - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { - gl = canvas.getContext('webgl2', options); - } - if (gl) { - this.webGLVersion = 2; - } - else { - this.webGLVersion = 1; - gl = canvas.getContext('webgl', options) - || canvas.getContext('experimental-webgl', options); - if (!gl) { - // fail, not able to get a context - throw new Error('This browser does not support WebGL. Try using the canvas renderer'); - } - } - this.gl = gl; - this.getExtensions(); - return this.gl; - }; - /** - * Auto-populate the extensions - * - * @protected - */ - ContextSystem.prototype.getExtensions = function () { - // time to set up default extensions that Pixi uses. - var gl = this.gl; - if (this.webGLVersion === 1) { - Object.assign(this.extensions, { - drawBuffers: gl.getExtension('WEBGL_draw_buffers'), - depthTexture: gl.getExtension('WEBGL_depth_texture'), - loseContext: gl.getExtension('WEBGL_lose_context'), - vertexArrayObject: gl.getExtension('OES_vertex_array_object') - || gl.getExtension('MOZ_OES_vertex_array_object') - || gl.getExtension('WEBKIT_OES_vertex_array_object'), - anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), - uint32ElementIndex: gl.getExtension('OES_element_index_uint'), - // Floats and half-floats - floatTexture: gl.getExtension('OES_texture_float'), - floatTextureLinear: gl.getExtension('OES_texture_float_linear'), - textureHalfFloat: gl.getExtension('OES_texture_half_float'), - textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), - }); - } - else if (this.webGLVersion === 2) { - Object.assign(this.extensions, { - anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), - // Floats and half-floats - colorBufferFloat: gl.getExtension('EXT_color_buffer_float'), - floatTextureLinear: gl.getExtension('OES_texture_float_linear'), - }); - } - }; - /** - * Handles a lost webgl context - * - * @protected - * @param {WebGLContextEvent} event - The context lost event. - */ - ContextSystem.prototype.handleContextLost = function (event) { - event.preventDefault(); - }; - /** - * Handles a restored webgl context - * - * @protected - */ - ContextSystem.prototype.handleContextRestored = function () { - this.renderer.runners.contextChange.emit(this.gl); - }; - ContextSystem.prototype.destroy = function () { - var view = this.renderer.view; - // remove listeners - view.removeEventListener('webglcontextlost', this.handleContextLost); - view.removeEventListener('webglcontextrestored', this.handleContextRestored); - this.gl.useProgram(null); - if (this.extensions.loseContext) { - this.extensions.loseContext.loseContext(); - } - }; - /** - * Handle the post-render runner event - * - * @protected - */ - ContextSystem.prototype.postrender = function () { - if (this.renderer.renderingToScreen) { - this.gl.flush(); - } - }; - /** - * Validate context - * - * @protected - * @param {WebGLRenderingContext} gl - Render context - */ - ContextSystem.prototype.validateContext = function (gl) { - var attributes = gl.getContextAttributes(); - var isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext; - if (isWebGl2) { - this.webGLVersion = 2; - } - // this is going to be fairly simple for now.. but at least we have room to grow! - if (!attributes.stencil) { - /* eslint-disable max-len, no-console */ - console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); - /* eslint-enable max-len, no-console */ - } - var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); - this.supports.uint32Indices = hasuint32; - if (!hasuint32) { - /* eslint-disable max-len, no-console */ - console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); - /* eslint-enable max-len, no-console */ - } - }; - return ContextSystem; - }(System)); - - /** - * Internal framebuffer for WebGL context - * @class - * @memberof PIXI - */ - var GLFramebuffer = /** @class */ (function () { - function GLFramebuffer(framebuffer) { - /** - * The WebGL framebuffer - * @member {WebGLFramebuffer} - */ - this.framebuffer = framebuffer; - /** - * stencil+depth , usually costs 32bits per pixel - * @member {WebGLRenderbuffer} - */ - this.stencil = null; - /** - * latest known version of framebuffer - * @member {number} - * @protected - */ - this.dirtyId = 0; - /** - * latest known version of framebuffer format - * @member {number} - * @protected - */ - this.dirtyFormat = 0; - /** - * latest known version of framebuffer size - * @member {number} - * @protected - */ - this.dirtySize = 0; - /** - * Detected AA samples number - * @member {PIXI.MSAA_QUALITY} - */ - this.multisample = exports.MSAA_QUALITY.NONE; - /** - * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info - * @member {WebGLRenderbuffer} - */ - this.msaaBuffer = null; - /** - * In case we use MSAA, this is actual framebuffer that has colorTextures[0] - * The contents of that framebuffer are read when we use that renderTexture in sprites - * @member {PIXI.Framebuffer} - */ - this.blitFramebuffer = null; - } - return GLFramebuffer; - }()); - - var tempRectangle = new Rectangle(); - /** - * System plugin to the renderer to manage framebuffers. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var FramebufferSystem = /** @class */ (function (_super) { - __extends$2(FramebufferSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function FramebufferSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * A list of managed framebuffers - * @member {PIXI.Framebuffer[]} - * @readonly - */ - _this.managedFramebuffers = []; - /** - * Framebuffer value that shows that we don't know what is bound - * @member {Framebuffer} - * @readonly - */ - _this.unknownFramebuffer = new Framebuffer(10, 10); - _this.msaaSamples = null; - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - FramebufferSystem.prototype.contextChange = function () { - var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - this.current = this.unknownFramebuffer; - this.viewport = new Rectangle(); - this.hasMRT = true; - this.writeDepthTexture = true; - this.disposeAll(true); - // webgl2 - if (this.renderer.context.webGLVersion === 1) { - // webgl 1! - var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; - var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - nativeDrawBuffersExtension_1 = null; - nativeDepthTextureExtension = null; - } - if (nativeDrawBuffersExtension_1) { - gl.drawBuffers = function (activeTextures) { - return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); - }; - } - else { - this.hasMRT = false; - gl.drawBuffers = function () { - // empty - }; - } - if (!nativeDepthTextureExtension) { - this.writeDepthTexture = false; - } - } - else { - // WebGL2 - // cache possible MSAA samples - this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); - } - }; - /** - * Bind a framebuffer - * - * @param {PIXI.Framebuffer} framebuffer - * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size - */ - FramebufferSystem.prototype.bind = function (framebuffer, frame) { - var gl = this.gl; - if (framebuffer) { - // TODO caching layer! - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); - if (this.current !== framebuffer) { - this.current = framebuffer; - gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - } - // make sure all textures are unbound.. - // now check for updates... - if (fbo.dirtyId !== framebuffer.dirtyId) { - fbo.dirtyId = framebuffer.dirtyId; - if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { - fbo.dirtyFormat = framebuffer.dirtyFormat; - this.updateFramebuffer(framebuffer); - } - else if (fbo.dirtySize !== framebuffer.dirtySize) { - fbo.dirtySize = framebuffer.dirtySize; - this.resizeFramebuffer(framebuffer); - } - } - for (var i = 0; i < framebuffer.colorTextures.length; i++) { - var tex = framebuffer.colorTextures[i]; - this.renderer.texture.unbind(tex.parentTextureArray || tex); - } - if (framebuffer.depthTexture) { - this.renderer.texture.unbind(framebuffer.depthTexture); - } - if (frame) { - this.setViewport(frame.x, frame.y, frame.width, frame.height); - } - else { - this.setViewport(0, 0, framebuffer.width, framebuffer.height); - } - } - else { - if (this.current) { - this.current = null; - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - } - if (frame) { - this.setViewport(frame.x, frame.y, frame.width, frame.height); - } - else { - this.setViewport(0, 0, this.renderer.width, this.renderer.height); - } - } - }; - /** - * Set the WebGLRenderingContext's viewport. - * - * @param {Number} x - X position of viewport - * @param {Number} y - Y position of viewport - * @param {Number} width - Width of viewport - * @param {Number} height - Height of viewport - */ - FramebufferSystem.prototype.setViewport = function (x, y, width, height) { - var v = this.viewport; - if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { - v.x = x; - v.y = y; - v.width = width; - v.height = height; - this.gl.viewport(x, y, width, height); - } - }; - Object.defineProperty(FramebufferSystem.prototype, "size", { - /** - * Get the size of the current width and height. Returns object with `width` and `height` values. - * - * @member {object} - * @readonly - */ - get: function () { - if (this.current) { - // TODO store temp - return { x: 0, y: 0, width: this.current.width, height: this.current.height }; - } - return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; - }, - enumerable: false, - configurable: true - }); - /** - * Clear the color of the context - * - * @param {Number} r - Red value from 0 to 1 - * @param {Number} g - Green value from 0 to 1 - * @param {Number} b - Blue value from 0 to 1 - * @param {Number} a - Alpha value from 0 to 1 - * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks - * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. - */ - FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { - if (mask === void 0) { mask = exports.BUFFER_BITS.COLOR | exports.BUFFER_BITS.DEPTH; } - var gl = this.gl; - // TODO clear color can be set only one right? - gl.clearColor(r, g, b, a); - gl.clear(mask); - }; - /** - * Initialize framebuffer for this context - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - * @returns {PIXI.GLFramebuffer} created GLFramebuffer - */ - FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = new GLFramebuffer(gl.createFramebuffer()); - fbo.multisample = this.detectSamples(framebuffer.multisample); - framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; - this.managedFramebuffers.push(framebuffer); - framebuffer.disposeRunner.add(this); - return fbo; - }; - /** - * Resize the framebuffer - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - */ - FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - if (fbo.stencil) { - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); - } - var colorTextures = framebuffer.colorTextures; - for (var i = 0; i < colorTextures.length; i++) { - this.renderer.texture.bind(colorTextures[i], 0); - } - if (framebuffer.depthTexture) { - this.renderer.texture.bind(framebuffer.depthTexture, 0); - } - }; - /** - * Update the framebuffer - * - * @protected - * @param {PIXI.Framebuffer} framebuffer - */ - FramebufferSystem.prototype.updateFramebuffer = function (framebuffer) { - var gl = this.gl; - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - // bind the color texture - var colorTextures = framebuffer.colorTextures; - var count = colorTextures.length; - if (!gl.drawBuffers) { - count = Math.min(count, 1); - } - if (fbo.multisample > 1) { - fbo.msaaBuffer = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); - gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); - } - var activeTextures = []; - for (var i = 0; i < count; i++) { - if (i === 0 && fbo.multisample > 1) { - continue; - } - var texture = framebuffer.colorTextures[i]; - var parentTexture = texture.parentTextureArray || texture; - this.renderer.texture.bind(parentTexture, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, 0); - activeTextures.push(gl.COLOR_ATTACHMENT0 + i); - } - if (activeTextures.length > 1) { - gl.drawBuffers(activeTextures); - } - if (framebuffer.depthTexture) { - var writeDepthTexture = this.writeDepthTexture; - if (writeDepthTexture) { - var depthTexture = framebuffer.depthTexture; - this.renderer.texture.bind(depthTexture, 0); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, 0); - } - } - if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) { - fbo.stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); - // TODO.. this is depth AND stencil? - if (!framebuffer.depthTexture) { // you can't have both, so one should take priority if enabled - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); - } - } - }; - /** - * Detects number of samples that is not more than a param but as close to it as possible - * - * @param {PIXI.MSAA_QUALITY} samples - number of samples - * @returns {PIXI.MSAA_QUALITY} - recommended number of samples - */ - FramebufferSystem.prototype.detectSamples = function (samples) { - var msaaSamples = this.msaaSamples; - var res = exports.MSAA_QUALITY.NONE; - if (samples <= 1 || msaaSamples === null) { - return res; - } - for (var i = 0; i < msaaSamples.length; i++) { - if (msaaSamples[i] <= samples) { - res = msaaSamples[i]; - break; - } - } - if (res === 1) { - res = exports.MSAA_QUALITY.NONE; - } - return res; - }; - /** - * Only works with WebGL2 - * - * blits framebuffer to another of the same or bigger size - * after that target framebuffer is bound - * - * Fails with WebGL warning if blits multisample framebuffer to different size - * - * @param {PIXI.Framebuffer} [framebuffer] - by default it blits "into itself", from renderBuffer to texture. - * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels - * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels - */ - FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { - var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; - if (renderer.context.webGLVersion !== 2) { - return; - } - if (!current) { - return; - } - var fbo = current.glFramebuffers[CONTEXT_UID]; - if (!fbo) { - return; - } - if (!framebuffer) { - if (fbo.multisample <= 1) { - return; - } - if (!fbo.blitFramebuffer) { - fbo.blitFramebuffer = new Framebuffer(current.width, current.height); - fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]); - } - framebuffer = fbo.blitFramebuffer; - framebuffer.width = current.width; - framebuffer.height = current.height; - } - if (!sourcePixels) { - sourcePixels = tempRectangle; - sourcePixels.width = current.width; - sourcePixels.height = current.height; - } - if (!destPixels) { - destPixels = sourcePixels; - } - var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; - this.bind(framebuffer); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); - gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); - }; - /** - * Disposes framebuffer - * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of - * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls - */ - FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - var gl = this.gl; - if (!fbo) { - return; - } - delete framebuffer.glFramebuffers[this.CONTEXT_UID]; - var index = this.managedFramebuffers.indexOf(framebuffer); - if (index >= 0) { - this.managedFramebuffers.splice(index, 1); - } - framebuffer.disposeRunner.remove(this); - if (!contextLost) { - gl.deleteFramebuffer(fbo.framebuffer); - if (fbo.stencil) { - gl.deleteRenderbuffer(fbo.stencil); - } - } - }; - /** - * Disposes all framebuffers, but not textures bound to them - * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls - */ - FramebufferSystem.prototype.disposeAll = function (contextLost) { - var list = this.managedFramebuffers; - this.managedFramebuffers = []; - for (var i = 0; i < list.length; i++) { - this.disposeFramebuffer(list[i], contextLost); - } - }; - /** - * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. - * Used by MaskSystem, when its time to use stencil mask for Graphics element. - * - * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. - * - * @private - */ - FramebufferSystem.prototype.forceStencil = function () { - var framebuffer = this.current; - if (!framebuffer) { - return; - } - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - if (!fbo || fbo.stencil) { - return; - } - framebuffer.enableStencil(); - var w = framebuffer.width; - var h = framebuffer.height; - var gl = this.gl; - var stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); - fbo.stencil = stencil; - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); - }; - /** - * resets framebuffer stored state, binds screen framebuffer - * - * should be called before renderTexture reset() - */ - FramebufferSystem.prototype.reset = function () { - this.current = this.unknownFramebuffer; - this.viewport = new Rectangle(); - }; - return FramebufferSystem; - }(System)); - - var GLBuffer = /** @class */ (function () { - function GLBuffer(buffer) { - this.buffer = buffer || null; - this.updateID = -1; - this.byteLength = -1; - this.refCount = 0; - } - return GLBuffer; - }()); - - var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; - /** - * System plugin to the renderer to manage geometry. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var GeometrySystem = /** @class */ (function (_super) { - __extends$2(GeometrySystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function GeometrySystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this._activeGeometry = null; - _this._activeVao = null; - /** - * `true` if we has `*_vertex_array_object` extension - * @member {boolean} - * @readonly - */ - _this.hasVao = true; - /** - * `true` if has `ANGLE_instanced_arrays` extension - * @member {boolean} - * @readonly - */ - _this.hasInstance = true; - /** - * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced` - * @member {boolean} - * @readonly - */ - _this.canUseUInt32ElementIndex = false; - /** - * Cache for all geometries by id, used in case renderer gets destroyed or for profiling - * @member {object} - * @readonly - */ - _this.managedGeometries = {}; - /** - * Cache for all buffers by id, used in case renderer gets destroyed or for profiling - * @member {object} - * @readonly - */ - _this.managedBuffers = {}; - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - GeometrySystem.prototype.contextChange = function () { - this.disposeAll(true); - var gl = this.gl = this.renderer.gl; - var context = this.renderer.context; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - // webgl2 - if (context.webGLVersion !== 2) { - // webgl 1! - var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - nativeVaoExtension_1 = null; - } - if (nativeVaoExtension_1) { - gl.createVertexArray = function () { - return nativeVaoExtension_1.createVertexArrayOES(); - }; - gl.bindVertexArray = function (vao) { - return nativeVaoExtension_1.bindVertexArrayOES(vao); - }; - gl.deleteVertexArray = function (vao) { - return nativeVaoExtension_1.deleteVertexArrayOES(vao); - }; - } - else { - this.hasVao = false; - gl.createVertexArray = function () { - return null; - }; - gl.bindVertexArray = function () { - return null; - }; - gl.deleteVertexArray = function () { - return null; - }; - } - } - if (context.webGLVersion !== 2) { - var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); - if (instanceExt_1) { - gl.vertexAttribDivisor = function (a, b) { - return instanceExt_1.vertexAttribDivisorANGLE(a, b); - }; - gl.drawElementsInstanced = function (a, b, c, d, e) { - return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); - }; - gl.drawArraysInstanced = function (a, b, c, d) { - return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); - }; - } - else { - this.hasInstance = false; - } - } - this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; - }; - /** - * Binds geometry so that is can be drawn. Creating a Vao if required - * - * @param {PIXI.Geometry} geometry - instance of geometry to bind - * @param {PIXI.Shader} [shader] - instance of shader to use vao for - */ - GeometrySystem.prototype.bind = function (geometry, shader) { - shader = shader || this.renderer.shader.shader; - var gl = this.gl; - // not sure the best way to address this.. - // currently different shaders require different VAOs for the same geometry - // Still mulling over the best way to solve this one.. - // will likely need to modify the shader attribute locations at run time! - var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var incRefCount = false; - if (!vaos) { - this.managedGeometries[geometry.id] = geometry; - geometry.disposeRunner.add(this); - geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; - incRefCount = true; - } - var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount); - this._activeGeometry = geometry; - if (this._activeVao !== vao) { - this._activeVao = vao; - if (this.hasVao) { - gl.bindVertexArray(vao); - } - else { - this.activateVao(geometry, shader.program); - } - } - // TODO - optimise later! - // don't need to loop through if nothing changed! - // maybe look to add an 'autoupdate' to geometry? - this.updateBuffers(); - }; - /** - * Reset and unbind any active VAO and geometry - */ - GeometrySystem.prototype.reset = function () { - this.unbind(); - }; - /** - * Update buffers - * @protected - */ - GeometrySystem.prototype.updateBuffers = function () { - var geometry = this._activeGeometry; - var gl = this.gl; - for (var i = 0; i < geometry.buffers.length; i++) { - var buffer = geometry.buffers[i]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; - if (buffer._updateID !== glBuffer.updateID) { - glBuffer.updateID = buffer._updateID; - // TODO can cache this on buffer! maybe added a getter / setter? - var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER; - // TODO this could change if the VAO changes... - // need to come up with a better way to cache.. - // if (this.boundBuffers[type] !== glBuffer) - // { - // this.boundBuffers[type] = glBuffer; - gl.bindBuffer(type, glBuffer.buffer); - // } - this._boundBuffer = glBuffer; - if (glBuffer.byteLength >= buffer.data.byteLength) { - // offset is always zero for now! - gl.bufferSubData(type, 0, buffer.data); - } - else { - var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; - glBuffer.byteLength = buffer.data.byteLength; - gl.bufferData(type, buffer.data, drawType); - } - } - } - }; - /** - * Check compability between a geometry and a program - * @protected - * @param {PIXI.Geometry} geometry - Geometry instance - * @param {PIXI.Program} program - Program instance - */ - GeometrySystem.prototype.checkCompatibility = function (geometry, program) { - // geometry must have at least all the attributes that the shader requires. - var geometryAttributes = geometry.attributes; - var shaderAttributes = program.attributeData; - for (var j in shaderAttributes) { - if (!geometryAttributes[j]) { - throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); - } - } - }; - /** - * Takes a geometry and program and generates a unique signature for them. - * - * @param {PIXI.Geometry} geometry - to get signature from - * @param {PIXI.Program} program - to test geometry against - * @returns {String} Unique signature of the geometry and program - * @protected - */ - GeometrySystem.prototype.getSignature = function (geometry, program) { - var attribs = geometry.attributes; - var shaderAttributes = program.attributeData; - var strings = ['g', geometry.id]; - for (var i in attribs) { - if (shaderAttributes[i]) { - strings.push(i); - } - } - return strings.join('-'); - }; - /** - * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. - * If vao is created, it is bound automatically. - * - * @protected - * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for - * @param {PIXI.Program} program - Instance of program - * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers - */ - GeometrySystem.prototype.initGeometryVao = function (geometry, program, incRefCount) { - if (incRefCount === void 0) { incRefCount = true; } - this.checkCompatibility(geometry, program); - var gl = this.gl; - var CONTEXT_UID = this.CONTEXT_UID; - var signature = this.getSignature(geometry, program); - var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var vao = vaoObjectHash[signature]; - if (vao) { - // this will give us easy access to the vao - vaoObjectHash[program.id] = vao; - return vao; - } - var buffers = geometry.buffers; - var attributes = geometry.attributes; - var tempStride = {}; - var tempStart = {}; - for (var j in buffers) { - tempStride[j] = 0; - tempStart[j] = 0; - } - for (var j in attributes) { - if (!attributes[j].size && program.attributeData[j]) { - attributes[j].size = program.attributeData[j].size; - } - else if (!attributes[j].size) { - console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line - } - tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type]; - } - for (var j in attributes) { - var attribute = attributes[j]; - var attribSize = attribute.size; - if (attribute.stride === undefined) { - if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) { - attribute.stride = 0; - } - else { - attribute.stride = tempStride[attribute.buffer]; - } - } - if (attribute.start === undefined) { - attribute.start = tempStart[attribute.buffer]; - tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type]; - } - } - vao = gl.createVertexArray(); - gl.bindVertexArray(vao); - // first update - and create the buffers! - // only create a gl buffer if it actually gets - for (var i = 0; i < buffers.length; i++) { - var buffer = buffers[i]; - if (!buffer._glBuffers[CONTEXT_UID]) { - buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); - this.managedBuffers[buffer.id] = buffer; - buffer.disposeRunner.add(this); - } - if (incRefCount) { - buffer._glBuffers[CONTEXT_UID].refCount++; - } - } - // TODO - maybe make this a data object? - // lets wait to see if we need to first! - this.activateVao(geometry, program); - this._activeVao = vao; - // add it to the cache! - vaoObjectHash[program.id] = vao; - vaoObjectHash[signature] = vao; - return vao; - }; - /** - * Disposes buffer - * @param {PIXI.Buffer} buffer - buffer with data - * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray - */ - GeometrySystem.prototype.disposeBuffer = function (buffer, contextLost) { - if (!this.managedBuffers[buffer.id]) { - return; - } - delete this.managedBuffers[buffer.id]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; - var gl = this.gl; - buffer.disposeRunner.remove(this); - if (!glBuffer) { - return; - } - if (!contextLost) { - gl.deleteBuffer(glBuffer.buffer); - } - delete buffer._glBuffers[this.CONTEXT_UID]; - }; - /** - * Disposes geometry - * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed - * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray - */ - GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { - if (!this.managedGeometries[geometry.id]) { - return; - } - delete this.managedGeometries[geometry.id]; - var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var gl = this.gl; - var buffers = geometry.buffers; - geometry.disposeRunner.remove(this); - if (!vaos) { - return; - } - for (var i = 0; i < buffers.length; i++) { - var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; - buf.refCount--; - if (buf.refCount === 0 && !contextLost) { - this.disposeBuffer(buffers[i], contextLost); - } - } - if (!contextLost) { - for (var vaoId in vaos) { - // delete only signatures, everything else are copies - if (vaoId[0] === 'g') { - var vao = vaos[vaoId]; - if (this._activeVao === vao) { - this.unbind(); - } - gl.deleteVertexArray(vao); - } - } - } - delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; - }; - /** - * dispose all WebGL resources of all managed geometries and buffers - * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls - */ - GeometrySystem.prototype.disposeAll = function (contextLost) { - var all = Object.keys(this.managedGeometries); - for (var i = 0; i < all.length; i++) { - this.disposeGeometry(this.managedGeometries[all[i]], contextLost); - } - all = Object.keys(this.managedBuffers); - for (var i = 0; i < all.length; i++) { - this.disposeBuffer(this.managedBuffers[all[i]], contextLost); - } - }; - /** - * Activate vertex array object - * - * @protected - * @param {PIXI.Geometry} geometry - Geometry instance - * @param {PIXI.Program} program - Shader program instance - */ - GeometrySystem.prototype.activateVao = function (geometry, program) { - var gl = this.gl; - var CONTEXT_UID = this.CONTEXT_UID; - var buffers = geometry.buffers; - var attributes = geometry.attributes; - if (geometry.indexBuffer) { - // first update the index buffer if we have one.. - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer); - } - var lastBuffer = null; - // add a new one! - for (var j in attributes) { - var attribute = attributes[j]; - var buffer = buffers[attribute.buffer]; - var glBuffer = buffer._glBuffers[CONTEXT_UID]; - if (program.attributeData[j]) { - if (lastBuffer !== glBuffer) { - gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer); - lastBuffer = glBuffer; - } - var location = program.attributeData[j].location; - // TODO introduce state again - // we can optimise this for older devices that have no VAOs - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); - if (attribute.instance) { - // TODO calculate instance count based of this... - if (this.hasInstance) { - gl.vertexAttribDivisor(location, 1); - } - else { - throw new Error('geometry error, GPU Instancing is not supported on this device'); - } - } - } - } - }; - /** - * Draw the geometry - * - * @param {Number} type - the type primitive to render - * @param {Number} [size] - the number of elements to be rendered - * @param {Number} [start] - Starting index - * @param {Number} [instanceCount] - the number of instances of the set of elements to execute - */ - GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { - var gl = this.gl; - var geometry = this._activeGeometry; - // TODO.. this should not change so maybe cache the function? - if (geometry.indexBuffer) { - var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; - var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; - if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { - if (geometry.instanced) { - /* eslint-disable max-len */ - gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); - /* eslint-enable max-len */ - } - else { - /* eslint-disable max-len */ - gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); - /* eslint-enable max-len */ - } - } - else { - console.warn('unsupported index buffer type: uint32'); - } - } - else if (geometry.instanced) { - // TODO need a better way to calculate size.. - gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); - } - else { - gl.drawArrays(type, start, size || geometry.getSize()); - } - return this; - }; - /** - * Unbind/reset everything - * @protected - */ - GeometrySystem.prototype.unbind = function () { - this.gl.bindVertexArray(null); - this._activeVao = null; - this._activeGeometry = null; - }; - return GeometrySystem; - }(System)); - - /** - * Component for masked elements - * - * Holds mask mode and temporary data about current mask - * - * @class - * @memberof PIXI - */ - var MaskData = /** @class */ (function () { - /** - * Create MaskData - * - * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask - */ - function MaskData(maskObject) { - if (maskObject === void 0) { maskObject = null; } - /** - * Mask type - * @member {PIXI.MASK_TYPES} - */ - this.type = exports.MASK_TYPES.NONE; - /** - * Whether we know the mask type beforehand - * @member {boolean} - * @default true - */ - this.autoDetect = true; - /** - * Which element we use to mask - * @member {PIXI.DisplayObject} - */ - this.maskObject = maskObject || null; - /** - * Whether it belongs to MaskSystem pool - * @member {boolean} - */ - this.pooled = false; - /** - * Indicator of the type - * @member {boolean} - */ - this.isMaskData = true; - /** - * Stencil counter above the mask in stack - * @member {number} - * @private - */ - this._stencilCounter = 0; - /** - * Scissor counter above the mask in stack - * @member {number} - * @private - */ - this._scissorCounter = 0; - /** - * Scissor operation above the mask in stack. - * Null if _scissorCounter is zero, rectangle instance if positive. - * @member {PIXI.Rectangle} - */ - this._scissorRect = null; - /** - * Targeted element. Temporary variable set by MaskSystem - * @member {PIXI.DisplayObject} - * @private - */ - this._target = null; - } - /** - * resets the mask data after popMask() - */ - MaskData.prototype.reset = function () { - if (this.pooled) { - this.maskObject = null; - this.type = exports.MASK_TYPES.NONE; - this.autoDetect = true; - } - this._target = null; - }; - /** - * copies counters from maskData above, called from pushMask() - * @param {PIXI.MaskData|null} maskAbove - */ - MaskData.prototype.copyCountersOrReset = function (maskAbove) { - if (maskAbove) { - this._stencilCounter = maskAbove._stencilCounter; - this._scissorCounter = maskAbove._scissorCounter; - this._scissorRect = maskAbove._scissorRect; - } - else { - this._stencilCounter = 0; - this._scissorCounter = 0; - this._scissorRect = null; - } - }; - return MaskData; - }()); - - /** - * @private - * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} - * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER - * @param src {string} The vertex shader source as an array of strings. - * @return {WebGLShader} the shader - */ - function compileShader(gl, type, src) { - var shader = gl.createShader(type); - gl.shaderSource(shader, src); - gl.compileShader(shader); - return shader; - } - /** - * @method compileProgram - * @private - * @memberof PIXI.shader - * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} - * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. - * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. - * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations - * @return {WebGLProgram} the shader program - */ - function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) { - var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc); - var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc); - var program = gl.createProgram(); - gl.attachShader(program, glVertShader); - gl.attachShader(program, glFragShader); - // optionally, set the attributes manually for the program rather than letting WebGL decide.. - if (attributeLocations) { - for (var i in attributeLocations) { - gl.bindAttribLocation(program, attributeLocations[i], i); - } - } - gl.linkProgram(program); - // if linking fails, then log and cleanup - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) { - console.warn(vertexSrc); - console.error(gl.getShaderInfoLog(glVertShader)); - } - if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) { - console.warn(fragmentSrc); - console.error(gl.getShaderInfoLog(glFragShader)); - } - console.error('Pixi.js Error: Could not initialize shader.'); - console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); - console.error('gl.getError()', gl.getError()); - // if there is a program info log, log it - if (gl.getProgramInfoLog(program) !== '') { - console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); - } - gl.deleteProgram(program); - program = null; - } - // clean up some shaders - gl.deleteShader(glVertShader); - gl.deleteShader(glFragShader); - return program; - } - - function booleanArray(size) { - var array = new Array(size); - for (var i = 0; i < array.length; i++) { - array[i] = false; - } - return array; - } - /** - * @method defaultValue - * @memberof PIXI.shader - * @param type {String} Type of value - * @param size {Number} - * @private - */ - function defaultValue(type, size) { - switch (type) { - case 'float': - return 0; - case 'vec2': - return new Float32Array(2 * size); - case 'vec3': - return new Float32Array(3 * size); - case 'vec4': - return new Float32Array(4 * size); - case 'int': - case 'sampler2D': - case 'sampler2DArray': - return 0; - case 'ivec2': - return new Int32Array(2 * size); - case 'ivec3': - return new Int32Array(3 * size); - case 'ivec4': - return new Int32Array(4 * size); - case 'bool': - return false; - case 'bvec2': - return booleanArray(2 * size); - case 'bvec3': - return booleanArray(3 * size); - case 'bvec4': - return booleanArray(4 * size); - case 'mat2': - return new Float32Array([1, 0, - 0, 1]); - case 'mat3': - return new Float32Array([1, 0, 0, - 0, 1, 0, - 0, 0, 1]); - case 'mat4': - return new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]); - } - return null; - } - - var unknownContext = {}; - var context = unknownContext; - /** - * returns a little WebGL context to use for program inspection. - * - * @static - * @private - * @returns {WebGLRenderingContext} a gl context to test with - */ - function getTestContext() { - if (context === unknownContext || (context && context.isContextLost())) { - var canvas = document.createElement('canvas'); - var gl = void 0; - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { - gl = canvas.getContext('webgl2', {}); - } - if (!gl) { - gl = canvas.getContext('webgl', {}) - || canvas.getContext('experimental-webgl', {}); - if (!gl) { - // fail, not able to get a context - gl = null; - } - else { - // for shader testing.. - gl.getExtension('WEBGL_draw_buffers'); - } - } - context = gl; - } - return context; - } - - var maxFragmentPrecision; - function getMaxFragmentPrecision() { - if (!maxFragmentPrecision) { - maxFragmentPrecision = exports.PRECISION.MEDIUM; - var gl = getTestContext(); - if (gl) { - if (gl.getShaderPrecisionFormat) { - var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); - maxFragmentPrecision = shaderFragment.precision ? exports.PRECISION.HIGH : exports.PRECISION.MEDIUM; - } - } - } - return maxFragmentPrecision; - } - - /** - * Sets the float precision on the shader, ensuring the device supports the request precision. - * If the precision is already present, it just ensures that the device is able to handle it. - * - * @private - * @param {string} src - The shader source - * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. - * @param {string} maxSupportedPrecision - The maximum precision the shader supports. - * - * @return {string} modified shader source - */ - function setPrecision(src, requestedPrecision, maxSupportedPrecision) { - if (src.substring(0, 9) !== 'precision') { - // no precision supplied, so PixiJS will add the requested level. - var precision = requestedPrecision; - // If highp is requested but not supported, downgrade precision to a level all devices support. - if (requestedPrecision === exports.PRECISION.HIGH && maxSupportedPrecision !== exports.PRECISION.HIGH) { - precision = exports.PRECISION.MEDIUM; - } - return "precision " + precision + " float;\n" + src; - } - else if (maxSupportedPrecision !== exports.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { - // precision was supplied, but at a level this device does not support, so downgrading to mediump. - return src.replace('precision highp', 'precision mediump'); - } - return src; - } - - var GLSL_TO_SIZE = { - float: 1, - vec2: 2, - vec3: 3, - vec4: 4, - int: 1, - ivec2: 2, - ivec3: 3, - ivec4: 4, - bool: 1, - bvec2: 2, - bvec3: 3, - bvec4: 4, - mat2: 4, - mat3: 9, - mat4: 16, - sampler2D: 1, - }; - /** - * @private - * @method mapSize - * @memberof PIXI.shader - * @param type {String} - * @return {Number} - */ - function mapSize(type) { - return GLSL_TO_SIZE[type]; - } - - var GL_TABLE = null; - var GL_TO_GLSL_TYPES = { - FLOAT: 'float', - FLOAT_VEC2: 'vec2', - FLOAT_VEC3: 'vec3', - FLOAT_VEC4: 'vec4', - INT: 'int', - INT_VEC2: 'ivec2', - INT_VEC3: 'ivec3', - INT_VEC4: 'ivec4', - BOOL: 'bool', - BOOL_VEC2: 'bvec2', - BOOL_VEC3: 'bvec3', - BOOL_VEC4: 'bvec4', - FLOAT_MAT2: 'mat2', - FLOAT_MAT3: 'mat3', - FLOAT_MAT4: 'mat4', - SAMPLER_2D: 'sampler2D', - INT_SAMPLER_2D: 'sampler2D', - UNSIGNED_INT_SAMPLER_2D: 'sampler2D', - SAMPLER_CUBE: 'samplerCube', - INT_SAMPLER_CUBE: 'samplerCube', - UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', - SAMPLER_2D_ARRAY: 'sampler2DArray', - INT_SAMPLER_2D_ARRAY: 'sampler2DArray', - UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', - }; - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function mapType(gl, type) { - if (!GL_TABLE) { - var typeNames = Object.keys(GL_TO_GLSL_TYPES); - GL_TABLE = {}; - for (var i = 0; i < typeNames.length; ++i) { - var tn = typeNames[i]; - GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; - } - } - return GL_TABLE[type]; - } - - /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - // Parsers, each one of these will take a look at the type of shader property and uniform. - // if they pass the test function then the code function is called that returns a the shader upload code for that uniform. - // Shader upload code is automagically generated with these parsers. - // If no parser is valid then the default upload functions are used. - // exposing Parsers means that custom upload logic can be added to pixi's shaders. - // A good example would be a pixi rectangle can be directly set on a uniform. - // If the shader sees it it knows how to upload the rectangle structure as a vec4 - // format is as follows: - // - // { - // test: (data, uniform) => {} <--- test is this code should be used for this uniform - // code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform - // } - var uniformParsers = [ - // a float cache layer - { - test: function (data) { - return data.type === 'float' && data.size === 1; - }, - code: function (name) { - return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; - }, - }, - // handling samplers - { - test: function (data) { - // eslint-disable-next-line max-len - return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray; - }, - code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, - }, - // uploading pixi matrix object to mat3 - { - test: function (data, uniform) { - return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined; - }, - code: function (name) { - // TODO and some smart caching dirty ids here! - return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; - }, - }, - // uploading a pixi point as a vec2 with caching layer - { - test: function (data, uniform) { - return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; - }, - }, - // caching layer for a vec2 - { - test: function (data) { - return data.type === 'vec2' && data.size === 1; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; - }, - }, - // upload a pixi rectangle as a vec4 with caching layer - { - test: function (data, uniform) { - return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; - }, - }, - // a caching layer for vec4 uploading - { - test: function (data) { - return data.type === 'vec4' && data.size === 1; - }, - code: function (name) { - return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; - }, - } ]; - - // cv = CachedValue - // v = value - // ud = uniformData - // uv = uniformValue - // l = location - var GLSL_TO_SINGLE_SETTERS_CACHED = { - float: "\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }", - vec2: "\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }", - vec3: "\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", - vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])', - int: 'gl.uniform1i(location, v)', - ivec2: 'gl.uniform2i(location, v[0], v[1])', - ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - bool: 'gl.uniform1i(location, v)', - bvec2: 'gl.uniform2i(location, v[0], v[1])', - bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - mat2: 'gl.uniformMatrix2fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat4: 'gl.uniformMatrix4fv(location, false, v)', - sampler2D: 'gl.uniform1i(location, v)', - samplerCube: 'gl.uniform1i(location, v)', - sampler2DArray: 'gl.uniform1i(location, v)', - }; - var GLSL_TO_ARRAY_SETTERS = { - float: "gl.uniform1fv(location, v)", - vec2: "gl.uniform2fv(location, v)", - vec3: "gl.uniform3fv(location, v)", - vec4: 'gl.uniform4fv(location, v)', - mat4: 'gl.uniformMatrix4fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat2: 'gl.uniformMatrix2fv(location, false, v)', - int: 'gl.uniform1iv(location, v)', - ivec2: 'gl.uniform2iv(location, v)', - ivec3: 'gl.uniform3iv(location, v)', - ivec4: 'gl.uniform4iv(location, v)', - bool: 'gl.uniform1iv(location, v)', - bvec2: 'gl.uniform2iv(location, v)', - bvec3: 'gl.uniform3iv(location, v)', - bvec4: 'gl.uniform4iv(location, v)', - sampler2D: 'gl.uniform1iv(location, v)', - samplerCube: 'gl.uniform1iv(location, v)', - sampler2DArray: 'gl.uniform1iv(location, v)', - }; - function generateUniformsSync(group, uniformData) { - var funcFragments = ["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "]; - for (var i in group.uniforms) { - var data = uniformData[i]; - if (!data) { - if (group.uniforms[i].group) { - funcFragments.push("\n renderer.shader.syncUniformGroup(uv[\"" + i + "\"], syncData);\n "); - } - continue; - } - var uniform = group.uniforms[i]; - var parsed = false; - for (var j = 0; j < uniformParsers.length; j++) { - if (uniformParsers[j].test(data, uniform)) { - funcFragments.push(uniformParsers[j].code(i, uniform)); - parsed = true; - break; - } - } - if (!parsed) { - var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; - var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); - funcFragments.push("\n cv = ud[\"" + i + "\"].value;\n v = uv[\"" + i + "\"];\n " + template + ";"); - } - } - /** - * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly - * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used - * no matter which group is being used - * - */ - // eslint-disable-next-line no-new-func - return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); - } - - var fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}' ].join('\n'); - function generateIfTestSrc(maxIfs) { - var src = ''; - for (var i = 0; i < maxIfs; ++i) { - if (i > 0) { - src += '\nelse '; - } - if (i < maxIfs - 1) { - src += "if(test == " + i + ".0){}"; - } - } - return src; - } - function checkMaxIfStatementsInShader(maxIfs, gl) { - if (maxIfs === 0) { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - var shader = gl.createShader(gl.FRAGMENT_SHADER); - while (true) // eslint-disable-line no-constant-condition - { - var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { - maxIfs = (maxIfs / 2) | 0; - } - else { - // valid! - break; - } - } - return maxIfs; - } - - // Cache the result to prevent running this over and over - var unsafeEval; - /** - * Not all platforms allow to generate function code (e.g., `new Function`). - * this provides the platform-level detection. - * - * @private - * @returns {boolean} - */ - function unsafeEvalSupported() { - if (typeof unsafeEval === 'boolean') { - return unsafeEval; - } - try { - /* eslint-disable no-new-func */ - var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); - /* eslint-enable no-new-func */ - unsafeEval = func({ a: 'b' }, 'a', 'b') === true; - } - catch (e) { - unsafeEval = false; - } - return unsafeEval; - } - - var defaultFragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; - - var defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; - - var UID$3 = 0; - var nameCache = {}; - /** - * Helper class to create a shader program. - * - * @class - * @memberof PIXI - */ - var Program = /** @class */ (function () { - /** - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {string} [name] - Name for shader - */ - function Program(vertexSrc, fragmentSrc, name) { - if (name === void 0) { name = 'pixi-shader'; } - this.id = UID$3++; - /** - * The vertex shader. - * - * @member {string} - */ - this.vertexSrc = vertexSrc || Program.defaultVertexSrc; - /** - * The fragment shader. - * - * @member {string} - */ - this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; - this.vertexSrc = this.vertexSrc.trim(); - this.fragmentSrc = this.fragmentSrc.trim(); - if (this.vertexSrc.substring(0, 8) !== '#version') { - name = name.replace(/\s+/g, '-'); - if (nameCache[name]) { - nameCache[name]++; - name += "-" + nameCache[name]; - } - else { - nameCache[name] = 1; - } - this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; - this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; - this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, exports.PRECISION.HIGH); - this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); - } - // currently this does not extract structs only default types - this.extractData(this.vertexSrc, this.fragmentSrc); - // this is where we store shader references.. - this.glPrograms = {}; - this.syncUniforms = null; - } - /** - * Extracts the data for a buy creating a small test program - * or reading the src directly. - * @protected - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - */ - Program.prototype.extractData = function (vertexSrc, fragmentSrc) { - var gl = getTestContext(); - if (gl) { - var program = compileProgram(gl, vertexSrc, fragmentSrc); - this.attributeData = this.getAttributeData(program, gl); - this.uniformData = this.getUniformData(program, gl); - gl.deleteProgram(program); - } - else { - this.uniformData = {}; - this.attributeData = {}; - } - }; - /** - * returns the attribute data from the program - * @private - * - * @param {WebGLProgram} [program] - the WebGL program - * @param {WebGLRenderingContext} [gl] - the WebGL context - * - * @returns {object} the attribute data for this program - */ - Program.prototype.getAttributeData = function (program, gl) { - var attributes = {}; - var attributesArray = []; - var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (var i = 0; i < totalAttributes; i++) { - var attribData = gl.getActiveAttrib(program, i); - var type = mapType(gl, attribData.type); - /*eslint-disable */ - var data = { - type: type, - name: attribData.name, - size: mapSize(type), - location: 0, - }; - /* eslint-enable */ - attributes[attribData.name] = data; - attributesArray.push(data); - } - attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow - for (var i = 0; i < attributesArray.length; i++) { - attributesArray[i].location = i; - } - return attributes; - }; - /** - * returns the uniform data from the program - * @private - * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the WebGL context - * - * @returns {object} the uniform data for this program - */ - Program.prototype.getUniformData = function (program, gl) { - var uniforms = {}; - var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - // TODO expose this as a prop? - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - for (var i = 0; i < totalUniforms; i++) { - var uniformData = gl.getActiveUniform(program, i); - var name = uniformData.name.replace(/\[.*?\]$/, ''); - var isArray = uniformData.name.match(/\[.*?\]$/); - var type = mapType(gl, uniformData.type); - /*eslint-disable */ - uniforms[name] = { - type: type, - size: uniformData.size, - isArray: isArray, - value: defaultValue(type, uniformData.size), - }; - /* eslint-enable */ - } - return uniforms; - }; - Object.defineProperty(Program, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @constant - * @member {string} - */ - get: function () { - return defaultVertex; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Program, "defaultFragmentSrc", { - /** - * The default fragment shader source - * - * @static - * @constant - * @member {string} - */ - get: function () { - return defaultFragment; - }, - enumerable: false, - configurable: true - }); - /** - * A short hand function to create a program based of a vertex and fragment shader - * this method will also check to see if there is a cached program. - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {string} [name=pixi-shader] - Name for shader - * - * @returns {PIXI.Program} an shiny new Pixi shader! - */ - Program.from = function (vertexSrc, fragmentSrc, name) { - var key = vertexSrc + fragmentSrc; - var program = ProgramCache[key]; - if (!program) { - ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); - } - return program; - }; - return Program; - }()); - - /** - * A helper class for shaders - * - * @class - * @memberof PIXI - */ - var Shader = /** @class */ (function () { - /** - * @param {PIXI.Program} [program] - The program the shader will use. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - */ - function Shader(program, uniforms) { - /** - * Program that the shader uses - * - * @member {PIXI.Program} - */ - this.program = program; - // lets see whats been passed in - // uniforms should be converted to a uniform group - if (uniforms) { - if (uniforms instanceof UniformGroup) { - this.uniformGroup = uniforms; - } - else { - this.uniformGroup = new UniformGroup(uniforms); - } - } - else { - this.uniformGroup = new UniformGroup({}); - } - // time to build some getters and setters! - // I guess down the line this could sort of generate an instruction list rather than use dirty ids? - // does the trick for now though! - for (var i in program.uniformData) { - if (this.uniformGroup.uniforms[i] instanceof Array) { - this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]); - } - } - } - // TODO move to shader system.. - Shader.prototype.checkUniformExists = function (name, group) { - if (group.uniforms[name]) { - return true; - } - for (var i in group.uniforms) { - var uniform = group.uniforms[i]; - if (uniform.group) { - if (this.checkUniformExists(name, uniform)) { - return true; - } - } - } - return false; - }; - Shader.prototype.destroy = function () { - // usage count on programs? - // remove if not used! - this.uniformGroup = null; - }; - Object.defineProperty(Shader.prototype, "uniforms", { - /** - * Shader uniform values, shortcut for `uniformGroup.uniforms` - * @readonly - * @member {object} - */ - get: function () { - return this.uniformGroup.uniforms; - }, - enumerable: false, - configurable: true - }); - /** - * A short hand function to create a shader based of a vertex and fragment shader - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - * - * @returns {PIXI.Shader} an shiny new Pixi shader! - */ - Shader.from = function (vertexSrc, fragmentSrc, uniforms) { - var program = Program.from(vertexSrc, fragmentSrc); - return new Shader(program, uniforms); - }; - return Shader; - }()); - - /* eslint-disable max-len */ - var BLEND = 0; - var OFFSET = 1; - var CULLING = 2; - var DEPTH_TEST = 3; - var WINDING = 4; - /** - * This is a WebGL state, and is is passed The WebGL StateManager. - * - * Each mesh rendered may require WebGL to be in a different state. - * For example you may want different blend mode or to enable polygon offsets - * - * @class - * @memberof PIXI - */ - var State = /** @class */ (function () { - function State() { - this.data = 0; - this.blendMode = exports.BLEND_MODES.NORMAL; - this.polygonOffset = 0; - this.blend = true; - // this.depthTest = true; - } - Object.defineProperty(State.prototype, "blend", { - /** - * Activates blending of the computed fragment color values - * - * @member {boolean} - */ - get: function () { - return !!(this.data & (1 << BLEND)); - }, - set: function (value) { - if (!!(this.data & (1 << BLEND)) !== value) { - this.data ^= (1 << BLEND); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "offsets", { - /** - * Activates adding an offset to depth values of polygon's fragments - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << OFFSET)); - }, - set: function (value) { - if (!!(this.data & (1 << OFFSET)) !== value) { - this.data ^= (1 << OFFSET); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "culling", { - /** - * Activates culling of polygons. - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << CULLING)); - }, - set: function (value) { - if (!!(this.data & (1 << CULLING)) !== value) { - this.data ^= (1 << CULLING); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "depthTest", { - /** - * Activates depth comparisons and updates to the depth buffer. - * - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << DEPTH_TEST)); - }, - set: function (value) { - if (!!(this.data & (1 << DEPTH_TEST)) !== value) { - this.data ^= (1 << DEPTH_TEST); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "clockwiseFrontFace", { - /** - * Specifies whether or not front or back-facing polygons can be culled. - * @member {boolean} - * @default false - */ - get: function () { - return !!(this.data & (1 << WINDING)); - }, - set: function (value) { - if (!!(this.data & (1 << WINDING)) !== value) { - this.data ^= (1 << WINDING); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "blendMode", { - /** - * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * Setting this mode to anything other than NO_BLEND will automatically switch blending on. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - get: function () { - return this._blendMode; - }, - set: function (value) { - this.blend = (value !== exports.BLEND_MODES.NONE); - this._blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(State.prototype, "polygonOffset", { - /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. - * - * @member {number} - * @default 0 - */ - get: function () { - return this._polygonOffset; - }, - set: function (value) { - this.offsets = !!value; - this._polygonOffset = value; - }, - enumerable: false, - configurable: true - }); - State.for2d = function () { - var state = new State(); - state.depthTest = false; - state.blend = true; - return state; - }; - return State; - }()); - - var defaultVertex$1 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; - - var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; - - /** - * Filter is a special type of WebGL shader that is applied to the screen. - * - * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the - * {@link PIXI.filters.BlurFilter BlurFilter}. - * - * ### Usage - * Filters can be applied to any DisplayObject or Container. - * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, - * then filter renders it to the screen. - * Multiple filters can be added to the `filters` array property and stacked on each other. - * - * ``` - * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); - * const container = new PIXI.Container(); - * container.filters = [filter]; - * ``` - * - * ### Previous Version Differences - * - * In PixiJS **v3**, a filter was always applied to _whole screen_. - * - * In PixiJS **v4**, a filter can be applied _only part of the screen_. - * Developers had to create a set of uniforms to deal with coordinates. - * - * In PixiJS **v5** combines _both approaches_. - * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, - * bringing those extra uniforms into account. - * - * Also be aware that we have changed default vertex shader, please consult - * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. - * - * ### Built-in Uniforms - * - * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, - * and `projectionMatrix` uniform maps it to the gl viewport. - * - * **uSampler** - * - * The most important uniform is the input texture that container was rendered into. - * _Important note: as with all Framebuffers in PixiJS, both input and output are - * premultiplied by alpha._ - * - * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. - * Use it to sample the input. - * - * ``` - * const fragment = ` - * varying vec2 vTextureCoord; - * uniform sampler2D uSampler; - * void main(void) - * { - * gl_FragColor = texture2D(uSampler, vTextureCoord); - * } - * `; - * - * const myFilter = new PIXI.Filter(null, fragment); - * ``` - * - * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. - * - * **outputFrame** - * - * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. - * It's the same as `renderer.screen` for a fullscreen filter. - * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, - * `(0, 0, outputFrame.width, outputFrame.height)`, - * - * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. - * To calculate vertex position in screen space using normalized (0-1) space: - * - * ``` - * vec4 filterVertexPosition( void ) - * { - * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; - * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); - * } - * ``` - * - * **inputSize** - * - * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. - * The `inputSize.xy` are size of temporary framebuffer that holds input. - * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. - * - * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. - * - * To calculate input normalized coordinate, you have to map it to filter normalized space. - * Multiply by `outputFrame.zw` to get input coordinate. - * Divide by `inputSize.xy` to get input normalized coordinate. - * - * ``` - * vec2 filterTextureCoord( void ) - * { - * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy - * } - * ``` - * **resolution** - * - * The `resolution` is the ratio of screen (CSS) pixels to real pixels. - * - * **inputPixel** - * - * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` - * `inputPixel.zw` is inverted `inputPixel.xy`. - * - * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. - * - * **inputClamp** - * - * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. - * For displacements, coordinates has to be clamped. - * - * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer - * `inputClamp.zw` is bottom-right pixel center. - * - * ``` - * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw)) - * ``` - * OR - * ``` - * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) - * ``` - * - * ### Additional Information - * - * Complete documentation on Filter usage is located in the - * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. - * - * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded - * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. - * - * @class - * @memberof PIXI - * @extends PIXI.Shader - */ - var Filter = /** @class */ (function (_super) { - __extends$2(Filter, _super); - /** - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - */ - function Filter(vertexSrc, fragmentSrc, uniforms) { - var _this = this; - var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); - _this = _super.call(this, program, uniforms) || this; - /** - * The padding of the filter. Some filters require extra space to breath such as a blur. - * Increasing this will add extra width and height to the bounds of the object that the - * filter is applied to. - * - * @member {number} - */ - _this.padding = 0; - /** - * The resolution of the filter. Setting this to be lower will lower the quality but - * increase the performance of the filter. - * - * @member {number} - */ - _this.resolution = settings.FILTER_RESOLUTION; - /** - * If enabled is true the filter is applied, if false it will not. - * - * @member {boolean} - */ - _this.enabled = true; - /** - * If enabled, PixiJS will fit the filter area into boundaries for better performance. - * Switch it off if it does not work for specific shader. - * - * @member {boolean} - */ - _this.autoFit = true; - /** - * Legacy filters use position and uvs from attributes - * @member {boolean} - * @readonly - */ - _this.legacy = !!_this.program.attributeData.aTextureCoord; - /** - * The WebGL state the filter requires to render - * @member {PIXI.State} - */ - _this.state = new State(); - return _this; - } - /** - * Applies the filter - * - * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. - * @param {object} [currentState] - It's current state of filter. - * There are some useful properties in the currentState : - * target, filters, sourceFrame, destinationFrame, renderTarget, resolution - */ - Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { - // do as you please! - filterManager.applyFilter(this, input, output, clearMode); - // or just do a regular render.. - }; - Object.defineProperty(Filter.prototype, "blendMode", { - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - get: function () { - return this.state.blendMode; - }, - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Filter, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultVertex$1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Filter, "defaultFragmentSrc", { - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultFragment$1; - }, - enumerable: false, - configurable: true - }); - return Filter; - }(Shader)); - - var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; - - var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; - - var tempMat = new Matrix(); - /** - * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * - * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. - * - * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. - * If you want to add support for texture region of certain feature or filter, that's what you're looking for. - * - * Takes track of Texture changes through `_lastTextureID` private field. - * Use `update()` method call to track it from outside. - * - * @see PIXI.Texture - * @see PIXI.Mesh - * @see PIXI.TilingSprite - * @class - * @memberof PIXI - */ - var TextureMatrix = /** @class */ (function () { - /** - * - * @param {PIXI.Texture} texture - observed texture - * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. - * @constructor - */ - function TextureMatrix(texture, clampMargin) { - this._texture = texture; - /** - * Matrix operation that converts texture region coords to texture coords - * @member {PIXI.Matrix} - * @readonly - */ - this.mapCoord = new Matrix(); - /** - * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampFrame = new Float32Array(4); - /** - * Normalized clamp offset. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampOffset = new Float32Array(2); - /** - * Tracks Texture frame changes - * @member {number} - * @protected - */ - this._textureID = -1; - /** - * Tracks Texture frame changes - * @member {number} - * @protected - */ - this._updateID = 0; - /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders - * - * @default 0 - * @member {number} - */ - this.clampOffset = 0; - /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} - */ - this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; - /** - * If texture size is the same as baseTexture - * @member {boolean} - * @default false - * @readonly - */ - this.isSimple = false; - } - Object.defineProperty(TextureMatrix.prototype, "texture", { - /** - * texture property - * @member {PIXI.Texture} - */ - get: function () { - return this._texture; - }, - set: function (value) { - this._texture = value; - this._textureID = -1; - }, - enumerable: false, - configurable: true - }); - /** - * Multiplies uvs array to transform - * @param {Float32Array} uvs - mesh uvs - * @param {Float32Array} [out=uvs] output - * @returns {Float32Array} output - */ - TextureMatrix.prototype.multiplyUvs = function (uvs, out) { - if (out === undefined) { - out = uvs; - } - var mat = this.mapCoord; - for (var i = 0; i < uvs.length; i += 2) { - var x = uvs[i]; - var y = uvs[i + 1]; - out[i] = (x * mat.a) + (y * mat.c) + mat.tx; - out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; - } - return out; - }; - /** - * updates matrices if texture was changed - * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case - * @returns {boolean} whether or not it was updated - */ - TextureMatrix.prototype.update = function (forceUpdate) { - var tex = this._texture; - if (!tex || !tex.valid) { - return false; - } - if (!forceUpdate - && this._textureID === tex._updateID) { - return false; - } - this._textureID = tex._updateID; - this._updateID++; - var uvs = tex._uvs; - this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); - var orig = tex.orig; - var trim = tex.trim; - if (trim) { - tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); - this.mapCoord.append(tempMat); - } - var texBase = tex.baseTexture; - var frame = this.uClampFrame; - var margin = this.clampMargin / texBase.resolution; - var offset = this.clampOffset; - frame[0] = (tex._frame.x + margin + offset) / texBase.width; - frame[1] = (tex._frame.y + margin + offset) / texBase.height; - frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; - frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; - this.uClampOffset[0] = offset / texBase.realWidth; - this.uClampOffset[1] = offset / texBase.realHeight; - this.isSimple = tex._frame.width === texBase.width - && tex._frame.height === texBase.height - && tex.rotate === 0; - return true; - }; - return TextureMatrix; - }()); - - /** - * This handles a Sprite acting as a mask, as opposed to a Graphic. - * - * WebGL only. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI - */ - var SpriteMaskFilter = /** @class */ (function (_super) { - __extends$2(SpriteMaskFilter, _super); - /** - * @param {PIXI.Sprite} sprite - the target sprite - */ - function SpriteMaskFilter(sprite) { - var _this = this; - var maskMatrix = new Matrix(); - _this = _super.call(this, vertex, fragment) || this; - sprite.renderable = false; - /** - * Sprite mask - * @member {PIXI.Sprite} - */ - _this.maskSprite = sprite; - /** - * Mask matrix - * @member {PIXI.Matrix} - */ - _this.maskMatrix = maskMatrix; - return _this; - } - /** - * Applies the filter - * - * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from - * @param {PIXI.RenderTexture} input - The input render target. - * @param {PIXI.RenderTexture} output - The target to output to. - * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. - */ - SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { - var maskSprite = this.maskSprite; - var tex = maskSprite._texture; - if (!tex.valid) { - return; - } - if (!tex.uvMatrix) { - // margin = 0.0, let it bleed a bit, shader code becomes easier - // assuming that atlas textures were made with 1-pixel padding - tex.uvMatrix = new TextureMatrix(tex, 0.0); - } - tex.uvMatrix.update(); - this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; - this.uniforms.mask = tex; - // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` - this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) - .prepend(tex.uvMatrix.mapCoord); - this.uniforms.alpha = maskSprite.worldAlpha; - this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; - filterManager.applyFilter(this, input, output, clearMode); - }; - return SpriteMaskFilter; - }(Filter)); - - /** - * System plugin to the renderer to manage masks. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var MaskSystem = /** @class */ (function (_super) { - __extends$2(MaskSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function MaskSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Enable scissor - * @member {boolean} - * @readonly - */ - _this.enableScissor = false; - /** - * Pool of used sprite mask filters - * @member {PIXI.SpriteMaskFilter[]} - * @readonly - */ - _this.alphaMaskPool = []; - /** - * Pool of mask data - * @member {PIXI.MaskData[]} - * @readonly - */ - _this.maskDataPool = []; - _this.maskStack = []; - /** - * Current index of alpha mask pool - * @member {number} - * @default 0 - * @readonly - */ - _this.alphaMaskIndex = 0; - return _this; - } - /** - * Changes the mask stack that is used by this System. - * - * @param {PIXI.MaskData[]} maskStack - The mask stack - */ - MaskSystem.prototype.setMaskStack = function (maskStack) { - this.maskStack = maskStack; - this.renderer.scissor.setMaskStack(maskStack); - this.renderer.stencil.setMaskStack(maskStack); - }; - /** - * Applies the Mask and adds it to the current filter stack. - * Renderer batch must be flushed beforehand. - * - * @param {PIXI.DisplayObject} target - Display Object to push the mask to - * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data. - */ - MaskSystem.prototype.push = function (target, maskDataOrTarget) { - var maskData = maskDataOrTarget; - if (!maskData.isMaskData) { - var d = this.maskDataPool.pop() || new MaskData(); - d.pooled = true; - d.maskObject = maskDataOrTarget; - maskData = d; - } - if (maskData.autoDetect) { - this.detect(maskData); - } - maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]); - maskData._target = target; - switch (maskData.type) { - case exports.MASK_TYPES.SCISSOR: - this.maskStack.push(maskData); - this.renderer.scissor.push(maskData); - break; - case exports.MASK_TYPES.STENCIL: - this.maskStack.push(maskData); - this.renderer.stencil.push(maskData); - break; - case exports.MASK_TYPES.SPRITE: - maskData.copyCountersOrReset(null); - this.pushSpriteMask(maskData); - this.maskStack.push(maskData); - break; - default: - break; - } - }; - /** - * Removes the last mask from the mask stack and doesn't return it. - * Renderer batch must be flushed beforehand. - * - * @param {PIXI.DisplayObject} target - Display Object to pop the mask from - */ - MaskSystem.prototype.pop = function (target) { - var maskData = this.maskStack.pop(); - if (!maskData || maskData._target !== target) { - // TODO: add an assert when we have it - return; - } - switch (maskData.type) { - case exports.MASK_TYPES.SCISSOR: - this.renderer.scissor.pop(); - break; - case exports.MASK_TYPES.STENCIL: - this.renderer.stencil.pop(maskData.maskObject); - break; - case exports.MASK_TYPES.SPRITE: - this.popSpriteMask(); - break; - default: - break; - } - maskData.reset(); - if (maskData.pooled) { - this.maskDataPool.push(maskData); - } - }; - /** - * Sets type of MaskData based on its maskObject - * @param {PIXI.MaskData} maskData - */ - MaskSystem.prototype.detect = function (maskData) { - var maskObject = maskData.maskObject; - if (maskObject.isSprite) { - maskData.type = exports.MASK_TYPES.SPRITE; - return; - } - maskData.type = exports.MASK_TYPES.STENCIL; - // detect scissor in graphics - if (this.enableScissor - && maskObject.isFastRect - && maskObject.isFastRect()) { - var matrix = maskObject.worldTransform; - // TODO: move the check to the matrix itself - // we are checking that its orthogonal and x rotation is 0 90 180 or 270 - var rotX = Math.atan2(matrix.b, matrix.a); - var rotXY = Math.atan2(matrix.d, matrix.c); - // use the nearest degree to 0.01 - rotX = Math.round(rotX * (180 / Math.PI) * 100); - rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX; - rotX = ((rotX % 9000) + 9000) % 9000; - rotXY = ((rotXY % 18000) + 18000) % 18000; - if (rotX === 0 && rotXY === 9000) { - maskData.type = exports.MASK_TYPES.SCISSOR; - } - } - }; - /** - * Applies the Mask and adds it to the current filter stack. - * - * @param {PIXI.MaskData} maskData - Sprite to be used as the mask - */ - MaskSystem.prototype.pushSpriteMask = function (maskData) { - var maskObject = maskData.maskObject; - var target = maskData._target; - var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; - if (!alphaMaskFilter) { - alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)]; - } - alphaMaskFilter[0].resolution = this.renderer.resolution; - alphaMaskFilter[0].maskSprite = maskObject; - var stashFilterArea = target.filterArea; - target.filterArea = maskObject.getBounds(true); - this.renderer.filter.push(target, alphaMaskFilter); - target.filterArea = stashFilterArea; - this.alphaMaskIndex++; - }; - /** - * Removes the last filter from the filter stack and doesn't return it. - */ - MaskSystem.prototype.popSpriteMask = function () { - this.renderer.filter.pop(); - this.alphaMaskIndex--; - }; - return MaskSystem; - }(System)); - - /** - * System plugin to the renderer to manage masks of certain type - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var AbstractMaskSystem = /** @class */ (function (_super) { - __extends$2(AbstractMaskSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function AbstractMaskSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * The mask stack - * @member {PIXI.MaskData[]} - */ - _this.maskStack = []; - /** - * Constant for gl.enable - * @member {number} - * @private - */ - _this.glConst = 0; - return _this; - } - /** - * gets count of masks of certain type - * @returns {number} - */ - AbstractMaskSystem.prototype.getStackLength = function () { - return this.maskStack.length; - }; - /** - * Changes the mask stack that is used by this System. - * - * @param {PIXI.MaskData[]} maskStack - The mask stack - */ - AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { - var gl = this.renderer.gl; - var curStackLen = this.getStackLength(); - this.maskStack = maskStack; - var newStackLen = this.getStackLength(); - if (newStackLen !== curStackLen) { - if (newStackLen === 0) { - gl.disable(this.glConst); - } - else { - gl.enable(this.glConst); - this._useCurrent(); - } - } - }; - /** - * Setup renderer to use the current mask data. - * @private - */ - AbstractMaskSystem.prototype._useCurrent = function () { - // OVERWRITE; - }; - /** - * Destroys the mask stack. - * - */ - AbstractMaskSystem.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.maskStack = null; - }; - return AbstractMaskSystem; - }(System)); - - /** - * System plugin to the renderer to manage scissor rects (used for masks). - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ScissorSystem = /** @class */ (function (_super) { - __extends$2(ScissorSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ScissorSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.glConst = WebGLRenderingContext.SCISSOR_TEST; - return _this; - } - ScissorSystem.prototype.getStackLength = function () { - var maskData = this.maskStack[this.maskStack.length - 1]; - if (maskData) { - return maskData._scissorCounter; - } - return 0; - }; - /** - * Applies the Mask and adds it to the current stencil stack. @alvin - * - * @param {PIXI.MaskData} maskData - The mask data - */ - ScissorSystem.prototype.push = function (maskData) { - var maskObject = maskData.maskObject; - maskObject.renderable = true; - var prevData = maskData._scissorRect; - var bounds = maskObject.getBounds(true); - var gl = this.renderer.gl; - maskObject.renderable = false; - if (prevData) { - bounds.fit(prevData); - } - else { - gl.enable(gl.SCISSOR_TEST); - } - maskData._scissorCounter++; - maskData._scissorRect = bounds; - this._useCurrent(); - }; - /** - * Pops scissor mask. MaskData is already removed from stack - */ - ScissorSystem.prototype.pop = function () { - var gl = this.renderer.gl; - if (this.getStackLength() > 0) { - this._useCurrent(); - } - else { - gl.disable(gl.SCISSOR_TEST); - } - }; - /** - * Setup renderer to use the current scissor data. - * @private - */ - ScissorSystem.prototype._useCurrent = function () { - var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; - var rt = this.renderer.renderTexture.current; - var _a = this.renderer.projection, transform = _a.transform, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var resolution = rt ? rt.resolution : this.renderer.resolution; - var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x; - var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y; - var width = rect.width * resolution; - var height = rect.height * resolution; - if (transform) { - x += transform.tx * resolution; - y += transform.ty * resolution; - } - if (!rt) { - // flipY. In future we'll have it over renderTextures as an option - y = this.renderer.height - height - y; - } - this.renderer.gl.scissor(x, y, width, height); - }; - return ScissorSystem; - }(AbstractMaskSystem)); - - /** - * System plugin to the renderer to manage stencils (used for masks). - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var StencilSystem = /** @class */ (function (_super) { - __extends$2(StencilSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function StencilSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.glConst = WebGLRenderingContext.STENCIL_TEST; - return _this; - } - StencilSystem.prototype.getStackLength = function () { - var maskData = this.maskStack[this.maskStack.length - 1]; - if (maskData) { - return maskData._stencilCounter; - } - return 0; - }; - /** - * Applies the Mask and adds it to the current stencil stack. - * - * @param {PIXI.MaskData} maskData - The mask data - */ - StencilSystem.prototype.push = function (maskData) { - var maskObject = maskData.maskObject; - var gl = this.renderer.gl; - var prevMaskCount = maskData._stencilCounter; - if (prevMaskCount === 0) { - // force use stencil texture in current framebuffer - this.renderer.framebuffer.forceStencil(); - gl.enable(gl.STENCIL_TEST); - } - maskData._stencilCounter++; - // Increment the reference stencil value where the new mask overlaps with the old ones. - gl.colorMask(false, false, false, false); - gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask()); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); - maskObject.renderable = true; - maskObject.render(this.renderer); - this.renderer.batch.flush(); - maskObject.renderable = false; - this._useCurrent(); - }; - /** - * Pops stencil mask. MaskData is already removed from stack - * - * @param {PIXI.DisplayObject} maskObject - object of popped mask data - */ - StencilSystem.prototype.pop = function (maskObject) { - var gl = this.renderer.gl; - if (this.getStackLength() === 0) { - // the stack is empty! - gl.disable(gl.STENCIL_TEST); - gl.clear(gl.STENCIL_BUFFER_BIT); - gl.clearStencil(0); - } - else { - // Decrement the reference stencil value where the popped mask overlaps with the other ones - gl.colorMask(false, false, false, false); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); - maskObject.renderable = true; - maskObject.render(this.renderer); - this.renderer.batch.flush(); - maskObject.renderable = false; - this._useCurrent(); - } - }; - /** - * Setup renderer to use the current stencil data. - * @private - */ - StencilSystem.prototype._useCurrent = function () { - var gl = this.renderer.gl; - gl.colorMask(true, true, true, true); - gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask()); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - }; - /** - * Fill 1s equal to the number of acitve stencil masks. - * @private - * @return {number} The bitwise mask. - */ - StencilSystem.prototype._getBitwiseMask = function () { - return (1 << this.getStackLength()) - 1; - }; - return StencilSystem; - }(AbstractMaskSystem)); - - /** - * System plugin to the renderer to manage the projection matrix. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var ProjectionSystem = /** @class */ (function (_super) { - __extends$2(ProjectionSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ProjectionSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.destinationFrame = null; - /** - * Source frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.sourceFrame = null; - /** - * Default destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.defaultFrame = null; - /** - * Project matrix - * @member {PIXI.Matrix} - * @readonly - */ - _this.projectionMatrix = new Matrix(); - /** - * A transform that will be appended to the projection matrix - * if null, nothing will be applied - * @member {PIXI.Matrix} - */ - _this.transform = null; - return _this; - } - /** - * Updates the projection matrix based on a projection frame (which is a rectangle). - * - * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this. - * - * @param {PIXI.Rectangle} destinationFrame - The destination frame. - * @param {PIXI.Rectangle} sourceFrame - The source frame. - * @param {Number} resolution - Resolution - * @param {boolean} root - If is root - */ - ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { - this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; - this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; - // Calculate object-space to clip-space projection - this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); - if (this.transform) { - this.projectionMatrix.append(this.transform); - } - var renderer = this.renderer; - renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; - renderer.globalUniforms.update(); - // this will work for now - // but would be sweet to stick and even on the global uniforms.. - if (renderer.shader.shader) { - renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); - } - }; - /** - * Updates the projection matrix based on a projection frame (which is a rectangle) - * - * @param {PIXI.Rectangle} destinationFrame - The destination frame. - * @param {PIXI.Rectangle} sourceFrame - The source frame. - * @param {Number} resolution - Resolution - * @param {boolean} root - If is root - */ - ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { - var pm = this.projectionMatrix; - var sign = !root ? 1 : -1; - pm.identity(); - pm.a = (1 / sourceFrame.width * 2); - pm.d = sign * (1 / sourceFrame.height * 2); - pm.tx = -1 - (sourceFrame.x * pm.a); - pm.ty = -sign - (sourceFrame.y * pm.d); - }; - /** - * Sets the transform of the active render target to the given matrix - * - * @param {PIXI.Matrix} matrix - The transformation matrix - */ - ProjectionSystem.prototype.setTransform = function (_matrix) { - // this._activeRenderTarget.transform = matrix; - }; - return ProjectionSystem; - }(System)); - - // Temporary rectangle for assigned sourceFrame or destinationFrame - var tempRect = new Rectangle(); - // Temporary rectangle for renderTexture destinationFrame - var tempRect2 = new Rectangle(); - // Temporary rectangle for passing the framebuffer viewport - var viewportFrame = new Rectangle(); - /** - * System plugin to the renderer to manage render textures. - * - * Should be added after FramebufferSystem - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var RenderTextureSystem = /** @class */ (function (_super) { - __extends$2(RenderTextureSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function RenderTextureSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * The clear background color as rgba - * @member {number[]} - */ - _this.clearColor = renderer._backgroundColorRgba; - // TODO move this property somewhere else! - /** - * List of masks for the StencilSystem - * @member {PIXI.Graphics[]} - * @readonly - */ - _this.defaultMaskStack = []; - // empty render texture? - /** - * Render texture - * @member {PIXI.RenderTexture} - * @readonly - */ - _this.current = null; - /** - * Source frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.sourceFrame = new Rectangle(); - /** - * Destination frame - * @member {PIXI.Rectangle} - * @readonly - */ - _this.destinationFrame = new Rectangle(); - return _this; - } - /** - * Bind the current render texture - * - * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen - * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture - * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame - */ - RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { - if (renderTexture === void 0) { renderTexture = null; } - var renderer = this.renderer; - this.current = renderTexture; - var baseTexture; - var framebuffer; - var resolution; - if (renderTexture) { - baseTexture = renderTexture.baseTexture; - resolution = baseTexture.resolution; - if (!sourceFrame) { - tempRect.width = renderTexture.frame.width; - tempRect.height = renderTexture.frame.height; - sourceFrame = tempRect; - } - if (!destinationFrame) { - tempRect2.x = renderTexture.frame.x; - tempRect2.y = renderTexture.frame.y; - tempRect2.width = sourceFrame.width; - tempRect2.height = sourceFrame.height; - destinationFrame = tempRect2; - } - framebuffer = baseTexture.framebuffer; - } - else { - resolution = renderer.resolution; - if (!sourceFrame) { - tempRect.width = renderer.screen.width; - tempRect.height = renderer.screen.height; - sourceFrame = tempRect; - } - if (!destinationFrame) { - destinationFrame = tempRect; - destinationFrame.width = sourceFrame.width; - destinationFrame.height = sourceFrame.height; - } - } - viewportFrame.x = destinationFrame.x * resolution; - viewportFrame.y = destinationFrame.y * resolution; - viewportFrame.width = destinationFrame.width * resolution; - viewportFrame.height = destinationFrame.height * resolution; - this.renderer.framebuffer.bind(framebuffer, viewportFrame); - this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); - if (renderTexture) { - this.renderer.mask.setMaskStack(baseTexture.maskStack); - } - else { - this.renderer.mask.setMaskStack(this.defaultMaskStack); - } - this.sourceFrame.copyFrom(sourceFrame); - this.destinationFrame.copyFrom(destinationFrame); - }; - /** - * Erases the render texture and fills the drawing area with a colour - * - * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor - * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks - * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. - * @return {PIXI.Renderer} Returns itself. - */ - RenderTextureSystem.prototype.clear = function (clearColor, mask) { - if (this.current) { - clearColor = clearColor || this.current.baseTexture.clearColor; - } - else { - clearColor = clearColor || this.clearColor; - } - this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); - }; - RenderTextureSystem.prototype.resize = function () { - // resize the root only! - this.bind(null); - }; - /** - * Resets renderTexture state - */ - RenderTextureSystem.prototype.reset = function () { - this.bind(null); - }; - return RenderTextureSystem; - }(System)); - - var IGLUniformData = /** @class */ (function () { - function IGLUniformData() { - } - return IGLUniformData; - }()); - /** - * Helper class to create a WebGL Program - * - * @class - * @memberof PIXI - */ - var GLProgram = /** @class */ (function () { - /** - * Makes a new Pixi program - * - * @param program {WebGLProgram} webgl program - * @param uniformData {Object} uniforms - */ - function GLProgram(program, uniformData) { - /** - * The shader program - * - * @member {WebGLProgram} - */ - this.program = program; - /** - * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing unneeded GPU commands - * @member {Object} - */ - this.uniformData = uniformData; - /** - * uniformGroups holds the various upload functions for the shader. Each uniform group - * and program have a unique upload function generated. - * @member {Object} - */ - this.uniformGroups = {}; - } - /** - * Destroys this program - */ - GLProgram.prototype.destroy = function () { - this.uniformData = null; - this.uniformGroups = null; - this.program = null; - }; - return GLProgram; - }()); - - var UID$4 = 0; - // defualt sync data so we don't create a new one each time! - var defaultSyncData = { textureCount: 0 }; - /** - * System plugin to the renderer to manage shaders. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var ShaderSystem = /** @class */ (function (_super) { - __extends$2(ShaderSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function ShaderSystem(renderer) { - var _this = _super.call(this, renderer) || this; - _this.destroyed = false; - // Validation check that this environment support `new Function` - _this.systemCheck(); - /** - * The current WebGL rendering context - * - * @member {WebGLRenderingContext} - */ - _this.gl = null; - _this.shader = null; - _this.program = null; - /** - * Cache to holds the generated functions. Stored against UniformObjects unique signature - * @type {Object} - * @private - */ - _this.cache = {}; - _this.id = UID$4++; - return _this; - } - /** - * Overrideable function by `@pixi/unsafe-eval` to silence - * throwing an error if platform doesn't support unsafe-evals. - * - * @private - */ - ShaderSystem.prototype.systemCheck = function () { - if (!unsafeEvalSupported()) { - throw new Error('Current environment does not allow unsafe-eval, ' - + 'please use @pixi/unsafe-eval module to enable support.'); - } - }; - ShaderSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.reset(); - }; - /** - * Changes the current shader to the one given in parameter - * - * @param {PIXI.Shader} shader - the new shader - * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms. - * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. - */ - ShaderSystem.prototype.bind = function (shader, dontSync) { - shader.uniforms.globals = this.renderer.globalUniforms; - var program = shader.program; - var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader); - this.shader = shader; - // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. - if (this.program !== program) { - this.program = program; - this.gl.useProgram(glProgram.program); - } - if (!dontSync) { - defaultSyncData.textureCount = 0; - this.syncUniformGroup(shader.uniformGroup, defaultSyncData); - } - return glProgram; - }; - /** - * Uploads the uniforms values to the currently bound shader. - * - * @param {object} uniforms - the uniforms values that be applied to the current shader - */ - ShaderSystem.prototype.setUniforms = function (uniforms) { - var shader = this.shader.program; - var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; - shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); - }; - /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - /** - * - * syncs uniforms on the group - * @param {*} group - the uniform group to sync - * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions - */ - ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { - var glProgram = this.getglProgram(); - if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) { - glProgram.uniformGroups[group.id] = group.dirtyId; - this.syncUniforms(group, glProgram, syncData); - } - }; - /** - * Overrideable by the @pixi/unsafe-eval package to use static - * syncUnforms instead. - * - * @private - */ - ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { - var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); - syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); - }; - /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ - ShaderSystem.prototype.createSyncGroups = function (group) { - var id = this.getSignature(group, this.shader.program.uniformData); - if (!this.cache[id]) { - this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); - } - group.syncUniforms[this.shader.program.id] = this.cache[id]; - return group.syncUniforms[this.shader.program.id]; - }; - /** - * Takes a uniform group and data and generates a unique signature for them. - * - * @param {PIXI.UniformGroup} group - the uniform group to get signature of - * @param {Object} uniformData - uniform information generated by the shader - * @returns {String} Unique signature of the uniform group - * @private - */ - ShaderSystem.prototype.getSignature = function (group, uniformData) { - var uniforms = group.uniforms; - var strings = []; - for (var i in uniforms) { - strings.push(i); - if (uniformData[i]) { - strings.push(uniformData[i].type); - } - } - return strings.join('-'); - }; - /** - * Returns the underlying GLShade rof the currently bound shader. - * This can be handy for when you to have a little more control over the setting of your uniforms. - * - * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context - */ - ShaderSystem.prototype.getglProgram = function () { - if (this.shader) { - return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; - } - return null; - }; - /** - * Generates a glProgram version of the Shader provided. - * - * @private - * @param {PIXI.Shader} shader - the shader that the glProgram will be based on. - * @return {PIXI.GLProgram} A shiny new glProgram! - */ - ShaderSystem.prototype.generateShader = function (shader) { - var gl = this.gl; - var program = shader.program; - var attribMap = {}; - for (var i in program.attributeData) { - attribMap[i] = program.attributeData[i].location; - } - var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap); - var uniformData = {}; - for (var i in program.uniformData) { - var data = program.uniformData[i]; - uniformData[i] = { - location: gl.getUniformLocation(shaderProgram, i), - value: defaultValue(data.type, data.size), - }; - } - var glProgram = new GLProgram(shaderProgram, uniformData); - program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; - return glProgram; - }; - /** - * Resets ShaderSystem state, does not affect WebGL state - */ - ShaderSystem.prototype.reset = function () { - this.program = null; - this.shader = null; - }; - /** - * Destroys this System and removes all its textures - */ - ShaderSystem.prototype.destroy = function () { - // TODO implement destroy method for ShaderSystem - this.destroyed = true; - }; - return ShaderSystem; - }(System)); - - /** - * Maps gl blend combinations to WebGL. - * - * @memberof PIXI - * @function mapWebGLBlendModesToPixi - * @private - * @param {WebGLRenderingContext} gl - The rendering context. - * @param {number[][]} [array=[]] - The array to output into. - * @return {number[][]} Mapped modes. - */ - function mapWebGLBlendModesToPixi(gl, array) { - if (array === void 0) { array = []; } - // TODO - premultiply alpha would be different. - // add a boolean for that! - array[exports.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; - array[exports.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.NONE] = [0, 0]; - // not-premultiplied blend modes - array[exports.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; - array[exports.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - // composite operations - array[exports.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; - array[exports.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; - array[exports.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; - array[exports.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; - array[exports.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; - array[exports.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; - array[exports.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; - // SUBTRACT from flash - array[exports.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; - return array; - } - - var BLEND$1 = 0; - var OFFSET$1 = 1; - var CULLING$1 = 2; - var DEPTH_TEST$1 = 3; - var WINDING$1 = 4; - /** - * System plugin to the renderer to manage WebGL state machines. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var StateSystem = /** @class */ (function (_super) { - __extends$2(StateSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function StateSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * GL context - * @member {WebGLRenderingContext} - * @readonly - */ - _this.gl = null; - /** - * State ID - * @member {number} - * @readonly - */ - _this.stateId = 0; - /** - * Polygon offset - * @member {number} - * @readonly - */ - _this.polygonOffset = 0; - /** - * Blend mode - * @member {number} - * @default PIXI.BLEND_MODES.NONE - * @readonly - */ - _this.blendMode = exports.BLEND_MODES.NONE; - /** - * Whether current blend equation is different - * @member {boolean} - * @protected - */ - _this._blendEq = false; - /** - * Collection of calls - * @member {function[]} - * @readonly - */ - _this.map = []; - // map functions for when we set state.. - _this.map[BLEND$1] = _this.setBlend; - _this.map[OFFSET$1] = _this.setOffset; - _this.map[CULLING$1] = _this.setCullFace; - _this.map[DEPTH_TEST$1] = _this.setDepthTest; - _this.map[WINDING$1] = _this.setFrontFace; - /** - * Collection of check calls - * @member {function[]} - * @readonly - */ - _this.checks = []; - /** - * Default WebGL State - * @member {PIXI.State} - * @readonly - */ - _this.defaultState = new State(); - _this.defaultState.blend = true; - return _this; - } - StateSystem.prototype.contextChange = function (gl) { - this.gl = gl; - this.blendModes = mapWebGLBlendModesToPixi(gl); - this.set(this.defaultState); - this.reset(); - }; - /** - * Sets the current state - * - * @param {*} state - The state to set. - */ - StateSystem.prototype.set = function (state) { - state = state || this.defaultState; - // TODO maybe to an object check? ( this.state === state )? - if (this.stateId !== state.data) { - var diff = this.stateId ^ state.data; - var i = 0; - // order from least to most common - while (diff) { - if (diff & 1) { - // state change! - this.map[i].call(this, !!(state.data & (1 << i))); - } - diff = diff >> 1; - i++; - } - this.stateId = state.data; - } - // based on the above settings we check for specific modes.. - // for example if blend is active we check and set the blend modes - // or of polygon offset is active we check the poly depth. - for (var i = 0; i < this.checks.length; i++) { - this.checks[i](this, state); - } - }; - /** - * Sets the state, when previous state is unknown - * - * @param {*} state - The state to set - */ - StateSystem.prototype.forceState = function (state) { - state = state || this.defaultState; - for (var i = 0; i < this.map.length; i++) { - this.map[i].call(this, !!(state.data & (1 << i))); - } - for (var i = 0; i < this.checks.length; i++) { - this.checks[i](this, state); - } - this.stateId = state.data; - }; - /** - * Enables or disabled blending. - * - * @param {boolean} value - Turn on or off webgl blending. - */ - StateSystem.prototype.setBlend = function (value) { - this.updateCheck(StateSystem.checkBlendMode, value); - this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); - }; - /** - * Enables or disable polygon offset fill - * - * @param {boolean} value - Turn on or off webgl polygon offset testing. - */ - StateSystem.prototype.setOffset = function (value) { - this.updateCheck(StateSystem.checkPolygonOffset, value); - this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); - }; - /** - * Sets whether to enable or disable depth test. - * - * @param {boolean} value - Turn on or off webgl depth testing. - */ - StateSystem.prototype.setDepthTest = function (value) { - this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); - }; - /** - * Sets whether to enable or disable cull face. - * - * @param {boolean} value - Turn on or off webgl cull face. - */ - StateSystem.prototype.setCullFace = function (value) { - this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); - }; - /** - * Sets the gl front face. - * - * @param {boolean} value - true is clockwise and false is counter-clockwise - */ - StateSystem.prototype.setFrontFace = function (value) { - this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); - }; - /** - * Sets the blend mode. - * - * @param {number} value - The blend mode to set to. - */ - StateSystem.prototype.setBlendMode = function (value) { - if (value === this.blendMode) { - return; - } - this.blendMode = value; - var mode = this.blendModes[value]; - var gl = this.gl; - if (mode.length === 2) { - gl.blendFunc(mode[0], mode[1]); - } - else { - gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); - } - if (mode.length === 6) { - this._blendEq = true; - gl.blendEquationSeparate(mode[4], mode[5]); - } - else if (this._blendEq) { - this._blendEq = false; - gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); - } - }; - /** - * Sets the polygon offset. - * - * @param {number} value - the polygon offset - * @param {number} scale - the polygon offset scale - */ - StateSystem.prototype.setPolygonOffset = function (value, scale) { - this.gl.polygonOffset(value, scale); - }; - // used - /** - * Resets all the logic and disables the vaos - */ - StateSystem.prototype.reset = function () { - this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); - this.forceState(this.defaultState); - this._blendEq = true; - this.blendMode = -1; - this.setBlendMode(0); - }; - /** - * checks to see which updates should be checked based on which settings have been activated. - * For example, if blend is enabled then we should check the blend modes each time the state is changed - * or if polygon fill is activated then we need to check if the polygon offset changes. - * The idea is that we only check what we have too. - * - * @param {Function} func - the checking function to add or remove - * @param {boolean} value - should the check function be added or removed. - */ - StateSystem.prototype.updateCheck = function (func, value) { - var index = this.checks.indexOf(func); - if (value && index === -1) { - this.checks.push(func); - } - else if (!value && index !== -1) { - this.checks.splice(index, 1); - } - }; - /** - * A private little wrapper function that we call to check the blend mode. - * - * @static - * @private - * @param {PIXI.StateSystem} System - the System to perform the state check on - * @param {PIXI.State} state - the state that the blendMode will pulled from - */ - StateSystem.checkBlendMode = function (system, state) { - system.setBlendMode(state.blendMode); - }; - /** - * A private little wrapper function that we call to check the polygon offset. - * - * @static - * @private - * @param {PIXI.StateSystem} System - the System to perform the state check on - * @param {PIXI.State} state - the state that the blendMode will pulled from - */ - StateSystem.checkPolygonOffset = function (system, state) { - system.setPolygonOffset(1, state.polygonOffset); - }; - return StateSystem; - }(System)); - - /** - * System plugin to the renderer to manage texture garbage collection on the GPU, - * ensuring that it does not get clogged up with textures that are no longer being used. - * - * @class - * @memberof PIXI.systems - * @extends PIXI.System - */ - var TextureGCSystem = /** @class */ (function (_super) { - __extends$2(TextureGCSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function TextureGCSystem(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * Count - * @member {number} - * @readonly - */ - _this.count = 0; - /** - * Check count - * @member {number} - * @readonly - */ - _this.checkCount = 0; - /** - * Maximum idle time, in seconds - * @member {number} - * @see PIXI.settings.GC_MAX_IDLE - */ - _this.maxIdle = settings.GC_MAX_IDLE; - /** - * Maximum number of item to check - * @member {number} - * @see PIXI.settings.GC_MAX_CHECK_COUNT - */ - _this.checkCountMax = settings.GC_MAX_CHECK_COUNT; - /** - * Current garabage collection mode - * @member {PIXI.GC_MODES} - * @see PIXI.settings.GC_MODE - */ - _this.mode = settings.GC_MODE; - return _this; - } - /** - * Checks to see when the last time a texture was used - * if the texture has not been used for a specified amount of time it will be removed from the GPU - */ - TextureGCSystem.prototype.postrender = function () { - if (!this.renderer.renderingToScreen) { - return; - } - this.count++; - if (this.mode === exports.GC_MODES.MANUAL) { - return; - } - this.checkCount++; - if (this.checkCount > this.checkCountMax) { - this.checkCount = 0; - this.run(); - } - }; - /** - * Checks to see when the last time a texture was used - * if the texture has not been used for a specified amount of time it will be removed from the GPU - */ - TextureGCSystem.prototype.run = function () { - var tm = this.renderer.texture; - var managedTextures = tm.managedTextures; - var wasRemoved = false; - for (var i = 0; i < managedTextures.length; i++) { - var texture = managedTextures[i]; - // only supports non generated textures at the moment! - if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { - tm.destroyTexture(texture, true); - managedTextures[i] = null; - wasRemoved = true; - } - } - if (wasRemoved) { - var j = 0; - for (var i = 0; i < managedTextures.length; i++) { - if (managedTextures[i] !== null) { - managedTextures[j++] = managedTextures[i]; - } - } - managedTextures.length = j; - } - }; - /** - * Removes all the textures within the specified displayObject and its children from the GPU - * - * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. - */ - TextureGCSystem.prototype.unload = function (displayObject) { - var tm = this.renderer.texture; - var texture = displayObject._texture; - // only destroy non generated textures - if (texture && !texture.framebuffer) { - tm.destroyTexture(texture); - } - for (var i = displayObject.children.length - 1; i >= 0; i--) { - this.unload(displayObject.children[i]); - } - }; - return TextureGCSystem; - }(System)); - - /** - * Internal texture for WebGL context - * @class - * @memberof PIXI - */ - var GLTexture = /** @class */ (function () { - function GLTexture(texture) { - /** - * The WebGL texture - * @member {WebGLTexture} - */ - this.texture = texture; - /** - * Width of texture that was used in texImage2D - * @member {number} - */ - this.width = -1; - /** - * Height of texture that was used in texImage2D - * @member {number} - */ - this.height = -1; - /** - * Texture contents dirty flag - * @member {number} - */ - this.dirtyId = -1; - /** - * Texture style dirty flag - * @member {number} - */ - this.dirtyStyleId = -1; - /** - * Whether mip levels has to be generated - * @member {boolean} - */ - this.mipmap = false; - /** - * WrapMode copied from baseTexture - * @member {number} - */ - this.wrapMode = 33071; - /** - * Type copied from baseTexture - * @member {number} - */ - this.type = 6408; - /** - * Type copied from baseTexture - * @member {number} - */ - this.internalFormat = 5121; - } - return GLTexture; - }()); - - /** - * System plugin to the renderer to manage textures. - * - * @class - * @extends PIXI.System - * @memberof PIXI.systems - */ - var TextureSystem = /** @class */ (function (_super) { - __extends$2(TextureSystem, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this System works for. - */ - function TextureSystem(renderer) { - var _this = _super.call(this, renderer) || this; - // TODO set to max textures... - /** - * Bound textures - * @member {PIXI.BaseTexture[]} - * @readonly - */ - _this.boundTextures = []; - /** - * Current location - * @member {number} - * @readonly - */ - _this.currentLocation = -1; - /** - * List of managed textures - * @member {PIXI.BaseTexture[]} - * @readonly - */ - _this.managedTextures = []; - /** - * Did someone temper with textures state? We'll overwrite them when we need to unbind something. - * @member {boolean} - * @private - */ - _this._unknownBoundTextures = false; - /** - * BaseTexture value that shows that we don't know what is bound - * @member {PIXI.BaseTexture} - * @readonly - */ - _this.unknownTexture = new BaseTexture(); - return _this; - } - /** - * Sets up the renderer context and necessary buffers. - */ - TextureSystem.prototype.contextChange = function () { - var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - this.webGLVersion = this.renderer.context.webGLVersion; - var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - this.boundTextures.length = maxTextures; - for (var i = 0; i < maxTextures; i++) { - this.boundTextures[i] = null; - } - // TODO move this.. to a nice make empty textures class.. - this.emptyTextures = {}; - var emptyTexture2D = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); - this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; - this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); - for (var i = 0; i < 6; i++) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); - } - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - for (var i = 0; i < this.boundTextures.length; i++) { - this.bind(null, i); - } - }; - /** - * Bind a texture to a specific location - * - * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` - * - * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind - * @param {number} [location=0] - Location to bind at - */ - TextureSystem.prototype.bind = function (texture, location) { - if (location === void 0) { location = 0; } - var gl = this.gl; - if (texture) { - texture = texture.castToBaseTexture(); - if (!texture || texture.parentTextureArray) { - // cannot bind partial texture - // TODO: report a warning - return; - } - if (texture.valid) { - texture.touched = this.renderer.textureGC.count; - var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); - if (this.boundTextures[location] !== texture) { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - gl.bindTexture(texture.target, glTexture.texture); - } - if (glTexture.dirtyId !== texture.dirtyId) { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - this.updateTexture(texture); - } - this.boundTextures[location] = texture; - } - } - else { - if (this.currentLocation !== location) { - this.currentLocation = location; - gl.activeTexture(gl.TEXTURE0 + location); - } - gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); - this.boundTextures[location] = null; - } - }; - /** - * Resets texture location and bound textures - * - * Actual `bind(null, i)` calls will be performed at next `unbind()` call - */ - TextureSystem.prototype.reset = function () { - this._unknownBoundTextures = true; - this.currentLocation = -1; - for (var i = 0; i < this.boundTextures.length; i++) { - this.boundTextures[i] = this.unknownTexture; - } - }; - /** - * Unbind a texture - * @param {PIXI.BaseTexture} texture - Texture to bind - */ - TextureSystem.prototype.unbind = function (texture) { - var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; - if (this._unknownBoundTextures) { - this._unknownBoundTextures = false; - // someone changed webGL state, - // we have to be sure that our texture does not appear in multi-texture renderer samplers - for (var i = 0; i < boundTextures.length; i++) { - if (boundTextures[i] === this.unknownTexture) { - this.bind(null, i); - } - } - } - for (var i = 0; i < boundTextures.length; i++) { - if (boundTextures[i] === texture) { - if (this.currentLocation !== i) { - gl.activeTexture(gl.TEXTURE0 + i); - this.currentLocation = i; - } - gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); - boundTextures[i] = null; - } - } - }; - /** - * Initialize a texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to initialize - */ - TextureSystem.prototype.initTexture = function (texture) { - var glTexture = new GLTexture(this.gl.createTexture()); - // guarantee an update.. - glTexture.dirtyId = -1; - texture._glTextures[this.CONTEXT_UID] = glTexture; - this.managedTextures.push(texture); - texture.on('dispose', this.destroyTexture, this); - return glTexture; - }; - TextureSystem.prototype.initTextureType = function (texture, glTexture) { - glTexture.internalFormat = texture.format; - glTexture.type = texture.type; - if (this.webGLVersion !== 2) { - return; - } - var gl = this.renderer.gl; - if (texture.type === gl.FLOAT - && texture.format === gl.RGBA) { - glTexture.internalFormat = gl.RGBA32F; - } - // that's WebGL1 HALF_FLOAT_OES - // we have to convert it to WebGL HALF_FLOAT - if (texture.type === exports.TYPES.HALF_FLOAT) { - glTexture.type = gl.HALF_FLOAT; - } - if (glTexture.type === gl.HALF_FLOAT - && texture.format === gl.RGBA) { - glTexture.internalFormat = gl.RGBA16F; - } - }; - /** - * Update a texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to initialize - */ - TextureSystem.prototype.updateTexture = function (texture) { - var glTexture = texture._glTextures[this.CONTEXT_UID]; - if (!glTexture) { - return; - } - var renderer = this.renderer; - this.initTextureType(texture, glTexture); - if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { ; } - else { - // default, renderTexture-like logic - var width = texture.realWidth; - var height = texture.realHeight; - var gl = renderer.gl; - if (glTexture.width !== width - || glTexture.height !== height - || glTexture.dirtyId < 0) { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); - } - } - // lets only update what changes.. - if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { - this.updateTextureStyle(texture); - } - glTexture.dirtyId = texture.dirtyId; - }; - /** - * Deletes the texture from WebGL - * - * @private - * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy - * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager. - */ - TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { - var gl = this.gl; - texture = texture.castToBaseTexture(); - if (texture._glTextures[this.CONTEXT_UID]) { - this.unbind(texture); - gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); - texture.off('dispose', this.destroyTexture, this); - delete texture._glTextures[this.CONTEXT_UID]; - if (!skipRemove) { - var i = this.managedTextures.indexOf(texture); - if (i !== -1) { - removeItems(this.managedTextures, i, 1); - } - } - } - }; - /** - * Update texture style such as mipmap flag - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to update - */ - TextureSystem.prototype.updateTextureStyle = function (texture) { - var glTexture = texture._glTextures[this.CONTEXT_UID]; - if (!glTexture) { - return; - } - if ((texture.mipmap === exports.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { - glTexture.mipmap = false; - } - else { - glTexture.mipmap = texture.mipmap >= 1; - } - if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { - glTexture.wrapMode = exports.WRAP_MODES.CLAMP; - } - else { - glTexture.wrapMode = texture.wrapMode; - } - if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) { ; } - else { - this.setStyle(texture, glTexture); - } - glTexture.dirtyStyleId = texture.dirtyStyleId; - }; - /** - * Set style for texture - * - * @private - * @param {PIXI.BaseTexture} texture - Texture to update - * @param {PIXI.GLTexture} glTexture - */ - TextureSystem.prototype.setStyle = function (texture, glTexture) { - var gl = this.gl; - if (glTexture.mipmap) { - gl.generateMipmap(texture.target); - } - gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); - gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); - if (glTexture.mipmap) { - /* eslint-disable max-len */ - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); - /* eslint-disable max-len */ - var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; - if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === exports.SCALE_MODES.LINEAR) { - var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); - gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); - } - } - else { - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); - } - gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); - }; - return TextureSystem; - }(System)); - - /** - * Systems are individual components to the Renderer pipeline. - * @namespace PIXI.systems - */ - - var systems = ({ - FilterSystem: FilterSystem, - BatchSystem: BatchSystem, - ContextSystem: ContextSystem, - FramebufferSystem: FramebufferSystem, - GeometrySystem: GeometrySystem, - MaskSystem: MaskSystem, - ScissorSystem: ScissorSystem, - StencilSystem: StencilSystem, - ProjectionSystem: ProjectionSystem, - RenderTextureSystem: RenderTextureSystem, - ShaderSystem: ShaderSystem, - StateSystem: StateSystem, - TextureGCSystem: TextureGCSystem, - TextureSystem: TextureSystem - }); - - var tempMatrix = new Matrix(); - /** - * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} - * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. - * - * @abstract - * @class - * @extends PIXI.utils.EventEmitter - * @memberof PIXI - */ - var AbstractRenderer = /** @class */ (function (_super) { - __extends$2(AbstractRenderer, _super); - /** - * @param {string} system - The name of the system this renderer is for. - * @param {object} [options] - The optional renderer parameters. - * @param {number} [options.width=800] - The width of the screen. - * @param {number} [options.height=600] - The height of the screen. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The - * resolution of the renderer retina would be 2. - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, - * enable this if you need to call toDataUrl on the WebGL context. - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - */ - function AbstractRenderer(type, options) { - if (type === void 0) { type = exports.RENDERER_TYPE.UNKNOWN; } - var _this = _super.call(this) || this; - // Add the default render options - options = Object.assign({}, settings.RENDER_OPTIONS, options); - // Deprecation notice for renderer roundPixels option - if (options.roundPixels) { - settings.ROUND_PIXELS = options.roundPixels; - deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2); - } - /** - * The supplied constructor options. - * - * @member {Object} - * @readOnly - */ - _this.options = options; - /** - * The type of the renderer. - * - * @member {number} - * @default PIXI.RENDERER_TYPE.UNKNOWN - * @see PIXI.RENDERER_TYPE - */ - _this.type = type; - /** - * Measurements of the screen. (0, 0, screenWidth, screenHeight). - * - * Its safe to use as filterArea or hitArea for the whole stage. - * - * @member {PIXI.Rectangle} - */ - _this.screen = new Rectangle(0, 0, options.width, options.height); - /** - * The canvas element that everything is drawn to. - * - * @member {HTMLCanvasElement} - */ - _this.view = options.view || document.createElement('canvas'); - /** - * The resolution / device pixel ratio of the renderer. - * - * @member {number} - * @default 1 - */ - _this.resolution = options.resolution || settings.RESOLUTION; - /** - * Whether the render view is transparent. - * - * @member {boolean} - */ - _this.transparent = options.transparent; - /** - * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. - * - * @member {boolean} - */ - _this.autoDensity = options.autoDensity || options.autoResize || false; - // autoResize is deprecated, provides fallback support - /** - * The value of the preserveDrawingBuffer flag affects whether or not the contents of - * the stencil buffer is retained after rendering. - * - * @member {boolean} - */ - _this.preserveDrawingBuffer = options.preserveDrawingBuffer; - /** - * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. - * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every - * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect - * to clear the canvas every frame. Disable this by setting this to false. For example, if - * your game has a canvas filling background image you often don't need this set. - * - * @member {boolean} - * @default - */ - _this.clearBeforeRender = options.clearBeforeRender; - /** - * The background color as a number. - * - * @member {number} - * @protected - */ - _this._backgroundColor = 0x000000; - /** - * The background color as an [R, G, B] array. - * - * @member {number[]} - * @protected - */ - _this._backgroundColorRgba = [0, 0, 0, 0]; - /** - * The background color as a string. - * - * @member {string} - * @protected - */ - _this._backgroundColorString = '#000000'; - _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter - /** - * The last root object that the renderer tried to render. - * - * @member {PIXI.DisplayObject} - * @protected - */ - _this._lastObjectRendered = null; - /** - * Collection of plugins. - * @readonly - * @member {object} - */ - _this.plugins = {}; - return _this; - } - /** - * Initialize the plugins. - * - * @protected - * @param {object} staticMap - The dictionary of statically saved plugins. - */ - AbstractRenderer.prototype.initPlugins = function (staticMap) { - for (var o in staticMap) { - this.plugins[o] = new (staticMap[o])(this); - } - }; - Object.defineProperty(AbstractRenderer.prototype, "width", { - /** - * Same as view.width, actual number of pixels in the canvas by horizontal. - * - * @member {number} - * @readonly - * @default 800 - */ - get: function () { - return this.view.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AbstractRenderer.prototype, "height", { - /** - * Same as view.height, actual number of pixels in the canvas by vertical. - * - * @member {number} - * @readonly - * @default 600 - */ - get: function () { - return this.view.height; - }, - enumerable: false, - configurable: true - }); - /** - * Resizes the screen and canvas to the specified width and height. - * Canvas dimensions are multiplied by resolution. - * - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - AbstractRenderer.prototype.resize = function (screenWidth, screenHeight) { - this.screen.width = screenWidth; - this.screen.height = screenHeight; - this.view.width = screenWidth * this.resolution; - this.view.height = screenHeight * this.resolution; - if (this.autoDensity) { - this.view.style.width = screenWidth + "px"; - this.view.style.height = screenHeight + "px"; - } - /** - * Fired after view has been resized. - * - * @event PIXI.Renderer#resize - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - this.emit('resize', screenWidth, screenHeight); - }; - /** - * Useful function that returns a texture of the display object that can then be used to create sprites - * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. - * - * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from. - * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture. - * @param {number} resolution - The resolution / device pixel ratio of the texture being generated. - * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, - * if no region is specified, defaults to the local bounds of the displayObject. - * @return {PIXI.RenderTexture} A texture of the graphics object. - */ - AbstractRenderer.prototype.generateTexture = function (displayObject, scaleMode, resolution, region) { - region = region || displayObject.getLocalBounds(null, true); - // minimum texture size is 1x1, 0x0 will throw an error - if (region.width === 0) - { region.width = 1; } - if (region.height === 0) - { region.height = 1; } - var renderTexture = RenderTexture.create({ - width: region.width | 0, - height: region.height | 0, - scaleMode: scaleMode, - resolution: resolution, - }); - tempMatrix.tx = -region.x; - tempMatrix.ty = -region.y; - this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent); - return renderTexture; - }; - /** - * Removes everything from the renderer and optionally removes the Canvas DOM element. - * - * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. - */ - AbstractRenderer.prototype.destroy = function (removeView) { - for (var o in this.plugins) { - this.plugins[o].destroy(); - this.plugins[o] = null; - } - if (removeView && this.view.parentNode) { - this.view.parentNode.removeChild(this.view); - } - var thisAny = this; - // null-ing all objects, that's a tradition! - thisAny.plugins = null; - thisAny.type = exports.RENDERER_TYPE.UNKNOWN; - thisAny.view = null; - thisAny.screen = null; - thisAny._tempDisplayObjectParent = null; - thisAny.options = null; - this._backgroundColorRgba = null; - this._backgroundColorString = null; - this._lastObjectRendered = null; - }; - Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { - /** - * The background color to fill if not transparent - * - * @member {number} - */ - get: function () { - return this._backgroundColor; - }, - set: function (value) { - this._backgroundColor = value; - this._backgroundColorString = hex2string(value); - hex2rgb(value, this._backgroundColorRgba); - }, - enumerable: false, - configurable: true - }); - return AbstractRenderer; - }(eventemitter3)); - - /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. - * - * This renderer should be used for browsers that support WebGL. - * - * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything! - * - * @class - * @memberof PIXI - * @extends PIXI.AbstractRenderer - */ - var Renderer = /** @class */ (function (_super) { - __extends$2(Renderer, _super); - /** - * @param {object} [options] - The optional renderer parameters. - * @param {number} [options.width=800] - The width of the screen. - * @param {number} [options.height=600] - The height of the screen. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA - * antialiasing is used. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. - * The resolution of the renderer retina would be 2. - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear - * the canvas or not before the new render pass. If you wish to set this to false, you *must* set - * preserveDrawingBuffer to `true`. - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, - * enable this if you need to call toDataUrl on the WebGL context. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" - * for devices with dual graphics card. - * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it. - * @public - */ - function Renderer(options) { - var _this = _super.call(this, exports.RENDERER_TYPE.WEBGL, options) || this; - // the options will have been modified here in the super constructor with pixi's default settings.. - options = _this.options; - /** - * WebGL context, set by the contextSystem (this.context) - * - * @readonly - * @member {WebGLRenderingContext} - */ - _this.gl = null; - _this.CONTEXT_UID = 0; - // TODO legacy! - /** - * Internal signal instances of **runner**, these - * are assigned to each system created. - * @see PIXI.Runner - * @name PIXI.Renderer#runners - * @private - * @type {object} - * @readonly - * @property {PIXI.Runner} destroy - Destroy runner - * @property {PIXI.Runner} contextChange - Context change runner - * @property {PIXI.Runner} reset - Reset runner - * @property {PIXI.Runner} update - Update runner - * @property {PIXI.Runner} postrender - Post-render runner - * @property {PIXI.Runner} prerender - Pre-render runner - * @property {PIXI.Runner} resize - Resize runner - */ - _this.runners = { - destroy: new Runner('destroy'), - contextChange: new Runner('contextChange'), - reset: new Runner('reset'), - update: new Runner('update'), - postrender: new Runner('postrender'), - prerender: new Runner('prerender'), - resize: new Runner('resize'), - }; - /** - * Global uniforms - * @member {PIXI.UniformGroup} - */ - _this.globalUniforms = new UniformGroup({ - projectionMatrix: new Matrix(), - }, true); - /** - * Mask system instance - * @member {PIXI.systems.MaskSystem} mask - * @memberof PIXI.Renderer# - * @readonly - */ - _this.addSystem(MaskSystem, 'mask') - /** - * Context system instance - * @member {PIXI.systems.ContextSystem} context - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ContextSystem, 'context') - /** - * State system instance - * @member {PIXI.systems.StateSystem} state - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(StateSystem, 'state') - /** - * Shader system instance - * @member {PIXI.systems.ShaderSystem} shader - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ShaderSystem, 'shader') - /** - * Texture system instance - * @member {PIXI.systems.TextureSystem} texture - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(TextureSystem, 'texture') - /** - * Geometry system instance - * @member {PIXI.systems.GeometrySystem} geometry - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(GeometrySystem, 'geometry') - /** - * Framebuffer system instance - * @member {PIXI.systems.FramebufferSystem} framebuffer - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(FramebufferSystem, 'framebuffer') - /** - * Scissor system instance - * @member {PIXI.systems.ScissorSystem} scissor - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ScissorSystem, 'scissor') - /** - * Stencil system instance - * @member {PIXI.systems.StencilSystem} stencil - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(StencilSystem, 'stencil') - /** - * Projection system instance - * @member {PIXI.systems.ProjectionSystem} projection - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(ProjectionSystem, 'projection') - /** - * Texture garbage collector system instance - * @member {PIXI.systems.TextureGCSystem} textureGC - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(TextureGCSystem, 'textureGC') - /** - * Filter system instance - * @member {PIXI.systems.FilterSystem} filter - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(FilterSystem, 'filter') - /** - * RenderTexture system instance - * @member {PIXI.systems.RenderTextureSystem} renderTexture - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(RenderTextureSystem, 'renderTexture') - /** - * Batch system instance - * @member {PIXI.systems.BatchSystem} batch - * @memberof PIXI.Renderer# - * @readonly - */ - .addSystem(BatchSystem, 'batch'); - _this.initPlugins(Renderer.__plugins); - /** - * The options passed in to create a new WebGL context. - */ - if (options.context) { - _this.context.initFromContext(options.context); - } - else { - _this.context.initFromOptions({ - alpha: !!_this.transparent, - antialias: options.antialias, - premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied', - stencil: true, - preserveDrawingBuffer: options.preserveDrawingBuffer, - powerPreference: _this.options.powerPreference, - }); - } - /** - * Flag if we are rendering to the screen vs renderTexture - * @member {boolean} - * @readonly - * @default true - */ - _this.renderingToScreen = true; - sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); - _this.resize(_this.options.width, _this.options.height); - return _this; - } - /** - * Create renderer if WebGL is available. Overrideable - * by the **@pixi/canvas-renderer** package to allow fallback. - * throws error if WebGL is not available. - * @static - * @private - */ - Renderer.create = function (options) { - if (isWebGLSupported()) { - return new Renderer(options); - } - throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); - }; - /** - * Add a new system to the renderer. - * @param {Function} ClassRef - Class reference - * @param {string} [name] - Property name for system, if not specified - * will use a static `name` property on the class itself. This - * name will be assigned as s property on the Renderer so make - * sure it doesn't collide with properties on Renderer. - * @return {PIXI.Renderer} Return instance of renderer - */ - Renderer.prototype.addSystem = function (ClassRef, name) { - if (!name) { - name = ClassRef.name; - } - var system = new ClassRef(this); - if (this[name]) { - throw new Error("Whoops! The name \"" + name + "\" is already in use"); - } - this[name] = system; - for (var i in this.runners) { - this.runners[i].add(system); - } - /** - * Fired after rendering finishes. - * - * @event PIXI.Renderer#postrender - */ - /** - * Fired before rendering starts. - * - * @event PIXI.Renderer#prerender - */ - /** - * Fired when the WebGL context is set. - * - * @event PIXI.Renderer#context - * @param {WebGLRenderingContext} gl - WebGL context. - */ - return this; - }; - /** - * Renders the object to its WebGL view - * - * @param {PIXI.DisplayObject} displayObject - The object to be rendered. - * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to. - * @param {boolean} [clear=true] - Should the canvas be cleared before the new render. - * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering. - * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass? - */ - Renderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { - // can be handy to know! - this.renderingToScreen = !renderTexture; - this.runners.prerender.emit(); - this.emit('prerender'); - // apply a transform at a GPU level - this.projection.transform = transform; - // no point rendering if our context has been blown up! - if (this.context.isLost) { - return; - } - if (!renderTexture) { - this._lastObjectRendered = displayObject; - } - if (!skipUpdateTransform) { - // update the scene graph - var cacheParent = displayObject.enableTempParent(); - displayObject.updateTransform(); - displayObject.disableTempParent(cacheParent); - // displayObject.hitArea = //TODO add a temp hit area - } - this.renderTexture.bind(renderTexture); - this.batch.currentRenderer.start(); - if (clear !== undefined ? clear : this.clearBeforeRender) { - this.renderTexture.clear(); - } - displayObject.render(this); - // apply transform.. - this.batch.currentRenderer.flush(); - if (renderTexture) { - renderTexture.baseTexture.update(); - } - this.runners.postrender.emit(); - // reset transform after render - this.projection.transform = null; - this.emit('postrender'); - }; - /** - * Resizes the WebGL view to the specified width and height. - * - * @param {number} screenWidth - The new width of the screen. - * @param {number} screenHeight - The new height of the screen. - */ - Renderer.prototype.resize = function (screenWidth, screenHeight) { - _super.prototype.resize.call(this, screenWidth, screenHeight); - this.runners.resize.emit(screenWidth, screenHeight); - }; - /** - * Resets the WebGL state so you can render things however you fancy! - * - * @return {PIXI.Renderer} Returns itself. - */ - Renderer.prototype.reset = function () { - this.runners.reset.emit(); - return this; - }; - /** - * Clear the frame buffer - */ - Renderer.prototype.clear = function () { - this.renderTexture.bind(); - this.renderTexture.clear(); - }; - /** - * Removes everything from the renderer (event listeners, spritebatch, etc...) - * - * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. - * See: https://github.com/pixijs/pixi.js/issues/2233 - */ - Renderer.prototype.destroy = function (removeView) { - this.runners.destroy.emit(); - for (var r in this.runners) { - this.runners[r].destroy(); - } - // call base destroy - _super.prototype.destroy.call(this, removeView); - // TODO nullify all the managers.. - this.gl = null; - }; - /** - * Adds a plugin to the renderer. - * - * @method - * @param {string} pluginName - The name of the plugin. - * @param {Function} ctor - The constructor function or class for the plugin. - */ - Renderer.registerPlugin = function (pluginName, ctor) { - Renderer.__plugins = Renderer.__plugins || {}; - Renderer.__plugins[pluginName] = ctor; - }; - return Renderer; - }(AbstractRenderer)); - - /** - * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by - * the browser then this function will return a canvas renderer - * - * @memberof PIXI - * @function autoDetectRenderer - * @param {object} [options] - The optional renderer parameters - * @param {number} [options.width=800] - the width of the renderers view - * @param {number} [options.height=600] - the height of the renderers view - * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional - * @param {boolean} [options.transparent=false] - If the render view is transparent, default false - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1 - * @param {boolean} [options.antialias=false] - sets antialias - * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you - * need to call toDataUrl on the webgl context - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2 - * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this - * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise - * it is ignored. - * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" - * for devices with dual graphics card **webgl only** - * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer - */ - function autoDetectRenderer(options) { - return Renderer.create(options); - } - - var _default = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; - - var defaultFilter = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; - - /** - * Used by the batcher to draw batches. - * Each one of these contains all information required to draw a bound geometry. - * - * @class - * @memberof PIXI - */ - var BatchDrawCall = /** @class */ (function () { - function BatchDrawCall() { - this.texArray = null; - this.blend = 0; - this.type = exports.DRAW_MODES.TRIANGLES; - this.start = 0; - this.size = 0; - /** - * data for uniforms or custom webgl state - * @member {object} - */ - this.data = null; - } - return BatchDrawCall; - }()); - - /** - * Used by the batcher to build texture batches. - * Holds list of textures and their respective locations. - * - * @class - * @memberof PIXI - */ - var BatchTextureArray = /** @class */ (function () { - function BatchTextureArray() { - /** - * inside textures array - * @member {PIXI.BaseTexture[]} - */ - this.elements = []; - /** - * Respective locations for textures - * @member {number[]} - */ - this.ids = []; - /** - * number of filled elements - * @member {number} - */ - this.count = 0; - } - BatchTextureArray.prototype.clear = function () { - for (var i = 0; i < this.count; i++) { - this.elements[i] = null; - } - this.count = 0; - }; - return BatchTextureArray; - }()); - - /** - * Flexible wrapper around `ArrayBuffer` that also provides - * typed array views on demand. - * - * @class - * @memberof PIXI - */ - var ViewableBuffer = /** @class */ (function () { - /** - * @param {number} size - The size of the buffer in bytes. - */ - function ViewableBuffer(size) { - /** - * Underlying `ArrayBuffer` that holds all the data - * and is of capacity `size`. - * - * @member {ArrayBuffer} - */ - this.rawBinaryData = new ArrayBuffer(size); - /** - * View on the raw binary data as a `Uint32Array`. - * - * @member {Uint32Array} - */ - this.uint32View = new Uint32Array(this.rawBinaryData); - /** - * View on the raw binary data as a `Float32Array`. - * - * @member {Float32Array} - */ - this.float32View = new Float32Array(this.rawBinaryData); - } - Object.defineProperty(ViewableBuffer.prototype, "int8View", { - /** - * View on the raw binary data as a `Int8Array`. - * - * @member {Int8Array} - */ - get: function () { - if (!this._int8View) { - this._int8View = new Int8Array(this.rawBinaryData); - } - return this._int8View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "uint8View", { - /** - * View on the raw binary data as a `Uint8Array`. - * - * @member {Uint8Array} - */ - get: function () { - if (!this._uint8View) { - this._uint8View = new Uint8Array(this.rawBinaryData); - } - return this._uint8View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "int16View", { - /** - * View on the raw binary data as a `Int16Array`. - * - * @member {Int16Array} - */ - get: function () { - if (!this._int16View) { - this._int16View = new Int16Array(this.rawBinaryData); - } - return this._int16View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "uint16View", { - /** - * View on the raw binary data as a `Uint16Array`. - * - * @member {Uint16Array} - */ - get: function () { - if (!this._uint16View) { - this._uint16View = new Uint16Array(this.rawBinaryData); - } - return this._uint16View; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ViewableBuffer.prototype, "int32View", { - /** - * View on the raw binary data as a `Int32Array`. - * - * @member {Int32Array} - */ - get: function () { - if (!this._int32View) { - this._int32View = new Int32Array(this.rawBinaryData); - } - return this._int32View; - }, - enumerable: false, - configurable: true - }); - /** - * Returns the view of the given type. - * - * @param {string} type - One of `int8`, `uint8`, `int16`, - * `uint16`, `int32`, `uint32`, and `float32`. - * @return {object} typed array of given type - */ - ViewableBuffer.prototype.view = function (type) { - return this[type + "View"]; - }; - /** - * Destroys all buffer references. Do not use after calling - * this. - */ - ViewableBuffer.prototype.destroy = function () { - this.rawBinaryData = null; - this._int8View = null; - this._uint8View = null; - this._int16View = null; - this._uint16View = null; - this._int32View = null; - this.uint32View = null; - this.float32View = null; - }; - ViewableBuffer.sizeOf = function (type) { - switch (type) { - case 'int8': - case 'uint8': - return 1; - case 'int16': - case 'uint16': - return 2; - case 'int32': - case 'uint32': - case 'float32': - return 4; - default: - throw new Error(type + " isn't a valid view type"); - } - }; - return ViewableBuffer; - }()); - - /** - * Renderer dedicated to drawing and batching sprites. - * - * This is the default batch renderer. It buffers objects - * with texture-based geometries and renders them in - * batches. It uploads multiple textures to the GPU to - * reduce to the number of draw calls. - * - * @class - * @protected - * @memberof PIXI - * @extends PIXI.ObjectRenderer - */ - var AbstractBatchRenderer = /** @class */ (function (_super) { - __extends$2(AbstractBatchRenderer, _super); - /** - * This will hook onto the renderer's `contextChange` - * and `prerender` signals. - * - * @param {PIXI.Renderer} renderer - The renderer this works for. - */ - function AbstractBatchRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - /** - * This is used to generate a shader that can - * color each vertex based on a `aTextureId` - * attribute that points to an texture in `uSampler`. - * - * This enables the objects with different textures - * to be drawn in the same draw call. - * - * You can customize your shader by creating your - * custom shader generator. - * - * @member {PIXI.BatchShaderGenerator} - * @protected - */ - _this.shaderGenerator = null; - /** - * The class that represents the geometry of objects - * that are going to be batched with this. - * - * @member {object} - * @default PIXI.BatchGeometry - * @protected - */ - _this.geometryClass = null; - /** - * Size of data being buffered per vertex in the - * attribute buffers (in floats). By default, the - * batch-renderer plugin uses 6: - * - * | aVertexPosition | 2 | - * |-----------------|---| - * | aTextureCoords | 2 | - * | aColor | 1 | - * | aTextureId | 1 | - * - * @member {number} - * @readonly - */ - _this.vertexSize = null; - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - /** - * The number of bufferable objects before a flush - * occurs automatically. - * - * @member {number} - * @default settings.SPRITE_BATCH_SIZE * 4 - */ - _this.size = settings.SPRITE_BATCH_SIZE * 4; - /** - * Total count of all vertices used by the currently - * buffered objects. - * - * @member {number} - * @private - */ - _this._vertexCount = 0; - /** - * Total count of all indices used by the currently - * buffered objects. - * - * @member {number} - * @private - */ - _this._indexCount = 0; - /** - * Buffer of objects that are yet to be rendered. - * - * @member {PIXI.DisplayObject[]} - * @private - */ - _this._bufferedElements = []; - /** - * Data for texture batch builder, helps to save a bit of CPU on a pass. - * @type {PIXI.BaseTexture[]} - * @private - */ - _this._bufferedTextures = []; - /** - * Number of elements that are buffered and are - * waiting to be flushed. - * - * @member {number} - * @private - */ - _this._bufferSize = 0; - /** - * This shader is generated by `this.shaderGenerator`. - * - * It is generated specifically to handle the required - * number of textures being batched together. - * - * @member {PIXI.Shader} - * @protected - */ - _this._shader = null; - /** - * Pool of `this.geometryClass` geometry objects - * that store buffers. They are used to pass data - * to the shader on each draw call. - * - * These are never re-allocated again, unless a - * context change occurs; however, the pool may - * be expanded if required. - * - * @member {PIXI.Geometry[]} - * @private - * @see PIXI.AbstractBatchRenderer.contextChange - */ - _this._packedGeometries = []; - /** - * Size of `this._packedGeometries`. It can be expanded - * if more than `this._packedGeometryPoolSize` flushes - * occur in a single frame. - * - * @member {number} - * @private - */ - _this._packedGeometryPoolSize = 2; - /** - * A flush may occur multiple times in a single - * frame. On iOS devices or when - * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the - * batch renderer does not upload data to the same - * `WebGLBuffer` for performance reasons. - * - * This is the index into `packedGeometries` that points to - * geometry holding the most recent buffers. - * - * @member {number} - * @private - */ - _this._flushId = 0; - /** - * Pool of `ViewableBuffer` objects that are sorted in - * order of increasing size. The flush method uses - * the buffer with the least size above the amount - * it requires. These are used for passing attributes. - * - * The first buffer has a size of 8; each subsequent - * buffer has double capacity of its previous. - * - * @member {PIXI.ViewableBuffer[]} - * @private - * @see PIXI.AbstractBatchRenderer#getAttributeBuffer - */ - _this._aBuffers = {}; - /** - * Pool of `Uint16Array` objects that are sorted in - * order of increasing size. The flush method uses - * the buffer with the least size above the amount - * it requires. These are used for passing indices. - * - * The first buffer has a size of 12; each subsequent - * buffer has double capacity of its previous. - * - * @member {Uint16Array[]} - * @private - * @see PIXI.AbstractBatchRenderer#getIndexBuffer - */ - _this._iBuffers = {}; - /** - * Maximum number of textures that can be uploaded to - * the GPU under the current context. It is initialized - * properly in `this.contextChange`. - * - * @member {number} - * @see PIXI.AbstractBatchRenderer#contextChange - * @readonly - */ - _this.MAX_TEXTURES = 1; - _this.renderer.on('prerender', _this.onPrerender, _this); - renderer.runners.contextChange.add(_this); - _this._dcIndex = 0; - _this._aIndex = 0; - _this._iIndex = 0; - _this._attributeBuffer = null; - _this._indexBuffer = null; - _this._tempBoundTextures = []; - return _this; - } - /** - * Handles the `contextChange` signal. - * - * It calculates `this.MAX_TEXTURES` and allocating the - * packed-geometry object pool. - */ - AbstractBatchRenderer.prototype.contextChange = function () { - var gl = this.renderer.gl; - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { - this.MAX_TEXTURES = 1; - } - else { - // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); - // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); - } - this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); - // we use the second shader as the first one depending on your browser - // may omit aTextureId as it is not used by the shader so is optimized out. - for (var i = 0; i < this._packedGeometryPoolSize; i++) { - /* eslint-disable max-len */ - this._packedGeometries[i] = new (this.geometryClass)(); - } - this.initFlushBuffers(); - }; - /** - * Makes sure that static and dynamic flush pooled objects have correct dimensions - */ - AbstractBatchRenderer.prototype.initFlushBuffers = function () { - var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; - // max draw calls - var MAX_SPRITES = this.size / 4; - // max texture arrays - var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; - while (_drawCallPool.length < MAX_SPRITES) { - _drawCallPool.push(new BatchDrawCall()); - } - while (_textureArrayPool.length < MAX_TA) { - _textureArrayPool.push(new BatchTextureArray()); - } - for (var i = 0; i < this.MAX_TEXTURES; i++) { - this._tempBoundTextures[i] = null; - } - }; - /** - * Handles the `prerender` signal. - * - * It ensures that flushes start from the first geometry - * object again. - */ - AbstractBatchRenderer.prototype.onPrerender = function () { - this._flushId = 0; - }; - /** - * Buffers the "batchable" object. It need not be rendered - * immediately. - * - * @param {PIXI.DisplayObject} element - the element to render when - * using this renderer - */ - AbstractBatchRenderer.prototype.render = function (element) { - if (!element._texture.valid) { - return; - } - if (this._vertexCount + (element.vertexData.length / 2) > this.size) { - this.flush(); - } - this._vertexCount += element.vertexData.length / 2; - this._indexCount += element.indices.length; - this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; - this._bufferedElements[this._bufferSize++] = element; - }; - AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { - var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; - var textureArrays = AbstractBatchRenderer._textureArrayPool; - var batch = this.renderer.batch; - var boundTextures = this._tempBoundTextures; - var touch = this.renderer.textureGC.count; - var TICK = ++BaseTexture._globalBatch; - var countTexArrays = 0; - var texArray = textureArrays[0]; - var start = 0; - batch.copyBoundTextures(boundTextures, MAX_TEXTURES); - for (var i = 0; i < this._bufferSize; ++i) { - var tex = textures[i]; - textures[i] = null; - if (tex._batchEnabled === TICK) { - continue; - } - if (texArray.count >= MAX_TEXTURES) { - batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); - this.buildDrawCalls(texArray, start, i); - start = i; - texArray = textureArrays[++countTexArrays]; - ++TICK; - } - tex._batchEnabled = TICK; - tex.touched = touch; - texArray.elements[texArray.count++] = tex; - } - if (texArray.count > 0) { - batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); - this.buildDrawCalls(texArray, start, this._bufferSize); - ++countTexArrays; - ++TICK; - } - // Clean-up - for (var i = 0; i < boundTextures.length; i++) { - boundTextures[i] = null; - } - BaseTexture._globalBatch = TICK; - }; - /** - * Populating drawcalls for rendering - * - * @param {PIXI.BatchTextureArray} texArray - * @param {number} start - * @param {number} finish - */ - AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { - var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; - var drawCalls = AbstractBatchRenderer._drawCallPool; - var dcIndex = this._dcIndex; - var aIndex = this._aIndex; - var iIndex = this._iIndex; - var drawCall = drawCalls[dcIndex]; - drawCall.start = this._iIndex; - drawCall.texArray = texArray; - for (var i = start; i < finish; ++i) { - var sprite = elements[i]; - var tex = sprite._texture.baseTexture; - var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; - elements[i] = null; - if (start < i && drawCall.blend !== spriteBlendMode) { - drawCall.size = iIndex - drawCall.start; - start = i; - drawCall = drawCalls[++dcIndex]; - drawCall.texArray = texArray; - drawCall.start = iIndex; - } - this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); - aIndex += sprite.vertexData.length / 2 * vertexSize; - iIndex += sprite.indices.length; - drawCall.blend = spriteBlendMode; - } - if (start < finish) { - drawCall.size = iIndex - drawCall.start; - ++dcIndex; - } - this._dcIndex = dcIndex; - this._aIndex = aIndex; - this._iIndex = iIndex; - }; - /** - * Bind textures for current rendering - * - * @param {PIXI.BatchTextureArray} texArray - */ - AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { - var textureSystem = this.renderer.texture; - for (var j = 0; j < texArray.count; j++) { - textureSystem.bind(texArray.elements[j], texArray.ids[j]); - texArray.elements[j] = null; - } - texArray.count = 0; - }; - AbstractBatchRenderer.prototype.updateGeometry = function () { - var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; - if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't - like uploads to the same buffer in a single frame. */ - if (this._packedGeometryPoolSize <= this._flushId) { - this._packedGeometryPoolSize++; - packedGeometries[this._flushId] = new (this.geometryClass)(); - } - packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); - packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.bind(packedGeometries[this._flushId]); - this.renderer.geometry.updateBuffers(); - this._flushId++; - } - else { - // lets use the faster option, always use buffer number 0 - packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); - packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.updateBuffers(); - } - }; - AbstractBatchRenderer.prototype.drawBatches = function () { - var dcCount = this._dcIndex; - var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; - var drawCalls = AbstractBatchRenderer._drawCallPool; - var curTexArray = null; - // Upload textures and do the draw calls - for (var i = 0; i < dcCount; i++) { - var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; - if (curTexArray !== texArray) { - curTexArray = texArray; - this.bindAndClearTexArray(texArray); - } - this.state.blendMode = blend; - stateSystem.set(this.state); - gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); - } - }; - /** - * Renders the content _now_ and empties the current batch. - */ - AbstractBatchRenderer.prototype.flush = function () { - if (this._vertexCount === 0) { - return; - } - this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); - this._indexBuffer = this.getIndexBuffer(this._indexCount); - this._aIndex = 0; - this._iIndex = 0; - this._dcIndex = 0; - this.buildTexturesAndDrawCalls(); - this.updateGeometry(); - this.drawBatches(); - // reset elements buffer for the next flush - this._bufferSize = 0; - this._vertexCount = 0; - this._indexCount = 0; - }; - /** - * Starts a new sprite batch. - */ - AbstractBatchRenderer.prototype.start = function () { - this.renderer.state.set(this.state); - this.renderer.shader.bind(this._shader); - if (settings.CAN_UPLOAD_SAME_BUFFER) { - // bind buffer #0, we don't need others - this.renderer.geometry.bind(this._packedGeometries[this._flushId]); - } - }; - /** - * Stops and flushes the current batch. - */ - AbstractBatchRenderer.prototype.stop = function () { - this.flush(); - }; - /** - * Destroys this `AbstractBatchRenderer`. It cannot be used again. - */ - AbstractBatchRenderer.prototype.destroy = function () { - for (var i = 0; i < this._packedGeometryPoolSize; i++) { - if (this._packedGeometries[i]) { - this._packedGeometries[i].destroy(); - } - } - this.renderer.off('prerender', this.onPrerender, this); - this._aBuffers = null; - this._iBuffers = null; - this._packedGeometries = null; - this._attributeBuffer = null; - this._indexBuffer = null; - if (this._shader) { - this._shader.destroy(); - this._shader = null; - } - _super.prototype.destroy.call(this); - }; - /** - * Fetches an attribute buffer from `this._aBuffers` that - * can hold atleast `size` floats. - * - * @param {number} size - minimum capacity required - * @return {ViewableBuffer} - buffer than can hold atleast `size` floats - * @private - */ - AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { - // 8 vertices is enough for 2 quads - var roundedP2 = nextPow2(Math.ceil(size / 8)); - var roundedSizeIndex = log2(roundedP2); - var roundedSize = roundedP2 * 8; - if (this._aBuffers.length <= roundedSizeIndex) { - this._iBuffers.length = roundedSizeIndex + 1; - } - var buffer = this._aBuffers[roundedSize]; - if (!buffer) { - this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); - } - return buffer; - }; - /** - * Fetches an index buffer from `this._iBuffers` that can - * have at least `size` capacity. - * - * @param {number} size - minimum required capacity - * @return {Uint16Array} - buffer that can fit `size` - * indices. - * @private - */ - AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { - // 12 indices is enough for 2 quads - var roundedP2 = nextPow2(Math.ceil(size / 12)); - var roundedSizeIndex = log2(roundedP2); - var roundedSize = roundedP2 * 12; - if (this._iBuffers.length <= roundedSizeIndex) { - this._iBuffers.length = roundedSizeIndex + 1; - } - var buffer = this._iBuffers[roundedSizeIndex]; - if (!buffer) { - this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); - } - return buffer; - }; - /** - * Takes the four batching parameters of `element`, interleaves - * and pushes them into the batching attribute/index buffers given. - * - * It uses these properties: `vertexData` `uvs`, `textureId` and - * `indicies`. It also uses the "tint" of the base-texture, if - * present. - * - * @param {PIXI.Sprite} element - element being rendered - * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer. - * @param {Uint16Array} indexBuffer - index buffer - * @param {number} aIndex - number of floats already in the attribute buffer - * @param {number} iIndex - number of indices already in `indexBuffer` - */ - AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { - var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; - var packedVertices = aIndex / this.vertexSize; - var uvs = element.uvs; - var indicies = element.indices; - var vertexData = element.vertexData; - var textureId = element._texture.baseTexture._batchLocation; - var alpha = Math.min(element.worldAlpha, 1.0); - var argb = (alpha < 1.0 - && element._texture.baseTexture.alphaMode) - ? premultiplyTint(element._tintRGB, alpha) - : element._tintRGB + (alpha * 255 << 24); - // lets not worry about tint! for now.. - for (var i = 0; i < vertexData.length; i += 2) { - float32View[aIndex++] = vertexData[i]; - float32View[aIndex++] = vertexData[i + 1]; - float32View[aIndex++] = uvs[i]; - float32View[aIndex++] = uvs[i + 1]; - uint32View[aIndex++] = argb; - float32View[aIndex++] = textureId; - } - for (var i = 0; i < indicies.length; i++) { - indexBuffer[iIndex++] = packedVertices + indicies[i]; - } - }; - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchDrawCall[]} - */ - AbstractBatchRenderer._drawCallPool = []; - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchTextureArray[]} - */ - AbstractBatchRenderer._textureArrayPool = []; - return AbstractBatchRenderer; - }(ObjectRenderer)); - - /** - * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer - * - * @class - * @memberof PIXI - */ - var BatchShaderGenerator = /** @class */ (function () { - /** - * @param {string} vertexSrc - Vertex shader - * @param {string} fragTemplate - Fragment shader template - */ - function BatchShaderGenerator(vertexSrc, fragTemplate) { - /** - * Reference to the vertex shader source. - * - * @member {string} - */ - this.vertexSrc = vertexSrc; - /** - * Reference to the fragement shader template. Must contain "%count%" and "%forloop%". - * - * @member {string} - */ - this.fragTemplate = fragTemplate; - this.programCache = {}; - this.defaultGroupCache = {}; - if (fragTemplate.indexOf('%count%') < 0) { - throw new Error('Fragment template must contain "%count%".'); - } - if (fragTemplate.indexOf('%forloop%') < 0) { - throw new Error('Fragment template must contain "%forloop%".'); - } - } - BatchShaderGenerator.prototype.generateShader = function (maxTextures) { - if (!this.programCache[maxTextures]) { - var sampleValues = new Int32Array(maxTextures); - for (var i = 0; i < maxTextures; i++) { - sampleValues[i] = i; - } - this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); - var fragmentSrc = this.fragTemplate; - fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); - fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); - this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); - } - var uniforms = { - tint: new Float32Array([1, 1, 1, 1]), - translationMatrix: new Matrix(), - default: this.defaultGroupCache[maxTextures], - }; - return new Shader(this.programCache[maxTextures], uniforms); - }; - BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { - var src = ''; - src += '\n'; - src += '\n'; - for (var i = 0; i < maxTextures; i++) { - if (i > 0) { - src += '\nelse '; - } - if (i < maxTextures - 1) { - src += "if(vTextureId < " + i + ".5)"; - } - src += '\n{'; - src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; - src += '\n}'; - } - src += '\n'; - src += '\n'; - return src; - }; - return BatchShaderGenerator; - }()); - - /** - * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). - * - * @class - * @memberof PIXI - */ - var BatchGeometry = /** @class */ (function (_super) { - __extends$2(BatchGeometry, _super); - /** - * @param {boolean} [_static=false] - Optimization flag, where `false` - * is updated every frame, `true` doesn't change frame-to-frame. - */ - function BatchGeometry(_static) { - if (_static === void 0) { _static = false; } - var _this = _super.call(this) || this; - /** - * Buffer used for position, color, texture IDs - * - * @member {PIXI.Buffer} - * @protected - */ - _this._buffer = new Buffer(null, _static, false); - /** - * Index buffer data - * - * @member {PIXI.Buffer} - * @protected - */ - _this._indexBuffer = new Buffer(null, _static, true); - _this.addAttribute('aVertexPosition', _this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', _this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aColor', _this._buffer, 4, true, exports.TYPES.UNSIGNED_BYTE) - .addAttribute('aTextureId', _this._buffer, 1, true, exports.TYPES.FLOAT) - .addIndex(_this._indexBuffer); - return _this; - } - return BatchGeometry; - }(Geometry)); - - var defaultVertex$2 = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; - - var defaultFragment$2 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; - - /** - * @class - * @memberof PIXI - * @hideconstructor - */ - var BatchPluginFactory = /** @class */ (function () { - function BatchPluginFactory() { - } - /** - * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way - * to extend BatchRenderer with all the necessary pieces. - * @example - * const fragment = ` - * varying vec2 vTextureCoord; - * varying vec4 vColor; - * varying float vTextureId; - * uniform sampler2D uSamplers[%count%]; - * - * void main(void){ - * vec4 color; - * %forloop% - * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); - * } - * `; - * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); - * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer); - * const sprite = new PIXI.Sprite(); - * sprite.pluginName = 'invert'; - * - * @static - * @param {object} [options] - * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source - * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template - * @param {number} [options.vertexSize=6] - Vertex size - * @param {object} [options.geometryClass=PIXI.BatchGeometry] - * @return {*} New batch renderer plugin - */ - BatchPluginFactory.create = function (options) { - var _a = Object.assign({ - vertex: defaultVertex$2, - fragment: defaultFragment$2, - geometryClass: BatchGeometry, - vertexSize: 6, - }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; - return /** @class */ (function (_super) { - __extends$2(BatchPlugin, _super); - function BatchPlugin(renderer) { - var _this = _super.call(this, renderer) || this; - _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); - _this.geometryClass = geometryClass; - _this.vertexSize = vertexSize; - return _this; - } - return BatchPlugin; - }(AbstractBatchRenderer)); - }; - Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultVertex$2; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - get: function () { - return defaultFragment$2; - }, - enumerable: false, - configurable: true - }); - return BatchPluginFactory; - }()); - // Setup the default BatchRenderer plugin, this is what - // we'll actually export at the root level - var BatchRenderer = BatchPluginFactory.create(); - - /*! - * @pixi/app - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/app is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Convenience class to create a new PIXI application. - * - * This class automatically creates the renderer, ticker and root container. - * - * @example - * // Create the application - * const app = new PIXI.Application(); - * - * // Add the view to the DOM - * document.body.appendChild(app.view); - * - * // ex, add display objects - * app.stage.addChild(PIXI.Sprite.from('something.png')); - * - * @class - * @memberof PIXI - */ - var Application = /** @class */ (function () { - /** - * @param {object} [options] - The optional renderer parameters. - * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. - * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set - * options.sharedTicker to true in case that it is already started. Stop it by your own. - * @param {number} [options.width=800] - The width of the renderers view. - * @param {number} [options.height=600] - The height of the renderers view. - * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. - * @param {boolean} [options.transparent=false] - If the render view is transparent. - * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for - * resolutions other than 1. - * @param {boolean} [options.antialias=false] - Sets antialias - * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you - * need to call toDataUrl on the WebGL context. - * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2. - * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this - * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise - * it is ignored. - * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area - * (shown if not transparent). - * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or - * not before the new render pass. - * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" - * for devices with dual graphics card. **(WebGL only)**. - * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker. - * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker. - * The system ticker will always run before both the shared ticker and the app ticker. - * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader. - * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to. - */ - function Application(options) { - var _this = this; - // The default options - options = Object.assign({ - forceCanvas: false, - }, options); - /** - * WebGL renderer if available, otherwise CanvasRenderer. - * @member {PIXI.Renderer|PIXI.CanvasRenderer} - */ - this.renderer = autoDetectRenderer(options); - /** - * The root display container that's rendered. - * @member {PIXI.Container} - */ - this.stage = new Container(); - // install plugins here - Application._plugins.forEach(function (plugin) { - plugin.init.call(_this, options); - }); - } - /** - * Register a middleware plugin for the application - * @static - * @param {PIXI.Application.Plugin} plugin - Plugin being installed - */ - Application.registerPlugin = function (plugin) { - Application._plugins.push(plugin); - }; - /** - * Render the current stage. - */ - Application.prototype.render = function () { - // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject - // This can be fixed when CanvasRenderer is converted. - this.renderer.render(this.stage); - }; - Object.defineProperty(Application.prototype, "view", { - /** - * Reference to the renderer's canvas element. - * @member {HTMLCanvasElement} - * @readonly - */ - get: function () { - return this.renderer.view; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Application.prototype, "screen", { - /** - * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. - * @member {PIXI.Rectangle} - * @readonly - */ - get: function () { - return this.renderer.screen; - }, - enumerable: false, - configurable: true - }); - /** - * Destroy and don't use after this. - * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM. - * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy - * method called as well. 'stageOptions' will be passed on to those calls. - * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the texture of the child sprite - * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the base texture of the child sprite - */ - Application.prototype.destroy = function (removeView, stageOptions) { - var _this = this; - // Destroy plugins in the opposite order - // which they were constructed - var plugins = Application._plugins.slice(0); - plugins.reverse(); - plugins.forEach(function (plugin) { - plugin.destroy.call(_this); - }); - this.stage.destroy(stageOptions); - this.stage = null; - this.renderer.destroy(removeView); - this.renderer = null; - }; - return Application; - }()); - /** - * @memberof PIXI.Application - * @typedef {object} Plugin - * @property {function} init - Called when Application is constructed, scoped to Application instance. - * Passes in `options` as the only argument, which are Application constructor options. - * @property {function} destroy - Called when destroying Application, scoped to Application instance - */ - /** - * Collection of installed plugins. - * @static - * @private - * @type {PIXI.Application.Plugin[]} - */ - Application._plugins = []; - - /** - * Middleware for for Application's resize functionality - * @private - * @class - */ - var ResizePlugin = /** @class */ (function () { - function ResizePlugin() { - } - /** - * Initialize the plugin with scope of application instance - * @static - * @private - * @param {object} [options] - See application options - */ - ResizePlugin.init = function (options) { - var _this = this; - /** - * The HTML element or window to automatically resize the - * renderer's view element to match width and height. - * @type {Window|HTMLElement} - * @name resizeTo - * @memberof PIXI.Application# - */ - Object.defineProperty(this, 'resizeTo', { - set: function (dom) { - window.removeEventListener('resize', this.queueResize); - this._resizeTo = dom; - if (dom) { - window.addEventListener('resize', this.queueResize); - this.resize(); - } - }, - get: function () { - return this._resizeTo; - }, - }); - /** - * Resize is throttled, so it's - * safe to call this multiple times per frame and it'll - * only be called once. - * @method PIXI.Application#queueResize - */ - this.queueResize = function () { - if (!_this._resizeTo) { - return; - } - _this.cancelResize(); - // // Throttle resize events per raf - _this._resizeId = requestAnimationFrame(function () { return _this.resize(); }); - }; - /** - * Cancel the resize queue. - * @method PIXI.Application#cancelResize - * @private - */ - this.cancelResize = function () { - if (_this._resizeId) { - cancelAnimationFrame(_this._resizeId); - _this._resizeId = null; - } - }; - /** - * Execute an immediate resize on the renderer, this is not - * throttled and can be expensive to call many times in a row. - * Will resize only if `resizeTo` property is set. - * @method PIXI.Application#resize - */ - this.resize = function () { - if (!_this._resizeTo) { - return; - } - // clear queue resize - _this.cancelResize(); - var width; - var height; - // Resize to the window - if (_this._resizeTo === window) { - width = window.innerWidth; - height = window.innerHeight; - } - // Resize to other HTML entities - else { - var _a = _this._resizeTo, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight; - width = clientWidth; - height = clientHeight; - } - _this.renderer.resize(width, height); - }; - // On resize - this._resizeId = null; - this._resizeTo = null; - this.resizeTo = options.resizeTo || null; - }; - /** - * Clean up the ticker, scoped to application - * @static - * @private - */ - ResizePlugin.destroy = function () { - this.cancelResize(); - this.cancelResize = null; - this.queueResize = null; - this.resizeTo = null; - this.resize = null; - }; - return ResizePlugin; - }()); - - Application.registerPlugin(ResizePlugin); - - /*! - * @pixi/extract - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/extract is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var TEMP_RECT = new Rectangle(); - var BYTES_PER_PIXEL = 4; - /** - * This class provides renderer-specific plugins for exporting content from a renderer. - * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels). - * - * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. - * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. - * @example - * // Create a new app (will auto-add extract plugin to renderer) - * const app = new PIXI.Application(); - * - * // Draw a red circle - * const graphics = new PIXI.Graphics() - * .beginFill(0xFF0000) - * .drawCircle(0, 0, 50); - * - * // Render the graphics as an HTMLImageElement - * const image = app.renderer.plugins.extract.image(graphics); - * document.body.appendChild(image); - * @class - * @memberof PIXI - */ - var Extract = /** @class */ (function () { - /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer - */ - function Extract(renderer) { - this.renderer = renderer; - /** - * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture - * - * @member {PIXI.Extract} extract - * @memberof PIXI.Renderer# - * @see PIXI.Extract - */ - renderer.extract = this; - } - /** - * Will return a HTML Image of the target - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {HTMLImageElement} HTML Image of the target - */ - Extract.prototype.image = function (target, format, quality) { - var image = new Image(); - image.src = this.base64(target, format, quality); - return image; - }; - /** - * Will return a a base64 encoded string of this target. It works by calling - * `Extract.getCanvas` and then running toDataURL on that. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {string} A base64 encoded string of the texture. - */ - Extract.prototype.base64 = function (target, format, quality) { - return this.canvas(target).toDataURL(format, quality); - }; - /** - * Creates a Canvas element, renders this target to it and then returns it. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ - Extract.prototype.canvas = function (target) { - var renderer = this.renderer; - var resolution; - var frame; - var flipY = false; - var renderTexture; - var generated = false; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = this.renderer.generateTexture(target); - generated = true; - } - } - if (renderTexture) { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - flipY = false; - renderer.renderTexture.bind(renderTexture); - } - else { - resolution = this.renderer.resolution; - flipY = true; - frame = TEMP_RECT; - frame.width = this.renderer.width; - frame.height = this.renderer.height; - renderer.renderTexture.bind(null); - } - var width = Math.floor((frame.width * resolution) + 1e-4); - var height = Math.floor((frame.height * resolution) + 1e-4); - var canvasBuffer = new CanvasRenderTarget(width, height, 1); - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - // read pixels to the array - var gl = renderer.gl; - gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); - // add the pixels to the canvas - var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); - Extract.arrayPostDivide(webglPixels, canvasData.data); - canvasBuffer.context.putImageData(canvasData, 0, 0); - // pulling pixels - if (flipY) { - var target_1 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1); - target_1.context.scale(1, -1); - // we can't render to itself because we should be empty before render. - target_1.context.drawImage(canvasBuffer.canvas, 0, -height); - canvasBuffer.destroy(); - canvasBuffer = target_1; - } - if (generated) { - renderTexture.destroy(true); - } - // send the canvas back.. - return canvasBuffer.canvas; - }; - /** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA - * order, with integer values between 0 and 255 (included). - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture - */ - Extract.prototype.pixels = function (target) { - var renderer = this.renderer; - var resolution; - var frame; - var renderTexture; - var generated = false; - if (target) { - if (target instanceof RenderTexture) { - renderTexture = target; - } - else { - renderTexture = this.renderer.generateTexture(target); - generated = true; - } - } - if (renderTexture) { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - // bind the buffer - renderer.renderTexture.bind(renderTexture); - } - else { - resolution = renderer.resolution; - frame = TEMP_RECT; - frame.width = renderer.width; - frame.height = renderer.height; - renderer.renderTexture.bind(null); - } - var width = frame.width * resolution; - var height = frame.height * resolution; - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - // read pixels to the array - var gl = renderer.gl; - gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); - if (generated) { - renderTexture.destroy(true); - } - Extract.arrayPostDivide(webglPixels, webglPixels); - return webglPixels; - }; - /** - * Destroys the extract - * - */ - Extract.prototype.destroy = function () { - this.renderer.extract = null; - this.renderer = null; - }; - /** - * Takes premultiplied pixel data and produces regular pixel data - * - * @private - * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data - * @param out {number[] | Uint8Array | Uint8ClampedArray} output array - */ - Extract.arrayPostDivide = function (pixels, out) { - for (var i = 0; i < pixels.length; i += 4) { - var alpha = out[i + 3] = pixels[i + 3]; - if (alpha !== 0) { - out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0)); - out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0)); - out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0)); - } - else { - out[i] = pixels[i]; - out[i + 1] = pixels[i + 1]; - out[i + 2] = pixels[i + 2]; - } - } - }; - return Extract; - }()); - - 'use strict'; - - function parseURI (str, opts) { - if (!str) { return undefined } - - opts = opts || {}; - - var o = { - key: [ - 'source', - 'protocol', - 'authority', - 'userInfo', - 'user', - 'password', - 'host', - 'port', - 'relative', - 'path', - 'directory', - 'file', - 'query', - 'anchor' - ], - q: { - name: 'queryKey', - parser: /(?:^|&)([^&=]*)=?([^&]*)/g - }, - parser: { - strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, - loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ - } - }; - - var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); - var uri = {}; - var i = 14; - - while (i--) { uri[o.key[i]] = m[i] || ''; } - - uri[o.q.name] = {}; - uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { - if ($1) { uri[o.q.name][$1] = $2; } - }); - - return uri - } - - var parseUri = parseURI; - - var miniSignals = createCommonjsModule(function (module, exports) { - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; })(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - - var MiniSignalBinding = (function () { - function MiniSignalBinding(fn, once, thisArg) { - if (once === undefined) { once = false; } - - _classCallCheck(this, MiniSignalBinding); - - this._fn = fn; - this._once = once; - this._thisArg = thisArg; - this._next = this._prev = this._owner = null; - } - - _createClass(MiniSignalBinding, [{ - key: 'detach', - value: function detach() { - if (this._owner === null) { return false; } - this._owner.detach(this); - return true; - } - }]); - - return MiniSignalBinding; - })(); - - function _addMiniSignalBinding(self, node) { - if (!self._head) { - self._head = node; - self._tail = node; - } else { - self._tail._next = node; - node._prev = self._tail; - self._tail = node; - } - - node._owner = self; - - return node; - } - - var MiniSignal = (function () { - function MiniSignal() { - _classCallCheck(this, MiniSignal); - - this._head = this._tail = undefined; - } - - _createClass(MiniSignal, [{ - key: 'handlers', - value: function handlers() { - var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var node = this._head; - - if (exists) { return !!node; } - - var ee = []; - - while (node) { - ee.push(node); - node = node._next; - } - - return ee; - } - }, { - key: 'has', - value: function has(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); - } - - return node._owner === this; - } - }, { - key: 'dispatch', - value: function dispatch() { - var arguments$1 = arguments; - - var node = this._head; - - if (!node) { return false; } - - while (node) { - if (node._once) { this.detach(node); } - node._fn.apply(node._thisArg, arguments$1); - node = node._next; - } - - return true; - } - }, { - key: 'add', - value: function add(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#add(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); - } - }, { - key: 'once', - value: function once(fn) { - var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (typeof fn !== 'function') { - throw new Error('MiniSignal#once(): First arg must be a Function.'); - } - return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); - } - }, { - key: 'detach', - value: function detach(node) { - if (!(node instanceof MiniSignalBinding)) { - throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); - } - if (node._owner !== this) { return this; } - - if (node._prev) { node._prev._next = node._next; } - if (node._next) { node._next._prev = node._prev; } - - if (node === this._head) { - this._head = node._next; - if (node._next === null) { - this._tail = null; - } - } else if (node === this._tail) { - this._tail = node._prev; - this._tail._next = null; - } - - node._owner = null; - return this; - } - }, { - key: 'detachAll', - value: function detachAll() { - var node = this._head; - if (!node) { return this; } - - this._head = this._tail = null; - - while (node) { - node._owner = null; - node = node._next; - } - return this; - } - }]); - - return MiniSignal; - })(); - - MiniSignal.MiniSignalBinding = MiniSignalBinding; - - exports['default'] = MiniSignal; - module.exports = exports['default']; - }); - - var Signal = unwrapExports(miniSignals); - - /*! - * resource-loader - v3.0.1 - * https://github.com/pixijs/pixi-sound - * Compiled Tue, 02 Jul 2019 14:06:18 UTC - * - * resource-loader is licensed under the MIT license. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Smaller version of the async library constructs. - * - * @namespace async - */ - - /** - * Noop function - * - * @ignore - * @function - * @memberof async - */ - function _noop() {} - /* empty */ - - /** - * Iterates an array in series. - * - * @memberof async - * @function eachSeries - * @param {Array.<*>} array - Array to iterate. - * @param {function} iterator - Function to call for each element. - * @param {function} callback - Function to call when done, or on error. - * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. - */ - - - function eachSeries(array, iterator, callback, deferNext) { - var i = 0; - var len = array.length; - - (function next(err) { - if (err || i === len) { - if (callback) { - callback(err); - } - - return; - } - - if (deferNext) { - setTimeout(function () { - iterator(array[i++], next); - }, 1); - } else { - iterator(array[i++], next); - } - })(); - } - /** - * Ensures a function is only called once. - * - * @ignore - * @memberof async - * @param {function} fn - The function to wrap. - * @return {function} The wrapping function. - */ - - function onlyOnce(fn) { - return function onceWrapper() { - if (fn === null) { - throw new Error('Callback was already called.'); - } - - var callFn = fn; - fn = null; - callFn.apply(this, arguments); - }; - } - /** - * Async queue implementation, - * - * @memberof async - * @function queue - * @param {function} worker - The worker function to call for each task. - * @param {number} concurrency - How many workers to run in parrallel. - * @return {*} The async queue object. - */ - - - function queue(worker, concurrency) { - if (concurrency == null) { - // eslint-disable-line no-eq-null,eqeqeq - concurrency = 1; - } else if (concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - - var workers = 0; - var q = { - _tasks: [], - concurrency: concurrency, - saturated: _noop, - unsaturated: _noop, - buffer: concurrency / 4, - empty: _noop, - drain: _noop, - error: _noop, - started: false, - paused: false, - push: function push(data, callback) { - _insert(data, false, callback); - }, - kill: function kill() { - workers = 0; - q.drain = _noop; - q.started = false; - q._tasks = []; - }, - unshift: function unshift(data, callback) { - _insert(data, true, callback); - }, - process: function process() { - while (!q.paused && workers < q.concurrency && q._tasks.length) { - var task = q._tasks.shift(); - - if (q._tasks.length === 0) { - q.empty(); - } - - workers += 1; - - if (workers === q.concurrency) { - q.saturated(); - } - - worker(task.data, onlyOnce(_next(task))); - } - }, - length: function length() { - return q._tasks.length; - }, - running: function running() { - return workers; - }, - idle: function idle() { - return q._tasks.length + workers === 0; - }, - pause: function pause() { - if (q.paused === true) { - return; - } - - q.paused = true; - }, - resume: function resume() { - if (q.paused === false) { - return; - } - - q.paused = false; // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - - for (var w = 1; w <= q.concurrency; w++) { - q.process(); - } - } - }; - - function _insert(data, insertAtFront, callback) { - if (callback != null && typeof callback !== 'function') { - // eslint-disable-line no-eq-null,eqeqeq - throw new Error('task callback must be a function'); - } - - q.started = true; - - if (data == null && q.idle()) { - // eslint-disable-line no-eq-null,eqeqeq - // call drain immediately if there are no tasks - setTimeout(function () { - return q.drain(); - }, 1); - return; - } - - var item = { - data: data, - callback: typeof callback === 'function' ? callback : _noop - }; - - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - - setTimeout(function () { - return q.process(); - }, 1); - } - - function _next(task) { - return function next() { - workers -= 1; - task.callback.apply(task, arguments); - - if (arguments[0] != null) { - // eslint-disable-line no-eq-null,eqeqeq - q.error(arguments[0], task.data); - } - - if (workers <= q.concurrency - q.buffer) { - q.unsaturated(); - } - - if (q.idle()) { - q.drain(); - } - - q.process(); - }; - } - - return q; - } - - var async = ({ - eachSeries: eachSeries, - queue: queue - }); - - // a simple in-memory cache for resources - var cache = {}; - /** - * A simple in-memory cache for resource. - * - * @memberof middleware - * @function caching - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.caching); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function caching(resource, next) { - var _this = this; - - // if cached, then set data and complete the resource - if (cache[resource.url]) { - resource.data = cache[resource.url]; - resource.complete(); // marks resource load complete and stops processing before middlewares - } // if not cached, wait for complete and store it in the cache. - else { - resource.onComplete.once(function () { - return cache[_this.url] = _this.data; - }); - } - - next(); - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) { descriptor.writable = true; } - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } - if (staticProps) { _defineProperties(Constructor, staticProps); } - return Constructor; - } - - var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); - var tempAnchor$1 = null; // some status constants - - var STATUS_NONE = 0; - var STATUS_OK = 200; - var STATUS_EMPTY = 204; - var STATUS_IE_BUG_EMPTY = 1223; - var STATUS_TYPE_OK = 2; // noop - - function _noop$1() {} - /* empty */ - - /** - * Manages the state and loading of a resource and all child resources. - * - * @class - */ - - - var Resource$1 = - /*#__PURE__*/ - function () { - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. - */ - Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { - setExtMap(Resource._loadTypeMap, extname, loadType); - } - /** - * Sets the load type to be used for a specific extension. - * - * @static - * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" - * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. - */ - ; - - Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { - setExtMap(Resource._xhrTypeMap, extname, xhrType); - } - /** - * @param {string} name - The name of the resource to load. - * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass - * an array of sources. - * @param {object} [options] - The options for the load. - * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. - */ - ; - - function Resource(name, url, options) { - if (typeof name !== 'string' || typeof url !== 'string') { - throw new Error('Both name and url are required for constructing a resource.'); - } - - options = options || {}; - /** - * The state flags of this resource. - * - * @private - * @member {number} - */ - - this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work. - - this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); - /** - * The name of this resource. - * - * @readonly - * @member {string} - */ - - - this.name = name; - /** - * The url used to load this resource. - * - * @readonly - * @member {string} - */ - - this.url = url; - /** - * The extension used to load this resource. - * - * @readonly - * @member {string} - */ - - this.extension = this._getExtension(); - /** - * The data that was loaded by the resource. - * - * @member {any} - */ - - this.data = null; - /** - * Is this request cross-origin? If unset, determined automatically. - * - * @member {string} - */ - - this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; - /** - * A timeout in milliseconds for the load. If the load takes longer than this time - * it is cancelled and the load is considered a failure. If this value is set to `0` - * then there is no explicit timeout. - * - * @member {number} - */ - - this.timeout = options.timeout || 0; - /** - * The method of loading to use for this resource. - * - * @member {Resource.LOAD_TYPE} - */ - - this.loadType = options.loadType || this._determineLoadType(); - /** - * The type used to load the resource via XHR. If unset, determined automatically. - * - * @member {string} - */ - - this.xhrType = options.xhrType; - /** - * Extra info for middleware, and controlling specifics about how the resource loads. - * - * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. - * Meaning it will modify it as it sees fit. - * - * @member {Resource.IMetadata} - */ - - this.metadata = options.metadata || {}; - /** - * The error that occurred while loading (if any). - * - * @readonly - * @member {Error} - */ - - this.error = null; - /** - * The XHR object that was used to load this resource. This is only set - * when `loadType` is `Resource.LOAD_TYPE.XHR`. - * - * @readonly - * @member {XMLHttpRequest} - */ - - this.xhr = null; - /** - * The child resources this resource owns. - * - * @readonly - * @member {Resource[]} - */ - - this.children = []; - /** - * The resource type. - * - * @readonly - * @member {Resource.TYPE} - */ - - this.type = Resource.TYPE.UNKNOWN; - /** - * The progress chunk owned by this resource. - * - * @readonly - * @member {number} - */ - - this.progressChunk = 0; - /** - * The `dequeue` method that will be used a storage place for the async queue dequeue method - * used privately by the loader. - * - * @private - * @member {function} - */ - - this._dequeue = _noop$1; - /** - * Used a storage place for the on load binding used privately by the loader. - * - * @private - * @member {function} - */ - - this._onLoadBinding = null; - /** - * The timer for element loads to check if they timeout. - * - * @private - * @member {number} - */ - - this._elementTimer = 0; - /** - * The `complete` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundComplete = this.complete.bind(this); - /** - * The `_onError` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnError = this._onError.bind(this); - /** - * The `_onProgress` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnProgress = this._onProgress.bind(this); - /** - * The `_onTimeout` function bound to this resource's context. - * - * @private - * @member {function} - */ - - this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks - - this._boundXhrOnError = this._xhrOnError.bind(this); - this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); - this._boundXhrOnAbort = this._xhrOnAbort.bind(this); - this._boundXhrOnLoad = this._xhrOnLoad.bind(this); - /** - * Dispatched when the resource beings to load. - * - * The callback looks like {@link Resource.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched each time progress of this resource load updates. - * Not all resources types and loader systems can support this event - * so sometimes it may not be available. If the resource - * is being loaded on a modern browser, using XHR, and the remote server - * properly sets Content-Length headers, then this will be available. - * - * The callback looks like {@link Resource.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once this resource has loaded, if there was an error it will - * be in the `error` property. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); - /** - * Dispatched after this resource has had all the *after* middleware run on it. - * - * The callback looks like {@link Resource.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onAfterMiddleware = new Signal(); - } - /** - * When the resource starts to load. - * - * @memberof Resource - * @callback OnStartSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * When the resource reports loading progress. - * - * @memberof Resource - * @callback OnProgressSignal - * @param {Resource} resource - The resource that the event happened on. - * @param {number} percentage - The progress of the load in the range [0, 1]. - */ - - /** - * When the resource finishes loading. - * - * @memberof Resource - * @callback OnCompleteSignal - * @param {Resource} resource - The resource that the event happened on. - */ - - /** - * @memberof Resource - * @typedef {object} IMetadata - * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The - * element to use for loading, instead of creating one. - * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This - * is useful if you want to pass in a `loadElement` that you already added load sources to. - * @property {string|string[]} [mimeType] - The mime type to use for the source element - * of a video/audio elment. If the urls are an array, you can pass this as an array as well - * where each index is the mime type to use for the corresponding url index. - */ - - /** - * Stores whether or not this url is a data url. - * - * @readonly - * @member {boolean} - */ - - - var _proto = Resource.prototype; - - /** - * Marks the resource as complete. - * - */ - _proto.complete = function complete() { - this._clearEvents(); - - this._finish(); - } - /** - * Aborts the loading of this resource, with an optional message. - * - * @param {string} message - The message to use for the error - */ - ; - - _proto.abort = function abort(message) { - // abort can be called multiple times, ignore subsequent calls. - if (this.error) { - return; - } // store error - - - this.error = new Error(message); // clear events before calling aborts - - this._clearEvents(); // abort the actual loading - - - if (this.xhr) { - this.xhr.abort(); - } else if (this.xdr) { - this.xdr.abort(); - } else if (this.data) { - // single source - if (this.data.src) { - this.data.src = Resource.EMPTY_GIF; - } // multi-source - else { - while (this.data.firstChild) { - this.data.removeChild(this.data.firstChild); - } - } - } // done now. - - - this._finish(); - } - /** - * Kicks off loading of this resource. This method is asynchronous. - * - * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. - */ - ; - - _proto.load = function load(cb) { - var _this = this; - - if (this.isLoading) { - return; - } - - if (this.isComplete) { - if (cb) { - setTimeout(function () { - return cb(_this); - }, 1); - } - - return; - } else if (cb) { - this.onComplete.once(cb); - } - - this._setFlag(Resource.STATUS_FLAGS.LOADING, true); - - this.onStart.dispatch(this); // if unset, determine the value - - if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { - this.crossOrigin = this._determineCrossOrigin(this.url); - } - - switch (this.loadType) { - case Resource.LOAD_TYPE.IMAGE: - this.type = Resource.TYPE.IMAGE; - - this._loadElement('image'); - - break; - - case Resource.LOAD_TYPE.AUDIO: - this.type = Resource.TYPE.AUDIO; - - this._loadSourceElement('audio'); - - break; - - case Resource.LOAD_TYPE.VIDEO: - this.type = Resource.TYPE.VIDEO; - - this._loadSourceElement('video'); - - break; - - case Resource.LOAD_TYPE.XHR: - /* falls through */ - - default: - if (useXdr && this.crossOrigin) { - this._loadXdr(); - } else { - this._loadXhr(); - } - - break; - } - } - /** - * Checks if the flag is set. - * - * @private - * @param {number} flag - The flag to check. - * @return {boolean} True if the flag is set. - */ - ; - - _proto._hasFlag = function _hasFlag(flag) { - return (this._flags & flag) !== 0; - } - /** - * (Un)Sets the flag. - * - * @private - * @param {number} flag - The flag to (un)set. - * @param {boolean} value - Whether to set or (un)set the flag. - */ - ; - - _proto._setFlag = function _setFlag(flag, value) { - this._flags = value ? this._flags | flag : this._flags & ~flag; - } - /** - * Clears all the events from the underlying loading source. - * - * @private - */ - ; - - _proto._clearEvents = function _clearEvents() { - clearTimeout(this._elementTimer); - - if (this.data && this.data.removeEventListener) { - this.data.removeEventListener('error', this._boundOnError, false); - this.data.removeEventListener('load', this._boundComplete, false); - this.data.removeEventListener('progress', this._boundOnProgress, false); - this.data.removeEventListener('canplaythrough', this._boundComplete, false); - } - - if (this.xhr) { - if (this.xhr.removeEventListener) { - this.xhr.removeEventListener('error', this._boundXhrOnError, false); - this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); - this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); - this.xhr.removeEventListener('progress', this._boundOnProgress, false); - this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); - } else { - this.xhr.onerror = null; - this.xhr.ontimeout = null; - this.xhr.onprogress = null; - this.xhr.onload = null; - } - } - } - /** - * Finalizes the load. - * - * @private - */ - ; - - _proto._finish = function _finish() { - if (this.isComplete) { - throw new Error('Complete called again for an already completed resource.'); - } - - this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); - - this._setFlag(Resource.STATUS_FLAGS.LOADING, false); - - this.onComplete.dispatch(this); - } - /** - * Loads this resources using an element that has a single source, - * like an HTMLImageElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadElement = function _loadElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'image' && typeof window.Image !== 'undefined') { - this.data = new Image(); - } else { - this.data = document.createElement(type); - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - this.data.src = this.url; - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an element that has multiple sources, - * like an HTMLAudioElement or HTMLVideoElement. - * - * @private - * @param {string} type - The type of element to use. - */ - ; - - _proto._loadSourceElement = function _loadSourceElement(type) { - if (this.metadata.loadElement) { - this.data = this.metadata.loadElement; - } else if (type === 'audio' && typeof window.Audio !== 'undefined') { - this.data = new Audio(); - } else { - this.data = document.createElement(type); - } - - if (this.data === null) { - this.abort("Unsupported element: " + type); - return; - } - - if (this.crossOrigin) { - this.data.crossOrigin = this.crossOrigin; - } - - if (!this.metadata.skipSource) { - // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') - if (navigator.isCocoonJS) { - this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; - } else if (Array.isArray(this.url)) { - var mimeTypes = this.metadata.mimeType; - - for (var i = 0; i < this.url.length; ++i) { - this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); - } - } else { - var _mimeTypes = this.metadata.mimeType; - this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); - } - } - - this.data.addEventListener('error', this._boundOnError, false); - this.data.addEventListener('load', this._boundComplete, false); - this.data.addEventListener('progress', this._boundOnProgress, false); - this.data.addEventListener('canplaythrough', this._boundComplete, false); - this.data.load(); - - if (this.timeout) { - this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); - } - } - /** - * Loads this resources using an XMLHttpRequest. - * - * @private - */ - ; - - _proto._loadXhr = function _loadXhr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url - - xhr.open('GET', this.url, true); - xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers - // *cough* safari *cough* can't deal with it. - - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; - } else { - xhr.responseType = this.xhrType; - } - - xhr.addEventListener('error', this._boundXhrOnError, false); - xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); - xhr.addEventListener('abort', this._boundXhrOnAbort, false); - xhr.addEventListener('progress', this._boundOnProgress, false); - xhr.addEventListener('load', this._boundXhrOnLoad, false); - xhr.send(); - } - /** - * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). - * - * @private - */ - ; - - _proto._loadXdr = function _loadXdr() { - // if unset, determine the value - if (typeof this.xhrType !== 'string') { - this.xhrType = this._determineXhrType(); - } - - var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef - // XDomainRequest has a few quirks. Occasionally it will abort requests - // A way to avoid this is to make sure ALL callbacks are set even if not used - // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 - - xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 - - xdr.onerror = this._boundXhrOnError; - xdr.ontimeout = this._boundXhrOnTimeout; - xdr.onprogress = this._boundOnProgress; - xdr.onload = this._boundXhrOnLoad; - xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an - // issue with the interface where some requests are lost if multiple - // XDomainRequests are being sent at the same time. - // Some info here: https://github.com/photonstorm/phaser/issues/1248 - - setTimeout(function () { - return xdr.send(); - }, 1); - } - /** - * Creates a source used in loading via an element. - * - * @private - * @param {string} type - The element type (video or audio). - * @param {string} url - The source URL to load from. - * @param {string} [mime] - The mime type of the video - * @return {HTMLSourceElement} The source element. - */ - ; - - _proto._createSource = function _createSource(type, url, mime) { - if (!mime) { - mime = type + "/" + this._getExtension(url); - } - - var source = document.createElement('source'); - source.src = url; - source.type = mime; - return source; - } - /** - * Called if a load errors out. - * - * @param {Event} event - The error event from the element that emits it. - * @private - */ - ; - - _proto._onError = function _onError(event) { - this.abort("Failed to load element using: " + event.target.nodeName); - } - /** - * Called if a load progress event fires for an element or xhr/xdr. - * - * @private - * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. - */ - ; - - _proto._onProgress = function _onProgress(event) { - if (event && event.lengthComputable) { - this.onProgress.dispatch(this, event.loaded / event.total); - } - } - /** - * Called if a timeout event fires for an element. - * - * @private - */ - ; - - _proto._onTimeout = function _onTimeout() { - this.abort("Load timed out."); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnError = function _xhrOnError() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); - } - /** - * Called if an error event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnTimeout = function _xhrOnTimeout() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request timed out."); - } - /** - * Called if an abort event fires for xhr/xdr. - * - * @private - */ - ; - - _proto._xhrOnAbort = function _xhrOnAbort() { - var xhr = this.xhr; - this.abort(reqType(xhr) + " Request was aborted by the user."); - } - /** - * Called when data successfully loads from an xhr/xdr request. - * - * @private - * @param {XMLHttpRequestLoadEvent|Event} event - Load event - */ - ; - - _proto._xhrOnLoad = function _xhrOnLoad() { - var xhr = this.xhr; - var text = ''; - var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. - // responseText is accessible only if responseType is '' or 'text' and on older browsers - - if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { - text = xhr.responseText; - } // status can be 0 when using the `file://` protocol so we also check if a response is set. - // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. - - - if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { - status = STATUS_OK; - } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - else if (status === STATUS_IE_BUG_EMPTY) { - status = STATUS_EMPTY; - } - - var statusType = status / 100 | 0; - - if (statusType === STATUS_TYPE_OK) { - // if text, just return it - if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { - this.data = text; - this.type = Resource.TYPE.TEXT; - } // if json, parse into json object - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { - try { - this.data = JSON.parse(text); - this.type = Resource.TYPE.JSON; - } catch (e) { - this.abort("Error trying to parse loaded json: " + e); - return; - } - } // if xml, parse into an xml document or div element - else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { - try { - if (window.DOMParser) { - var domparser = new DOMParser(); - this.data = domparser.parseFromString(text, 'text/xml'); - } else { - var div = document.createElement('div'); - div.innerHTML = text; - this.data = div; - } - - this.type = Resource.TYPE.XML; - } catch (e) { - this.abort("Error trying to parse loaded xml: " + e); - return; - } - } // other types just return the response - else { - this.data = xhr.response || text; - } - } else { - this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); - return; - } - - this.complete(); - } - /** - * Sets the `crossOrigin` property for this resource based on if the url - * for this resource is cross-origin. If crossOrigin was manually set, this - * function does nothing. - * - * @private - * @param {string} url - The url to test. - * @param {object} [loc=window.location] - The location object to test against. - * @return {string} The crossOrigin value to use (or empty string for none). - */ - ; - - _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) { - // data: and javascript: urls are considered same-origin - if (url.indexOf('data:') === 0) { - return ''; - } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special - // origin designed not to match window.location.origin, and will always require - // crossOrigin requests regardless of whether the location matches. - - - if (window.origin !== window.location.origin) { - return 'anonymous'; - } // default is window.location - - - loc = loc || window.location; - - if (!tempAnchor$1) { - tempAnchor$1 = document.createElement('a'); - } // let the browser determine the full href for the url of this resource and then - // parse with the node url lib, we can't use the properties of the anchor element - // because they don't work in IE9 :( - - - tempAnchor$1.href = url; - url = parseUri(tempAnchor$1.href, { - strictMode: true - }); - var samePort = !url.port && loc.port === '' || url.port === loc.port; - var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin - - if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { - return 'anonymous'; - } - - return ''; - } - /** - * Determines the responseType of an XHR request based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. - */ - ; - - _proto._determineXhrType = function _determineXhrType() { - return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; - } - /** - * Determines the loadType of a resource based on the extension of the - * resource being loaded. - * - * @private - * @return {Resource.LOAD_TYPE} The loadType to use. - */ - ; - - _proto._determineLoadType = function _determineLoadType() { - return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; - } - /** - * Extracts the extension (sans '.') of the file being loaded by the resource. - * - * @private - * @return {string} The extension. - */ - ; - - _proto._getExtension = function _getExtension() { - var url = this.url; - var ext = ''; - - if (this.isDataUrl) { - var slashIndex = url.indexOf('/'); - ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); - } else { - var queryStart = url.indexOf('?'); - var hashStart = url.indexOf('#'); - var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); - url = url.substring(0, index); - ext = url.substring(url.lastIndexOf('.') + 1); - } - - return ext.toLowerCase(); - } - /** - * Determines the mime type of an XHR request based on the responseType of - * resource being loaded. - * - * @private - * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. - * @return {string} The mime type to use. - */ - ; - - _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) { - switch (type) { - case Resource.XHR_RESPONSE_TYPE.BUFFER: - return 'application/octet-binary'; - - case Resource.XHR_RESPONSE_TYPE.BLOB: - return 'application/blob'; - - case Resource.XHR_RESPONSE_TYPE.DOCUMENT: - return 'application/xml'; - - case Resource.XHR_RESPONSE_TYPE.JSON: - return 'application/json'; - - case Resource.XHR_RESPONSE_TYPE.DEFAULT: - case Resource.XHR_RESPONSE_TYPE.TEXT: - /* falls through */ - - default: - return 'text/plain'; - } - }; - - _createClass(Resource, [{ - key: "isDataUrl", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); - } - /** - * Describes if this resource has finished loading. Is true when the resource has completely - * loaded. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isComplete", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); - } - /** - * Describes if this resource is currently loading. Is true when the resource starts loading, - * and is false again when complete. - * - * @readonly - * @member {boolean} - */ - - }, { - key: "isLoading", - get: function get() { - return this._hasFlag(Resource.STATUS_FLAGS.LOADING); - } - }]); - - return Resource; - }(); - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - - Resource$1.STATUS_FLAGS = { - NONE: 0, - DATA_URL: 1 << 0, - COMPLETE: 1 << 1, - LOADING: 1 << 2 - }; - /** - * The types of resources a resource could represent. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.TYPE = { - UNKNOWN: 0, - JSON: 1, - XML: 2, - IMAGE: 3, - AUDIO: 4, - VIDEO: 5, - TEXT: 6 - }; - /** - * The types of loading a resource can use. - * - * @static - * @readonly - * @enum {number} - */ - - Resource$1.LOAD_TYPE = { - /** Uses XMLHttpRequest to load the resource. */ - XHR: 1, - - /** Uses an `Image` object to load the resource. */ - IMAGE: 2, - - /** Uses an `Audio` object to load the resource. */ - AUDIO: 3, - - /** Uses a `Video` object to load the resource. */ - VIDEO: 4 - }; - /** - * The XHR ready states, used internally. - * - * @static - * @readonly - * @enum {string} - */ - - Resource$1.XHR_RESPONSE_TYPE = { - /** string */ - DEFAULT: 'text', - - /** ArrayBuffer */ - BUFFER: 'arraybuffer', - - /** Blob */ - BLOB: 'blob', - - /** Document */ - DOCUMENT: 'document', - - /** Object */ - JSON: 'json', - - /** String */ - TEXT: 'text' - }; - Resource$1._loadTypeMap = { - // images - gif: Resource$1.LOAD_TYPE.IMAGE, - png: Resource$1.LOAD_TYPE.IMAGE, - bmp: Resource$1.LOAD_TYPE.IMAGE, - jpg: Resource$1.LOAD_TYPE.IMAGE, - jpeg: Resource$1.LOAD_TYPE.IMAGE, - tif: Resource$1.LOAD_TYPE.IMAGE, - tiff: Resource$1.LOAD_TYPE.IMAGE, - webp: Resource$1.LOAD_TYPE.IMAGE, - tga: Resource$1.LOAD_TYPE.IMAGE, - svg: Resource$1.LOAD_TYPE.IMAGE, - 'svg+xml': Resource$1.LOAD_TYPE.IMAGE, - // for SVG data urls - // audio - mp3: Resource$1.LOAD_TYPE.AUDIO, - ogg: Resource$1.LOAD_TYPE.AUDIO, - wav: Resource$1.LOAD_TYPE.AUDIO, - // videos - mp4: Resource$1.LOAD_TYPE.VIDEO, - webm: Resource$1.LOAD_TYPE.VIDEO - }; - Resource$1._xhrTypeMap = { - // xml - xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. - // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, - // this should probably be fine. - tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, - // images - gif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - png: Resource$1.XHR_RESPONSE_TYPE.BLOB, - bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tif: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB, - webp: Resource$1.XHR_RESPONSE_TYPE.BLOB, - tga: Resource$1.XHR_RESPONSE_TYPE.BLOB, - // json - json: Resource$1.XHR_RESPONSE_TYPE.JSON, - // text - text: Resource$1.XHR_RESPONSE_TYPE.TEXT, - txt: Resource$1.XHR_RESPONSE_TYPE.TEXT, - // fonts - ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER, - otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER - }; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif - - Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; - /** - * Quick helper to set a value on one of the extension maps. Ensures there is no - * dot at the start of the extension. - * - * @ignore - * @param {object} map - The map to set on. - * @param {string} extname - The extension (or key) to set. - * @param {number} val - The value to set. - */ - - function setExtMap(map, extname, val) { - if (extname && extname.indexOf('.') === 0) { - extname = extname.substring(1); - } - - if (!extname) { - return; - } - - map[extname] = val; - } - /** - * Quick helper to get string xhr type. - * - * @ignore - * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. - * @return {string} The type. - */ - - - function reqType(xhr) { - return xhr.toString().replace('object ', ''); - } - - var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - /** - * Encodes binary into base64. - * - * @function encodeBinary - * @param {string} input The input data to encode. - * @returns {string} The encoded base64 string - */ - - function encodeBinary(input) { - var output = ''; - var inx = 0; - - while (inx < input.length) { - // Fill byte buffer array - var bytebuffer = [0, 0, 0]; - var encodedCharIndexes = [0, 0, 0, 0]; - - for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { - if (inx < input.length) { - // throw away high-order byte, as documented at: - // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data - bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; - } else { - bytebuffer[jnx] = 0; - } - } // Get each encoded character, 6 bits at a time - // index 1: first 6 bits - - - encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) - - encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) - - encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3) - - encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly - - var paddingBytes = inx - (input.length - 1); - - switch (paddingBytes) { - case 2: - // Set last 2 characters to padding char - encodedCharIndexes[3] = 64; - encodedCharIndexes[2] = 64; - break; - - case 1: - // Set last character to padding char - encodedCharIndexes[3] = 64; - break; - - default: - break; - // No padding - proceed - } // Now we will grab each appropriate character out of our keystring - // based on our index array and append it to the output string - - - for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { - output += _keyStr.charAt(encodedCharIndexes[_jnx]); - } - } - - return output; - } - - var Url$1 = window.URL || window.webkitURL; - /** - * A middleware for transforming XHR loaded Blobs into more useful objects - * - * @memberof middleware - * @function parsing - * @example - * import { Loader, middleware } from 'resource-loader'; - * const loader = new Loader(); - * loader.use(middleware.parsing); - * @param {Resource} resource - Current Resource - * @param {function} next - Callback when complete - */ - - function parsing(resource, next) { - if (!resource.data) { - next(); - return; - } // if this was an XHR load of a blob - - - if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) { - // if there is no blob support we probably got a binary string back - if (!window.Blob || typeof resource.data === 'string') { - var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url - - if (type && type.indexOf('image') === 0) { - resource.data = new Image(); - resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); - resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback - - resource.data.onload = function () { - resource.data.onload = null; - next(); - }; // next will be called on load - - - return; - } - } // if content type says this is an image, then we should transform the blob into an Image object - else if (resource.data.type.indexOf('image') === 0) { - var src = Url$1.createObjectURL(resource.data); - resource.blob = resource.data; - resource.data = new Image(); - resource.data.src = src; - resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads - // TODO: Is this correct? Will the image be invalid after revoking? - - resource.data.onload = function () { - Url$1.revokeObjectURL(src); - resource.data.onload = null; - next(); - }; // next will be called on load. - - - return; - } - } - - next(); - } - - /** - * @namespace middleware - */ - - var index$1 = ({ - caching: caching, - parsing: parsing - }); - - var MAX_PROGRESS = 100; - var rgxExtractUrlHash = /(#[\w-]+)?$/; - /** - * Manages the state and loading of multiple resources to load. - * - * @class - */ - - var Loader = - /*#__PURE__*/ - function () { - /** - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - function Loader(baseUrl, concurrency) { - var _this = this; - - if (baseUrl === void 0) { - baseUrl = ''; - } - - if (concurrency === void 0) { - concurrency = 10; - } - - /** - * The base url for all resources loaded by this loader. - * - * @member {string} - */ - this.baseUrl = baseUrl; - /** - * The progress percent of the loader going through the queue. - * - * @member {number} - * @default 0 - */ - - this.progress = 0; - /** - * Loading state of the loader, true if it is currently loading resources. - * - * @member {boolean} - * @default false - */ - - this.loading = false; - /** - * A querystring to append to every URL added to the loader. - * - * This should be a valid query string *without* the question-mark (`?`). The loader will - * also *not* escape values for you. Make sure to escape your parameters with - * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. - * - * @example - * const loader = new Loader(); - * - * loader.defaultQueryString = 'user=me&password=secret'; - * - * // This will request 'image.png?user=me&password=secret' - * loader.add('image.png').load(); - * - * loader.reset(); - * - * // This will request 'image.png?v=1&user=me&password=secret' - * loader.add('iamge.png?v=1').load(); - * - * @member {string} - * @default '' - */ - - this.defaultQueryString = ''; - /** - * The middleware to run before loading each resource. - * - * @private - * @member {function[]} - */ - - this._beforeMiddleware = []; - /** - * The middleware to run after loading each resource. - * - * @private - * @member {function[]} - */ - - this._afterMiddleware = []; - /** - * The tracks the resources we are currently completing parsing for. - * - * @private - * @member {Resource[]} - */ - - this._resourcesParsing = []; - /** - * The `_loadResource` function bound with this object context. - * - * @private - * @member {function} - * @param {Resource} r - The resource to load - * @param {Function} d - The dequeue function - * @return {undefined} - */ - - this._boundLoadResource = function (r, d) { - return _this._loadResource(r, d); - }; - /** - * The resources waiting to be loaded. - * - * @private - * @member {Resource[]} - */ - - - this._queue = queue(this._boundLoadResource, concurrency); - - this._queue.pause(); - /** - * All the resources for this loader keyed by name. - * - * @member {object} - */ - - - this.resources = {}; - /** - * Dispatched once per loaded or errored resource. - * - * The callback looks like {@link Loader.OnProgressSignal}. - * - * @member {Signal} - */ - - this.onProgress = new Signal(); - /** - * Dispatched once per errored resource. - * - * The callback looks like {@link Loader.OnErrorSignal}. - * - * @member {Signal} - */ - - this.onError = new Signal(); - /** - * Dispatched once per loaded resource. - * - * The callback looks like {@link Loader.OnLoadSignal}. - * - * @member {Signal} - */ - - this.onLoad = new Signal(); - /** - * Dispatched when the loader begins to process the queue. - * - * The callback looks like {@link Loader.OnStartSignal}. - * - * @member {Signal} - */ - - this.onStart = new Signal(); - /** - * Dispatched when the queued resources all load. - * - * The callback looks like {@link Loader.OnCompleteSignal}. - * - * @member {Signal} - */ - - this.onComplete = new Signal(); // Add default before middleware - - for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { - this.pre(Loader._defaultBeforeMiddleware[i]); - } // Add default after middleware - - - for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { - this.use(Loader._defaultAfterMiddleware[_i]); - } - } - /** - * When the progress changes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnProgressSignal - * @param {Loader} loader - The loader the progress is advancing on. - * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. - */ - - /** - * When an error occurrs the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnErrorSignal - * @param {Loader} loader - The loader the error happened in. - * @param {Resource} resource - The resource that caused the error. - */ - - /** - * When a load completes the loader and resource are disaptched. - * - * @memberof Loader - * @callback OnLoadSignal - * @param {Loader} loader - The loader that laoded the resource. - * @param {Resource} resource - The resource that has completed loading. - */ - - /** - * When the loader starts loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnStartSignal - * @param {Loader} loader - The loader that has started loading resources. - */ - - /** - * When the loader completes loading resources it dispatches this callback. - * - * @memberof Loader - * @callback OnCompleteSignal - * @param {Loader} loader - The loader that has finished loading resources. - */ - - /** - * Options for a call to `.add()`. - * - * @see Loader#add - * - * @typedef {object} IAddOptions - * @property {string} [name] - The name of the resource to load, if not passed the url is used. - * @property {string} [key] - Alias for `name`. - * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. - * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to - * determine automatically. - * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes - * longer than this time it is cancelled and the load is considered a failure. If this value is - * set to `0` then there is no explicit timeout. - * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource - * be loaded? - * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How - * should the data being loaded be interpreted when using XHR? - * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. - * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`. - * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. - */ - - /* eslint-disable require-jsdoc,valid-jsdoc */ - - /** - * Adds a resource (or multiple resources) to the loader queue. - * - * This function can take a wide variety of different parameters. The only thing that is always - * required the url to load. All the following will work: - * - * ```js - * loader - * // normal param syntax - * .add('key', 'http://...', function () {}) - * .add('http://...', function () {}) - * .add('http://...') - * - * // object syntax - * .add({ - * name: 'key2', - * url: 'http://...' - * }, function () {}) - * .add({ - * url: 'http://...' - * }, function () {}) - * .add({ - * name: 'key3', - * url: 'http://...' - * onComplete: function () {} - * }) - * .add({ - * url: 'https://...', - * onComplete: function () {}, - * crossOrigin: true - * }) - * - * // you can also pass an array of objects or urls or both - * .add([ - * { name: 'key4', url: 'http://...', onComplete: function () {} }, - * { url: 'http://...', onComplete: function () {} }, - * 'http://...' - * ]) - * - * // and you can use both params and options - * .add('key', 'http://...', { crossOrigin: true }, function () {}) - * .add('http://...', { crossOrigin: true }, function () {}); - * ``` - * - * @function - * @variation 1 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 2 - * @param {string} name - The name of the resource to load. - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 3 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 4 - * @param {string} url - The url for this resource, relative to the baseUrl of this loader. - * @param {IAddOptions} [options] - The options for the load. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 5 - * @param {IAddOptions} options - The options for the load. This object must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - /** - * @function - * @variation 6 - * @param {Array} resources - An array of resources to load, where each is - * either an object with the options or a string url. If you pass an object, it must contain a `url` property. - * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. - * @return {this} Returns itself. - */ - - - var _proto = Loader.prototype; - - _proto.add = function add(name, url, options, cb) { - // special case of an array of objects or urls - if (Array.isArray(name)) { - for (var i = 0; i < name.length; ++i) { - this.add(name[i]); - } - - return this; - } // if an object is passed instead of params - - - if (typeof name === 'object') { - cb = url || name.callback || name.onComplete; - options = name; - url = name.url; - name = name.name || name.key || name.url; - } // case where no name is passed shift all args over by one. - - - if (typeof url !== 'string') { - cb = options; - options = url; - url = name; - } // now that we shifted make sure we have a proper url. - - - if (typeof url !== 'string') { - throw new Error('No url passed to add resource to loader.'); - } // options are optional so people might pass a function and no options - - - if (typeof options === 'function') { - cb = options; - options = null; - } // if loading already you can only add resources that have a parent. - - - if (this.loading && (!options || !options.parentResource)) { - throw new Error('Cannot add resources while the loader is running.'); - } // check if resource already exists. - - - if (this.resources[name]) { - throw new Error("Resource named \"" + name + "\" already exists."); - } // add base url if this isn't an absolute url - - - url = this._prepareUrl(url); // create the store the resource - - this.resources[name] = new Resource$1(name, url, options); - - if (typeof cb === 'function') { - this.resources[name].onAfterMiddleware.once(cb); - } // if actively loading, make sure to adjust progress chunks for that parent and its children - - - if (this.loading) { - var parent = options.parentResource; - var incompleteChildren = []; +(function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f() } else if (typeof define === "function" && define.amd) { define([], f) } else { var g; if (typeof window !== "undefined") { g = window } else if (typeof global !== "undefined") { g = global } else if (typeof self !== "undefined") { g = self } else { g = this } g.PIXI = f() } })(function () { + var define, module, exports; return (function () { function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++)s(r[o]); return s } return e })()({ + 1: [function (require, module, exports) { + /** + * Bit twiddling hacks for JavaScript. + * + * Author: Mikola Lysenko + * + * Ported from Stanford bit twiddling hack library: + * http://graphics.stanford.edu/~seander/bithacks.html + */ + + "use strict"; "use restrict"; + + //Number of bits in an integer + var INT_BITS = 32; + + //Constants + exports.INT_BITS = INT_BITS; + exports.INT_MAX = 0x7fffffff; + exports.INT_MIN = -1 << (INT_BITS - 1); + + //Returns -1, 0, +1 depending on sign of x + exports.sign = function (v) { + return (v > 0) - (v < 0); + } + + //Computes absolute value of integer + exports.abs = function (v) { + var mask = v >> (INT_BITS - 1); + return (v ^ mask) - mask; + } + + //Computes minimum of integers x and y + exports.min = function (x, y) { + return y ^ ((x ^ y) & -(x < y)); + } + + //Computes maximum of integers x and y + exports.max = function (x, y) { + return x ^ ((x ^ y) & -(x < y)); + } + + //Checks if a number is a power of two + exports.isPow2 = function (v) { + return !(v & (v - 1)) && (!!v); + } + + //Computes log base 2 of v + exports.log2 = function (v) { + var r, shift; + r = (v > 0xFFFF) << 4; v >>>= r; + shift = (v > 0xFF) << 3; v >>>= shift; r |= shift; + shift = (v > 0xF) << 2; v >>>= shift; r |= shift; + shift = (v > 0x3) << 1; v >>>= shift; r |= shift; + return r | (v >> 1); + } + + //Computes log base 10 of v + exports.log10 = function (v) { + return (v >= 1000000000) ? 9 : (v >= 100000000) ? 8 : (v >= 10000000) ? 7 : + (v >= 1000000) ? 6 : (v >= 100000) ? 5 : (v >= 10000) ? 4 : + (v >= 1000) ? 3 : (v >= 100) ? 2 : (v >= 10) ? 1 : 0; + } + + //Counts number of bits + exports.popCount = function (v) { + v = v - ((v >>> 1) & 0x55555555); + v = (v & 0x33333333) + ((v >>> 2) & 0x33333333); + return ((v + (v >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24; + } + + //Counts number of trailing zeros + function countTrailingZeros(v) { + var c = 32; + v &= -v; + if (v) c--; + if (v & 0x0000FFFF) c -= 16; + if (v & 0x00FF00FF) c -= 8; + if (v & 0x0F0F0F0F) c -= 4; + if (v & 0x33333333) c -= 2; + if (v & 0x55555555) c -= 1; + return c; + } + exports.countTrailingZeros = countTrailingZeros; + + //Rounds to next power of 2 + exports.nextPow2 = function (v) { + v += v === 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; + } + + //Rounds down to previous power of 2 + exports.prevPow2 = function (v) { + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v - (v >>> 1); + } + + //Computes parity of word + exports.parity = function (v) { + v ^= v >>> 16; + v ^= v >>> 8; + v ^= v >>> 4; + v &= 0xf; + return (0x6996 >>> v) & 1; + } + + var REVERSE_TABLE = new Array(256); + + (function (tab) { + for (var i = 0; i < 256; ++i) { + var v = i, r = i, s = 7; + for (v >>>= 1; v; v >>>= 1) { + r <<= 1; + r |= v & 1; + --s; + } + tab[i] = (r << s) & 0xff; + } + })(REVERSE_TABLE); + + //Reverse bits in a 32 bit word + exports.reverse = function (v) { + return (REVERSE_TABLE[v & 0xff] << 24) | + (REVERSE_TABLE[(v >>> 8) & 0xff] << 16) | + (REVERSE_TABLE[(v >>> 16) & 0xff] << 8) | + REVERSE_TABLE[(v >>> 24) & 0xff]; + } + + //Interleave bits of 2 coordinates with 16 bits. Useful for fast quadtree codes + exports.interleave2 = function (x, y) { + x &= 0xFFFF; + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y &= 0xFFFF; + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); + } + + //Extracts the nth interleaved component + exports.deinterleave2 = function (v, n) { + v = (v >>> n) & 0x55555555; + v = (v | (v >>> 1)) & 0x33333333; + v = (v | (v >>> 2)) & 0x0F0F0F0F; + v = (v | (v >>> 4)) & 0x00FF00FF; + v = (v | (v >>> 16)) & 0x000FFFF; + return (v << 16) >> 16; + } + + + //Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes + exports.interleave3 = function (x, y, z) { + x &= 0x3FF; + x = (x | (x << 16)) & 4278190335; + x = (x | (x << 8)) & 251719695; + x = (x | (x << 4)) & 3272356035; + x = (x | (x << 2)) & 1227133513; + + y &= 0x3FF; + y = (y | (y << 16)) & 4278190335; + y = (y | (y << 8)) & 251719695; + y = (y | (y << 4)) & 3272356035; + y = (y | (y << 2)) & 1227133513; + x |= (y << 1); + + z &= 0x3FF; + z = (z | (z << 16)) & 4278190335; + z = (z | (z << 8)) & 251719695; + z = (z | (z << 4)) & 3272356035; + z = (z | (z << 2)) & 1227133513; + + return x | (z << 2); + } + + //Extracts nth interleaved component of a 3-tuple + exports.deinterleave3 = function (v, n) { + v = (v >>> n) & 1227133513; + v = (v | (v >>> 2)) & 3272356035; + v = (v | (v >>> 4)) & 251719695; + v = (v | (v >>> 8)) & 4278190335; + v = (v | (v >>> 16)) & 0x3FF; + return (v << 22) >> 22; + } + + //Computes next combination in colexicographic order (this is mistakenly called nextPermutation on the bit twiddling hacks page) + exports.nextCombination = function (v) { + var t = v | (v - 1); + return (t + 1) | (((~t & -~t) - 1) >>> (countTrailingZeros(v) + 1)); + } + + + }, {}], 2: [function (require, module, exports) { + 'use strict'; + + module.exports = earcut; + module.exports.default = earcut; + + function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode || outerNode.next === outerNode.prev) return triangles; + + var minX, minY, maxX, maxY, x, y, invSize; + + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 1 / invSize : 0; + } + + earcutLinked(outerNode, triangles, dim, minX, minY, invSize); + + return triangles; + } + + // create a circular doubly linked list from polygon points in the specified winding order + function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; + } + + // eliminate colinear or duplicate points + function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) break; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; + } + + // main ear slicing loop which triangulates a polygon (given as a linked list) + function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(ear, triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } + + break; + } + } + } + + // check whether a polygon node forms a valid ear with adjacent nodes + function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; + } + + function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + + var p = ear.prevZ, + n = ear.nextZ; + + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + return true; + } + + // go through all polygon nodes and cure small local self-intersections + function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return p; + } + + // try splitting polygon into two and triangulate them independently + function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize); + earcutLinked(c, triangles, dim, minX, minY, invSize); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); + } + + // link every hole into the outer loop, producing a single-ring polygon without holes + function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; + } + + function compareX(a, b) { + return a.x - b.x; + } + + // find a bridge between vertices that connects hole with an outer ring and and link it + function eliminateHole(hole, outerNode) { + outerNode = findHoleBridge(hole, outerNode); + if (outerNode) { + var b = splitPolygon(outerNode, hole); + filterPoints(b, b.next); + } + } + + // David Eberly's algorithm for finding a bridge between hole and outer polygon + function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) return p; + if (hy === p.next.y) return p.next; + } + m = p.x < p.next.x ? p : p.next; + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m.next; + + while (p !== stop) { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } + + return m; + } + + // interlink polygon nodes in z-order + function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); + } + + // Simon Tatham's linked list merge sort algorithm + // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html + function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; + } + + // z-order of a point given coords and inverse of the longer side of data bbox + function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) * invSize; + y = 32767 * (y - minY) * invSize; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); + } + + // find the leftmost node of a polygon ring + function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; + } + + // check if a point lies within a convex triangle + function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; + } + + // check if a diagonal between two polygon nodes is valid (lies in polygon interior) + function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); + } + + // signed area of a triangle + function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); + } + + // check if two points are equal + function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; + } + + // check if two segments intersect + function intersects(p1, q1, p2, q2) { + if ((equals(p1, q1) && equals(p2, q2)) || + (equals(p1, q2) && equals(p2, q1))) return true; + return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && + area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; + } + + // check if a polygon diagonal intersects any polygon segments + function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; + } + + // check if a polygon diagonal is locally inside the polygon + function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; + } + + // check if the middle point of a polygon diagonal is inside the polygon + function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; + } + + // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; + // if one belongs to the outer ring and another to a hole, it merges it into a single ring + function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; + } + + // create a node and optionally link it with previous one (in a circular doubly linked list) + function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; + } + + function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; + } + + function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; + } + + // return a percentage difference between the polygon area and its triangulation area; + // used to verify correctness of triangulation + earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); + }; + + function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; + } + + // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts + earcut.flatten = function (data) { + var dim = data[0][0].length, + result = { vertices: [], holes: [], dimensions: dim }, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; + }; + + }, {}], 3: [function (require, module, exports) { + 'use strict'; + + var has = Object.prototype.hasOwnProperty + , prefix = '~'; + + /** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @api private + */ + function Events() { } + + // + // We try to not inherit from `Object.prototype`. In some engines creating an + // instance in this way is faster than calling `Object.create(null)` directly. + // If `Object.create(null)` is not supported we prefix the event names with a + // character to make sure that the built-in object properties are not + // overridden or used as an attack vector. + // + if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; + } + + /** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {Mixed} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @api private + */ + function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; + } + + /** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @api public + */ + function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; + } + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @api public + */ + EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; + }; + + /** + * Return the listeners registered for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Boolean} exists Only check if there are listeners. + * @returns {Array|Boolean} + * @api public + */ + EventEmitter.prototype.listeners = function listeners(event, exists) { + var evt = prefix ? prefix + event : event + , available = this._events[evt]; + + if (exists) return !!available; + if (!available) return []; + if (available.fn) return [available.fn]; + + for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) { + ee[i] = available[i].fn; + } + + return ee; + }; + + /** + * Calls each of the listeners registered for a given event. + * + * @param {String|Symbol} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @api public + */ + EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len - 1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; + }; + + /** + * Add a listener for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn The listener function. + * @param {Mixed} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.on = function on(event, fn, context) { + var listener = new EE(fn, context || this) + , evt = prefix ? prefix + event : event; + + if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; + else if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [this._events[evt], listener]; + + return this; + }; + + /** + * Add a one-time listener for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn The listener function. + * @param {Mixed} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.once = function once(event, fn, context) { + var listener = new EE(fn, context || this, true) + , evt = prefix ? prefix + event : event; + + if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; + else if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [this._events[evt], listener]; + + return this; + }; + + /** + * Remove the listeners of a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {Mixed} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn + && (!once || listeners.once) + && (!context || listeners.context === context) + ) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn + || (once && !listeners[i].once) + || (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + + return this; + }; + + /** + * Remove all listeners, or those of the specified event. + * + * @param {String|Symbol} [event] The event name. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; + }; + + // + // Alias methods names because people roll like that. + // + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + // + // This function doesn't apply anymore. + // + EventEmitter.prototype.setMaxListeners = function setMaxListeners() { + return this; + }; + + // + // Expose the prefix. + // + EventEmitter.prefixed = prefix; + + // + // Allow `EventEmitter` to be imported as module namespace. + // + EventEmitter.EventEmitter = EventEmitter; + + // + // Expose the module. + // + if ('undefined' !== typeof module) { + module.exports = EventEmitter; + } + + }, {}], 4: [function (require, module, exports) { + !function (e) { var n = /iPhone/i, t = /iPod/i, r = /iPad/i, a = /\bAndroid(?:.+)Mobile\b/i, p = /Android/i, l = /\bAndroid(?:.+)SD4930UR\b/i, b = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i, f = /Windows Phone/i, u = /\bWindows(?:.+)ARM\b/i, c = /BlackBerry/i, s = /BB10/i, v = /Opera Mini/i, h = /\b(CriOS|Chrome)(?:.+)Mobile/i, w = /\Mobile(?:.+)Firefox\b/i; function m(e, i) { return e.test(i) } function i(e) { var i = e || ("undefined" != typeof navigator ? navigator.userAgent : ""), o = i.split("[FBAN"); void 0 !== o[1] && (i = o[0]), void 0 !== (o = i.split("Twitter"))[1] && (i = o[0]); var d = { apple: { phone: m(n, i) && !m(f, i), ipod: m(t, i), tablet: !m(n, i) && m(r, i) && !m(f, i), device: (m(n, i) || m(t, i) || m(r, i)) && !m(f, i) }, amazon: { phone: m(l, i), tablet: !m(l, i) && m(b, i), device: m(l, i) || m(b, i) }, android: { phone: !m(f, i) && m(l, i) || !m(f, i) && m(a, i), tablet: !m(f, i) && !m(l, i) && !m(a, i) && (m(b, i) || m(p, i)), device: !m(f, i) && (m(l, i) || m(b, i) || m(a, i) || m(p, i)) }, windows: { phone: m(f, i), tablet: m(u, i), device: m(f, i) || m(u, i) }, other: { blackberry: m(c, i), blackberry10: m(s, i), opera: m(v, i), firefox: m(w, i), chrome: m(h, i), device: m(c, i) || m(s, i) || m(v, i) || m(w, i) || m(h, i) } }; return d.any = d.apple.device || d.android.device || d.windows.device || d.other.device, d.phone = d.apple.phone || d.android.phone || d.windows.phone, d.tablet = d.apple.tablet || d.android.tablet || d.windows.tablet, d } "undefined" != typeof module && module.exports && "undefined" == typeof window ? module.exports = i : "undefined" != typeof module && module.exports && "undefined" != typeof window ? module.exports = i() : "function" == typeof define && define.amd ? define([], e.isMobile = i()) : e.isMobile = i() }(this); + }, {}], 5: [function (require, module, exports) { + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var MiniSignalBinding = (function () { + function MiniSignalBinding(fn, once, thisArg) { + if (once === undefined) once = false; + + _classCallCheck(this, MiniSignalBinding); + + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + + _createClass(MiniSignalBinding, [{ + key: 'detach', + value: function detach() { + if (this._owner === null) return false; + this._owner.detach(this); + return true; + } + }]); + + return MiniSignalBinding; + })(); + + function _addMiniSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + + node._owner = self; + + return node; + } + + var MiniSignal = (function () { + function MiniSignal() { + _classCallCheck(this, MiniSignal); + + this._head = this._tail = undefined; + } + + _createClass(MiniSignal, [{ + key: 'handlers', + value: function handlers() { + var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var node = this._head; + + if (exists) return !!node; + + var ee = []; + + while (node) { + ee.push(node); + node = node._next; + } + + return ee; + } + }, { + key: 'has', + value: function has(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); + } + + return node._owner === this; + } + }, { + key: 'dispatch', + value: function dispatch() { + var node = this._head; + + if (!node) return false; + + while (node) { + if (node._once) this.detach(node); + node._fn.apply(node._thisArg, arguments); + node = node._next; + } + + return true; + } + }, { + key: 'add', + value: function add(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); + } + }, { + key: 'once', + value: function once(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); + } + }, { + key: 'detach', + value: function detach(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); + } + if (node._owner !== this) return this; + + if (node._prev) node._prev._next = node._next; + if (node._next) node._next._prev = node._prev; + + if (node === this._head) { + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } else if (node === this._tail) { + this._tail = node._prev; + this._tail._next = null; + } + + node._owner = null; + return this; + } + }, { + key: 'detachAll', + value: function detachAll() { + var node = this._head; + if (!node) return this; + + this._head = this._tail = null; + + while (node) { + node._owner = null; + node = node._next; + } + return this; + } + }]); + + return MiniSignal; + })(); + + MiniSignal.MiniSignalBinding = MiniSignalBinding; + + exports['default'] = MiniSignal; + module.exports = exports['default']; + + }, {}], 6: [function (require, module, exports) { + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + + 'use strict'; + /* eslint-disable no-unused-vars */ + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); + } + + function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } + } + + module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; + }; + + }, {}], 7: [function (require, module, exports) { + 'use strict' + + module.exports = function parseURI(str, opts) { + opts = opts || {} + + var o = { + key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ + } + } + + var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str) + var uri = {} + var i = 14 + + while (i--) uri[o.key[i]] = m[i] || '' + + uri[o.q.name] = {} + uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { + if ($1) uri[o.q.name][$1] = $2 + }) + + return uri + } + + }, {}], 8: [function (require, module, exports) { + (function (process) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + // resolves . and .. elements in a path array with directory names there + // must be no slashes, empty elements, or device names (c:\) in the array + // (so also no leading and trailing slashes - it does not distinguish + // relative and absolute paths) + function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; + } + + // Split a filename into [root, dir, basename, ext], unix version + // 'root' is just a slash, or nothing. + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + var splitPath = function (filename) { + return splitPathRe.exec(filename).slice(1); + }; + + // path.resolve([from ...], to) + // posix version + exports.resolve = function () { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; + }; + + // path.normalize(path) + // posix version + exports.normalize = function (path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function (p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; + }; + + // posix version + exports.isAbsolute = function (path) { + return path.charAt(0) === '/'; + }; + + // posix version + exports.join = function () { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function (p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); + }; + + + // path.relative(from, to) + // posix version + exports.relative = function (from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); + }; + + exports.sep = '/'; + exports.delimiter = ':'; + + exports.dirname = function (path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; + }; + + + exports.basename = function (path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; + }; + + + exports.extname = function (path) { + return splitPath(path)[3]; + }; + + function filter(xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; + } + + // String.prototype.substr - negative index don't work in IE8 + var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } + ; + + }).call(this, require('_process')) + + }, { "_process": 26 }], 9: [function (require, module, exports) { + var EMPTY_ARRAY_BUFFER = new ArrayBuffer(0); + + /** + * Helper class to create a webGL buffer + * + * @class + * @memberof PIXI.glCore + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param type {gl.ARRAY_BUFFER | gl.ELEMENT_ARRAY_BUFFER} @mat + * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data + * @param drawType {gl.STATIC_DRAW|gl.DYNAMIC_DRAW|gl.STREAM_DRAW} + */ + var Buffer = function (gl, type, data, drawType) { + + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + /** + * The WebGL buffer, created upon instantiation + * + * @member {WebGLBuffer} + */ + this.buffer = gl.createBuffer(); + + /** + * The type of the buffer + * + * @member {gl.ARRAY_BUFFER|gl.ELEMENT_ARRAY_BUFFER} + */ + this.type = type || gl.ARRAY_BUFFER; + + /** + * The draw type of the buffer + * + * @member {gl.STATIC_DRAW|gl.DYNAMIC_DRAW|gl.STREAM_DRAW} + */ + this.drawType = drawType || gl.STATIC_DRAW; + + /** + * The data in the buffer, as a typed array + * + * @member {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} + */ + this.data = EMPTY_ARRAY_BUFFER; + + if (data) { + this.upload(data); + } + + this._updateID = 0; + }; + + /** + * Uploads the buffer to the GPU + * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data to upload + * @param offset {Number} if only a subset of the data should be uploaded, this is the amount of data to subtract + * @param dontBind {Boolean} whether to bind the buffer before uploading it + */ + Buffer.prototype.upload = function (data, offset, dontBind) { + // todo - needed? + if (!dontBind) this.bind(); + + var gl = this.gl; + + data = data || this.data; + offset = offset || 0; + + if (this.data.byteLength >= data.byteLength) { + gl.bufferSubData(this.type, offset, data); + } + else { + gl.bufferData(this.type, data, this.drawType); + } + + this.data = data; + }; + /** + * Binds the buffer + * + */ + Buffer.prototype.bind = function () { + var gl = this.gl; + gl.bindBuffer(this.type, this.buffer); + }; + + Buffer.createVertexBuffer = function (gl, data, drawType) { + return new Buffer(gl, gl.ARRAY_BUFFER, data, drawType); + }; + + Buffer.createIndexBuffer = function (gl, data, drawType) { + return new Buffer(gl, gl.ELEMENT_ARRAY_BUFFER, data, drawType); + }; + + Buffer.create = function (gl, type, data, drawType) { + return new Buffer(gl, type, data, drawType); + }; + + /** + * Destroys the buffer + * + */ + Buffer.prototype.destroy = function () { + this.gl.deleteBuffer(this.buffer); + }; + + module.exports = Buffer; + + }, {}], 10: [function (require, module, exports) { + + var Texture = require('./GLTexture'); + + /** + * Helper class to create a webGL Framebuffer + * + * @class + * @memberof PIXI.glCore + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param width {Number} the width of the drawing area of the frame buffer + * @param height {Number} the height of the drawing area of the frame buffer + */ + var Framebuffer = function (gl, width, height) { + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + /** + * The frame buffer + * + * @member {WebGLFramebuffer} + */ + this.framebuffer = gl.createFramebuffer(); + + /** + * The stencil buffer + * + * @member {WebGLRenderbuffer} + */ + this.stencil = null; + + /** + * The stencil buffer + * + * @member {PIXI.glCore.GLTexture} + */ + this.texture = null; + + /** + * The width of the drawing area of the buffer + * + * @member {Number} + */ + this.width = width || 100; + /** + * The height of the drawing area of the buffer + * + * @member {Number} + */ + this.height = height || 100; + }; + + /** + * Adds a texture to the frame buffer + * @param texture {PIXI.glCore.GLTexture} + */ + Framebuffer.prototype.enableTexture = function (texture) { + var gl = this.gl; + + this.texture = texture || new Texture(gl); + + this.texture.bind(); + + //gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + + this.bind(); + + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture.texture, 0); + }; + + /** + * Initialises the stencil buffer + */ + Framebuffer.prototype.enableStencil = function () { + if (this.stencil) return; + + var gl = this.gl; + + this.stencil = gl.createRenderbuffer(); + + gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil); + + // TODO.. this is depth AND stencil? + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.stencil); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.width, this.height); + + + }; + + /** + * Erases the drawing area and fills it with a colour + * @param r {Number} the red value of the clearing colour + * @param g {Number} the green value of the clearing colour + * @param b {Number} the blue value of the clearing colour + * @param a {Number} the alpha value of the clearing colour + */ + Framebuffer.prototype.clear = function (r, g, b, a) { + this.bind(); + + var gl = this.gl; + + gl.clearColor(r, g, b, a); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + }; + + /** + * Binds the frame buffer to the WebGL context + */ + Framebuffer.prototype.bind = function () { + var gl = this.gl; + gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); + }; + + /** + * Unbinds the frame buffer to the WebGL context + */ + Framebuffer.prototype.unbind = function () { + var gl = this.gl; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + /** + * Resizes the drawing area of the buffer to the given width and height + * @param width {Number} the new width + * @param height {Number} the new height + */ + Framebuffer.prototype.resize = function (width, height) { + var gl = this.gl; + + this.width = width; + this.height = height; + + if (this.texture) { + this.texture.uploadData(null, width, height); + } + + if (this.stencil) { + // update the stencil buffer width and height + gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); + } + }; + + /** + * Destroys this buffer + */ + Framebuffer.prototype.destroy = function () { + var gl = this.gl; + + //TODO + if (this.texture) { + this.texture.destroy(); + } + + gl.deleteFramebuffer(this.framebuffer); + + this.gl = null; + + this.stencil = null; + this.texture = null; + }; + + /** + * Creates a frame buffer with a texture containing the given data + * @static + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param width {Number} the width of the drawing area of the frame buffer + * @param height {Number} the height of the drawing area of the frame buffer + * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data + */ + Framebuffer.createRGBA = function (gl, width, height, data) { + var texture = Texture.fromData(gl, null, width, height); + texture.enableNearestScaling(); + texture.enableWrapClamp(); + + //now create the framebuffer object and attach the texture to it. + var fbo = new Framebuffer(gl, width, height); + fbo.enableTexture(texture); + //fbo.enableStencil(); // get this back on soon! + + //fbo.enableStencil(); // get this back on soon! + + fbo.unbind(); + + return fbo; + }; + + /** + * Creates a frame buffer with a texture containing the given data + * @static + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param width {Number} the width of the drawing area of the frame buffer + * @param height {Number} the height of the drawing area of the frame buffer + * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data + */ + Framebuffer.createFloat32 = function (gl, width, height, data) { + // create a new texture.. + var texture = new Texture.fromData(gl, data, width, height); + texture.enableNearestScaling(); + texture.enableWrapClamp(); + + //now create the framebuffer object and attach the texture to it. + var fbo = new Framebuffer(gl, width, height); + fbo.enableTexture(texture); + + fbo.unbind(); + + return fbo; + }; + + module.exports = Framebuffer; + + }, { "./GLTexture": 12 }], 11: [function (require, module, exports) { + + var compileProgram = require('./shader/compileProgram'), + extractAttributes = require('./shader/extractAttributes'), + extractUniforms = require('./shader/extractUniforms'), + setPrecision = require('./shader/setPrecision'), + generateUniformAccessObject = require('./shader/generateUniformAccessObject'); + + /** + * Helper class to create a webGL Shader + * + * @class + * @memberof PIXI.glCore + * @param gl {WebGLRenderingContext} + * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. + * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param precision {string} The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. + * @param attributeLocations {object} A key value pair showing which location eact attribute should sit eg {position:0, uvs:1} + */ + var Shader = function (gl, vertexSrc, fragmentSrc, precision, attributeLocations) { + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + if (precision) { + vertexSrc = setPrecision(vertexSrc, precision); + fragmentSrc = setPrecision(fragmentSrc, precision); + } + + /** + * The shader program + * + * @member {WebGLProgram} + */ + // First compile the program.. + this.program = compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations); + + /** + * The attributes of the shader as an object containing the following properties + * { + * type, + * size, + * location, + * pointer + * } + * @member {Object} + */ + // next extract the attributes + this.attributes = extractAttributes(gl, this.program); + + this.uniformData = extractUniforms(gl, this.program); + + /** + * The uniforms of the shader as an object containing the following properties + * { + * gl, + * data + * } + * @member {Object} + */ + this.uniforms = generateUniformAccessObject(gl, this.uniformData); + + }; + /** + * Uses this shader + * + * @return {PIXI.glCore.GLShader} Returns itself. + */ + Shader.prototype.bind = function () { + this.gl.useProgram(this.program); + return this; + }; + + /** + * Destroys this shader + * TODO + */ + Shader.prototype.destroy = function () { + this.attributes = null; + this.uniformData = null; + this.uniforms = null; + + var gl = this.gl; + gl.deleteProgram(this.program); + }; + + + module.exports = Shader; + + }, { "./shader/compileProgram": 17, "./shader/extractAttributes": 19, "./shader/extractUniforms": 20, "./shader/generateUniformAccessObject": 21, "./shader/setPrecision": 25 }], 12: [function (require, module, exports) { + + /** + * Helper class to create a WebGL Texture + * + * @class + * @memberof PIXI.glCore + * @param gl {WebGLRenderingContext} The current WebGL context + * @param width {number} the width of the texture + * @param height {number} the height of the texture + * @param format {number} the pixel format of the texture. defaults to gl.RGBA + * @param type {number} the gl type of the texture. defaults to gl.UNSIGNED_BYTE + */ + var Texture = function (gl, width, height, format, type) { + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + + /** + * The WebGL texture + * + * @member {WebGLTexture} + */ + this.texture = gl.createTexture(); + + /** + * If mipmapping was used for this texture, enable and disable with enableMipmap() + * + * @member {Boolean} + */ + // some settings.. + this.mipmap = false; + + + /** + * Set to true to enable pre-multiplied alpha + * + * @member {Boolean} + */ + this.premultiplyAlpha = false; + + /** + * The width of texture + * + * @member {Number} + */ + this.width = width || -1; + /** + * The height of texture + * + * @member {Number} + */ + this.height = height || -1; + + /** + * The pixel format of the texture. defaults to gl.RGBA + * + * @member {Number} + */ + this.format = format || gl.RGBA; + + /** + * The gl type of the texture. defaults to gl.UNSIGNED_BYTE + * + * @member {Number} + */ + this.type = type || gl.UNSIGNED_BYTE; + + + }; + + /** + * Uploads this texture to the GPU + * @param source {HTMLImageElement|ImageData|HTMLVideoElement} the source image of the texture + */ + Texture.prototype.upload = function (source) { + this.bind(); + + var gl = this.gl; + + + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha); + + var newWidth = source.videoWidth || source.width; + var newHeight = source.videoHeight || source.height; + + if (newHeight !== this.height || newWidth !== this.width) { + gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source); + } + else { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.format, this.type, source); + } + + // if the source is a video, we need to use the videoWidth / videoHeight properties as width / height will be incorrect. + this.width = newWidth; + this.height = newHeight; + + }; + + var FLOATING_POINT_AVAILABLE = false; + + /** + * Use a data source and uploads this texture to the GPU + * @param data {TypedArray} the data to upload to the texture + * @param width {number} the new width of the texture + * @param height {number} the new height of the texture + */ + Texture.prototype.uploadData = function (data, width, height) { + this.bind(); + + var gl = this.gl; + + + if (data instanceof Float32Array) { + if (!FLOATING_POINT_AVAILABLE) { + var ext = gl.getExtension("OES_texture_float"); + + if (ext) { + FLOATING_POINT_AVAILABLE = true; + } + else { + throw new Error('floating point textures not available'); + } + } + + this.type = gl.FLOAT; + } + else { + // TODO support for other types + this.type = this.type || gl.UNSIGNED_BYTE; + } + + // what type of data? + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha); + + + if (width !== this.width || height !== this.height) { + gl.texImage2D(gl.TEXTURE_2D, 0, this.format, width, height, 0, this.format, this.type, data || null); + } + else { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, this.format, this.type, data || null); + } + + this.width = width; + this.height = height; + + + // texSubImage2D + }; + + /** + * Binds the texture + * @param location + */ + Texture.prototype.bind = function (location) { + var gl = this.gl; + + if (location !== undefined) { + gl.activeTexture(gl.TEXTURE0 + location); + } - for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { - if (!parent.children[_i2].isComplete) { - incompleteChildren.push(parent.children[_i2]); - } - } + gl.bindTexture(gl.TEXTURE_2D, this.texture); + }; - var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + /** + * Unbinds the texture + */ + Texture.prototype.unbind = function () { + var gl = this.gl; + gl.bindTexture(gl.TEXTURE_2D, null); + }; + + /** + * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation + */ + Texture.prototype.minFilter = function (linear) { + var gl = this.gl; + + this.bind(); + + if (this.mipmap) { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + } + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR : gl.NEAREST); + } + }; + + /** + * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation + */ + Texture.prototype.magFilter = function (linear) { + var gl = this.gl; + + this.bind(); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, linear ? gl.LINEAR : gl.NEAREST); + }; + + /** + * Enables mipmapping + */ + Texture.prototype.enableMipmap = function () { + var gl = this.gl; + + this.bind(); + + this.mipmap = true; + + gl.generateMipmap(gl.TEXTURE_2D); + }; + + /** + * Enables linear filtering + */ + Texture.prototype.enableLinearScaling = function () { + this.minFilter(true); + this.magFilter(true); + }; + + /** + * Enables nearest neighbour interpolation + */ + Texture.prototype.enableNearestScaling = function () { + this.minFilter(false); + this.magFilter(false); + }; + + /** + * Enables clamping on the texture so WebGL will not repeat it + */ + Texture.prototype.enableWrapClamp = function () { + var gl = this.gl; + + this.bind(); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + }; + + /** + * Enable tiling on the texture + */ + Texture.prototype.enableWrapRepeat = function () { + var gl = this.gl; + + this.bind(); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + }; + + Texture.prototype.enableWrapMirrorRepeat = function () { + var gl = this.gl; + + this.bind(); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT); + }; + + + /** + * Destroys this texture + */ + Texture.prototype.destroy = function () { + var gl = this.gl; + //TODO + gl.deleteTexture(this.texture); + }; + + /** + * @static + * @param gl {WebGLRenderingContext} The current WebGL context + * @param source {HTMLImageElement|ImageData} the source image of the texture + * @param premultiplyAlpha {Boolean} If we want to use pre-multiplied alpha + */ + Texture.fromSource = function (gl, source, premultiplyAlpha) { + var texture = new Texture(gl); + texture.premultiplyAlpha = premultiplyAlpha || false; + texture.upload(source); + + return texture; + }; + + /** + * @static + * @param gl {WebGLRenderingContext} The current WebGL context + * @param data {TypedArray} the data to upload to the texture + * @param width {number} the new width of the texture + * @param height {number} the new height of the texture + */ + Texture.fromData = function (gl, data, width, height) { + //console.log(data, width, height); + var texture = new Texture(gl); + texture.uploadData(data, width, height); + + return texture; + }; + + + module.exports = Texture; + + }, {}], 13: [function (require, module, exports) { + + // state object// + var setVertexAttribArrays = require('./setVertexAttribArrays'); + + /** + * Helper class to work with WebGL VertexArrayObjects (vaos) + * Only works if WebGL extensions are enabled (they usually are) + * + * @class + * @memberof PIXI.glCore + * @param gl {WebGLRenderingContext} The current WebGL rendering context + */ + function VertexArrayObject(gl, state) { + this.nativeVaoExtension = null; + + if (!VertexArrayObject.FORCE_NATIVE) { + this.nativeVaoExtension = gl.getExtension('OES_vertex_array_object') || + gl.getExtension('MOZ_OES_vertex_array_object') || + gl.getExtension('WEBKIT_OES_vertex_array_object'); + } + + this.nativeState = state; + + if (this.nativeVaoExtension) { + this.nativeVao = this.nativeVaoExtension.createVertexArrayOES(); + + var maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); + + // VAO - overwrite the state.. + this.nativeState = { + tempAttribState: new Array(maxAttribs), + attribState: new Array(maxAttribs) + }; + } + + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + /** + * An array of attributes + * + * @member {Array} + */ + this.attributes = []; + + /** + * @member {PIXI.glCore.GLBuffer} + */ + this.indexBuffer = null; + + /** + * A boolean flag + * + * @member {Boolean} + */ + this.dirty = false; + } + + VertexArrayObject.prototype.constructor = VertexArrayObject; + module.exports = VertexArrayObject; + + /** + * Some devices behave a bit funny when using the newer extensions (im looking at you ipad 2!) + * If you find on older devices that things have gone a bit weird then set this to true. + */ + /** + * Lets the VAO know if you should use the WebGL extension or the native methods. + * Some devices behave a bit funny when using the newer extensions (im looking at you ipad 2!) + * If you find on older devices that things have gone a bit weird then set this to true. + * @static + * @property {Boolean} FORCE_NATIVE + */ + VertexArrayObject.FORCE_NATIVE = false; + + /** + * Binds the buffer + */ + VertexArrayObject.prototype.bind = function () { + if (this.nativeVao) { + this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao); + + if (this.dirty) { + this.dirty = false; + this.activate(); + return this; + } + if (this.indexBuffer) { + this.indexBuffer.bind(); + } + } + else { + this.activate(); + } + + return this; + }; + + /** + * Unbinds the buffer + */ + VertexArrayObject.prototype.unbind = function () { + if (this.nativeVao) { + this.nativeVaoExtension.bindVertexArrayOES(null); + } + + return this; + }; + + /** + * Uses this vao + */ + VertexArrayObject.prototype.activate = function () { + + var gl = this.gl; + var lastBuffer = null; + + for (var i = 0; i < this.attributes.length; i++) { + var attrib = this.attributes[i]; + + if (lastBuffer !== attrib.buffer) { + attrib.buffer.bind(); + lastBuffer = attrib.buffer; + } + + gl.vertexAttribPointer(attrib.attribute.location, + attrib.attribute.size, + attrib.type || gl.FLOAT, + attrib.normalized || false, + attrib.stride || 0, + attrib.start || 0); + } + + setVertexAttribArrays(gl, this.attributes, this.nativeState); + + if (this.indexBuffer) { + this.indexBuffer.bind(); + } + + return this; + }; + + /** + * + * @param buffer {PIXI.gl.GLBuffer} + * @param attribute {*} + * @param type {String} + * @param normalized {Boolean} + * @param stride {Number} + * @param start {Number} + */ + VertexArrayObject.prototype.addAttribute = function (buffer, attribute, type, normalized, stride, start) { + this.attributes.push({ + buffer: buffer, + attribute: attribute, + + location: attribute.location, + type: type || this.gl.FLOAT, + normalized: normalized || false, + stride: stride || 0, + start: start || 0 + }); + + this.dirty = true; + + return this; + }; + + /** + * + * @param buffer {PIXI.gl.GLBuffer} + */ + VertexArrayObject.prototype.addIndex = function (buffer/*, options*/) { + this.indexBuffer = buffer; + + this.dirty = true; + + return this; + }; + + /** + * Unbinds this vao and disables it + */ + VertexArrayObject.prototype.clear = function () { + // var gl = this.gl; + + // TODO - should this function unbind after clear? + // for now, no but lets see what happens in the real world! + if (this.nativeVao) { + this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao); + } + + this.attributes.length = 0; + this.indexBuffer = null; + + return this; + }; + + /** + * @param type {Number} + * @param size {Number} + * @param start {Number} + */ + VertexArrayObject.prototype.draw = function (type, size, start) { + var gl = this.gl; + + if (this.indexBuffer) { + gl.drawElements(type, size || this.indexBuffer.data.length, gl.UNSIGNED_SHORT, (start || 0) * 2); + } + else { + // TODO need a better way to calculate size.. + gl.drawArrays(type, start, size || this.getSize()); + } + + return this; + }; + + /** + * Destroy this vao + */ + VertexArrayObject.prototype.destroy = function () { + // lose references + this.gl = null; + this.indexBuffer = null; + this.attributes = null; + this.nativeState = null; + + if (this.nativeVao) { + this.nativeVaoExtension.deleteVertexArrayOES(this.nativeVao); + } + + this.nativeVaoExtension = null; + this.nativeVao = null; + }; + + VertexArrayObject.prototype.getSize = function () { + var attrib = this.attributes[0]; + return attrib.buffer.data.length / ((attrib.stride / 4) || attrib.attribute.size); + }; + + }, { "./setVertexAttribArrays": 16 }], 14: [function (require, module, exports) { + + /** + * Helper class to create a webGL Context + * + * @class + * @memberof PIXI.glCore + * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from + * @param options {Object} An options object that gets passed in to the canvas element containing the context attributes, + * see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext for the options available + * @return {WebGLRenderingContext} the WebGL context + */ + var createContext = function (canvas, options) { + var gl = canvas.getContext('webgl', options) || + canvas.getContext('experimental-webgl', options); + + if (!gl) { + // fail, not able to get a context + throw new Error('This browser does not support webGL. Try using the canvas renderer'); + } + + return gl; + }; + + module.exports = createContext; + + }, {}], 15: [function (require, module, exports) { + var gl = { + createContext: require('./createContext'), + setVertexAttribArrays: require('./setVertexAttribArrays'), + GLBuffer: require('./GLBuffer'), + GLFramebuffer: require('./GLFramebuffer'), + GLShader: require('./GLShader'), + GLTexture: require('./GLTexture'), + VertexArrayObject: require('./VertexArrayObject'), + shader: require('./shader') + }; + + // Export for Node-compatible environments + if (typeof module !== 'undefined' && module.exports) { + // Export the module + module.exports = gl; + } + + // Add to the browser window pixi.gl + if (typeof window !== 'undefined') { + // add the window object + window.PIXI = window.PIXI || {}; + window.PIXI.glCore = gl; + } + + }, { "./GLBuffer": 9, "./GLFramebuffer": 10, "./GLShader": 11, "./GLTexture": 12, "./VertexArrayObject": 13, "./createContext": 14, "./setVertexAttribArrays": 16, "./shader": 22 }], 16: [function (require, module, exports) { + // var GL_MAP = {}; + + /** + * @param gl {WebGLRenderingContext} The current WebGL context + * @param attribs {*} + * @param state {*} + */ + var setVertexAttribArrays = function (gl, attribs, state) { + var i; + if (state) { + var tempAttribState = state.tempAttribState, + attribState = state.attribState; + + for (i = 0; i < tempAttribState.length; i++) { + tempAttribState[i] = false; + } + + // set the new attribs + for (i = 0; i < attribs.length; i++) { + tempAttribState[attribs[i].attribute.location] = true; + } + + for (i = 0; i < attribState.length; i++) { + if (attribState[i] !== tempAttribState[i]) { + attribState[i] = tempAttribState[i]; + + if (state.attribState[i]) { + gl.enableVertexAttribArray(i); + } + else { + gl.disableVertexAttribArray(i); + } + } + } + + } + else { + for (i = 0; i < attribs.length; i++) { + var attrib = attribs[i]; + gl.enableVertexAttribArray(attrib.attribute.location); + } + } + }; + + module.exports = setVertexAttribArrays; + + }, {}], 17: [function (require, module, exports) { + + /** + * @class + * @memberof PIXI.glCore.shader + * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} + * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. + * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations + * @return {WebGLProgram} the shader program + */ + var compileProgram = function (gl, vertexSrc, fragmentSrc, attributeLocations) { + var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc); + var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc); + + var program = gl.createProgram(); + + gl.attachShader(program, glVertShader); + gl.attachShader(program, glFragShader); + + // optionally, set the attributes manually for the program rather than letting WebGL decide.. + if (attributeLocations) { + for (var i in attributeLocations) { + gl.bindAttribLocation(program, attributeLocations[i], i); + } + } + + + gl.linkProgram(program); + + // if linking fails, then log and cleanup + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + console.error('Pixi.js Error: Could not initialize shader.'); + console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); + console.error('gl.getError()', gl.getError()); + + // if there is a program info log, log it + if (gl.getProgramInfoLog(program) !== '') { + console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); + } + + gl.deleteProgram(program); + program = null; + } + + // clean up some shaders + gl.deleteShader(glVertShader); + gl.deleteShader(glFragShader); + + return program; + }; + + /** + * @private + * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} + * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. + * @return {WebGLShader} the shader + */ + var compileShader = function (gl, type, src) { + var shader = gl.createShader(type); + + gl.shaderSource(shader, src); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + console.log(gl.getShaderInfoLog(shader)); + return null; + } + + return shader; + }; + + module.exports = compileProgram; + + }, {}], 18: [function (require, module, exports) { + /** + * @class + * @memberof PIXI.glCore.shader + * @param type {String} Type of value + * @param size {Number} + */ + var defaultValue = function (type, size) { + switch (type) { + case 'float': + return 0; + + case 'vec2': + return new Float32Array(2 * size); + + case 'vec3': + return new Float32Array(3 * size); + + case 'vec4': + return new Float32Array(4 * size); + + case 'int': + case 'sampler2D': + return 0; + + case 'ivec2': + return new Int32Array(2 * size); + + case 'ivec3': + return new Int32Array(3 * size); + + case 'ivec4': + return new Int32Array(4 * size); + + case 'bool': + return false; + + case 'bvec2': + + return booleanArray(2 * size); + + case 'bvec3': + return booleanArray(3 * size); + + case 'bvec4': + return booleanArray(4 * size); + + case 'mat2': + return new Float32Array([1, 0, + 0, 1]); + + case 'mat3': + return new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + + case 'mat4': + return new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + } + }; + + var booleanArray = function (size) { + var array = new Array(size); + + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + + return array; + }; + + module.exports = defaultValue; + + }, {}], 19: [function (require, module, exports) { + + var mapType = require('./mapType'); + var mapSize = require('./mapSize'); + + /** + * Extracts the attributes + * @class + * @memberof PIXI.glCore.shader + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param program {WebGLProgram} The shader program to get the attributes from + * @return attributes {Object} + */ + var extractAttributes = function (gl, program) { + var attributes = {}; + + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + var type = mapType(gl, attribData.type); + + attributes[attribData.name] = { + type: type, + size: mapSize(type), + location: gl.getAttribLocation(program, attribData.name), + //TODO - make an attribute object + pointer: pointer + }; + } + + return attributes; + }; - parent.children.push(this.resources[name]); - parent.progressChunk = eachChunk; + var pointer = function (type, normalized, stride, start) { + // console.log(this.location) + gl.vertexAttribPointer(this.location, this.size, type || gl.FLOAT, normalized || false, stride || 0, start || 0); + }; - for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { - incompleteChildren[_i3].progressChunk = eachChunk; - } + module.exports = extractAttributes; + + }, { "./mapSize": 23, "./mapType": 24 }], 20: [function (require, module, exports) { + var mapType = require('./mapType'); + var defaultValue = require('./defaultValue'); + + /** + * Extracts the uniforms + * @class + * @memberof PIXI.glCore.shader + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param program {WebGLProgram} The shader program to get the uniforms from + * @return uniforms {Object} + */ + var extractUniforms = function (gl, program) { + var uniforms = {}; + + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]/, ""); + var type = mapType(gl, uniformData.type); + + uniforms[name] = { + type: type, + size: uniformData.size, + location: gl.getUniformLocation(program, name), + value: defaultValue(type, uniformData.size) + }; + } + + return uniforms; + }; + + module.exports = extractUniforms; + + }, { "./defaultValue": 18, "./mapType": 24 }], 21: [function (require, module, exports) { + /** + * Extracts the attributes + * @class + * @memberof PIXI.glCore.shader + * @param gl {WebGLRenderingContext} The current WebGL rendering context + * @param uniforms {Array} @mat ? + * @return attributes {Object} + */ + var generateUniformAccessObject = function (gl, uniformData) { + // this is the object we will be sending back. + // an object hierachy will be created for structs + var uniforms = { data: {} }; + + uniforms.gl = gl; + + var uniformKeys = Object.keys(uniformData); + + for (var i = 0; i < uniformKeys.length; i++) { + var fullName = uniformKeys[i]; + + var nameTokens = fullName.split('.'); + var name = nameTokens[nameTokens.length - 1]; + + + var uniformGroup = getUniformGroup(nameTokens, uniforms); + + var uniform = uniformData[fullName]; + uniformGroup.data[name] = uniform; + + uniformGroup.gl = gl; + + Object.defineProperty(uniformGroup, name, { + get: generateGetter(name), + set: generateSetter(name, uniform) + }); + } + + return uniforms; + }; + + var generateGetter = function (name) { + return function () { + return this.data[name].value; + }; + }; + + var GLSL_SINGLE_SETTERS = { + float: function setSingleFloat(gl, location, value) { gl.uniform1f(location, value); }, + vec2: function setSingleVec2(gl, location, value) { gl.uniform2f(location, value[0], value[1]); }, + vec3: function setSingleVec3(gl, location, value) { gl.uniform3f(location, value[0], value[1], value[2]); }, + vec4: function setSingleVec4(gl, location, value) { gl.uniform4f(location, value[0], value[1], value[2], value[3]); }, + + int: function setSingleInt(gl, location, value) { gl.uniform1i(location, value); }, + ivec2: function setSingleIvec2(gl, location, value) { gl.uniform2i(location, value[0], value[1]); }, + ivec3: function setSingleIvec3(gl, location, value) { gl.uniform3i(location, value[0], value[1], value[2]); }, + ivec4: function setSingleIvec4(gl, location, value) { gl.uniform4i(location, value[0], value[1], value[2], value[3]); }, + + bool: function setSingleBool(gl, location, value) { gl.uniform1i(location, value); }, + bvec2: function setSingleBvec2(gl, location, value) { gl.uniform2i(location, value[0], value[1]); }, + bvec3: function setSingleBvec3(gl, location, value) { gl.uniform3i(location, value[0], value[1], value[2]); }, + bvec4: function setSingleBvec4(gl, location, value) { gl.uniform4i(location, value[0], value[1], value[2], value[3]); }, + + mat2: function setSingleMat2(gl, location, value) { gl.uniformMatrix2fv(location, false, value); }, + mat3: function setSingleMat3(gl, location, value) { gl.uniformMatrix3fv(location, false, value); }, + mat4: function setSingleMat4(gl, location, value) { gl.uniformMatrix4fv(location, false, value); }, + + sampler2D: function setSingleSampler2D(gl, location, value) { gl.uniform1i(location, value); }, + }; + + var GLSL_ARRAY_SETTERS = { + float: function setFloatArray(gl, location, value) { gl.uniform1fv(location, value); }, + vec2: function setVec2Array(gl, location, value) { gl.uniform2fv(location, value); }, + vec3: function setVec3Array(gl, location, value) { gl.uniform3fv(location, value); }, + vec4: function setVec4Array(gl, location, value) { gl.uniform4fv(location, value); }, + int: function setIntArray(gl, location, value) { gl.uniform1iv(location, value); }, + ivec2: function setIvec2Array(gl, location, value) { gl.uniform2iv(location, value); }, + ivec3: function setIvec3Array(gl, location, value) { gl.uniform3iv(location, value); }, + ivec4: function setIvec4Array(gl, location, value) { gl.uniform4iv(location, value); }, + bool: function setBoolArray(gl, location, value) { gl.uniform1iv(location, value); }, + bvec2: function setBvec2Array(gl, location, value) { gl.uniform2iv(location, value); }, + bvec3: function setBvec3Array(gl, location, value) { gl.uniform3iv(location, value); }, + bvec4: function setBvec4Array(gl, location, value) { gl.uniform4iv(location, value); }, + sampler2D: function setSampler2DArray(gl, location, value) { gl.uniform1iv(location, value); }, + }; + + function generateSetter(name, uniform) { + return function (value) { + this.data[name].value = value; + var location = this.data[name].location; + if (uniform.size === 1) { + GLSL_SINGLE_SETTERS[uniform.type](this.gl, location, value); + } + else { + // glslSetArray(gl, location, type, value) { + GLSL_ARRAY_SETTERS[uniform.type](this.gl, location, value); + } + }; + } + + function getUniformGroup(nameTokens, uniform) { + var cur = uniform; + + for (var i = 0; i < nameTokens.length - 1; i++) { + var o = cur[nameTokens[i]] || { data: {} }; + cur[nameTokens[i]] = o; + cur = o; + } + + return cur; + } + + + module.exports = generateUniformAccessObject; + + }, {}], 22: [function (require, module, exports) { + module.exports = { + compileProgram: require('./compileProgram'), + defaultValue: require('./defaultValue'), + extractAttributes: require('./extractAttributes'), + extractUniforms: require('./extractUniforms'), + generateUniformAccessObject: require('./generateUniformAccessObject'), + setPrecision: require('./setPrecision'), + mapSize: require('./mapSize'), + mapType: require('./mapType') + }; + }, { "./compileProgram": 17, "./defaultValue": 18, "./extractAttributes": 19, "./extractUniforms": 20, "./generateUniformAccessObject": 21, "./mapSize": 23, "./mapType": 24, "./setPrecision": 25 }], 23: [function (require, module, exports) { + /** + * @class + * @memberof PIXI.glCore.shader + * @param type {String} + * @return {Number} + */ + var mapSize = function (type) { + return GLSL_TO_SIZE[type]; + }; + + + var GLSL_TO_SIZE = { + 'float': 1, + 'vec2': 2, + 'vec3': 3, + 'vec4': 4, + + 'int': 1, + 'ivec2': 2, + 'ivec3': 3, + 'ivec4': 4, + + 'bool': 1, + 'bvec2': 2, + 'bvec3': 3, + 'bvec4': 4, + + 'mat2': 4, + 'mat3': 9, + 'mat4': 16, + + 'sampler2D': 1 + }; + + module.exports = mapSize; + + }, {}], 24: [function (require, module, exports) { + + + var mapType = function (gl, type) { + if (!GL_TABLE) { + var typeNames = Object.keys(GL_TO_GLSL_TYPES); + + GL_TABLE = {}; + + for (var i = 0; i < typeNames.length; ++i) { + var tn = typeNames[i]; + GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; + } + } + + return GL_TABLE[type]; + }; + + var GL_TABLE = null; + + var GL_TO_GLSL_TYPES = { + 'FLOAT': 'float', + 'FLOAT_VEC2': 'vec2', + 'FLOAT_VEC3': 'vec3', + 'FLOAT_VEC4': 'vec4', + + 'INT': 'int', + 'INT_VEC2': 'ivec2', + 'INT_VEC3': 'ivec3', + 'INT_VEC4': 'ivec4', + + 'BOOL': 'bool', + 'BOOL_VEC2': 'bvec2', + 'BOOL_VEC3': 'bvec3', + 'BOOL_VEC4': 'bvec4', + + 'FLOAT_MAT2': 'mat2', + 'FLOAT_MAT3': 'mat3', + 'FLOAT_MAT4': 'mat4', + + 'SAMPLER_2D': 'sampler2D' + }; + + module.exports = mapType; + + }, {}], 25: [function (require, module, exports) { + /** + * Sets the float precision on the shader. If the precision is already present this function will do nothing + * @param {string} src the shader source + * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. + * + * @return {string} modified shader source + */ + var setPrecision = function (src, precision) { + if (src.substring(0, 9) !== 'precision') { + return 'precision ' + precision + ' float;\n' + src; + } + + return src; + }; + + module.exports = setPrecision; + + }, {}], 26: [function (require, module, exports) { + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + }()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() { } + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function () { return 0; }; + + }, {}], 27: [function (require, module, exports) { + (function (global) { + /*! https://mths.be/punycode v1.4.1 by @mathias */ + ; (function (root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function (value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function (string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function (string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function () { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + + }(this)); + + }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + + }, {}], 28: [function (require, module, exports) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + // If obj.hasOwnProperty has been overridden, then calling + // obj.hasOwnProperty(prop) will break. + // See: https://github.com/joyent/node/issues/1707 + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + module.exports = function (qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; + }; + + var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; + }; + + }, {}], 29: [function (require, module, exports) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + var stringifyPrimitive = function (v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } + }; + + module.exports = function (obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function (k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function (v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); + }; + + var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; + }; + + function map(xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; + } + + var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; + }; + + }, {}], 30: [function (require, module, exports) { + 'use strict'; + + exports.decode = exports.parse = require('./decode'); + exports.encode = exports.stringify = require('./encode'); + + }, { "./decode": 28, "./encode": 29 }], 31: [function (require, module, exports) { + 'use strict' + + /** + * Remove a range of items from an array + * + * @function removeItems + * @param {Array<*>} arr The target array + * @param {number} startIdx The index to begin removing from (inclusive) + * @param {number} removeCount How many items to remove + */ + module.exports = function removeItems(arr, startIdx, removeCount) { + var i, length = arr.length + + if (startIdx >= length || removeCount === 0) { + return + } + + removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount) + + var len = length - removeCount + + for (i = startIdx; i < len; ++i) { + arr[i] = arr[i + removeCount] + } + + arr.length = len + } + + }, {}], 32: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.Loader = undefined; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _miniSignals = require('mini-signals'); + + var _miniSignals2 = _interopRequireDefault(_miniSignals); + + var _parseUri = require('parse-uri'); + + var _parseUri2 = _interopRequireDefault(_parseUri); + + var _async = require('./async'); + + var async = _interopRequireWildcard(_async); + + var _Resource = require('./Resource'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + // some constants + var MAX_PROGRESS = 100; + var rgxExtractUrlHash = /(#[\w-]+)?$/; + + /** + * Manages the state and loading of multiple resources to load. + * + * @class + */ + + var Loader = exports.Loader = function () { + /** + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + function Loader() { + var _this = this; + + var baseUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var concurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10; + + _classCallCheck(this, Loader); + + /** + * The base url for all resources loaded by this loader. + * + * @member {string} + */ + this.baseUrl = baseUrl; + + /** + * The progress percent of the loader going through the queue. + * + * @member {number} + */ + this.progress = 0; + + /** + * Loading state of the loader, true if it is currently loading resources. + * + * @member {boolean} + */ + this.loading = false; + + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + * + * @member {string} + */ + this.defaultQueryString = ''; + + /** + * The middleware to run before loading each resource. + * + * @private + * @member {function[]} + */ + this._beforeMiddleware = []; + + /** + * The middleware to run after loading each resource. + * + * @private + * @member {function[]} + */ + this._afterMiddleware = []; + + /** + * The tracks the resources we are currently completing parsing for. + * + * @private + * @member {Resource[]} + */ + this._resourcesParsing = []; + + /** + * The `_loadResource` function bound with this object context. + * + * @private + * @member {function} + * @param {Resource} r - The resource to load + * @param {Function} d - The dequeue function + * @return {undefined} + */ + this._boundLoadResource = function (r, d) { + return _this._loadResource(r, d); + }; + + /** + * The resources waiting to be loaded. + * + * @private + * @member {Resource[]} + */ + this._queue = async.queue(this._boundLoadResource, concurrency); + + this._queue.pause(); + + /** + * All the resources for this loader keyed by name. + * + * @member {object} + */ + this.resources = {}; + + /** + * Dispatched once per loaded or errored resource. + * + * The callback looks like {@link Loader.OnProgressSignal}. + * + * @member {Signal} + */ + this.onProgress = new _miniSignals2.default(); + + /** + * Dispatched once per errored resource. + * + * The callback looks like {@link Loader.OnErrorSignal}. + * + * @member {Signal} + */ + this.onError = new _miniSignals2.default(); + + /** + * Dispatched once per loaded resource. + * + * The callback looks like {@link Loader.OnLoadSignal}. + * + * @member {Signal} + */ + this.onLoad = new _miniSignals2.default(); + + /** + * Dispatched when the loader begins to process the queue. + * + * The callback looks like {@link Loader.OnStartSignal}. + * + * @member {Signal} + */ + this.onStart = new _miniSignals2.default(); + + /** + * Dispatched when the queued resources all load. + * + * The callback looks like {@link Loader.OnCompleteSignal}. + * + * @member {Signal} + */ + this.onComplete = new _miniSignals2.default(); + + // Add default before middleware + for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { + this.pre(Loader._defaultBeforeMiddleware[i]); + } + + // Add default after middleware + for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { + this.use(Loader._defaultAfterMiddleware[_i]); + } + } + + /** + * When the progress changes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnProgressSignal + * @param {Loader} loader - The loader the progress is advancing on. + * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. + */ + + /** + * When an error occurrs the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnErrorSignal + * @param {Loader} loader - The loader the error happened in. + * @param {Resource} resource - The resource that caused the error. + */ + + /** + * When a load completes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnLoadSignal + * @param {Loader} loader - The loader that laoded the resource. + * @param {Resource} resource - The resource that has completed loading. + */ + + /** + * When the loader starts loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnStartSignal + * @param {Loader} loader - The loader that has started loading resources. + */ + + /** + * When the loader completes loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnCompleteSignal + * @param {Loader} loader - The loader that has finished loading resources. + */ + + /** + * Options for a call to `.add()`. + * + * @see Loader#add + * + * @typedef {object} IAddOptions + * @property {string} [name] - The name of the resource to load, if not passed the url is used. + * @property {string} [key] - Alias for `name`. + * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. + * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @property {Loader.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. + * @property {Loader.OnCompleteSignal} [callback] - Alias for `onComplete`. + * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. + */ + + /** + * Adds a resource (or multiple resources) to the loader queue. + * + * This function can take a wide variety of different parameters. The only thing that is always + * required the url to load. All the following will work: + * + * ```js + * loader + * // normal param syntax + * .add('key', 'http://...', function () {}) + * .add('http://...', function () {}) + * .add('http://...') + * + * // object syntax + * .add({ + * name: 'key2', + * url: 'http://...' + * }, function () {}) + * .add({ + * url: 'http://...' + * }, function () {}) + * .add({ + * name: 'key3', + * url: 'http://...' + * onComplete: function () {} + * }) + * .add({ + * url: 'https://...', + * onComplete: function () {}, + * crossOrigin: true + * }) + * + * // you can also pass an array of objects or urls or both + * .add([ + * { name: 'key4', url: 'http://...', onComplete: function () {} }, + * { url: 'http://...', onComplete: function () {} }, + * 'http://...' + * ]) + * + * // and you can use both params and options + * .add('key', 'http://...', { crossOrigin: true }, function () {}) + * .add('http://...', { crossOrigin: true }, function () {}); + * ``` + * + * @param {string|IAddOptions} [name] - The name of the resource to load, if not passed the url is used. + * @param {string} [url] - The url for this resource, relative to the baseUrl of this loader. + * @param {IAddOptions} [options] - The options for the load. + * @param {Loader.OnCompleteSignal} [cb] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + + Loader.prototype.add = function add(name, url, options, cb) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + + return this; + } + + // if an object is passed instead of params + if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + cb = url || name.callback || name.onComplete; + options = name; + url = name.url; + name = name.name || name.key || name.url; + } + + // case where no name is passed shift all args over by one. + if (typeof url !== 'string') { + cb = options; + options = url; + url = name; + } + + // now that we shifted make sure we have a proper url. + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } + + // options are optional so people might pass a function and no options + if (typeof options === 'function') { + cb = options; + options = null; + } + + // if loading already you can only add resources that have a parent. + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } + + // check if resource already exists. + if (this.resources[name]) { + throw new Error('Resource named "' + name + '" already exists.'); + } + + // add base url if this isn't an absolute url + url = this._prepareUrl(url); + + // create the store the resource + this.resources[name] = new _Resource.Resource(name, url, options); + + if (typeof cb === 'function') { + this.resources[name].onAfterMiddleware.once(cb); + } + + // if actively loading, make sure to adjust progress chunks for that parent and its children + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + + for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { + if (!parent.children[_i2].isComplete) { + incompleteChildren.push(parent.children[_i2]); + } + } + + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + + for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { + incompleteChildren[_i3].progressChunk = eachChunk; + } + + this.resources[name].progressChunk = eachChunk; + } + + // add the resource to the queue + this._queue.push(this.resources[name]); + + return this; + }; + + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + + + Loader.prototype.pre = function pre(fn) { + this._beforeMiddleware.push(fn); + + return this; + }; + + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + + + Loader.prototype.use = function use(fn) { + this._afterMiddleware.push(fn); + + return this; + }; + + /** + * Resets the queue of the loader to prepare for a new load. + * + * @return {this} Returns itself. + */ + + + Loader.prototype.reset = function reset() { + this.progress = 0; + this.loading = false; + + this._queue.kill(); + this._queue.pause(); + + // abort all resource loads + for (var k in this.resources) { + var res = this.resources[k]; + + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + + if (res.isLoading) { + res.abort(); + } + } + + this.resources = {}; + + return this; + }; + + /** + * Starts loading the queued resources. + * + * @param {function} [cb] - Optional callback that will be bound to the `complete` event. + * @return {this} Returns itself. + */ + + + Loader.prototype.load = function load(cb) { + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } + + // if the queue has already started we are done here + if (this.loading) { + return this; + } + + if (this._queue.idle()) { + this._onStart(); + this._onComplete(); + } else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } + + // notify we are starting + this._onStart(); + + // start loading + this._queue.resume(); + } + + return this; + }; + + /** + * The number of resources to load concurrently. + * + * @member {number} + * @default 10 + */ + + + /** + * Prepares a url for usage based on the configuration of this object + * + * @private + * @param {string} url - The url to prepare. + * @return {string} The prepared url. + */ + Loader.prototype._prepareUrl = function _prepareUrl(url) { + var parsedUrl = (0, _parseUri2.default)(url, { strictMode: true }); + var result = void 0; + + // absolute url, just use it as is. + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } + // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { + result = this.baseUrl + '/' + url; + } else { + result = this.baseUrl + url; + } + + // if we need to add a default querystring, there is a bit more work + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + + result = result.substr(0, result.length - hash.length); + + if (result.indexOf('?') !== -1) { + result += '&' + this.defaultQueryString; + } else { + result += '?' + this.defaultQueryString; + } + + result += hash; + } + + return result; + }; + + /** + * Loads a single resource. + * + * @private + * @param {Resource} resource - The resource to load. + * @param {function} dequeue - The function to call when we need to dequeue this item. + */ + + + Loader.prototype._loadResource = function _loadResource(resource, dequeue) { + var _this2 = this; + + resource._dequeue = dequeue; + + // run before middleware + async.eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this2, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this2._onLoad(resource); + } else { + resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); + resource.load(); + } + }, true); + }; + + /** + * Called once loading has started. + * + * @private + */ + + + Loader.prototype._onStart = function _onStart() { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + }; + + /** + * Called once each resource has loaded. + * + * @private + */ + + + Loader.prototype._onComplete = function _onComplete() { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + }; + + /** + * Called each time a resources is loaded. + * + * @private + * @param {Resource} resource - The resource that was loaded + */ + + + Loader.prototype._onLoad = function _onLoad(resource) { + var _this3 = this; + + resource._onLoadBinding = null; + + // remove this resource from the async queue, and add it to our list of resources that are being parsed + this._resourcesParsing.push(resource); + resource._dequeue(); + + // run all the after middleware for this resource + async.eachSeries(this._afterMiddleware, function (fn, next) { + fn.call(_this3, resource, next); + }, function () { + resource.onAfterMiddleware.dispatch(resource); + + _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); + _this3.onProgress.dispatch(_this3, resource); + + if (resource.error) { + _this3.onError.dispatch(resource.error, _this3, resource); + } else { + _this3.onLoad.dispatch(_this3, resource); + } + + _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); + + // do completion check + if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { + _this3._onComplete(); + } + }, true); + }; + + _createClass(Loader, [{ + key: 'concurrency', + get: function get() { + return this._queue.concurrency; + } + // eslint-disable-next-line require-jsdoc + , + set: function set(concurrency) { + this._queue.concurrency = concurrency; + } + }]); + + return Loader; + }(); + + /** + * A default array of middleware to run before loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + + + Loader._defaultBeforeMiddleware = []; + + /** + * A default array of middleware to run after loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + Loader._defaultAfterMiddleware = []; + + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + Loader.pre = function LoaderPreStatic(fn) { + Loader._defaultBeforeMiddleware.push(fn); + + return Loader; + }; + + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + Loader.use = function LoaderUseStatic(fn) { + Loader._defaultAfterMiddleware.push(fn); + + return Loader; + }; + + }, { "./Resource": 33, "./async": 34, "mini-signals": 5, "parse-uri": 7 }], 33: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.Resource = undefined; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _parseUri = require('parse-uri'); + + var _parseUri2 = _interopRequireDefault(_parseUri); + + var _miniSignals = require('mini-signals'); + + var _miniSignals2 = _interopRequireDefault(_miniSignals); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + // tests if CORS is supported in XHR, if not we need to use XDR + var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); + var tempAnchor = null; + + // some status constants + var STATUS_NONE = 0; + var STATUS_OK = 200; + var STATUS_EMPTY = 204; + var STATUS_IE_BUG_EMPTY = 1223; + var STATUS_TYPE_OK = 2; + + // noop + function _noop() { } /* empty */ + + /** + * Manages the state and loading of a resource and all child resources. + * + * @class + */ + + var Resource = exports.Resource = function () { + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. + */ + Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { + setExtMap(Resource._loadTypeMap, extname, loadType); + }; + + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + + + Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { + setExtMap(Resource._xhrTypeMap, extname, xhrType); + }; + + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. + */ + + + function Resource(name, url, options) { + _classCallCheck(this, Resource); + + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + + options = options || {}; + + /** + * The state flags of this resource. + * + * @private + * @member {number} + */ + this._flags = 0; + + // set data url flag, needs to be set early for some _determineX checks to work. + this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + + /** + * The name of this resource. + * + * @readonly + * @member {string} + */ + this.name = name; + + /** + * The url used to load this resource. + * + * @readonly + * @member {string} + */ + this.url = url; + + /** + * The extension used to load this resource. + * + * @readonly + * @member {string} + */ + this.extension = this._getExtension(); + + /** + * The data that was loaded by the resource. + * + * @member {any} + */ + this.data = null; + + /** + * Is this request cross-origin? If unset, determined automatically. + * + * @member {string} + */ + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + + /** + * A timeout in milliseconds for the load. If the load takes longer than this time + * it is cancelled and the load is considered a failure. If this value is set to `0` + * then there is no explicit timeout. + * + * @member {number} + */ + this.timeout = options.timeout || 0; + + /** + * The method of loading to use for this resource. + * + * @member {Resource.LOAD_TYPE} + */ + this.loadType = options.loadType || this._determineLoadType(); + + /** + * The type used to load the resource via XHR. If unset, determined automatically. + * + * @member {string} + */ + this.xhrType = options.xhrType; + + /** + * Extra info for middleware, and controlling specifics about how the resource loads. + * + * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + * Meaning it will modify it as it sees fit. + * + * @member {Resource.IMetadata} + */ + this.metadata = options.metadata || {}; + + /** + * The error that occurred while loading (if any). + * + * @readonly + * @member {Error} + */ + this.error = null; + + /** + * The XHR object that was used to load this resource. This is only set + * when `loadType` is `Resource.LOAD_TYPE.XHR`. + * + * @readonly + * @member {XMLHttpRequest} + */ + this.xhr = null; + + /** + * The child resources this resource owns. + * + * @readonly + * @member {Resource[]} + */ + this.children = []; + + /** + * The resource type. + * + * @readonly + * @member {Resource.TYPE} + */ + this.type = Resource.TYPE.UNKNOWN; + + /** + * The progress chunk owned by this resource. + * + * @readonly + * @member {number} + */ + this.progressChunk = 0; + + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * + * @private + * @member {function} + */ + this._dequeue = _noop; + + /** + * Used a storage place for the on load binding used privately by the loader. + * + * @private + * @member {function} + */ + this._onLoadBinding = null; + + /** + * The timer for element loads to check if they timeout. + * + * @private + * @member {number} + */ + this._elementTimer = 0; + + /** + * The `complete` function bound to this resource's context. + * + * @private + * @member {function} + */ + this._boundComplete = this.complete.bind(this); + + /** + * The `_onError` function bound to this resource's context. + * + * @private + * @member {function} + */ + this._boundOnError = this._onError.bind(this); + + /** + * The `_onProgress` function bound to this resource's context. + * + * @private + * @member {function} + */ + this._boundOnProgress = this._onProgress.bind(this); + + /** + * The `_onTimeout` function bound to this resource's context. + * + * @private + * @member {function} + */ + this._boundOnTimeout = this._onTimeout.bind(this); + + // xhr callbacks + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + + /** + * Dispatched when the resource beings to load. + * + * The callback looks like {@link Resource.OnStartSignal}. + * + * @member {Signal} + */ + this.onStart = new _miniSignals2.default(); + + /** + * Dispatched each time progress of this resource load updates. + * Not all resources types and loader systems can support this event + * so sometimes it may not be available. If the resource + * is being loaded on a modern browser, using XHR, and the remote server + * properly sets Content-Length headers, then this will be available. + * + * The callback looks like {@link Resource.OnProgressSignal}. + * + * @member {Signal} + */ + this.onProgress = new _miniSignals2.default(); + + /** + * Dispatched once this resource has loaded, if there was an error it will + * be in the `error` property. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + this.onComplete = new _miniSignals2.default(); + + /** + * Dispatched after this resource has had all the *after* middleware run on it. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + this.onAfterMiddleware = new _miniSignals2.default(); + } + + /** + * When the resource starts to load. + * + * @memberof Resource + * @callback OnStartSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * When the resource reports loading progress. + * + * @memberof Resource + * @callback OnProgressSignal + * @param {Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + + /** + * When the resource finishes loading. + * + * @memberof Resource + * @callback OnCompleteSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * @memberof Resource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + + /** + * Stores whether or not this url is a data url. + * + * @readonly + * @member {boolean} + */ + + + /** + * Marks the resource as complete. + * + */ + Resource.prototype.complete = function complete() { + this._clearEvents(); + this._finish(); + }; + + /** + * Aborts the loading of this resource, with an optional message. + * + * @param {string} message - The message to use for the error + */ + + + Resource.prototype.abort = function abort(message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } + + // store error + this.error = new Error(message); + + // clear events before calling aborts + this._clearEvents(); + + // abort the actual loading + if (this.xhr) { + this.xhr.abort(); + } else if (this.xdr) { + this.xdr.abort(); + } else if (this.data) { + // single source + if (this.data.src) { + this.data.src = Resource.EMPTY_GIF; + } + // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } + + // done now. + this._finish(); + }; + + /** + * Kicks off loading of this resource. This method is asynchronous. + * + * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + + + Resource.prototype.load = function load(cb) { + var _this = this; + + if (this.isLoading) { + return; + } + + if (this.isComplete) { + if (cb) { + setTimeout(function () { + return cb(_this); + }, 1); + } + + return; + } else if (cb) { + this.onComplete.once(cb); + } + + this._setFlag(Resource.STATUS_FLAGS.LOADING, true); + + this.onStart.dispatch(this); + + // if unset, determine the value + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + + switch (this.loadType) { + case Resource.LOAD_TYPE.IMAGE: + this.type = Resource.TYPE.IMAGE; + this._loadElement('image'); + break; + + case Resource.LOAD_TYPE.AUDIO: + this.type = Resource.TYPE.AUDIO; + this._loadSourceElement('audio'); + break; + + case Resource.LOAD_TYPE.VIDEO: + this.type = Resource.TYPE.VIDEO; + this._loadSourceElement('video'); + break; + + case Resource.LOAD_TYPE.XHR: + /* falls through */ + default: + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } else { + this._loadXhr(); + } + break; + } + }; + + /** + * Checks if the flag is set. + * + * @private + * @param {number} flag - The flag to check. + * @return {boolean} True if the flag is set. + */ + + + Resource.prototype._hasFlag = function _hasFlag(flag) { + return (this._flags & flag) !== 0; + }; + + /** + * (Un)Sets the flag. + * + * @private + * @param {number} flag - The flag to (un)set. + * @param {boolean} value - Whether to set or (un)set the flag. + */ + + + Resource.prototype._setFlag = function _setFlag(flag, value) { + this._flags = value ? this._flags | flag : this._flags & ~flag; + }; + + /** + * Clears all the events from the underlying loading source. + * + * @private + */ + + + Resource.prototype._clearEvents = function _clearEvents() { + clearTimeout(this._elementTimer); + + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + }; + + /** + * Finalizes the load. + * + * @private + */ + + + Resource.prototype._finish = function _finish() { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + + this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); + this._setFlag(Resource.STATUS_FLAGS.LOADING, false); + + this.onComplete.dispatch(this); + }; + + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * + * @private + * @param {string} type - The type of element to use. + */ + + + Resource.prototype._loadElement = function _loadElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'image' && typeof window.Image !== 'undefined') { + this.data = new Image(); + } else { + this.data = document.createElement(type); + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * + * @private + * @param {string} type - The type of element to use. + */ + + + Resource.prototype._loadSourceElement = function _loadSourceElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'audio' && typeof window.Audio !== 'undefined') { + this.data = new Audio(); + } else { + this.data = document.createElement(type); + } + + if (this.data === null) { + this.abort('Unsupported element: ' + type); + + return; + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } else { + var _mimeTypes = this.metadata.mimeType; + + this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); + } + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + + this.data.load(); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + + /** + * Loads this resources using an XMLHttpRequest. + * + * @private + */ + + + Resource.prototype._loadXhr = function _loadXhr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xhr = this.xhr = new XMLHttpRequest(); + + // set the request type and url + xhr.open('GET', this.url, true); + + xhr.timeout = this.timeout; + + // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; + } else { + xhr.responseType = this.xhrType; + } + + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + + xhr.send(); + }; + + /** + * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). + * + * @private + */ + + + Resource.prototype._loadXdr = function _loadXdr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef + + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + + xdr.open('GET', this.url, true); + + // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + setTimeout(function () { + return xdr.send(); + }, 1); + }; - this.resources[name].progressChunk = eachChunk; - } // add the resource to the queue + /** + * Creates a source used in loading via an element. + * + * @private + * @param {string} type - The element type (video or audio). + * @param {string} url - The source URL to load from. + * @param {string} [mime] - The mime type of the video + * @return {HTMLSourceElement} The source element. + */ - this._queue.push(this.resources[name]); + Resource.prototype._createSource = function _createSource(type, url, mime) { + if (!mime) { + mime = type + '/' + this._getExtension(url); + } - return this; - } - /* eslint-enable require-jsdoc,valid-jsdoc */ + var source = document.createElement('source'); - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; + source.src = url; + source.type = mime; - _proto.pre = function pre(fn) { - this._beforeMiddleware.push(fn); + return source; + }; + + /** + * Called if a load errors out. + * + * @param {Event} event - The error event from the element that emits it. + * @private + */ - return this; - } - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @param {function} fn - The middleware function to register. - * @return {this} Returns itself. - */ - ; - _proto.use = function use(fn) { - this._afterMiddleware.push(fn); + Resource.prototype._onError = function _onError(event) { + this.abort('Failed to load element using: ' + event.target.nodeName); + }; + + /** + * Called if a load progress event fires for an element or xhr/xdr. + * + * @private + * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. + */ + + + Resource.prototype._onProgress = function _onProgress(event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + }; + + /** + * Called if a timeout event fires for an element. + * + * @private + */ + + + Resource.prototype._onTimeout = function _onTimeout() { + this.abort('Load timed out.'); + }; + + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + + + Resource.prototype._xhrOnError = function _xhrOnError() { + var xhr = this.xhr; + + this.abort(reqType(xhr) + ' Request failed. Status: ' + xhr.status + ', text: "' + xhr.statusText + '"'); + }; + + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + + + Resource.prototype._xhrOnTimeout = function _xhrOnTimeout() { + var xhr = this.xhr; + + this.abort(reqType(xhr) + ' Request timed out.'); + }; + + /** + * Called if an abort event fires for xhr/xdr. + * + * @private + */ + + + Resource.prototype._xhrOnAbort = function _xhrOnAbort() { + var xhr = this.xhr; + + this.abort(reqType(xhr) + ' Request was aborted by the user.'); + }; + + /** + * Called when data successfully loads from an xhr/xdr request. + * + * @private + * @param {XMLHttpRequestLoadEvent|Event} event - Load event + */ + + + Resource.prototype._xhrOnLoad = function _xhrOnLoad() { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + + // responseText is accessible only if responseType is '' or 'text' and on older browsers + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } + + // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + + var statusType = status / 100 | 0; + + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = Resource.TYPE.TEXT; + } + // if json, parse into json object + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = Resource.TYPE.JSON; + } catch (e) { + this.abort('Error trying to parse loaded json: ' + e); + + return; + } + } + // if xml, parse into an xml document or div element + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (window.DOMParser) { + var domparser = new DOMParser(); + + this.data = domparser.parseFromString(text, 'text/xml'); + } else { + var div = document.createElement('div'); + + div.innerHTML = text; + + this.data = div; + } + + this.type = Resource.TYPE.XML; + } catch (e) { + this.abort('Error trying to parse loaded xml: ' + e); + + return; + } + } + // other types just return the response + else { + this.data = xhr.response || text; + } + } else { + this.abort('[' + xhr.status + '] ' + xhr.statusText + ': ' + xhr.responseURL); + + return; + } + + this.complete(); + }; + + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * + * @private + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @return {string} The crossOrigin value to use (or empty string for none). + */ + + + Resource.prototype._determineCrossOrigin = function _determineCrossOrigin(url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + + // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match window.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + if (window.origin !== window.location.origin) { + return 'anonymous'; + } + + // default is window.location + loc = loc || window.location; + + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + url = (0, _parseUri2.default)(tempAnchor.href, { strictMode: true }); + + var samePort = !url.port && loc.port === '' || url.port === loc.port; + var protocol = url.protocol ? url.protocol + ':' : ''; + + // if cross origin + if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + + return ''; + }; + + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. + */ + + + Resource.prototype._determineXhrType = function _determineXhrType() { + return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; + }; + + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.LOAD_TYPE} The loadType to use. + */ + + + Resource.prototype._determineLoadType = function _determineLoadType() { + return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; + }; + + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * + * @private + * @return {string} The extension. + */ + + + Resource.prototype._getExtension = function _getExtension() { + var url = this.url; + var ext = ''; + + if (this.isDataUrl) { + var slashIndex = url.indexOf('/'); + + ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); + } else { + var queryStart = url.indexOf('?'); + var hashStart = url.indexOf('#'); + var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); + + url = url.substring(0, index); + ext = url.substring(url.lastIndexOf('.') + 1); + } + + return ext.toLowerCase(); + }; + + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * + * @private + * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. + * @return {string} The mime type to use. + */ + + + Resource.prototype._getMimeFromXhrType = function _getMimeFromXhrType(type) { + switch (type) { + case Resource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + + case Resource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + + case Resource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + + case Resource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + + case Resource.XHR_RESPONSE_TYPE.DEFAULT: + case Resource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + default: + return 'text/plain'; + } + }; + + _createClass(Resource, [{ + key: 'isDataUrl', + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); + } + + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * + * @readonly + * @member {boolean} + */ + + }, { + key: 'isComplete', + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); + } + + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * + * @readonly + * @member {boolean} + */ + + }, { + key: 'isLoading', + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.LOADING); + } + }]); + + return Resource; + }(); + + /** + * The types of resources a resource could represent. + * + * @static + * @readonly + * @enum {number} + */ + + + Resource.STATUS_FLAGS = { + NONE: 0, + DATA_URL: 1 << 0, + COMPLETE: 1 << 1, + LOADING: 1 << 2 + }; + + /** + * The types of resources a resource could represent. + * + * @static + * @readonly + * @enum {number} + */ + Resource.TYPE = { + UNKNOWN: 0, + JSON: 1, + XML: 2, + IMAGE: 3, + AUDIO: 4, + VIDEO: 5, + TEXT: 6 + }; + + /** + * The types of loading a resource can use. + * + * @static + * @readonly + * @enum {number} + */ + Resource.LOAD_TYPE = { + /** Uses XMLHttpRequest to load the resource. */ + XHR: 1, + /** Uses an `Image` object to load the resource. */ + IMAGE: 2, + /** Uses an `Audio` object to load the resource. */ + AUDIO: 3, + /** Uses a `Video` object to load the resource. */ + VIDEO: 4 + }; + + /** + * The XHR ready states, used internally. + * + * @static + * @readonly + * @enum {string} + */ + Resource.XHR_RESPONSE_TYPE = { + /** string */ + DEFAULT: 'text', + /** ArrayBuffer */ + BUFFER: 'arraybuffer', + /** Blob */ + BLOB: 'blob', + /** Document */ + DOCUMENT: 'document', + /** Object */ + JSON: 'json', + /** String */ + TEXT: 'text' + }; + + Resource._loadTypeMap = { + // images + gif: Resource.LOAD_TYPE.IMAGE, + png: Resource.LOAD_TYPE.IMAGE, + bmp: Resource.LOAD_TYPE.IMAGE, + jpg: Resource.LOAD_TYPE.IMAGE, + jpeg: Resource.LOAD_TYPE.IMAGE, + tif: Resource.LOAD_TYPE.IMAGE, + tiff: Resource.LOAD_TYPE.IMAGE, + webp: Resource.LOAD_TYPE.IMAGE, + tga: Resource.LOAD_TYPE.IMAGE, + svg: Resource.LOAD_TYPE.IMAGE, + 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls + + // audio + mp3: Resource.LOAD_TYPE.AUDIO, + ogg: Resource.LOAD_TYPE.AUDIO, + wav: Resource.LOAD_TYPE.AUDIO, + + // videos + mp4: Resource.LOAD_TYPE.VIDEO, + webm: Resource.LOAD_TYPE.VIDEO + }; + + Resource._xhrTypeMap = { + // xml + xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + html: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT, + + // images + gif: Resource.XHR_RESPONSE_TYPE.BLOB, + png: Resource.XHR_RESPONSE_TYPE.BLOB, + bmp: Resource.XHR_RESPONSE_TYPE.BLOB, + jpg: Resource.XHR_RESPONSE_TYPE.BLOB, + jpeg: Resource.XHR_RESPONSE_TYPE.BLOB, + tif: Resource.XHR_RESPONSE_TYPE.BLOB, + tiff: Resource.XHR_RESPONSE_TYPE.BLOB, + webp: Resource.XHR_RESPONSE_TYPE.BLOB, + tga: Resource.XHR_RESPONSE_TYPE.BLOB, + + // json + json: Resource.XHR_RESPONSE_TYPE.JSON, + + // text + text: Resource.XHR_RESPONSE_TYPE.TEXT, + txt: Resource.XHR_RESPONSE_TYPE.TEXT, + + // fonts + ttf: Resource.XHR_RESPONSE_TYPE.BUFFER, + otf: Resource.XHR_RESPONSE_TYPE.BUFFER + }; + + // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + Resource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; + + /** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * + * @ignore + * @param {object} map - The map to set on. + * @param {string} extname - The extension (or key) to set. + * @param {number} val - The value to set. + */ + function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + + if (!extname) { + return; + } + + map[extname] = val; + } + + /** + * Quick helper to get string xhr type. + * + * @ignore + * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. + * @return {string} The type. + */ + function reqType(xhr) { + return xhr.toString().replace('object ', ''); + } + + // Backwards compat + if (typeof module !== 'undefined') { + module.exports.default = Resource; // eslint-disable-line no-undef + } + + }, { "mini-signals": 5, "parse-uri": 7 }], 34: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.eachSeries = eachSeries; + exports.queue = queue; + /** + * Smaller version of the async library constructs. + * + * @namespace async + */ + + /** + * Noop function + * + * @ignore + * @function + * @memberof async + */ + function _noop() { } /* empty */ + + /** + * Iterates an array in series. + * + * @memberof async + * @param {Array.<*>} array - Array to iterate. + * @param {function} iterator - Function to call for each element. + * @param {function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + function eachSeries(array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + + (function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + + return; + } + + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } else { + iterator(array[i++], next); + } + })(); + } + + /** + * Ensures a function is only called once. + * + * @ignore + * @memberof async + * @param {function} fn - The function to wrap. + * @return {function} The wrapping function. + */ + function onlyOnce(fn) { + return function onceWrapper() { + if (fn === null) { + throw new Error('Callback was already called.'); + } + + var callFn = fn; + + fn = null; + callFn.apply(this, arguments); + }; + } + + /** + * Async queue implementation, + * + * @memberof async + * @param {function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @return {*} The async queue object. + */ + function queue(worker, concurrency) { + if (concurrency == null) { + // eslint-disable-line no-eq-null,eqeqeq + concurrency = 1; + } else if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var workers = 0; + var q = { + _tasks: [], + concurrency: concurrency, + saturated: _noop, + unsaturated: _noop, + buffer: concurrency / 4, + empty: _noop, + drain: _noop, + error: _noop, + started: false, + paused: false, + push: function push(data, callback) { + _insert(data, false, callback); + }, + kill: function kill() { + workers = 0; + q.drain = _noop; + q.started = false; + q._tasks = []; + }, + unshift: function unshift(data, callback) { + _insert(data, true, callback); + }, + process: function process() { + while (!q.paused && workers < q.concurrency && q._tasks.length) { + var task = q._tasks.shift(); + + if (q._tasks.length === 0) { + q.empty(); + } + + workers += 1; + + if (workers === q.concurrency) { + q.saturated(); + } + + worker(task.data, onlyOnce(_next(task))); + } + }, + length: function length() { + return q._tasks.length; + }, + running: function running() { + return workers; + }, + idle: function idle() { + return q._tasks.length + workers === 0; + }, + pause: function pause() { + if (q.paused === true) { + return; + } + + q.paused = true; + }, + resume: function resume() { + if (q.paused === false) { + return; + } + + q.paused = false; + + // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= q.concurrency; w++) { + q.process(); + } + } + }; + + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + // eslint-disable-line no-eq-null,eqeqeq + throw new Error('task callback must be a function'); + } + + q.started = true; + + if (data == null && q.idle()) { + // eslint-disable-line no-eq-null,eqeqeq + // call drain immediately if there are no tasks + setTimeout(function () { + return q.drain(); + }, 1); + + return; + } + + var item = { + data: data, + callback: typeof callback === 'function' ? callback : _noop + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + + setTimeout(function () { + return q.process(); + }, 1); + } + + function _next(task) { + return function next() { + workers -= 1; + + task.callback.apply(task, arguments); + + if (arguments[0] != null) { + // eslint-disable-line no-eq-null,eqeqeq + q.error(arguments[0], task.data); + } + + if (workers <= q.concurrency - q.buffer) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + + q.process(); + }; + } + + return q; + } + + }, {}], 35: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.encodeBinary = encodeBinary; + var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + /** + * Encodes binary into base64. + * + * @param {string} input The input data to encode. + * @returns {string} The encoded base64 string + */ + function encodeBinary(input) { + var output = ''; + var inx = 0; + + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } else { + bytebuffer[jnx] = 0; + } + } + + // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + encodedCharIndexes[0] = bytebuffer[0] >> 2; + + // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; + + // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; + + // index 3: forth 6 bits (6 least significant bits from input byte 3) + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; + + // Determine whether padding happened, and adjust accordingly + var paddingBytes = inx - (input.length - 1); + + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + + default: + break; // No padding - proceed + } + + // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { + output += _keyStr.charAt(encodedCharIndexes[_jnx]); + } + } + + return output; + } + + // Backwards compat + if (typeof module !== 'undefined') { + module.exports.default = encodeBinary; // eslint-disable-line no-undef + } + + }, {}], 36: [function (require, module, exports) { + 'use strict'; + + // import Loader from './Loader'; + // import Resource from './Resource'; + // import * as async from './async'; + // import * as b64 from './b64'; + + /* eslint-disable no-undef */ + + var Loader = require('./Loader').Loader; + var Resource = require('./Resource').Resource; + var async = require('./async'); + var b64 = require('./b64'); + + /** + * + * @static + * @memberof Loader + * @member {Class} + */ + Loader.Resource = Resource; + + /** + * + * @static + * @memberof Loader + * @member {Class} + */ + Loader.async = async; + + /** + * + * @static + * @memberof Loader + * @member {Class} + */ + Loader.encodeBinary = b64; + + /** + * + * @deprecated + * @see Loader.encodeBinary + * + * @static + * @memberof Loader + * @member {Class} + */ + Loader.base64 = b64; + + // export manually, and also as default + module.exports = Loader; + + // default & named export + module.exports.Loader = Loader; + module.exports.default = Loader; + + }, { "./Loader": 32, "./Resource": 33, "./async": 34, "./b64": 35 }], 37: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.blobMiddlewareFactory = blobMiddlewareFactory; + + var _Resource = require('../../Resource'); + + var _b = require('../../b64'); + + var Url = window.URL || window.webkitURL; + + // a middleware for transforming XHR loaded Blobs into more useful objects + function blobMiddlewareFactory() { + return function blobMiddleware(resource, next) { + if (!resource.data) { + next(); + + return; + } + + // if this was an XHR load of a blob + if (resource.xhr && resource.xhrType === _Resource.Resource.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!window.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); + + // this is an image, convert the binary string into a data url + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = 'data:' + type + ';base64,' + (0, _b.encodeBinary)(resource.xhr.responseText); + + resource.type = _Resource.Resource.TYPE.IMAGE; + + // wait until the image loads and then callback + resource.data.onload = function () { + resource.data.onload = null; + + next(); + }; + + // next will be called on load + return; + } + } + // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var src = Url.createObjectURL(resource.data); + + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src; + + resource.type = _Resource.Resource.TYPE.IMAGE; + + // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + resource.data.onload = function () { + Url.revokeObjectURL(src); + resource.data.onload = null; + + next(); + }; + + // next will be called on load. + return; + } + } + + next(); + }; + } + + }, { "../../Resource": 33, "../../b64": 35 }], 38: [function (require, module, exports) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + var punycode = require('punycode'); + var util = require('./util'); + + exports.parse = urlParse; + exports.resolve = urlResolve; + exports.resolveObject = urlResolveObject; + exports.format = urlFormat; + + exports.Url = Url; + + function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; + } + + // Reference: RFC 3986, RFC 1808, RFC 2396 + + // define these here so at least they only have to be + // compiled once on the first module load. + var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + + function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; + } + + Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; + }; + + // format a parsed object into a url string + function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); + } + + Url.prototype.format = function () { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function (match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; + }; + + function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); + } + + Url.prototype.resolve = function (relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); + }; + + function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); + } + + Url.prototype.resolveObject = function (relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + }; + + Url.prototype.parseHost = function () { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; + }; + + }, { "./util": 39, "punycode": 27, "querystring": 30 }], 39: [function (require, module, exports) { + 'use strict'; + + module.exports = { + isString: function (arg) { + return typeof (arg) === 'string'; + }, + isObject: function (arg) { + return typeof (arg) === 'object' && arg !== null; + }, + isNull: function (arg) { + return arg === null; + }, + isNullOrUndefined: function (arg) { + return arg == null; + } + }; + + }, {}], 40: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _ismobilejs = require('ismobilejs'); + + var _ismobilejs2 = _interopRequireDefault(_ismobilejs); + + var _accessibleTarget = require('./accessibleTarget'); + + var _accessibleTarget2 = _interopRequireDefault(_accessibleTarget); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + // add some extra variables to the container.. + core.utils.mixins.delayMixin(core.DisplayObject.prototype, _accessibleTarget2.default); + + var KEY_CODE_TAB = 9; + + var DIV_TOUCH_SIZE = 100; + var DIV_TOUCH_POS_X = 0; + var DIV_TOUCH_POS_Y = 0; + var DIV_TOUCH_ZINDEX = 2; + + var DIV_HOOK_SIZE = 1; + var DIV_HOOK_POS_X = -1000; + var DIV_HOOK_POS_Y = -1000; + var DIV_HOOK_ZINDEX = 2; + + /** + * The Accessibility manager recreates the ability to tab and have content read by screen + * readers. This is very important as it can possibly help people with disabilities access pixi + * content. + * + * Much like interaction any DisplayObject can be made accessible. This manager will map the + * events as if the mouse was being used, minimizing the effort required to implement. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * + * @class + * @memberof PIXI.accessibility + */ + + var AccessibilityManager = function () { + /** + * @param {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - A reference to the current renderer + */ + function AccessibilityManager(renderer) { + _classCallCheck(this, AccessibilityManager); + + if ((_ismobilejs2.default.tablet || _ismobilejs2.default.phone) && !navigator.isCocoonJS) { + this.createTouchHook(); + } + + // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. + var div = document.createElement('div'); + + div.style.width = DIV_TOUCH_SIZE + 'px'; + div.style.height = DIV_TOUCH_SIZE + 'px'; + div.style.position = 'absolute'; + div.style.top = DIV_TOUCH_POS_X + 'px'; + div.style.left = DIV_TOUCH_POS_Y + 'px'; + div.style.zIndex = DIV_TOUCH_ZINDEX; + + /** + * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. + * + * @type {HTMLElement} + * @private + */ + this.div = div; + + /** + * A simple pool for storing divs. + * + * @type {*} + * @private + */ + this.pool = []; + + /** + * This is a tick used to check if an object is no longer being rendered. + * + * @type {Number} + * @private + */ + this.renderId = 0; + + /** + * Setting this to true will visually show the divs. + * + * @type {boolean} + */ + this.debug = false; + + /** + * The renderer this accessibility manager works for. + * + * @member {PIXI.SystemRenderer} + */ + this.renderer = renderer; + + /** + * The array of currently active accessible items. + * + * @member {Array<*>} + * @private + */ + this.children = []; + + /** + * pre-bind the functions + * + * @private + */ + this._onKeyDown = this._onKeyDown.bind(this); + this._onMouseMove = this._onMouseMove.bind(this); + + /** + * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false. + * + * @member {Array<*>} + * @private + */ + this.isActive = false; + this.isMobileAccessabillity = false; + + // let listen for tab.. once pressed we can fire up and show the accessibility layer + window.addEventListener('keydown', this._onKeyDown, false); + } + + /** + * Creates the touch hooks. + * + */ + + + AccessibilityManager.prototype.createTouchHook = function createTouchHook() { + var _this = this; + + var hookDiv = document.createElement('button'); + + hookDiv.style.width = DIV_HOOK_SIZE + 'px'; + hookDiv.style.height = DIV_HOOK_SIZE + 'px'; + hookDiv.style.position = 'absolute'; + hookDiv.style.top = DIV_HOOK_POS_X + 'px'; + hookDiv.style.left = DIV_HOOK_POS_Y + 'px'; + hookDiv.style.zIndex = DIV_HOOK_ZINDEX; + hookDiv.style.backgroundColor = '#FF0000'; + hookDiv.title = 'HOOK DIV'; + + hookDiv.addEventListener('focus', function () { + _this.isMobileAccessabillity = true; + _this.activate(); + document.body.removeChild(hookDiv); + }); + + document.body.appendChild(hookDiv); + }; + + /** + * Activating will cause the Accessibility layer to be shown. This is called when a user + * preses the tab key. + * + * @private + */ + + + AccessibilityManager.prototype.activate = function activate() { + if (this.isActive) { + return; + } + + this.isActive = true; + + window.document.addEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown, false); + + this.renderer.on('postrender', this.update, this); + + if (this.renderer.view.parentNode) { + this.renderer.view.parentNode.appendChild(this.div); + } + }; + + /** + * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves + * the mouse. + * + * @private + */ + + + AccessibilityManager.prototype.deactivate = function deactivate() { + if (!this.isActive || this.isMobileAccessabillity) { + return; + } + + this.isActive = false; + + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.addEventListener('keydown', this._onKeyDown, false); + + this.renderer.off('postrender', this.update); + + if (this.div.parentNode) { + this.div.parentNode.removeChild(this.div); + } + }; + + /** + * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. + * + * @private + * @param {PIXI.Container} displayObject - The DisplayObject to check. + */ + - return this; - } - /** - * Resets the queue of the loader to prepare for a new load. - * - * @return {this} Returns itself. - */ - ; + AccessibilityManager.prototype.updateAccessibleObjects = function updateAccessibleObjects(displayObject) { + if (!displayObject.visible) { + return; + } + + if (displayObject.accessible && displayObject.interactive) { + if (!displayObject._accessibleActive) { + this.addChild(displayObject); + } - _proto.reset = function reset() { - this.progress = 0; - this.loading = false; + displayObject.renderId = this.renderId; + } - this._queue.kill(); + var children = displayObject.children; - this._queue.pause(); // abort all resource loads + for (var i = 0; i < children.length; i++) { + this.updateAccessibleObjects(children[i]); + } + }; + + /** + * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. + * + * @private + */ + + + AccessibilityManager.prototype.update = function update() { + if (!this.renderer.renderingToScreen) { + return; + } + + // update children... + this.updateAccessibleObjects(this.renderer._lastObjectRendered); + var rect = this.renderer.view.getBoundingClientRect(); + var sx = rect.width / this.renderer.width; + var sy = rect.height / this.renderer.height; + + var div = this.div; + + div.style.left = rect.left + 'px'; + div.style.top = rect.top + 'px'; + div.style.width = this.renderer.width + 'px'; + div.style.height = this.renderer.height + 'px'; + + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + + if (child.renderId !== this.renderId) { + child._accessibleActive = false; + + core.utils.removeItems(this.children, i, 1); + this.div.removeChild(child._accessibleDiv); + this.pool.push(child._accessibleDiv); + child._accessibleDiv = null; + + i--; + + if (this.children.length === 0) { + this.deactivate(); + } + } else { + // map div to display.. + div = child._accessibleDiv; + var hitArea = child.hitArea; + var wt = child.worldTransform; + + if (child.hitArea) { + div.style.left = (wt.tx + hitArea.x * wt.a) * sx + 'px'; + div.style.top = (wt.ty + hitArea.y * wt.d) * sy + 'px'; + + div.style.width = hitArea.width * wt.a * sx + 'px'; + div.style.height = hitArea.height * wt.d * sy + 'px'; + } else { + hitArea = child.getBounds(); + + this.capHitArea(hitArea); + + div.style.left = hitArea.x * sx + 'px'; + div.style.top = hitArea.y * sy + 'px'; + + div.style.width = hitArea.width * sx + 'px'; + div.style.height = hitArea.height * sy + 'px'; + + // update button titles and hints if they exist and they've changed + if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) { + div.title = child.accessibleTitle; + } + if (div.getAttribute('aria-label') !== child.accessibleHint && child.accessibleHint !== null) { + div.setAttribute('aria-label', child.accessibleHint); + } + } + } + } + + // increment the render id.. + this.renderId++; + }; + + /** + * TODO: docs. + * + * @param {Rectangle} hitArea - TODO docs + */ + + + AccessibilityManager.prototype.capHitArea = function capHitArea(hitArea) { + if (hitArea.x < 0) { + hitArea.width += hitArea.x; + hitArea.x = 0; + } + + if (hitArea.y < 0) { + hitArea.height += hitArea.y; + hitArea.y = 0; + } + + if (hitArea.x + hitArea.width > this.renderer.width) { + hitArea.width = this.renderer.width - hitArea.x; + } + + if (hitArea.y + hitArea.height > this.renderer.height) { + hitArea.height = this.renderer.height - hitArea.y; + } + }; + + /** + * Adds a DisplayObject to the accessibility manager + * + * @private + * @param {DisplayObject} displayObject - The child to make accessible. + */ + + + AccessibilityManager.prototype.addChild = function addChild(displayObject) { + // this.activate(); + + var div = this.pool.pop(); + + if (!div) { + div = document.createElement('button'); + + div.style.width = DIV_TOUCH_SIZE + 'px'; + div.style.height = DIV_TOUCH_SIZE + 'px'; + div.style.backgroundColor = this.debug ? 'rgba(255,0,0,0.5)' : 'transparent'; + div.style.position = 'absolute'; + div.style.zIndex = DIV_TOUCH_ZINDEX; + div.style.borderStyle = 'none'; + + // ARIA attributes ensure that button title and hint updates are announced properly + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. + div.setAttribute('aria-live', 'off'); + } else { + div.setAttribute('aria-live', 'polite'); + } + + if (navigator.userAgent.match(/rv:.*Gecko\//)) { + // FireFox needs this to announce only the new button name + div.setAttribute('aria-relevant', 'additions'); + } else { + // required by IE, other browsers don't much care + div.setAttribute('aria-relevant', 'text'); + } + + div.addEventListener('click', this._onClick.bind(this)); + div.addEventListener('focus', this._onFocus.bind(this)); + //div.addEventListener('focusout', this._onFocusOut.bind(this)); + } + + if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) { + div.title = displayObject.accessibleTitle; + } else if (!displayObject.accessibleHint || displayObject.accessibleHint === null) { + div.title = 'displayObject ' + displayObject.tabIndex; + } + + if (displayObject.accessibleHint && displayObject.accessibleHint !== null) { + div.setAttribute('aria-label', displayObject.accessibleHint); + } + + // + + displayObject._accessibleActive = true; + displayObject._accessibleDiv = div; + div.displayObject = displayObject; + + this.children.push(displayObject); + this.div.appendChild(displayObject._accessibleDiv); + displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; + }; + + /** + * Maps the div button press to pixi's InteractionManager (click) + * + * @private + * @param {MouseEvent} e - The click event. + */ + + + AccessibilityManager.prototype._onClick = function _onClick(e) { + var interactionManager = this.renderer.plugins.interaction; + + interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); + }; + + /** + * Maps the div focus events to pixi's InteractionManager (mouseover) + * + * @private + * @param {FocusEvent} e - The focus event. + */ + + + AccessibilityManager.prototype._onFocus = function _onFocus(e) { + if (!e.target.getAttribute('aria-live', 'off')) { + e.target.setAttribute('aria-live', 'assertive'); + } + var interactionManager = this.renderer.plugins.interaction; + + interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); + }; + + /** + * Maps the div focus events to pixi's InteractionManager (mouseout) + * + * @private + * @param {FocusEvent} e - The focusout event. + */ + + + AccessibilityManager.prototype._onFocusOut = function _onFocusOut(e) { + if (!e.target.getAttribute('aria-live', 'off')) { + e.target.setAttribute('aria-live', 'polite'); + } + var interactionManager = this.renderer.plugins.interaction; + + interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); + }; + + /** + * Is called when a key is pressed + * + * @private + * @param {KeyboardEvent} e - The keydown event. + */ + + + AccessibilityManager.prototype._onKeyDown = function _onKeyDown(e) { + if (e.keyCode !== KEY_CODE_TAB) { + return; + } + + this.activate(); + }; + + /** + * Is called when the mouse moves across the renderer element + * + * @private + * @param {MouseEvent} e - The mouse event. + */ + + + AccessibilityManager.prototype._onMouseMove = function _onMouseMove(e) { + if (e.movementX === 0 && e.movementY === 0) { + return; + } + + this.deactivate(); + }; + + /** + * Destroys the accessibility manager + * + */ + + + AccessibilityManager.prototype.destroy = function destroy() { + this.div = null; + + for (var i = 0; i < this.children.length; i++) { + this.children[i].div = null; + } + + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown); + + this.pool = null; + this.children = null; + this.renderer = null; + }; + + return AccessibilityManager; + }(); + + exports.default = AccessibilityManager; + + + core.WebGLRenderer.registerPlugin('accessibility', AccessibilityManager); + core.CanvasRenderer.registerPlugin('accessibility', AccessibilityManager); + + }, { "../core": 65, "./accessibleTarget": 41, "ismobilejs": 4 }], 41: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + /** + * Default property values of accessible objects + * used by {@link PIXI.accessibility.AccessibilityManager}. + * + * @function accessibleTarget + * @memberof PIXI.accessibility + * @example + * function MyObject() {} + * + * Object.assign( + * MyObject.prototype, + * PIXI.accessibility.accessibleTarget + * ); + */ + exports.default = { + /** + * Flag for if the object is accessible. If true AccessibilityManager will overlay a + * shadow div with attributes set + * + * @member {boolean} + */ + accessible: false, + + /** + * Sets the title attribute of the shadow div + * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' + * + * @member {string} + */ + accessibleTitle: null, + + /** + * Sets the aria-label attribute of the shadow div + * + * @member {string} + */ + accessibleHint: null, + + /** + * @todo Needs docs. + */ + tabIndex: 0, + + /** + * @todo Needs docs. + */ + _accessibleActive: false, + + /** + * @todo Needs docs. + */ + _accessibleDiv: false + }; + + }, {}], 42: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _accessibleTarget = require('./accessibleTarget'); + + Object.defineProperty(exports, 'accessibleTarget', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_accessibleTarget).default; + } + }); + + var _AccessibilityManager = require('./AccessibilityManager'); + + Object.defineProperty(exports, 'AccessibilityManager', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_AccessibilityManager).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./AccessibilityManager": 40, "./accessibleTarget": 41 }], 43: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _autoDetectRenderer = require('./autoDetectRenderer'); + + var _Container = require('./display/Container'); + + var _Container2 = _interopRequireDefault(_Container); + + var _ticker = require('./ticker'); + + var _settings = require('./settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _const = require('./const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Convenience class to create a new PIXI application. + * This class automatically creates the renderer, ticker + * and root container. + * + * @example + * // Create the application + * const app = new PIXI.Application(); + * + * // Add the view to the DOM + * document.body.appendChild(app.view); + * + * // ex, add display objects + * app.stage.addChild(PIXI.Sprite.fromImage('something.png')); + * + * @class + * @memberof PIXI + */ + var Application = function () { + // eslint-disable-next-line valid-jsdoc + /** + * @param {object} [options] - The optional renderer parameters + * @param {boolean} [options.autoStart=true] - automatically starts the rendering after the construction. + * Note that setting this parameter to false does NOT stop the shared ticker even if you set + * options.sharedTicker to true in case that it is already started. Stop it by your own. + * @param {number} [options.width=800] - the width of the renderers view + * @param {number} [options.height=600] - the height of the renderers view + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment) + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you + * need to call toDataUrl on the webgl context + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2 + * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, + * stopping pixel interpolation. + * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. + * FXAA is faster, but may not always look as great **webgl only** + * @param {boolean} [options.legacy=false] - `true` to ensure compatibility with older / less advanced devices. + * If you experience unexplained flickering try setting this to true. **webgl only** + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card **webgl only** + * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.ticker.shared, `false` to create new ticker. + * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.loaders.shared, `false` to create new Loader. + */ + function Application(options, arg2, arg3, arg4, arg5) { + _classCallCheck(this, Application); + + // Support for constructor(width, height, options, noWebGL, useSharedTicker) + if (typeof options === 'number') { + options = Object.assign({ + width: options, + height: arg2 || _settings2.default.RENDER_OPTIONS.height, + forceCanvas: !!arg4, + sharedTicker: !!arg5 + }, arg3); + } + + /** + * The default options, so we mixin functionality later. + * @member {object} + * @protected + */ + this._options = options = Object.assign({ + autoStart: true, + sharedTicker: false, + forceCanvas: false, + sharedLoader: false + }, options); + + /** + * WebGL renderer if available, otherwise CanvasRenderer + * @member {PIXI.WebGLRenderer|PIXI.CanvasRenderer} + */ + this.renderer = (0, _autoDetectRenderer.autoDetectRenderer)(options); + + /** + * The root display container that's rendered. + * @member {PIXI.Container} + */ + this.stage = new _Container2.default(); + + /** + * Internal reference to the ticker + * @member {PIXI.ticker.Ticker} + * @private + */ + this._ticker = null; + + /** + * Ticker for doing render updates. + * @member {PIXI.ticker.Ticker} + * @default PIXI.ticker.shared + */ + this.ticker = options.sharedTicker ? _ticker.shared : new _ticker.Ticker(); + + // Start the rendering + if (options.autoStart) { + this.start(); + } + } + + /** + * Render the current stage. + */ + Application.prototype.render = function render() { + this.renderer.render(this.stage); + }; + + /** + * Convenience method for stopping the render. + */ + + + Application.prototype.stop = function stop() { + this._ticker.stop(); + }; + + /** + * Convenience method for starting the render. + */ + + + Application.prototype.start = function start() { + this._ticker.start(); + }; + + /** + * Reference to the renderer's canvas element. + * @member {HTMLCanvasElement} + * @readonly + */ + + + /** + * Destroy and don't use after this. + * @param {Boolean} [removeView=false] Automatically remove canvas from DOM. + * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy + * method called as well. 'stageOptions' will be passed on to those calls. + * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the texture of the child sprite + * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the base texture of the child sprite + */ + Application.prototype.destroy = function destroy(removeView, stageOptions) { + if (this._ticker) { + var oldTicker = this._ticker; + + this.ticker = null; + oldTicker.destroy(); + } + + this.stage.destroy(stageOptions); + this.stage = null; + + this.renderer.destroy(removeView); + this.renderer = null; + + this._options = null; + }; + + _createClass(Application, [{ + key: 'ticker', + set: function set(ticker) // eslint-disable-line require-jsdoc + { + if (this._ticker) { + this._ticker.remove(this.render, this); + } + this._ticker = ticker; + if (ticker) { + ticker.add(this.render, this, _const.UPDATE_PRIORITY.LOW); + } + }, + get: function get() // eslint-disable-line require-jsdoc + { + return this._ticker; + } + }, { + key: 'view', + get: function get() { + return this.renderer.view; + } + + /** + * Reference to the renderer's screen rectangle. Its safe to use as filterArea or hitArea for whole screen + * @member {PIXI.Rectangle} + * @readonly + */ + + }, { + key: 'screen', + get: function get() { + return this.renderer.screen; + } + }]); + + return Application; + }(); + + exports.default = Application; + + }, { "./autoDetectRenderer": 45, "./const": 46, "./display/Container": 48, "./settings": 101, "./ticker": 121 }], 44: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _pixiGlCore = require('pixi-gl-core'); + + var _settings = require('./settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + function checkPrecision(src, def) { + if (src instanceof Array) { + if (src[0].substring(0, 9) !== 'precision') { + var copy = src.slice(0); + + copy.unshift('precision ' + def + ' float;'); + + return copy; + } + } else if (src.trim().substring(0, 9) !== 'precision') { + return 'precision ' + def + ' float;\n' + src; + } + + return src; + } + + /** + * Wrapper class, webGL Shader for Pixi. + * Adds precision string if vertexSrc or fragmentSrc have no mention of it. + * + * @class + * @extends GLShader + * @memberof PIXI + */ + + var Shader = function (_GLShader) { + _inherits(Shader, _GLShader); + + /** + * + * @param {WebGLRenderingContext} gl - The current WebGL rendering context + * @param {string|string[]} vertexSrc - The vertex shader source as an array of strings. + * @param {string|string[]} fragmentSrc - The fragment shader source as an array of strings. + * @param {object} [attributeLocations] - A key value pair showing which location eact attribute should sit. + e.g. {position:0, uvs:1}. + * @param {string} [precision] - The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. + */ + function Shader(gl, vertexSrc, fragmentSrc, attributeLocations, precision) { + _classCallCheck(this, Shader); + + return _possibleConstructorReturn(this, _GLShader.call(this, gl, checkPrecision(vertexSrc, precision || _settings2.default.PRECISION_VERTEX), checkPrecision(fragmentSrc, precision || _settings2.default.PRECISION_FRAGMENT), undefined, attributeLocations)); + } + + return Shader; + }(_pixiGlCore.GLShader); + + exports.default = Shader; + + }, { "./settings": 101, "pixi-gl-core": 15 }], 45: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.autoDetectRenderer = autoDetectRenderer; + + var _utils = require('./utils'); + + var utils = _interopRequireWildcard(_utils); + + var _CanvasRenderer = require('./renderers/canvas/CanvasRenderer'); + + var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); + + var _WebGLRenderer = require('./renderers/webgl/WebGLRenderer'); + + var _WebGLRenderer2 = _interopRequireDefault(_WebGLRenderer); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + // eslint-disable-next-line valid-jsdoc + /** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * the browser then this function will return a canvas renderer + * + * @memberof PIXI + * @function autoDetectRenderer + * @param {object} [options] - The optional renderer parameters + * @param {number} [options.width=800] - the width of the renderers view + * @param {number} [options.height=600] - the height of the renderers view + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment) + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you + * need to call toDataUrl on the webgl context + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2 + * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present + * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, + * stopping pixel interpolation. + * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. + * FXAA is faster, but may not always look as great **webgl only** + * @param {boolean} [options.legacy=false] - `true` to ensure compatibility with older / less advanced devices. + * If you experience unexplained flickering try setting this to true. **webgl only** + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card **webgl only** + * @return {PIXI.WebGLRenderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer + */ + function autoDetectRenderer(options, arg1, arg2, arg3) { + // Backward-compatible support for noWebGL option + var forceCanvas = options && options.forceCanvas; + + if (arg3 !== undefined) { + forceCanvas = arg3; + } + + if (!forceCanvas && utils.isWebGLSupported()) { + return new _WebGLRenderer2.default(options, arg1, arg2); + } + + return new _CanvasRenderer2.default(options, arg1, arg2); + } + + }, { "./renderers/canvas/CanvasRenderer": 77, "./renderers/webgl/WebGLRenderer": 84, "./utils": 125 }], 46: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + /** + * String of the current PIXI version. + * + * @static + * @constant + * @memberof PIXI + * @name VERSION + * @type {string} + */ + var VERSION = exports.VERSION = '4.8.9'; + + /** + * Two Pi. + * + * @static + * @constant + * @memberof PIXI + * @type {number} + */ + var PI_2 = exports.PI_2 = Math.PI * 2; + + /** + * Conversion factor for converting radians to degrees. + * + * @static + * @constant + * @memberof PIXI + * @type {number} + */ + var RAD_TO_DEG = exports.RAD_TO_DEG = 180 / Math.PI; + + /** + * Conversion factor for converting degrees to radians. + * + * @static + * @constant + * @memberof PIXI + * @type {number} + */ + var DEG_TO_RAD = exports.DEG_TO_RAD = Math.PI / 180; + + /** + * Constant to identify the Renderer Type. + * + * @static + * @constant + * @memberof PIXI + * @name RENDERER_TYPE + * @type {object} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ + var RENDERER_TYPE = exports.RENDERER_TYPE = { + UNKNOWN: 0, + WEBGL: 1, + CANVAS: 2 + }; + + /** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * + * @static + * @constant + * @memberof PIXI + * @name BLEND_MODES + * @type {object} + * @property {number} NORMAL + * @property {number} ADD + * @property {number} MULTIPLY + * @property {number} SCREEN + * @property {number} OVERLAY + * @property {number} DARKEN + * @property {number} LIGHTEN + * @property {number} COLOR_DODGE + * @property {number} COLOR_BURN + * @property {number} HARD_LIGHT + * @property {number} SOFT_LIGHT + * @property {number} DIFFERENCE + * @property {number} EXCLUSION + * @property {number} HUE + * @property {number} SATURATION + * @property {number} COLOR + * @property {number} LUMINOSITY + */ + var BLEND_MODES = exports.BLEND_MODES = { + NORMAL: 0, + ADD: 1, + MULTIPLY: 2, + SCREEN: 3, + OVERLAY: 4, + DARKEN: 5, + LIGHTEN: 6, + COLOR_DODGE: 7, + COLOR_BURN: 8, + HARD_LIGHT: 9, + SOFT_LIGHT: 10, + DIFFERENCE: 11, + EXCLUSION: 12, + HUE: 13, + SATURATION: 14, + COLOR: 15, + LUMINOSITY: 16, + NORMAL_NPM: 17, + ADD_NPM: 18, + SCREEN_NPM: 19 + }; + + /** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * + * @static + * @constant + * @memberof PIXI + * @name DRAW_MODES + * @type {object} + * @property {number} POINTS + * @property {number} LINES + * @property {number} LINE_LOOP + * @property {number} LINE_STRIP + * @property {number} TRIANGLES + * @property {number} TRIANGLE_STRIP + * @property {number} TRIANGLE_FAN + */ + var DRAW_MODES = exports.DRAW_MODES = { + POINTS: 0, + LINES: 1, + LINE_LOOP: 2, + LINE_STRIP: 3, + TRIANGLES: 4, + TRIANGLE_STRIP: 5, + TRIANGLE_FAN: 6 + }; + + /** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * + * @static + * @constant + * @memberof PIXI + * @name SCALE_MODES + * @type {object} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ + var SCALE_MODES = exports.SCALE_MODES = { + LINEAR: 0, + NEAREST: 1 + }; + + /** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as webGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * + * @static + * @constant + * @name WRAP_MODES + * @memberof PIXI + * @type {object} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ + var WRAP_MODES = exports.WRAP_MODES = { + CLAMP: 0, + REPEAT: 1, + MIRRORED_REPEAT: 2 + }; + + /** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * + * @static + * @constant + * @name GC_MODES + * @memberof PIXI + * @type {object} + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ + var GC_MODES = exports.GC_MODES = { + AUTO: 0, + MANUAL: 1 + }; + + /** + * Regexp for image type by extension. + * + * @static + * @constant + * @memberof PIXI + * @type {RegExp|string} + * @example `image.png` + */ + var URL_FILE_EXTENSION = exports.URL_FILE_EXTENSION = /\.(\w{3,4})(?:$|\?|#)/i; + + /** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * + * @static + * @constant + * @name DATA_URI + * @memberof PIXI + * @type {RegExp|string} + * @example data:image/png;base64 + */ + var DATA_URI = exports.DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; + + /** + * Regexp for SVG size. + * + * @static + * @constant + * @name SVG_SIZE + * @memberof PIXI + * @type {RegExp|string} + * @example <svg width="100" height="100"></svg> + */ + var SVG_SIZE = exports.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len + + /** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * + * @static + * @constant + * @name SHAPES + * @memberof PIXI + * @type {object} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + */ + var SHAPES = exports.SHAPES = { + POLY: 0, + RECT: 1, + CIRC: 2, + ELIP: 3, + RREC: 4 + }; + + /** + * Constants that specify float precision in shaders. + * + * @static + * @constant + * @name PRECISION + * @memberof PIXI + * @type {object} + * @property {string} LOW='lowp' + * @property {string} MEDIUM='mediump' + * @property {string} HIGH='highp' + */ + var PRECISION = exports.PRECISION = { + LOW: 'lowp', + MEDIUM: 'mediump', + HIGH: 'highp' + }; + + /** + * Constants that specify the transform type. + * + * @static + * @constant + * @name TRANSFORM_MODE + * @memberof PIXI + * @type {object} + * @property {number} STATIC + * @property {number} DYNAMIC + */ + var TRANSFORM_MODE = exports.TRANSFORM_MODE = { + STATIC: 0, + DYNAMIC: 1 + }; + + /** + * Constants that define the type of gradient on text. + * + * @static + * @constant + * @name TEXT_GRADIENT + * @memberof PIXI + * @type {object} + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient + */ + var TEXT_GRADIENT = exports.TEXT_GRADIENT = { + LINEAR_VERTICAL: 0, + LINEAR_HORIZONTAL: 1 + }; + + /** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.ticker.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @type {object} + * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.interaction.InteractionManager} + * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.extras.AnimatedSprite} + * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.ticker.Ticker#add}. + * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering. + * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.prepare.BasePrepare} utility. + */ + var UPDATE_PRIORITY = exports.UPDATE_PRIORITY = { + INTERACTION: 50, + HIGH: 25, + NORMAL: 0, + LOW: -25, + UTILITY: -50 + }; + + }, {}], 47: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _math = require('../math'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * 'Builder' pattern for bounds rectangles + * Axis-Aligned Bounding Box + * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * + * @class + * @memberof PIXI + */ + var Bounds = function () { + /** + * + */ + function Bounds() { + _classCallCheck(this, Bounds); + + /** + * @member {number} + * @default 0 + */ + this.minX = Infinity; + + /** + * @member {number} + * @default 0 + */ + this.minY = Infinity; + + /** + * @member {number} + * @default 0 + */ + this.maxX = -Infinity; + + /** + * @member {number} + * @default 0 + */ + this.maxY = -Infinity; + + this.rect = null; + } + + /** + * Checks if bounds are empty. + * + * @return {boolean} True if empty. + */ + + + Bounds.prototype.isEmpty = function isEmpty() { + return this.minX > this.maxX || this.minY > this.maxY; + }; + + /** + * Clears the bounds and resets. + * + */ + + + Bounds.prototype.clear = function clear() { + this.updateID++; + + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * + * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty + * @returns {PIXI.Rectangle} A rectangle of the bounds + */ + + + Bounds.prototype.getRectangle = function getRectangle(rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return _math.Rectangle.EMPTY; + } + + rect = rect || new _math.Rectangle(0, 0, 1, 1); + + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + + return rect; + }; + + /** + * This function should be inlined when its possible. + * + * @param {PIXI.Point} point - The point to add. + */ + + + Bounds.prototype.addPoint = function addPoint(point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + + /** + * Adds a quad, not transformed + * + * @param {Float32Array} vertices - The verts to add. + */ + + + Bounds.prototype.addQuad = function addQuad(vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + var x = vertices[0]; + var y = vertices[1]; + + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + + /** + * Adds sprite frame, transformed. + * + * @param {PIXI.TransformBase} transform - TODO + * @param {number} x0 - TODO + * @param {number} y0 - TODO + * @param {number} x1 - TODO + * @param {number} y1 - TODO + */ + + + Bounds.prototype.addFrame = function addFrame(transform, x0, y0, x1, y1) { + var matrix = transform.worldTransform; + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + var x = a * x0 + c * y0 + tx; + var y = b * x0 + d * y0 + ty; + + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = a * x1 + c * y0 + tx; + y = b * x1 + d * y0 + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = a * x0 + c * y1 + tx; + y = b * x0 + d * y1 + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + x = a * x1 + c * y1 + tx; + y = b * x1 + d * y1 + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + + /** + * Add an array of vertices + * + * @param {PIXI.TransformBase} transform - TODO + * @param {Float32Array} vertices - TODO + * @param {number} beginOffset - TODO + * @param {number} endOffset - TODO + */ + + + Bounds.prototype.addVertices = function addVertices(transform, vertices, beginOffset, endOffset) { + var matrix = transform.worldTransform; + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = a * rawX + c * rawY + tx; + var y = d * rawY + b * rawX + ty; + + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + + /** + * Adds other Bounds + * + * @param {PIXI.Bounds} bounds - TODO + */ + + + Bounds.prototype.addBounds = function addBounds(bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + + /** + * Adds other Bounds, masked with Bounds + * + * @param {PIXI.Bounds} bounds - TODO + * @param {PIXI.Bounds} mask - TODO + */ + + + Bounds.prototype.addBoundsMask = function addBoundsMask(bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + + /** + * Adds other Bounds, masked with Rectangle + * + * @param {PIXI.Bounds} bounds - TODO + * @param {PIXI.Rectangle} area - TODO + */ + + + Bounds.prototype.addBoundsArea = function addBoundsArea(bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : area.x + area.width; + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : area.y + area.height; + + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + + return Bounds; + }(); + + exports.default = Bounds; + + }, { "../math": 70 }], 48: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _utils = require('../utils'); + + var _DisplayObject2 = require('./DisplayObject'); + + var _DisplayObject3 = _interopRequireDefault(_DisplayObject2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A Container represents a collection of display objects. + * It is the base class of all display objects that act as a container for other objects. + * + *```js + * let container = new PIXI.Container(); + * container.addChild(sprite); + * ``` + * + * @class + * @extends PIXI.DisplayObject + * @memberof PIXI + */ + var Container = function (_DisplayObject) { + _inherits(Container, _DisplayObject); + + /** + * + */ + function Container() { + _classCallCheck(this, Container); + + /** + * The array of children of this container. + * + * @member {PIXI.DisplayObject[]} + * @readonly + */ + var _this = _possibleConstructorReturn(this, _DisplayObject.call(this)); + + _this.children = []; + return _this; + } + + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified + * + * @private + */ + + + Container.prototype.onChildrenChange = function onChildrenChange() { } + /* empty */ + + + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * + * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container + * @return {PIXI.DisplayObject} The first child that was added. + */ + ; + + Container.prototype.addChild = function addChild(child) { + var argumentsLength = arguments.length; + + // if there is only one argument we can bypass looping through the them + if (argumentsLength > 1) { + // loop through the arguments property and add all children + // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + for (var i = 0; i < argumentsLength; i++) { + this.addChild(arguments[i]); + } + } else { + // if the child has a parent then lets remove it as PixiJS objects can only exist in one place + if (child.parent) { + child.parent.removeChild(child); + } + + child.parent = this; + // ensure child transform will be recalculated + child.transform._parentID = -1; + + this.children.push(child); + + // ensure bounds will be recalculated + this._boundsID++; + + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(this.children.length - 1); + child.emit('added', this); + } + + return child; + }; + + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @return {PIXI.DisplayObject} The child that was added. + */ + + + Container.prototype.addChildAt = function addChildAt(child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + 'addChildAt: The index ' + index + ' supplied is out of bounds ' + this.children.length); + } + + if (child.parent) { + child.parent.removeChild(child); + } + + child.parent = this; + // ensure child transform will be recalculated + child.transform._parentID = -1; + + this.children.splice(index, 0, child); + + // ensure bounds will be recalculated + this._boundsID++; + + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('added', this); + + return child; + }; + + /** + * Swaps the position of 2 Display Objects within this container. + * + * @param {PIXI.DisplayObject} child - First display object to swap + * @param {PIXI.DisplayObject} child2 - Second display object to swap + */ + + + Container.prototype.swapChildren = function swapChildren(child, child2) { + if (child === child2) { + return; + } + + var index1 = this.getChildIndex(child); + var index2 = this.getChildIndex(child2); + + this.children[index1] = child2; + this.children[index2] = child; + this.onChildrenChange(index1 < index2 ? index1 : index2); + }; + + /** + * Returns the index position of a child DisplayObject instance + * + * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify + * @return {number} The index position of the child display object to identify + */ + + + Container.prototype.getChildIndex = function getChildIndex(child) { + var index = this.children.indexOf(child); + + if (index === -1) { + throw new Error('The supplied DisplayObject must be a child of the caller'); + } + + return index; + }; + + /** + * Changes the position of an existing child in the display object container + * + * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number + * @param {number} index - The resulting index number for the child display object + */ + + + Container.prototype.setChildIndex = function setChildIndex(child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error('The index ' + index + ' supplied is out of bounds ' + this.children.length); + } + + var currentIndex = this.getChildIndex(child); + + (0, _utils.removeItems)(this.children, currentIndex, 1); // remove from old position + this.children.splice(index, 0, child); // add at new position + + this.onChildrenChange(index); + }; + + /** + * Returns the child at the specified index + * + * @param {number} index - The index to get the child at + * @return {PIXI.DisplayObject} The child at the given index, if any. + */ + + + Container.prototype.getChildAt = function getChildAt(index) { + if (index < 0 || index >= this.children.length) { + throw new Error('getChildAt: Index (' + index + ') does not exist.'); + } + + return this.children[index]; + }; + + /** + * Removes one or more children from the container. + * + * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove + * @return {PIXI.DisplayObject} The first child that was removed. + */ + + + Container.prototype.removeChild = function removeChild(child) { + var argumentsLength = arguments.length; + + // if there is only one argument we can bypass looping through the them + if (argumentsLength > 1) { + // loop through the arguments property and add all children + // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + for (var i = 0; i < argumentsLength; i++) { + this.removeChild(arguments[i]); + } + } else { + var index = this.children.indexOf(child); + + if (index === -1) return null; + + child.parent = null; + // ensure child transform will be recalculated + child.transform._parentID = -1; + (0, _utils.removeItems)(this.children, index, 1); + + // ensure bounds will be recalculated + this._boundsID++; + + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + } + + return child; + }; + + /** + * Removes a child from the specified index position. + * + * @param {number} index - The index to get the child from + * @return {PIXI.DisplayObject} The child that was removed. + */ + + + Container.prototype.removeChildAt = function removeChildAt(index) { + var child = this.getChildAt(index); + + // ensure child transform will be recalculated.. + child.parent = null; + child.transform._parentID = -1; + (0, _utils.removeItems)(this.children, index, 1); + + // ensure bounds will be recalculated + this._boundsID++; + + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + + return child; + }; + + /** + * Removes all children from this container that are within the begin and end indexes. + * + * @param {number} [beginIndex=0] - The beginning position. + * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container. + * @returns {DisplayObject[]} List of removed children + */ + + + Container.prototype.removeChildren = function removeChildren() { + var beginIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var endIndex = arguments[1]; + + var begin = beginIndex; + var end = typeof endIndex === 'number' ? endIndex : this.children.length; + var range = end - begin; + var removed = void 0; + + if (range > 0 && range <= end) { + removed = this.children.splice(begin, range); + + for (var i = 0; i < removed.length; ++i) { + removed[i].parent = null; + if (removed[i].transform) { + removed[i].transform._parentID = -1; + } + } + + this._boundsID++; + + this.onChildrenChange(beginIndex); + + for (var _i = 0; _i < removed.length; ++_i) { + removed[_i].emit('removed', this); + } + + return removed; + } else if (range === 0 && this.children.length === 0) { + return []; + } + + throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); + }; + + /** + * Updates the transform on all children of this container for rendering + */ + + + Container.prototype.updateTransform = function updateTransform() { + this._boundsID++; + + this.transform.updateTransform(this.parent.transform); + + // TODO: check render flags, how to process stuff here + this.worldAlpha = this.alpha * this.parent.worldAlpha; + + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + + if (child.visible) { + child.updateTransform(); + } + } + }; + + /** + * Recalculates the bounds of the container. + * + */ + + + Container.prototype.calculateBounds = function calculateBounds() { + this._bounds.clear(); + + this._calculateBounds(); + + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + + if (!child.visible || !child.renderable) { + continue; + } + + child.calculateBounds(); + + // TODO: filter+mask, need to mask both somehow + if (child._mask) { + child._mask.calculateBounds(); + this._bounds.addBoundsMask(child._bounds, child._mask._bounds); + } else if (child.filterArea) { + this._bounds.addBoundsArea(child._bounds, child.filterArea); + } else { + this._bounds.addBounds(child._bounds); + } + } + + this._lastBoundsID = this._boundsID; + }; + + /** + * Recalculates the bounds of the object. Override this to + * calculate the bounds of the specific object (not including children). + * + */ + + + Container.prototype._calculateBounds = function _calculateBounds() { } + // FILL IN// + + + /** + * Renders the object using the WebGL renderer + * + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + ; + + Container.prototype.renderWebGL = function renderWebGL(renderer) { + // if the object is not visible or the alpha is 0 then no need to render this element + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + + // do a quick check to see if this element has a mask or a filter. + if (this._mask || this.filters && this.filters.length) { + this.renderAdvancedWebGL(renderer); + } else { + this._renderWebGL(renderer); + + // simple render children! + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].renderWebGL(renderer); + } + } + }; + + /** + * Render the object using the WebGL renderer and advanced features. + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) { + renderer.flush(); + + var filters = this._filters; + var mask = this._mask; + + // push filter first as we need to ensure the stencil buffer is correct for any masking + if (filters) { + if (!this._enabledFilters) { + this._enabledFilters = []; + } + + this._enabledFilters.length = 0; + + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { + this._enabledFilters.push(filters[i]); + } + } + + if (this._enabledFilters.length) { + renderer.filterManager.pushFilter(this, this._enabledFilters); + } + } + + if (mask) { + renderer.maskManager.pushMask(this, this._mask); + } + + // add this object to the batch, only rendered if it has a texture. + this._renderWebGL(renderer); + + // now loop through the children and make sure they get rendered + for (var _i2 = 0, j = this.children.length; _i2 < j; _i2++) { + this.children[_i2].renderWebGL(renderer); + } + + renderer.flush(); + + if (mask) { + renderer.maskManager.popMask(this, this._mask); + } + + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filterManager.popFilter(); + } + }; + + /** + * To be overridden by the subclasses. + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + Container.prototype._renderWebGL = function _renderWebGL(renderer) // eslint-disable-line no-unused-vars + { } + // this is where content itself gets rendered... + + + /** + * To be overridden by the subclass + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + ; + + Container.prototype._renderCanvas = function _renderCanvas(renderer) // eslint-disable-line no-unused-vars + { } + // this is where content itself gets rendered... + + + /** + * Renders the object using the Canvas renderer + * + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + ; + + Container.prototype.renderCanvas = function renderCanvas(renderer) { + // if not visible or the alpha is 0 then no need to render this + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + + if (this._mask) { + renderer.maskManager.pushMask(this._mask); + } + + this._renderCanvas(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].renderCanvas(renderer); + } + + if (this._mask) { + renderer.maskManager.popMask(renderer); + } + }; + + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + + + Container.prototype.destroy = function destroy(options) { + _DisplayObject.prototype.destroy.call(this); + + var destroyChildren = typeof options === 'boolean' ? options : options && options.children; + + var oldChildren = this.removeChildren(0, this.children.length); + + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { + oldChildren[i].destroy(options); + } + } + }; + + /** + * The width of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + + _createClass(Container, [{ + key: 'width', + get: function get() { + return this.scale.x * this.getLocalBounds().width; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + var width = this.getLocalBounds().width; + + if (width !== 0) { + this.scale.x = value / width; + } else { + this.scale.x = 1; + } + + this._width = value; + } + + /** + * The height of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return this.scale.y * this.getLocalBounds().height; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + var height = this.getLocalBounds().height; + + if (height !== 0) { + this.scale.y = value / height; + } else { + this.scale.y = 1; + } + + this._height = value; + } + }]); + + return Container; + }(_DisplayObject3.default); + + // performance increase to avoid using call.. (10x faster) + + + exports.default = Container; + Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; + + }, { "../utils": 125, "./DisplayObject": 49 }], 49: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _const = require('../const'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _TransformStatic = require('./TransformStatic'); + + var _TransformStatic2 = _interopRequireDefault(_TransformStatic); + + var _Transform = require('./Transform'); + + var _Transform2 = _interopRequireDefault(_Transform); + + var _Bounds = require('./Bounds'); + + var _Bounds2 = _interopRequireDefault(_Bounds); + + var _math = require('../math'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + // _tempDisplayObjectParent = new DisplayObject(); + + /** + * The base class for all objects that are rendered on the screen. + * This is an abstract class and should not be used on its own rather it should be extended. + * + * @class + * @extends EventEmitter + * @memberof PIXI + */ + var DisplayObject = function (_EventEmitter) { + _inherits(DisplayObject, _EventEmitter); + + /** + * + */ + function DisplayObject() { + _classCallCheck(this, DisplayObject); + + var _this = _possibleConstructorReturn(this, _EventEmitter.call(this)); + + var TransformClass = _settings2.default.TRANSFORM_MODE === _const.TRANSFORM_MODE.STATIC ? _TransformStatic2.default : _Transform2.default; + + _this.tempDisplayObjectParent = null; + + // TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will become read-only later, please do not assign anything there unless you know what are you doing + * + * @member {PIXI.TransformBase} + */ + _this.transform = new TransformClass(); + + /** + * The opacity of the object. + * + * @member {number} + */ + _this.alpha = 1; + + /** + * The visibility of the object. If false the object will not be drawn, and + * the updateTransform function will not be called. + * + * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually + * + * @member {boolean} + */ + _this.visible = true; + + /** + * Can this object be rendered, if false the object will not be drawn but the updateTransform + * methods will still be called. + * + * Only affects recursive calls from parent. You can ask for bounds manually + * + * @member {boolean} + */ + _this.renderable = true; + + /** + * The display object container that contains this display object. + * + * @member {PIXI.Container} + * @readonly + */ + _this.parent = null; + + /** + * The multiplied alpha of the displayObject + * + * @member {number} + * @readonly + */ + _this.worldAlpha = 1; + + /** + * The area the filter is applied to. This is used as more of an optimisation + * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle + * + * Also works as an interaction mask + * + * @member {PIXI.Rectangle} + */ + _this.filterArea = null; + + _this._filters = null; + _this._enabledFilters = null; + + /** + * The bounds object, this is used to calculate and store the bounds of the displayObject + * + * @member {PIXI.Rectangle} + * @private + */ + _this._bounds = new _Bounds2.default(); + _this._boundsID = 0; + _this._lastBoundsID = -1; + _this._boundsRect = null; + _this._localBoundsRect = null; + + /** + * The original, cached mask of the object + * + * @member {PIXI.Graphics|PIXI.Sprite} + * @private + */ + _this._mask = null; + + /** + * If the object has been destroyed via destroy(). If true, it should not be used. + * + * @member {boolean} + * @private + * @readonly + */ + _this._destroyed = false; + + /** + * Fired when this DisplayObject is added to a Container. + * + * @event PIXI.DisplayObject#added + * @param {PIXI.Container} container - The container added to. + */ + + /** + * Fired when this DisplayObject is removed from a Container. + * + * @event PIXI.DisplayObject#removed + * @param {PIXI.Container} container - The container removed from. + */ + return _this; + } + + /** + * @private + * @member {PIXI.DisplayObject} + */ + + + /** + * Updates the object transform for rendering + * + * TODO - Optimization pass! + */ + DisplayObject.prototype.updateTransform = function updateTransform() { + this.transform.updateTransform(this.parent.transform); + // multiply the alphas.. + this.worldAlpha = this.alpha * this.parent.worldAlpha; + + this._bounds.updateID++; + }; + + /** + * recursively updates transform of all objects from the root to this one + * internal function for toLocal() + */ + + + DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform() { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); + } + }; + + /** + * Retrieves the bounds of the displayObject as a rectangle object. + * + * @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost + * @param {PIXI.Rectangle} rect - Optional rectangle to store the result of the bounds calculation + * @return {PIXI.Rectangle} the rectangular bounding area + */ + + + DisplayObject.prototype.getBounds = function getBounds(skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } else { + this._recursivePostUpdateTransform(); + this.updateTransform(); + } + } + + if (this._boundsID !== this._lastBoundsID) { + this.calculateBounds(); + } + + if (!rect) { + if (!this._boundsRect) { + this._boundsRect = new _math.Rectangle(); + } + + rect = this._boundsRect; + } + + return this._bounds.getRectangle(rect); + }; + + /** + * Retrieves the local bounds of the displayObject as a rectangle object + * + * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation + * @return {PIXI.Rectangle} the rectangular bounding area + */ + + + DisplayObject.prototype.getLocalBounds = function getLocalBounds(rect) { + var transformRef = this.transform; + var parentRef = this.parent; + + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new _math.Rectangle(); + } + + rect = this._localBoundsRect; + } + + var bounds = this.getBounds(false, rect); + + this.parent = parentRef; + this.transform = transformRef; + + return bounds; + }; + + /** + * Calculates the global position of the display object + * + * @param {PIXI.Point} position - The world origin to calculate from + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * (otherwise will create a new Point) + * @param {boolean} [skipUpdate=false] - Should we skip the update transform. + * @return {PIXI.Point} A point object representing the position of this object + */ + + + DisplayObject.prototype.toGlobal = function toGlobal(position, point) { + var skipUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + + // don't need to update the lot + return this.worldTransform.apply(position, point); + }; + + /** + * Calculates the local position of the display object relative to another point + * + * @param {PIXI.Point} position - The world origin to calculate from + * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * (otherwise will create a new Point) + * @param {boolean} [skipUpdate=false] - Should we skip the update transform + * @return {PIXI.Point} A point object representing the position of this object + */ + + + DisplayObject.prototype.toLocal = function toLocal(position, from, point, skipUpdate) { + if (from) { + position = from.toGlobal(position, point, skipUpdate); + } + + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + + // simply apply the matrix.. + return this.worldTransform.applyInverse(position, point); + }; + + /** + * Renders the object using the WebGL renderer + * + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) // eslint-disable-line no-unused-vars + { } + // OVERWRITE; + + + /** + * Renders the object using the Canvas renderer + * + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + ; + + DisplayObject.prototype.renderCanvas = function renderCanvas(renderer) // eslint-disable-line no-unused-vars + { } + // OVERWRITE; + + + /** + * Set the parent Container of this DisplayObject + * + * @param {PIXI.Container} container - The Container to add this DisplayObject to + * @return {PIXI.Container} The Container that this DisplayObject was added to + */ + ; + + DisplayObject.prototype.setParent = function setParent(container) { + if (!container || !container.addChild) { + throw new Error('setParent: Argument must be a Container'); + } + + container.addChild(this); + + return container; + }; + + /** + * Convenience function to set the position, scale, skew and pivot at once. + * + * @param {number} [x=0] - The X position + * @param {number} [y=0] - The Y position + * @param {number} [scaleX=1] - The X scale value + * @param {number} [scaleY=1] - The Y scale value + * @param {number} [rotation=0] - The rotation + * @param {number} [skewX=0] - The X skew value + * @param {number} [skewY=0] - The Y skew value + * @param {number} [pivotX=0] - The X pivot value + * @param {number} [pivotY=0] - The Y pivot value + * @return {PIXI.DisplayObject} The DisplayObject instance + */ + + + DisplayObject.prototype.setTransform = function setTransform() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var scaleX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var scaleY = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + var rotation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var skewX = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; + var skewY = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var pivotX = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0; + var pivotY = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0; + + this.position.x = x; + this.position.y = y; + this.scale.x = !scaleX ? 1 : scaleX; + this.scale.y = !scaleY ? 1 : scaleY; + this.rotation = rotation; + this.skew.x = skewX; + this.skew.y = skewY; + this.pivot.x = pivotX; + this.pivot.y = pivotY; + + return this; + }; + + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy`. + * + */ + + + DisplayObject.prototype.destroy = function destroy() { + this.removeAllListeners(); + if (this.parent) { + this.parent.removeChild(this); + } + this.transform = null; + + this.parent = null; + + this._bounds = null; + this._currentBounds = null; + this._mask = null; + + this.filterArea = null; + + this.interactive = false; + this.interactiveChildren = false; + + this._destroyed = true; + }; + + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + * + * @member {number} + */ + + + _createClass(DisplayObject, [{ + key: '_tempDisplayObjectParent', + get: function get() { + if (this.tempDisplayObjectParent === null) { + this.tempDisplayObjectParent = new DisplayObject(); + } + + return this.tempDisplayObjectParent; + } + }, { + key: 'x', + get: function get() { + return this.position.x; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.position.x = value; + } + + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + * + * @member {number} + */ + + }, { + key: 'y', + get: function get() { + return this.position.y; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.position.y = value; + } + + /** + * Current transform of the object based on world (parent) factors + * + * @member {PIXI.Matrix} + * @readonly + */ + + }, { + key: 'worldTransform', + get: function get() { + return this.transform.worldTransform; + } + + /** + * Current transform of the object based on local factors: position, scale, other stuff + * + * @member {PIXI.Matrix} + * @readonly + */ + + }, { + key: 'localTransform', + get: function get() { + return this.transform.localTransform; + } + + /** + * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. + * + * @member {PIXI.Point|PIXI.ObservablePoint} + */ + + }, { + key: 'position', + get: function get() { + return this.transform.position; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.position.copy(value); + } + + /** + * The scale factor of the object. + * Assignment by value since pixi-v4. + * + * @member {PIXI.Point|PIXI.ObservablePoint} + */ + + }, { + key: 'scale', + get: function get() { + return this.transform.scale; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.scale.copy(value); + } + + /** + * The pivot point of the displayObject that it rotates around. + * Assignment by value since pixi-v4. + * + * @member {PIXI.Point|PIXI.ObservablePoint} + */ + + }, { + key: 'pivot', + get: function get() { + return this.transform.pivot; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.pivot.copy(value); + } + + /** + * The skew factor for the object in radians. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + + }, { + key: 'skew', + get: function get() { + return this.transform.skew; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.skew.copy(value); + } + + /** + * The rotation of the object in radians. + * + * @member {number} + */ + + }, { + key: 'rotation', + get: function get() { + return this.transform.rotation; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.transform.rotation = value; + } + + /** + * Indicates if the object is globally visible. + * + * @member {boolean} + * @readonly + */ + + }, { + key: 'worldVisible', + get: function get() { + var item = this; + + do { + if (!item.visible) { + return false; + } + + item = item.parent; + } while (item); + + return true; + } + + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it + * utilises shape clipping. To remove a mask, set this property to null. + * + * @todo For the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + * + * @member {PIXI.Graphics|PIXI.Sprite} + */ + + }, { + key: 'mask', + get: function get() { + return this._mask; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._mask) { + this._mask.renderable = true; + this._mask.isMask = false; + } + + this._mask = value; + + if (this._mask) { + this._mask.renderable = false; + this._mask.isMask = true; + } + } + + /** + * Sets the filters for the displayObject. + * * IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + * To remove filters simply set this property to 'null' + * + * @member {PIXI.Filter[]} + */ + + }, { + key: 'filters', + get: function get() { + return this._filters && this._filters.slice(); + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._filters = value && value.slice(); + } + }]); + + return DisplayObject; + }(_eventemitter2.default); + + // performance increase to avoid using call.. (10x faster) + + + exports.default = DisplayObject; + DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; + + }, { "../const": 46, "../math": 70, "../settings": 101, "./Bounds": 47, "./Transform": 50, "./TransformStatic": 52, "eventemitter3": 3 }], 50: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _math = require('../math'); + + var _TransformBase2 = require('./TransformBase'); + + var _TransformBase3 = _interopRequireDefault(_TransformBase2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * Generic class to deal with traditional 2D matrix transforms + * local transformation is calculated from position,scale,skew and rotation + * + * @class + * @extends PIXI.TransformBase + * @memberof PIXI + */ + var Transform = function (_TransformBase) { + _inherits(Transform, _TransformBase); + + /** + * + */ + function Transform() { + _classCallCheck(this, Transform); + + /** + * The coordinate of the object relative to the local coordinates of the parent. + * + * @member {PIXI.Point} + */ + var _this = _possibleConstructorReturn(this, _TransformBase.call(this)); + + _this.position = new _math.Point(0, 0); + + /** + * The scale factor of the object. + * + * @member {PIXI.Point} + */ + _this.scale = new _math.Point(1, 1); + + /** + * The skew amount, on the x and y axis. + * + * @member {PIXI.ObservablePoint} + */ + _this.skew = new _math.ObservablePoint(_this.updateSkew, _this, 0, 0); + + /** + * The pivot point of the displayObject that it rotates around. + * + * @member {PIXI.Point} + */ + _this.pivot = new _math.Point(0, 0); + + /** + * The rotation value of the object, in radians + * + * @member {Number} + * @private + */ + _this._rotation = 0; + + _this._cx = 1; // cos rotation + skewY; + _this._sx = 0; // sin rotation + skewY; + _this._cy = 0; // cos rotation + Math.PI/2 - skewX; + _this._sy = 1; // sin rotation + Math.PI/2 - skewX; + return _this; + } + + /** + * Updates the skew values when the skew or rotation changes. + * + * @private + */ + + + Transform.prototype.updateSkew = function updateSkew() { + this._cx = Math.cos(this._rotation + this.skew._y); + this._sx = Math.sin(this._rotation + this.skew._y); + this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2 + }; + + /** + * Updates only local matrix + */ + + + Transform.prototype.updateLocalTransform = function updateLocalTransform() { + var lt = this.localTransform; + + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + + lt.tx = this.position.x - (this.pivot.x * lt.a + this.pivot.y * lt.c); + lt.ty = this.position.y - (this.pivot.x * lt.b + this.pivot.y * lt.d); + }; + + /** + * Updates the values of the object and applies the parent's transform. + * + * @param {PIXI.Transform} parentTransform - The transform of the parent of this object + */ + + + Transform.prototype.updateTransform = function updateTransform(parentTransform) { + var lt = this.localTransform; + + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + + lt.tx = this.position.x - (this.pivot.x * lt.a + this.pivot.y * lt.c); + lt.ty = this.position.y - (this.pivot.x * lt.b + this.pivot.y * lt.d); + + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + + wt.a = lt.a * pt.a + lt.b * pt.c; + wt.b = lt.a * pt.b + lt.b * pt.d; + wt.c = lt.c * pt.a + lt.d * pt.c; + wt.d = lt.c * pt.b + lt.d * pt.d; + wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; + wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; + + this._worldID++; + }; + + /** + * Decomposes a matrix and sets the transforms properties based on it. + * + * @param {PIXI.Matrix} matrix - The matrix to decompose + */ + + + Transform.prototype.setFromMatrix = function setFromMatrix(matrix) { + matrix.decompose(this); + }; + + /** + * The rotation of the object in radians. + * + * @member {number} + */ + + + _createClass(Transform, [{ + key: 'rotation', + get: function get() { + return this._rotation; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._rotation = value; + this.updateSkew(); + } + }]); + + return Transform; + }(_TransformBase3.default); + + exports.default = Transform; + + }, { "../math": 70, "./TransformBase": 51 }], 51: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _math = require('../math'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Generic class to deal with traditional 2D matrix transforms + * + * @class + * @memberof PIXI + */ + var TransformBase = function () { + /** + * + */ + function TransformBase() { + _classCallCheck(this, TransformBase); + + /** + * The global matrix transform. It can be swapped temporarily by some functions like getLocalBounds() + * + * @member {PIXI.Matrix} + */ + this.worldTransform = new _math.Matrix(); + + /** + * The local matrix transform + * + * @member {PIXI.Matrix} + */ + this.localTransform = new _math.Matrix(); + + this._worldID = 0; + this._parentID = 0; + } + + /** + * TransformBase does not have decomposition, so this function wont do anything + */ + + + TransformBase.prototype.updateLocalTransform = function updateLocalTransform() { } + // empty + + + /** + * Updates the values of the object and applies the parent's transform. + * + * @param {PIXI.TransformBase} parentTransform - The transform of the parent of this object + */ + ; + + TransformBase.prototype.updateTransform = function updateTransform(parentTransform) { + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + var lt = this.localTransform; + + // concat the parent matrix with the objects transform. + wt.a = lt.a * pt.a + lt.b * pt.c; + wt.b = lt.a * pt.b + lt.b * pt.d; + wt.c = lt.c * pt.a + lt.d * pt.c; + wt.d = lt.c * pt.b + lt.d * pt.d; + wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; + wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; + + this._worldID++; + }; + + return TransformBase; + }(); + + /** + * Updates the values of the object and applies the parent's transform. + * @param parentTransform {PIXI.Transform} The transform of the parent of this object + * + */ + + + exports.default = TransformBase; + TransformBase.prototype.updateWorldTransform = TransformBase.prototype.updateTransform; + + TransformBase.IDENTITY = new TransformBase(); + + }, { "../math": 70 }], 52: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _math = require('../math'); + + var _TransformBase2 = require('./TransformBase'); + + var _TransformBase3 = _interopRequireDefault(_TransformBase2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * Transform that takes care about its versions + * + * @class + * @extends PIXI.TransformBase + * @memberof PIXI + */ + var TransformStatic = function (_TransformBase) { + _inherits(TransformStatic, _TransformBase); + + /** + * + */ + function TransformStatic() { + _classCallCheck(this, TransformStatic); + + /** + * The coordinate of the object relative to the local coordinates of the parent. + * + * @member {PIXI.ObservablePoint} + */ + var _this = _possibleConstructorReturn(this, _TransformBase.call(this)); + + _this.position = new _math.ObservablePoint(_this.onChange, _this, 0, 0); + + /** + * The scale factor of the object. + * + * @member {PIXI.ObservablePoint} + */ + _this.scale = new _math.ObservablePoint(_this.onChange, _this, 1, 1); + + /** + * The pivot point of the displayObject that it rotates around. + * + * @member {PIXI.ObservablePoint} + */ + _this.pivot = new _math.ObservablePoint(_this.onChange, _this, 0, 0); + + /** + * The skew amount, on the x and y axis. + * + * @member {PIXI.ObservablePoint} + */ + _this.skew = new _math.ObservablePoint(_this.updateSkew, _this, 0, 0); + + _this._rotation = 0; + + _this._cx = 1; // cos rotation + skewY; + _this._sx = 0; // sin rotation + skewY; + _this._cy = 0; // cos rotation + Math.PI/2 - skewX; + _this._sy = 1; // sin rotation + Math.PI/2 - skewX; + + _this._localID = 0; + _this._currentLocalID = 0; + return _this; + } + + /** + * Called when a value changes. + * + * @private + */ + + + TransformStatic.prototype.onChange = function onChange() { + this._localID++; + }; + + /** + * Called when skew or rotation changes + * + * @private + */ + + + TransformStatic.prototype.updateSkew = function updateSkew() { + this._cx = Math.cos(this._rotation + this.skew._y); + this._sx = Math.sin(this._rotation + this.skew._y); + this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2 + + this._localID++; + }; + + /** + * Updates only local matrix + */ + + + TransformStatic.prototype.updateLocalTransform = function updateLocalTransform() { + var lt = this.localTransform; + + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale._x; + lt.b = this._sx * this.scale._x; + lt.c = this._cy * this.scale._y; + lt.d = this._sy * this.scale._y; + + lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); + lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); + this._currentLocalID = this._localID; + + // force an update.. + this._parentID = -1; + } + }; + + /** + * Updates the values of the object and applies the parent's transform. + * + * @param {PIXI.Transform} parentTransform - The transform of the parent of this object + */ + + + TransformStatic.prototype.updateTransform = function updateTransform(parentTransform) { + var lt = this.localTransform; + + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale._x; + lt.b = this._sx * this.scale._x; + lt.c = this._cy * this.scale._y; + lt.d = this._sy * this.scale._y; + + lt.tx = this.position._x - (this.pivot._x * lt.a + this.pivot._y * lt.c); + lt.ty = this.position._y - (this.pivot._x * lt.b + this.pivot._y * lt.d); + this._currentLocalID = this._localID; + + // force an update.. + this._parentID = -1; + } + + if (this._parentID !== parentTransform._worldID) { + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + + wt.a = lt.a * pt.a + lt.b * pt.c; + wt.b = lt.a * pt.b + lt.b * pt.d; + wt.c = lt.c * pt.a + lt.d * pt.c; + wt.d = lt.c * pt.b + lt.d * pt.d; + wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; + wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; + + this._parentID = parentTransform._worldID; + + // update the id of the transform.. + this._worldID++; + } + }; + + /** + * Decomposes a matrix and sets the transforms properties based on it. + * + * @param {PIXI.Matrix} matrix - The matrix to decompose + */ + + + TransformStatic.prototype.setFromMatrix = function setFromMatrix(matrix) { + matrix.decompose(this); + this._localID++; + }; + + /** + * The rotation of the object in radians. + * + * @member {number} + */ + + + _createClass(TransformStatic, [{ + key: 'rotation', + get: function get() { + return this._rotation; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._rotation !== value) { + this._rotation = value; + this.updateSkew(); + } + } + }]); + + return TransformStatic; + }(_TransformBase3.default); + + exports.default = TransformStatic; + + }, { "../math": 70, "./TransformBase": 51 }], 53: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Container2 = require('../display/Container'); + + var _Container3 = _interopRequireDefault(_Container2); + + var _RenderTexture = require('../textures/RenderTexture'); + + var _RenderTexture2 = _interopRequireDefault(_RenderTexture); + + var _Texture = require('../textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + var _GraphicsData = require('./GraphicsData'); + + var _GraphicsData2 = _interopRequireDefault(_GraphicsData); + + var _Sprite = require('../sprites/Sprite'); + + var _Sprite2 = _interopRequireDefault(_Sprite); + + var _math = require('../math'); + + var _utils = require('../utils'); + + var _const = require('../const'); + + var _Bounds = require('../display/Bounds'); + + var _Bounds2 = _interopRequireDefault(_Bounds); + + var _bezierCurveTo2 = require('./utils/bezierCurveTo'); + + var _bezierCurveTo3 = _interopRequireDefault(_bezierCurveTo2); + + var _CanvasRenderer = require('../renderers/canvas/CanvasRenderer'); + + var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var canvasRenderer = void 0; + var tempMatrix = new _math.Matrix(); + var tempPoint = new _math.Point(); + var tempColor1 = new Float32Array(4); + var tempColor2 = new Float32Array(4); + + /** + * The Graphics class contains methods used to draw primitive shapes such as lines, circles and + * rectangles to the display, and to color and fill them. + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + + var Graphics = function (_Container) { + _inherits(Graphics, _Container); + + /** + * + * @param {boolean} [nativeLines=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + */ + function Graphics() { + var nativeLines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + _classCallCheck(this, Graphics); + + /** + * The alpha value used when filling the Graphics object. + * + * @member {number} + * @default 1 + */ + var _this = _possibleConstructorReturn(this, _Container.call(this)); + + _this.fillAlpha = 1; + + /** + * The width (thickness) of any lines drawn. + * + * @member {number} + * @default 0 + */ + _this.lineWidth = 0; + + /** + * If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * + * @member {boolean} + */ + _this.nativeLines = nativeLines; + + /** + * The color of any lines drawn. + * + * @member {string} + * @default 0 + */ + _this.lineColor = 0; + + /** + * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner). + * + * @member {number} + * @default 0.5 + */ + _this.lineAlignment = 0.5; + + /** + * Graphics data + * + * @member {PIXI.GraphicsData[]} + * @private + */ + _this.graphicsData = []; + + /** + * The tint applied to the graphic shape. This is a hex value. Apply a value of 0xFFFFFF to + * reset the tint. + * + * @member {number} + * @default 0xFFFFFF + */ + _this.tint = 0xFFFFFF; + + /** + * The previous tint applied to the graphic shape. Used to compare to the current tint and + * check if theres change. + * + * @member {number} + * @private + * @default 0xFFFFFF + */ + _this._prevTint = 0xFFFFFF; + + /** + * The blend mode to be applied to the graphic shape. Apply a value of + * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL; + * @see PIXI.BLEND_MODES + */ + _this.blendMode = _const.BLEND_MODES.NORMAL; + + /** + * Current path + * + * @member {PIXI.GraphicsData} + * @private + */ + _this.currentPath = null; + + /** + * Array containing some WebGL-related properties used by the WebGL renderer. + * + * @member {object} + * @private + */ + // TODO - _webgl should use a prototype object, not a random undocumented object... + _this._webGL = {}; + + /** + * Whether this shape is being used as a mask. + * + * @member {boolean} + */ + _this.isMask = false; + + /** + * The bounds' padding used for bounds calculation. + * + * @member {number} + */ + _this.boundsPadding = 0; + + /** + * A cache of the local bounds to prevent recalculation. + * + * @member {PIXI.Rectangle} + * @private + */ + _this._localBounds = new _Bounds2.default(); + + /** + * Used to detect if the graphics object has changed. If this is set to true then the graphics + * object will be recalculated. + * + * @member {boolean} + * @private + */ + _this.dirty = 0; + + /** + * Used to detect if we need to do a fast rect check using the id compare method + * @type {Number} + */ + _this.fastRectDirty = -1; + + /** + * Used to detect if we clear the graphics webGL data + * @type {Number} + */ + _this.clearDirty = 0; + + /** + * Used to detect if we we need to recalculate local bounds + * @type {Number} + */ + _this.boundsDirty = -1; + + /** + * Used to detect if the cached sprite object needs to be updated. + * + * @member {boolean} + * @private + */ + _this.cachedSpriteDirty = false; + + _this._spriteRect = null; + _this._fastRect = false; + + _this._prevRectTint = null; + _this._prevRectFillColor = null; + + /** + * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. + * This is useful if your graphics element does not change often, as it will speed up the rendering + * of the object in exchange for taking up texture memory. It is also useful if you need the graphics + * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if + * you are constantly redrawing the graphics element. + * + * @name cacheAsBitmap + * @member {boolean} + * @memberof PIXI.Graphics# + * @default false + */ + return _this; + } + + /** + * Creates a new Graphics object with the same values as this one. + * Note that the only the properties of the object are cloned, not its transform (position,scale,etc) + * + * @return {PIXI.Graphics} A clone of the graphics object + */ + + + Graphics.prototype.clone = function clone() { + var clone = new Graphics(); + + clone.renderable = this.renderable; + clone.fillAlpha = this.fillAlpha; + clone.lineWidth = this.lineWidth; + clone.lineColor = this.lineColor; + clone.lineAlignment = this.lineAlignment; + clone.tint = this.tint; + clone.blendMode = this.blendMode; + clone.isMask = this.isMask; + clone.boundsPadding = this.boundsPadding; + clone.dirty = 0; + clone.cachedSpriteDirty = this.cachedSpriteDirty; + + // copy graphics data + for (var i = 0; i < this.graphicsData.length; ++i) { + clone.graphicsData.push(this.graphicsData[i].clone()); + } + + clone.currentPath = clone.graphicsData[clone.graphicsData.length - 1]; + + clone.updateLocalBounds(); + + return clone; + }; + + /** + * Calculate length of quadratic curve + * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/} + * for the detailed explanation of math behind this. + * + * @private + * @param {number} fromX - x-coordinate of curve start point + * @param {number} fromY - y-coordinate of curve start point + * @param {number} cpX - x-coordinate of curve control point + * @param {number} cpY - y-coordinate of curve control point + * @param {number} toX - x-coordinate of curve end point + * @param {number} toY - y-coordinate of curve end point + * @return {number} Length of quadratic curve + */ + + + Graphics.prototype._quadraticCurveLength = function _quadraticCurveLength(fromX, fromY, cpX, cpY, toX, toY) { + var ax = fromX - 2.0 * cpX + toX; + var ay = fromY - 2.0 * cpY + toY; + var bx = 2.0 * cpX - 2.0 * fromX; + var by = 2.0 * cpY - 2.0 * fromY; + var a = 4.0 * (ax * ax + ay * ay); + var b = 4.0 * (ax * bx + ay * by); + var c = bx * bx + by * by; + + var s = 2.0 * Math.sqrt(a + b + c); + var a2 = Math.sqrt(a); + var a32 = 2.0 * a * a2; + var c2 = 2.0 * Math.sqrt(c); + var ba = b / a2; + + return (a32 * s + a2 * b * (s - c2) + (4.0 * c * a - b * b) * Math.log((2.0 * a2 + ba + s) / (ba + c2))) / (4.0 * a32); + }; + + /** + * Calculate length of bezier curve. + * Analytical solution is impossible, since it involves an integral that does not integrate in general. + * Therefore numerical solution is used. + * + * @private + * @param {number} fromX - Starting point x + * @param {number} fromY - Starting point y + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {number} Length of bezier curve + */ + + + Graphics.prototype._bezierCurveLength = function _bezierCurveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) { + var n = 10; + var result = 0.0; + var t = 0.0; + var t2 = 0.0; + var t3 = 0.0; + var nt = 0.0; + var nt2 = 0.0; + var nt3 = 0.0; + var x = 0.0; + var y = 0.0; + var dx = 0.0; + var dy = 0.0; + var prevX = fromX; + var prevY = fromY; + + for (var i = 1; i <= n; ++i) { + t = i / n; + t2 = t * t; + t3 = t2 * t; + nt = 1.0 - t; + nt2 = nt * nt; + nt3 = nt2 * nt; + + x = nt3 * fromX + 3.0 * nt2 * t * cpX + 3.0 * nt * t2 * cpX2 + t3 * toX; + y = nt3 * fromY + 3.0 * nt2 * t * cpY + 3 * nt * t2 * cpY2 + t3 * toY; + dx = prevX - x; + dy = prevY - y; + prevX = x; + prevY = y; + + result += Math.sqrt(dx * dx + dy * dy); + } + + return result; + }; + + /** + * Calculate number of segments for the curve based on its length to ensure its smoothness. + * + * @private + * @param {number} length - length of curve + * @return {number} Number of segments + */ + + + Graphics.prototype._segmentsCount = function _segmentsCount(length) { + var result = Math.ceil(length / Graphics.CURVES.maxLength); + + if (result < Graphics.CURVES.minSegments) { + result = Graphics.CURVES.minSegments; + } else if (result > Graphics.CURVES.maxSegments) { + result = Graphics.CURVES.maxSegments; + } + + return result; + }; + + /** + * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() + * method or the drawCircle() method. + * + * @param {number} [lineWidth=0] - width of the line to draw, will update the objects stored style + * @param {number} [color=0] - color of the line to draw, will update the objects stored style + * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style + * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.lineStyle = function lineStyle() { + var lineWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var alpha = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var alignment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5; + + this.lineWidth = lineWidth; + this.lineColor = color; + this.lineAlpha = alpha; + this.lineAlignment = alignment; + + if (this.currentPath) { + if (this.currentPath.shape.points.length) { + // halfway through a line? start a new one! + var shape = new _math.Polygon(this.currentPath.shape.points.slice(-2)); + + shape.closed = false; + + this.drawShape(shape); + } else { + // otherwise its empty so lets just set the line properties + this.currentPath.lineWidth = this.lineWidth; + this.currentPath.lineColor = this.lineColor; + this.currentPath.lineAlpha = this.lineAlpha; + this.currentPath.lineAlignment = this.lineAlignment; + } + } + + return this; + }; + + /** + * Moves the current drawing position to x, y. + * + * @param {number} x - the X coordinate to move to + * @param {number} y - the Y coordinate to move to + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.moveTo = function moveTo(x, y) { + var shape = new _math.Polygon([x, y]); + + shape.closed = false; + this.drawShape(shape); + + return this; + }; + + /** + * Draws a line using the current line style from the current drawing position to (x, y); + * The current drawing position is then set to (x, y). + * + * @param {number} x - the X coordinate to draw to + * @param {number} y - the Y coordinate to draw to + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.lineTo = function lineTo(x, y) { + var points = this.currentPath.shape.points; + + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + + if (fromX !== x || fromY !== y) { + points.push(x, y); + this.dirty++; + } + + return this; + }; + + /** + * Calculate the points for a quadratic bezier curve and then draws it. + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.quadraticCurveTo = function quadraticCurveTo(cpX, cpY, toX, toY) { + if (this.currentPath) { + if (this.currentPath.shape.points.length === 0) { + this.currentPath.shape.points = [0, 0]; + } + } else { + this.moveTo(0, 0); + } + + var points = this.currentPath.shape.points; + var xa = 0; + var ya = 0; + + if (points.length === 0) { + this.moveTo(0, 0); + } + + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var n = Graphics.CURVES.adaptive ? this._segmentsCount(this._quadraticCurveLength(fromX, fromY, cpX, cpY, toX, toY)) : 20; + + for (var i = 1; i <= n; ++i) { + var j = i / n; + + xa = fromX + (cpX - fromX) * j; + ya = fromY + (cpY - fromY) * j; + + points.push(xa + (cpX + (toX - cpX) * j - xa) * j, ya + (cpY + (toY - cpY) * j - ya) * j); + } + + this.dirty++; + + return this; + }; + + /** + * Calculate the points for a bezier curve and then draws it. + * + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.bezierCurveTo = function bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) { + if (this.currentPath) { + if (this.currentPath.shape.points.length === 0) { + this.currentPath.shape.points = [0, 0]; + } + } else { + this.moveTo(0, 0); + } + + var points = this.currentPath.shape.points; + + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + + points.length -= 2; + + var n = Graphics.CURVES.adaptive ? this._segmentsCount(this._bezierCurveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)) : 20; + + (0, _bezierCurveTo3.default)(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, points); + + this.dirty++; + + return this; + }; + + /** + * The arcTo() method creates an arc/curve between two tangents on the canvas. + * + * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! + * + * @param {number} x1 - The x-coordinate of the beginning of the arc + * @param {number} y1 - The y-coordinate of the beginning of the arc + * @param {number} x2 - The x-coordinate of the end of the arc + * @param {number} y2 - The y-coordinate of the end of the arc + * @param {number} radius - The radius of the arc + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.arcTo = function arcTo(x1, y1, x2, y2, radius) { + if (this.currentPath) { + if (this.currentPath.shape.points.length === 0) { + this.currentPath.shape.points.push(x1, y1); + } + } else { + this.moveTo(x1, y1); + } + + var points = this.currentPath.shape.points; + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var a1 = fromY - y1; + var b1 = fromX - x1; + var a2 = y2 - y1; + var b2 = x2 - x1; + var mm = Math.abs(a1 * b2 - b1 * a2); + + if (mm < 1.0e-8 || radius === 0) { + if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) { + points.push(x1, y1); + } + } else { + var dd = a1 * a1 + b1 * b1; + var cc = a2 * a2 + b2 * b2; + var tt = a1 * a2 + b1 * b2; + var k1 = radius * Math.sqrt(dd) / mm; + var k2 = radius * Math.sqrt(cc) / mm; + var j1 = k1 * tt / dd; + var j2 = k2 * tt / cc; + var cx = k1 * b2 + k2 * b1; + var cy = k1 * a2 + k2 * a1; + var px = b1 * (k2 + j1); + var py = a1 * (k2 + j1); + var qx = b2 * (k1 + j2); + var qy = a2 * (k1 + j2); + var startAngle = Math.atan2(py - cy, px - cx); + var endAngle = Math.atan2(qy - cy, qx - cx); + + this.arc(cx + x1, cy + y1, radius, startAngle, endAngle, b1 * a2 > b2 * a1); + } + + this.dirty++; + + return this; + }; + + /** + * The arc method creates an arc/curve (used to create circles, or parts of circles). + * + * @param {number} cx - The x-coordinate of the center of the circle + * @param {number} cy - The y-coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position + * of the arc's circle) + * @param {number} endAngle - The ending angle, in radians + * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be + * counter-clockwise or clockwise. False is default, and indicates clockwise, while true + * indicates counter-clockwise. + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.arc = function arc(cx, cy, radius, startAngle, endAngle) { + var anticlockwise = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; + + if (startAngle === endAngle) { + return this; + } + + if (!anticlockwise && endAngle <= startAngle) { + endAngle += _const.PI_2; + } else if (anticlockwise && startAngle <= endAngle) { + startAngle += _const.PI_2; + } + + var sweep = endAngle - startAngle; + var segs = Graphics.CURVES.adaptive ? this._segmentsCount(Math.abs(sweep) * radius) : Math.ceil(Math.abs(sweep) / _const.PI_2) * 40; + + if (sweep === 0) { + return this; + } + + var startX = cx + Math.cos(startAngle) * radius; + var startY = cy + Math.sin(startAngle) * radius; + + // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path. + var points = this.currentPath ? this.currentPath.shape.points : null; + + if (points) { + // We check how far our start is from the last existing point + var xDiff = Math.abs(points[points.length - 2] - startX); + var yDiff = Math.abs(points[points.length - 1] - startY); + + if (xDiff < 0.001 && yDiff < 0.001) { + // If the point is very close, we don't add it, since this would lead to artifacts + // during tesselation due to floating point imprecision. + } else { + points.push(startX, startY); + } + } else { + this.moveTo(startX, startY); + points = this.currentPath.shape.points; + } + + var theta = sweep / (segs * 2); + var theta2 = theta * 2; + + var cTheta = Math.cos(theta); + var sTheta = Math.sin(theta); + + var segMinus = segs - 1; + + var remainder = segMinus % 1 / segMinus; + + for (var i = 0; i <= segMinus; ++i) { + var real = i + remainder * i; + + var angle = theta + startAngle + theta2 * real; + + var c = Math.cos(angle); + var s = -Math.sin(angle); + + points.push((cTheta * c + sTheta * s) * radius + cx, (cTheta * -s + sTheta * c) * radius + cy); + } + + this.dirty++; + + return this; + }; + + /** + * Specifies a simple one-color fill that subsequent calls to other Graphics methods + * (such as lineTo() or drawCircle()) use when drawing. + * + * @param {number} [color=0] - the color of the fill + * @param {number} [alpha=1] - the alpha of the fill + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.beginFill = function beginFill() { + var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + + this.filling = true; + this.fillColor = color; + this.fillAlpha = alpha; + + if (this.currentPath) { + if (this.currentPath.shape.points.length <= 2) { + this.currentPath.fill = this.filling; + this.currentPath.fillColor = this.fillColor; + this.currentPath.fillAlpha = this.fillAlpha; + } + } + + return this; + }; + + /** + * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. + * + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.endFill = function endFill() { + this.filling = false; + this.fillColor = null; + this.fillAlpha = 1; + + return this; + }; + + /** + * + * @param {number} x - The X coord of the top-left of the rectangle + * @param {number} y - The Y coord of the top-left of the rectangle + * @param {number} width - The width of the rectangle + * @param {number} height - The height of the rectangle + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawRect = function drawRect(x, y, width, height) { + this.drawShape(new _math.Rectangle(x, y, width, height)); + + return this; + }; + + /** + * + * @param {number} x - The X coord of the top-left of the rectangle + * @param {number} y - The Y coord of the top-left of the rectangle + * @param {number} width - The width of the rectangle + * @param {number} height - The height of the rectangle + * @param {number} radius - Radius of the rectangle corners + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawRoundedRect = function drawRoundedRect(x, y, width, height, radius) { + this.drawShape(new _math.RoundedRectangle(x, y, width, height, radius)); + + return this; + }; + + /** + * Draws a circle. + * + * @param {number} x - The X coordinate of the center of the circle + * @param {number} y - The Y coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawCircle = function drawCircle(x, y, radius) { + this.drawShape(new _math.Circle(x, y, radius)); + + return this; + }; + + /** + * Draws an ellipse. + * + * @param {number} x - The X coordinate of the center of the ellipse + * @param {number} y - The Y coordinate of the center of the ellipse + * @param {number} width - The half width of the ellipse + * @param {number} height - The half height of the ellipse + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawEllipse = function drawEllipse(x, y, width, height) { + this.drawShape(new _math.Ellipse(x, y, width, height)); + + return this; + }; + + /** + * Draws a polygon using the given path. + * + * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon. + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawPolygon = function drawPolygon(path) { + // prevents an argument assignment deopt + // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments + var points = path; + + var closed = true; + + if (points instanceof _math.Polygon) { + closed = points.closed; + points = points.points; + } + + if (!Array.isArray(points)) { + // prevents an argument leak deopt + // see section 3.2: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments + points = new Array(arguments.length); + + for (var i = 0; i < points.length; ++i) { + points[i] = arguments[i]; // eslint-disable-line prefer-rest-params + } + } + + var shape = new _math.Polygon(points); + + shape.closed = closed; + + this.drawShape(shape); + + return this; + }; + + /** + * Draw a star shape with an abitrary number of points. + * + * @param {number} x - Center X position of the star + * @param {number} y - Center Y position of the star + * @param {number} points - The number of points of the star, must be > 1 + * @param {number} radius - The outer radius of the star + * @param {number} [innerRadius] - The inner radius between points, default half `radius` + * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.drawStar = function drawStar(x, y, points, radius, innerRadius) { + var rotation = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; + + innerRadius = innerRadius || radius / 2; + + var startAngle = -1 * Math.PI / 2 + rotation; + var len = points * 2; + var delta = _const.PI_2 / len; + var polygon = []; + + for (var i = 0; i < len; i++) { + var r = i % 2 ? innerRadius : radius; + var angle = i * delta + startAngle; + + polygon.push(x + r * Math.cos(angle), y + r * Math.sin(angle)); + } + + return this.drawPolygon(polygon); + }; + + /** + * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. + * + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + + + Graphics.prototype.clear = function clear() { + if (this.lineWidth || this.filling || this.graphicsData.length > 0) { + this.lineWidth = 0; + this.lineAlignment = 0.5; + + this.filling = false; + + this.boundsDirty = -1; + this.canvasTintDirty = -1; + this.dirty++; + this.clearDirty++; + this.graphicsData.length = 0; + } + + this.currentPath = null; + this._spriteRect = null; + + return this; + }; + + /** + * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and + * masked with gl.scissor. + * + * @returns {boolean} True if only 1 rect. + */ + + + Graphics.prototype.isFastRect = function isFastRect() { + return this.graphicsData.length === 1 && this.graphicsData[0].shape.type === _const.SHAPES.RECT && !this.graphicsData[0].lineWidth; + }; + + /** + * Renders the object using the WebGL renderer + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + Graphics.prototype._renderWebGL = function _renderWebGL(renderer) { + // if the sprite is not visible or the alpha is 0 then no need to render this element + if (this.dirty !== this.fastRectDirty) { + this.fastRectDirty = this.dirty; + this._fastRect = this.isFastRect(); + } + + // TODO this check can be moved to dirty? + if (this._fastRect) { + this._renderSpriteRect(renderer); + } else { + renderer.setObjectRenderer(renderer.plugins.graphics); + renderer.plugins.graphics.render(this); + } + }; + + /** + * Renders a sprite rectangle. + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + Graphics.prototype._renderSpriteRect = function _renderSpriteRect(renderer) { + var rect = this.graphicsData[0].shape; + + if (!this._spriteRect) { + this._spriteRect = new _Sprite2.default(new _Texture2.default(_Texture2.default.WHITE)); + } + + var sprite = this._spriteRect; + var fillColor = this.graphicsData[0].fillColor; + + if (this.tint === 0xffffff) { + sprite.tint = fillColor; + } else if (this.tint !== this._prevRectTint || fillColor !== this._prevRectFillColor) { + var t1 = tempColor1; + var t2 = tempColor2; + + (0, _utils.hex2rgb)(fillColor, t1); + (0, _utils.hex2rgb)(this.tint, t2); + + t1[0] *= t2[0]; + t1[1] *= t2[1]; + t1[2] *= t2[2]; + + sprite.tint = (0, _utils.rgb2hex)(t1); + + this._prevRectTint = this.tint; + this._prevRectFillColor = fillColor; + } + + sprite.alpha = this.graphicsData[0].fillAlpha; + sprite.worldAlpha = this.worldAlpha * sprite.alpha; + sprite.blendMode = this.blendMode; + + sprite._texture._frame.width = rect.width; + sprite._texture._frame.height = rect.height; + + sprite.transform.worldTransform = this.transform.worldTransform; + + sprite.anchor.set(-rect.x / rect.width, -rect.y / rect.height); + sprite._onAnchorUpdate(); + + sprite._renderWebGL(renderer); + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + + + Graphics.prototype._renderCanvas = function _renderCanvas(renderer) { + if (this.isMask === true) { + return; + } + + renderer.plugins.graphics.render(this); + }; + + /** + * Retrieves the bounds of the graphic shape as a rectangle object + * + * @private + */ + + + Graphics.prototype._calculateBounds = function _calculateBounds() { + if (this.boundsDirty !== this.dirty) { + this.boundsDirty = this.dirty; + this.updateLocalBounds(); + + this.cachedSpriteDirty = true; + } + + var lb = this._localBounds; + + this._bounds.addFrame(this.transform, lb.minX, lb.minY, lb.maxX, lb.maxY); + }; + + /** + * Tests if a point is inside this graphics object + * + * @param {PIXI.Point} point - the point to test + * @return {boolean} the result of the test + */ + + + Graphics.prototype.containsPoint = function containsPoint(point) { + this.worldTransform.applyInverse(point, tempPoint); + + var graphicsData = this.graphicsData; + + for (var i = 0; i < graphicsData.length; ++i) { + var data = graphicsData[i]; + + if (!data.fill) { + continue; + } + + // only deal with fills.. + if (data.shape) { + if (data.shape.contains(tempPoint.x, tempPoint.y)) { + var hitHole = false; + + if (data.holes) { + for (var _i = 0; _i < data.holes.length; _i++) { + var hole = data.holes[_i]; + + if (hole.contains(tempPoint.x, tempPoint.y)) { + hitHole = true; + break; + } + } + } + + if (!hitHole) { + return true; + } + } + } + } + + return false; + }; + + /** + * Update the bounds of the object + * + */ + + + Graphics.prototype.updateLocalBounds = function updateLocalBounds() { + var minX = Infinity; + var maxX = -Infinity; + + var minY = Infinity; + var maxY = -Infinity; + + if (this.graphicsData.length) { + var shape = 0; + var x = 0; + var y = 0; + var w = 0; + var h = 0; + + for (var i = 0; i < this.graphicsData.length; i++) { + var data = this.graphicsData[i]; + var type = data.type; + var lineWidth = data.lineWidth; + var lineAlignment = data.lineAlignment; + + var lineOffset = lineWidth * lineAlignment; + + shape = data.shape; + + if (type === _const.SHAPES.RECT || type === _const.SHAPES.RREC) { + x = shape.x - lineOffset; + y = shape.y - lineOffset; + w = shape.width + lineOffset * 2; + h = shape.height + lineOffset * 2; + + minX = x < minX ? x : minX; + maxX = x + w > maxX ? x + w : maxX; + + minY = y < minY ? y : minY; + maxY = y + h > maxY ? y + h : maxY; + } else if (type === _const.SHAPES.CIRC) { + x = shape.x; + y = shape.y; + w = shape.radius + lineOffset; + h = shape.radius + lineOffset; + + minX = x - w < minX ? x - w : minX; + maxX = x + w > maxX ? x + w : maxX; + + minY = y - h < minY ? y - h : minY; + maxY = y + h > maxY ? y + h : maxY; + } else if (type === _const.SHAPES.ELIP) { + x = shape.x; + y = shape.y; + w = shape.width + lineOffset; + h = shape.height + lineOffset; + + minX = x - w < minX ? x - w : minX; + maxX = x + w > maxX ? x + w : maxX; + + minY = y - h < minY ? y - h : minY; + maxY = y + h > maxY ? y + h : maxY; + } else { + // POLY + var points = shape.points; + var x2 = 0; + var y2 = 0; + var dx = 0; + var dy = 0; + var rw = 0; + var rh = 0; + var cx = 0; + var cy = 0; + + for (var j = 0; j + 2 < points.length; j += 2) { + x = points[j]; + y = points[j + 1]; + x2 = points[j + 2]; + y2 = points[j + 3]; + dx = Math.abs(x2 - x); + dy = Math.abs(y2 - y); + h = lineOffset * 2; + w = Math.sqrt(dx * dx + dy * dy); + + if (w < 1e-9) { + continue; + } + + rw = (h / w * dy + dx) / 2; + rh = (h / w * dx + dy) / 2; + cx = (x2 + x) / 2; + cy = (y2 + y) / 2; + + minX = cx - rw < minX ? cx - rw : minX; + maxX = cx + rw > maxX ? cx + rw : maxX; + + minY = cy - rh < minY ? cy - rh : minY; + maxY = cy + rh > maxY ? cy + rh : maxY; + } + } + } + } else { + minX = 0; + maxX = 0; + minY = 0; + maxY = 0; + } + + var padding = this.boundsPadding; + + this._localBounds.minX = minX - padding; + this._localBounds.maxX = maxX + padding; + + this._localBounds.minY = minY - padding; + this._localBounds.maxY = maxY + padding; + }; + + /** + * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. + * @return {PIXI.GraphicsData} The generated GraphicsData object. + */ + + + Graphics.prototype.drawShape = function drawShape(shape) { + if (this.currentPath) { + // check current path! + if (this.currentPath.shape.points.length <= 2) { + this.graphicsData.pop(); + } + } + + this.currentPath = null; + + var data = new _GraphicsData2.default(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.filling, this.nativeLines, shape, this.lineAlignment); + + this.graphicsData.push(data); + + if (data.type === _const.SHAPES.POLY) { + data.shape.closed = data.shape.closed; + this.currentPath = data; + } + + this.dirty++; + + return data; + }; + + /** + * Generates a canvas texture. + * + * @param {number} scaleMode - The scale mode of the texture. + * @param {number} resolution - The resolution of the texture. + * @return {PIXI.Texture} The new texture. + */ + + + Graphics.prototype.generateCanvasTexture = function generateCanvasTexture(scaleMode) { + var resolution = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + + var bounds = this.getLocalBounds(); + + var canvasBuffer = _RenderTexture2.default.create(bounds.width, bounds.height, scaleMode, resolution); + + if (!canvasRenderer) { + canvasRenderer = new _CanvasRenderer2.default(); + } + + this.transform.updateLocalTransform(); + this.transform.localTransform.copy(tempMatrix); + + tempMatrix.invert(); + + tempMatrix.tx -= bounds.x; + tempMatrix.ty -= bounds.y; + + canvasRenderer.render(this, canvasBuffer, true, tempMatrix); + + var texture = _Texture2.default.fromCanvas(canvasBuffer.baseTexture._canvasRenderTarget.canvas, scaleMode, 'graphics'); + + texture.baseTexture.resolution = resolution; + texture.baseTexture.update(); + + return texture; + }; + + /** + * Closes the current path. + * + * @return {PIXI.Graphics} Returns itself. + */ + + + Graphics.prototype.closePath = function closePath() { + // ok so close path assumes next one is a hole! + var currentPath = this.currentPath; + + if (currentPath && currentPath.shape) { + currentPath.shape.close(); + } + + return this; + }; + + /** + * Adds a hole in the current path. + * + * @return {PIXI.Graphics} Returns itself. + */ + + + Graphics.prototype.addHole = function addHole() { + // this is a hole! + var hole = this.graphicsData.pop(); + + this.currentPath = this.graphicsData[this.graphicsData.length - 1]; + + this.currentPath.addHole(hole.shape); + this.currentPath = null; + + return this; + }; + + /** + * Destroys the Graphics object. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all + * options have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have + * their destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + + + Graphics.prototype.destroy = function destroy(options) { + _Container.prototype.destroy.call(this, options); + + // destroy each of the GraphicsData objects + for (var i = 0; i < this.graphicsData.length; ++i) { + this.graphicsData[i].destroy(); + } + + // for each webgl data entry, destroy the WebGLGraphicsData + for (var id in this._webGL) { + for (var j = 0; j < this._webGL[id].data.length; ++j) { + this._webGL[id].data[j].destroy(); + } + } + + if (this._spriteRect) { + this._spriteRect.destroy(); + } + + this.graphicsData = null; + + this.currentPath = null; + this._webGL = null; + this._localBounds = null; + }; + + return Graphics; + }(_Container3.default); + + exports.default = Graphics; + + + Graphics._SPRITE_TEXTURE = null; + + /** + * Graphics curves resolution settings. If `adaptive` flag is set to `true`, + * the resolution is calculated based on the curve's length to ensure better visual quality. + * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`. + * + * @static + * @constant + * @memberof PIXI.Graphics + * @name CURVES + * @type {object} + * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive + * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored) + * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored) + * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored) + */ + Graphics.CURVES = { + adaptive: false, + maxLength: 10, + minSegments: 8, + maxSegments: 2048 + }; + + }, { "../const": 46, "../display/Bounds": 47, "../display/Container": 48, "../math": 70, "../renderers/canvas/CanvasRenderer": 77, "../sprites/Sprite": 102, "../textures/RenderTexture": 113, "../textures/Texture": 115, "../utils": 125, "./GraphicsData": 54, "./utils/bezierCurveTo": 56 }], 54: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * A GraphicsData object. + * + * @class + * @memberof PIXI + */ + var GraphicsData = function () { + /** + * + * @param {number} lineWidth - the width of the line to draw + * @param {number} lineColor - the color of the line to draw + * @param {number} lineAlpha - the alpha of the line to draw + * @param {number} fillColor - the color of the fill + * @param {number} fillAlpha - the alpha of the fill + * @param {boolean} fill - whether or not the shape is filled with a colour + * @param {boolean} nativeLines - the method for drawing lines + * @param {PIXI.Circle|PIXI.Rectangle|PIXI.Ellipse|PIXI.Polygon} shape - The shape object to draw. + * @param {number} lineAlignment - the alignment of the line. + */ + function GraphicsData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, nativeLines, shape, lineAlignment) { + _classCallCheck(this, GraphicsData); + + /** + * the width of the line to draw + * @member {number} + */ + this.lineWidth = lineWidth; + + /** + * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner). + * + * @member {number} + * @default 0 + */ + this.lineAlignment = lineAlignment; + + /** + * if true the liens will be draw using LINES instead of TRIANGLE_STRIP + * @member {boolean} + */ + this.nativeLines = nativeLines; + + /** + * the color of the line to draw + * @member {number} + */ + this.lineColor = lineColor; + + /** + * the alpha of the line to draw + * @member {number} + */ + this.lineAlpha = lineAlpha; + + /** + * cached tint of the line to draw + * @member {number} + * @private + */ + this._lineTint = lineColor; + + /** + * the color of the fill + * @member {number} + */ + this.fillColor = fillColor; + + /** + * the alpha of the fill + * @member {number} + */ + this.fillAlpha = fillAlpha; + + /** + * cached tint of the fill + * @member {number} + * @private + */ + this._fillTint = fillColor; + + /** + * whether or not the shape is filled with a colour + * @member {boolean} + */ + this.fill = fill; + + this.holes = []; + + /** + * The shape object to draw. + * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} + */ + this.shape = shape; + + /** + * The type of the shape, see the Const.Shapes file for all the existing types, + * @member {number} + */ + this.type = shape.type; + } + + /** + * Creates a new GraphicsData object with the same values as this one. + * + * @return {PIXI.GraphicsData} Cloned GraphicsData object + */ + + + GraphicsData.prototype.clone = function clone() { + return new GraphicsData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.fill, this.nativeLines, this.shape, this.lineAlignment); + }; + + /** + * Adds a hole to the shape. + * + * @param {PIXI.Rectangle|PIXI.Circle} shape - The shape of the hole. + */ + + + GraphicsData.prototype.addHole = function addHole(shape) { + this.holes.push(shape); + }; + + /** + * Destroys the Graphics data. + */ + + + GraphicsData.prototype.destroy = function destroy() { + this.shape = null; + this.holes = null; + }; + + return GraphicsData; + }(); + + exports.default = GraphicsData; + + }, {}], 55: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'); + + var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); + + var _const = require('../../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they + * now share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's CanvasGraphicsRenderer: + * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java + */ + + /** + * Renderer dedicated to drawing and batching graphics objects. + * + * @class + * @private + * @memberof PIXI + */ + var CanvasGraphicsRenderer = function () { + /** + * @param {PIXI.CanvasRenderer} renderer - The current PIXI renderer. + */ + function CanvasGraphicsRenderer(renderer) { + _classCallCheck(this, CanvasGraphicsRenderer); + + this.renderer = renderer; + } + + /** + * Renders a Graphics object to a canvas. + * + * @param {PIXI.Graphics} graphics - the actual graphics object to render + */ + + + CanvasGraphicsRenderer.prototype.render = function render(graphics) { + var renderer = this.renderer; + var context = renderer.context; + var worldAlpha = graphics.worldAlpha; + var transform = graphics.transform.worldTransform; + var resolution = renderer.resolution; + + context.setTransform(transform.a * resolution, transform.b * resolution, transform.c * resolution, transform.d * resolution, transform.tx * resolution, transform.ty * resolution); + + // update tint if graphics was dirty + if (graphics.canvasTintDirty !== graphics.dirty || graphics._prevTint !== graphics.tint) { + this.updateGraphicsTint(graphics); + } + + renderer.setBlendMode(graphics.blendMode); + + for (var i = 0; i < graphics.graphicsData.length; i++) { + var data = graphics.graphicsData[i]; + var shape = data.shape; + + var fillColor = data._fillTint; + var lineColor = data._lineTint; + + context.lineWidth = data.lineWidth; + + if (data.type === _const.SHAPES.POLY) { + context.beginPath(); + + var points = shape.points; + var holes = data.holes; + var outerArea = void 0; + var innerArea = void 0; + var px = void 0; + var py = void 0; + + context.moveTo(points[0], points[1]); + + for (var j = 2; j < points.length; j += 2) { + context.lineTo(points[j], points[j + 1]); + } + + // if the first and last point are the same close the path - much neater :) + if (shape.closed) { + context.closePath(); + } + + if (holes.length > 0) { + outerArea = 0; + px = points[0]; + py = points[1]; + for (var _j = 2; _j + 2 < points.length; _j += 2) { + outerArea += (points[_j] - px) * (points[_j + 3] - py) - (points[_j + 2] - px) * (points[_j + 1] - py); + } + + for (var k = 0; k < holes.length; k++) { + points = holes[k].points; + + if (!points) { + continue; + } + + innerArea = 0; + px = points[0]; + py = points[1]; + for (var _j2 = 2; _j2 + 2 < points.length; _j2 += 2) { + innerArea += (points[_j2] - px) * (points[_j2 + 3] - py) - (points[_j2 + 2] - px) * (points[_j2 + 1] - py); + } + + if (innerArea * outerArea < 0) { + context.moveTo(points[0], points[1]); + + for (var _j3 = 2; _j3 < points.length; _j3 += 2) { + context.lineTo(points[_j3], points[_j3 + 1]); + } + } else { + context.moveTo(points[points.length - 2], points[points.length - 1]); + + for (var _j4 = points.length - 4; _j4 >= 0; _j4 -= 2) { + context.lineTo(points[_j4], points[_j4 + 1]); + } + } + + if (holes[k].close) { + context.closePath(); + } + } + } + + if (data.fill) { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = '#' + ('00000' + (fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if (data.lineWidth) { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeStyle = '#' + ('00000' + (lineColor | 0).toString(16)).substr(-6); + context.stroke(); + } + } else if (data.type === _const.SHAPES.RECT) { + if (data.fillColor || data.fillColor === 0) { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = '#' + ('00000' + (fillColor | 0).toString(16)).substr(-6); + context.fillRect(shape.x, shape.y, shape.width, shape.height); + } + if (data.lineWidth) { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeStyle = '#' + ('00000' + (lineColor | 0).toString(16)).substr(-6); + context.strokeRect(shape.x, shape.y, shape.width, shape.height); + } + } else if (data.type === _const.SHAPES.CIRC) { + // TODO - need to be Undefined! + context.beginPath(); + context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI); + context.closePath(); + + if (data.fill) { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = '#' + ('00000' + (fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if (data.lineWidth) { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeStyle = '#' + ('00000' + (lineColor | 0).toString(16)).substr(-6); + context.stroke(); + } + } else if (data.type === _const.SHAPES.ELIP) { + // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + + var w = shape.width * 2; + var h = shape.height * 2; + + var x = shape.x - w / 2; + var y = shape.y - h / 2; + + context.beginPath(); + + var kappa = 0.5522848; + var ox = w / 2 * kappa; // control point offset horizontal + var oy = h / 2 * kappa; // control point offset vertical + var xe = x + w; // x-end + var ye = y + h; // y-end + var xm = x + w / 2; // x-middle + var ym = y + h / 2; // y-middle + + context.moveTo(x, ym); + context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + + context.closePath(); + + if (data.fill) { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = '#' + ('00000' + (fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if (data.lineWidth) { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeStyle = '#' + ('00000' + (lineColor | 0).toString(16)).substr(-6); + context.stroke(); + } + } else if (data.type === _const.SHAPES.RREC) { + var rx = shape.x; + var ry = shape.y; + var width = shape.width; + var height = shape.height; + var radius = shape.radius; + + var maxRadius = Math.min(width, height) / 2 | 0; + + radius = radius > maxRadius ? maxRadius : radius; + + context.beginPath(); + context.moveTo(rx, ry + radius); + context.lineTo(rx, ry + height - radius); + context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height); + context.lineTo(rx + width - radius, ry + height); + context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius); + context.lineTo(rx + width, ry + radius); + context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry); + context.lineTo(rx + radius, ry); + context.quadraticCurveTo(rx, ry, rx, ry + radius); + context.closePath(); + + if (data.fillColor || data.fillColor === 0) { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = '#' + ('00000' + (fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + + if (data.lineWidth) { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeStyle = '#' + ('00000' + (lineColor | 0).toString(16)).substr(-6); + context.stroke(); + } + } + } + }; + + /** + * Updates the tint of a graphics object + * + * @private + * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated + */ + + + CanvasGraphicsRenderer.prototype.updateGraphicsTint = function updateGraphicsTint(graphics) { + graphics._prevTint = graphics.tint; + graphics.canvasTintDirty = graphics.dirty; + + var tintR = (graphics.tint >> 16 & 0xFF) / 255; + var tintG = (graphics.tint >> 8 & 0xFF) / 255; + var tintB = (graphics.tint & 0xFF) / 255; + + for (var i = 0; i < graphics.graphicsData.length; ++i) { + var data = graphics.graphicsData[i]; + + var fillColor = data.fillColor | 0; + var lineColor = data.lineColor | 0; + + // super inline, cos optimization :) + data._fillTint = ((fillColor >> 16 & 0xFF) / 255 * tintR * 255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG * 255 << 8) + (fillColor & 0xFF) / 255 * tintB * 255; + + data._lineTint = ((lineColor >> 16 & 0xFF) / 255 * tintR * 255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG * 255 << 8) + (lineColor & 0xFF) / 255 * tintB * 255; + } + }; + + /** + * Renders a polygon. + * + * @param {PIXI.Point[]} points - The points to render + * @param {boolean} close - Should the polygon be closed + * @param {CanvasRenderingContext2D} context - The rendering context to use + */ + + + CanvasGraphicsRenderer.prototype.renderPolygon = function renderPolygon(points, close, context) { + context.moveTo(points[0], points[1]); + + for (var j = 1; j < points.length / 2; ++j) { + context.lineTo(points[j * 2], points[j * 2 + 1]); + } + + if (close) { + context.closePath(); + } + }; + + /** + * destroy graphics object + * + */ + + + CanvasGraphicsRenderer.prototype.destroy = function destroy() { + this.renderer = null; + }; + + return CanvasGraphicsRenderer; + }(); + + exports.default = CanvasGraphicsRenderer; + + + _CanvasRenderer2.default.registerPlugin('graphics', CanvasGraphicsRenderer); + + }, { "../../const": 46, "../../renderers/canvas/CanvasRenderer": 77 }], 56: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + exports.default = bezierCurveTo; + /** + * Calculate the points for a bezier curve and then draws it. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @param {number} fromX - Starting point x + * @param {number} fromY - Starting point y + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number} n - Number of segments approximating the bezier curve + * @param {number[]} [path=[]] - Path array to push points into + * @return {number[]} Array of points of the curve + */ + function bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n) { + var path = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : []; + + var dt = 0; + var dt2 = 0; + var dt3 = 0; + var t2 = 0; + var t3 = 0; + + path.push(fromX, fromY); + + for (var i = 1, j = 0; i <= n; ++i) { + j = i / n; + + dt = 1 - j; + dt2 = dt * dt; + dt3 = dt2 * dt; + + t2 = j * j; + t3 = t2 * j; + + path.push(dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX, dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY); + } + + return path; + } + + }, {}], 57: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _utils = require('../../utils'); + + var _const = require('../../const'); + + var _ObjectRenderer2 = require('../../renderers/webgl/utils/ObjectRenderer'); + + var _ObjectRenderer3 = _interopRequireDefault(_ObjectRenderer2); + + var _WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'); + + var _WebGLRenderer2 = _interopRequireDefault(_WebGLRenderer); + + var _WebGLGraphicsData = require('./WebGLGraphicsData'); + + var _WebGLGraphicsData2 = _interopRequireDefault(_WebGLGraphicsData); + + var _PrimitiveShader = require('./shaders/PrimitiveShader'); + + var _PrimitiveShader2 = _interopRequireDefault(_PrimitiveShader); + + var _buildPoly = require('./utils/buildPoly'); + + var _buildPoly2 = _interopRequireDefault(_buildPoly); + + var _buildRectangle = require('./utils/buildRectangle'); + + var _buildRectangle2 = _interopRequireDefault(_buildRectangle); + + var _buildRoundedRectangle = require('./utils/buildRoundedRectangle'); + + var _buildRoundedRectangle2 = _interopRequireDefault(_buildRoundedRectangle); + + var _buildCircle = require('./utils/buildCircle'); + + var _buildCircle2 = _interopRequireDefault(_buildCircle); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * Renders the graphics object. + * + * @class + * @memberof PIXI + * @extends PIXI.ObjectRenderer + */ + var GraphicsRenderer = function (_ObjectRenderer) { + _inherits(GraphicsRenderer, _ObjectRenderer); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this object renderer works for. + */ + function GraphicsRenderer(renderer) { + _classCallCheck(this, GraphicsRenderer); + + var _this = _possibleConstructorReturn(this, _ObjectRenderer.call(this, renderer)); + + _this.graphicsDataPool = []; + + _this.primitiveShader = null; + + _this.gl = renderer.gl; + + // easy access! + _this.CONTEXT_UID = 0; + return _this; + } + + /** + * Called when there is a WebGL context change + * + * @private + * + */ + + + GraphicsRenderer.prototype.onContextChange = function onContextChange() { + this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.primitiveShader = new _PrimitiveShader2.default(this.gl); + }; + + /** + * Destroys this renderer. + * + */ + + + GraphicsRenderer.prototype.destroy = function destroy() { + _ObjectRenderer3.default.prototype.destroy.call(this); + + for (var i = 0; i < this.graphicsDataPool.length; ++i) { + this.graphicsDataPool[i].destroy(); + } + + this.graphicsDataPool = null; + }; + + /** + * Renders a graphics object. + * + * @param {PIXI.Graphics} graphics - The graphics object to render. + */ + + + GraphicsRenderer.prototype.render = function render(graphics) { + var renderer = this.renderer; + var gl = renderer.gl; + + var webGLData = void 0; + var webGL = graphics._webGL[this.CONTEXT_UID]; + + if (!webGL || graphics.dirty !== webGL.dirty) { + this.updateGraphics(graphics); + + webGL = graphics._webGL[this.CONTEXT_UID]; + } + + // This could be speeded up for sure! + var shader = this.primitiveShader; + + renderer.bindShader(shader); + renderer.state.setBlendMode(graphics.blendMode); + + for (var i = 0, n = webGL.data.length; i < n; i++) { + webGLData = webGL.data[i]; + var shaderTemp = webGLData.shader; + + renderer.bindShader(shaderTemp); + shaderTemp.uniforms.translationMatrix = graphics.transform.worldTransform.toArray(true); + shaderTemp.uniforms.tint = (0, _utils.hex2rgb)(graphics.tint); + shaderTemp.uniforms.alpha = graphics.worldAlpha; + + renderer.bindVao(webGLData.vao); + + if (webGLData.nativeLines) { + gl.drawArrays(gl.LINES, 0, webGLData.points.length / 6); + } else { + webGLData.vao.draw(gl.TRIANGLE_STRIP, webGLData.indices.length); + } + } + }; + + /** + * Updates the graphics object + * + * @private + * @param {PIXI.Graphics} graphics - The graphics object to update + */ + + + GraphicsRenderer.prototype.updateGraphics = function updateGraphics(graphics) { + var gl = this.renderer.gl; + + // get the contexts graphics object + var webGL = graphics._webGL[this.CONTEXT_UID]; + + // if the graphics object does not exist in the webGL context time to create it! + if (!webGL) { + webGL = graphics._webGL[this.CONTEXT_UID] = { lastIndex: 0, data: [], gl: gl, clearDirty: -1, dirty: -1 }; + } + + // flag the graphics as not dirty as we are about to update it... + webGL.dirty = graphics.dirty; + + // if the user cleared the graphics object we will need to clear every object + if (graphics.clearDirty !== webGL.clearDirty) { + webGL.clearDirty = graphics.clearDirty; + + // loop through and return all the webGLDatas to the object pool so than can be reused later on + for (var i = 0; i < webGL.data.length; i++) { + this.graphicsDataPool.push(webGL.data[i]); + } + + // clear the array and reset the index.. + webGL.data.length = 0; + webGL.lastIndex = 0; + } + + var webGLData = void 0; + var webGLDataNativeLines = void 0; + + // loop through the graphics datas and construct each one.. + // if the object is a complex fill then the new stencil buffer technique will be used + // other wise graphics objects will be pushed into a batch.. + for (var _i = webGL.lastIndex; _i < graphics.graphicsData.length; _i++) { + var data = graphics.graphicsData[_i]; + + // TODO - this can be simplified + webGLData = this.getWebGLData(webGL, 0); + + if (data.nativeLines && data.lineWidth) { + webGLDataNativeLines = this.getWebGLData(webGL, 0, true); + webGL.lastIndex++; + } + + if (data.type === _const.SHAPES.POLY) { + (0, _buildPoly2.default)(data, webGLData, webGLDataNativeLines); + } + if (data.type === _const.SHAPES.RECT) { + (0, _buildRectangle2.default)(data, webGLData, webGLDataNativeLines); + } else if (data.type === _const.SHAPES.CIRC || data.type === _const.SHAPES.ELIP) { + (0, _buildCircle2.default)(data, webGLData, webGLDataNativeLines); + } else if (data.type === _const.SHAPES.RREC) { + (0, _buildRoundedRectangle2.default)(data, webGLData, webGLDataNativeLines); + } + + webGL.lastIndex++; + } + + this.renderer.bindVao(null); + + // upload all the dirty data... + for (var _i2 = 0; _i2 < webGL.data.length; _i2++) { + webGLData = webGL.data[_i2]; + + if (webGLData.dirty) { + webGLData.upload(); + } + } + }; + + /** + * + * @private + * @param {WebGLRenderingContext} gl - the current WebGL drawing context + * @param {number} type - TODO @Alvin + * @param {number} nativeLines - indicate whether the webGLData use for nativeLines. + * @return {*} TODO + */ + + + GraphicsRenderer.prototype.getWebGLData = function getWebGLData(gl, type, nativeLines) { + var webGLData = gl.data[gl.data.length - 1]; + + if (!webGLData || webGLData.nativeLines !== nativeLines || webGLData.points.length > 320000) { + webGLData = this.graphicsDataPool.pop() || new _WebGLGraphicsData2.default(this.renderer.gl, this.primitiveShader, this.renderer.state.attribsState); + webGLData.nativeLines = nativeLines; + webGLData.reset(type); + gl.data.push(webGLData); + } + + webGLData.dirty = true; + + return webGLData; + }; + + return GraphicsRenderer; + }(_ObjectRenderer3.default); + + exports.default = GraphicsRenderer; + + + _WebGLRenderer2.default.registerPlugin('graphics', GraphicsRenderer); + + }, { "../../const": 46, "../../renderers/webgl/WebGLRenderer": 84, "../../renderers/webgl/utils/ObjectRenderer": 94, "../../utils": 125, "./WebGLGraphicsData": 58, "./shaders/PrimitiveShader": 59, "./utils/buildCircle": 60, "./utils/buildPoly": 62, "./utils/buildRectangle": 63, "./utils/buildRoundedRectangle": 64 }], 58: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * An object containing WebGL specific properties to be used by the WebGL renderer + * + * @class + * @private + * @memberof PIXI + */ + var WebGLGraphicsData = function () { + /** + * @param {WebGLRenderingContext} gl - The current WebGL drawing context + * @param {PIXI.Shader} shader - The shader + * @param {object} attribsState - The state for the VAO + */ + function WebGLGraphicsData(gl, shader, attribsState) { + _classCallCheck(this, WebGLGraphicsData); + + /** + * The current WebGL drawing context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + // TODO does this need to be split before uploading?? + /** + * An array of color components (r,g,b) + * @member {number[]} + */ + this.color = [0, 0, 0]; // color split! + + /** + * An array of points to draw + * @member {PIXI.Point[]} + */ + this.points = []; + + /** + * The indices of the vertices + * @member {number[]} + */ + this.indices = []; + /** + * The main buffer + * @member {WebGLBuffer} + */ + this.buffer = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl); + + /** + * The index buffer + * @member {WebGLBuffer} + */ + this.indexBuffer = _pixiGlCore2.default.GLBuffer.createIndexBuffer(gl); + + /** + * Whether this graphics is dirty or not + * @member {boolean} + */ + this.dirty = true; + + /** + * Whether this graphics is nativeLines or not + * @member {boolean} + */ + this.nativeLines = false; + + this.glPoints = null; + this.glIndices = null; + + /** + * + * @member {PIXI.Shader} + */ + this.shader = shader; + + this.vao = new _pixiGlCore2.default.VertexArrayObject(gl, attribsState).addIndex(this.indexBuffer).addAttribute(this.buffer, shader.attributes.aVertexPosition, gl.FLOAT, false, 4 * 6, 0).addAttribute(this.buffer, shader.attributes.aColor, gl.FLOAT, false, 4 * 6, 2 * 4); + } + + /** + * Resets the vertices and the indices + */ + + + WebGLGraphicsData.prototype.reset = function reset() { + this.points.length = 0; + this.indices.length = 0; + }; + + /** + * Binds the buffers and uploads the data + */ + + + WebGLGraphicsData.prototype.upload = function upload() { + this.glPoints = new Float32Array(this.points); + this.buffer.upload(this.glPoints); + + this.glIndices = new Uint16Array(this.indices); + this.indexBuffer.upload(this.glIndices); + + this.dirty = false; + }; + + /** + * Empties all the data + */ + + + WebGLGraphicsData.prototype.destroy = function destroy() { + this.color = null; + this.points = null; + this.indices = null; + + this.vao.destroy(); + this.buffer.destroy(); + this.indexBuffer.destroy(); + + this.gl = null; + + this.buffer = null; + this.indexBuffer = null; + + this.glPoints = null; + this.glIndices = null; + }; + + return WebGLGraphicsData; + }(); + + exports.default = WebGLGraphicsData; + + }, { "pixi-gl-core": 15 }], 59: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Shader2 = require('../../../Shader'); + + var _Shader3 = _interopRequireDefault(_Shader2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * This shader is used to draw simple primitive shapes for {@link PIXI.Graphics}. + * + * @class + * @memberof PIXI + * @extends PIXI.Shader + */ + var PrimitiveShader = function (_Shader) { + _inherits(PrimitiveShader, _Shader); + + /** + * @param {WebGLRenderingContext} gl - The webgl shader manager this shader works for. + */ + function PrimitiveShader(gl) { + _classCallCheck(this, PrimitiveShader); + + return _possibleConstructorReturn(this, _Shader.call(this, gl, + // vertex shader + ['attribute vec2 aVertexPosition;', 'attribute vec4 aColor;', 'uniform mat3 translationMatrix;', 'uniform mat3 projectionMatrix;', 'uniform float alpha;', 'uniform vec3 tint;', 'varying vec4 vColor;', 'void main(void){', ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', ' vColor = aColor * vec4(tint * alpha, alpha);', '}'].join('\n'), + // fragment shader + ['varying vec4 vColor;', 'void main(void){', ' gl_FragColor = vColor;', '}'].join('\n'))); + } + + return PrimitiveShader; + }(_Shader3.default); + + exports.default = PrimitiveShader; + + }, { "../../../Shader": 44 }], 60: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = buildCircle; + + var _buildLine = require('./buildLine'); + + var _buildLine2 = _interopRequireDefault(_buildLine); + + var _const = require('../../../const'); + + var _utils = require('../../../utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Builds a circle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + */ + function buildCircle(graphicsData, webGLData, webGLDataNativeLines) { + // need to convert points to a nice regular data + var circleData = graphicsData.shape; + var x = circleData.x; + var y = circleData.y; + var width = void 0; + var height = void 0; + + // TODO - bit hacky?? + if (graphicsData.type === _const.SHAPES.CIRC) { + width = circleData.radius; + height = circleData.radius; + } else { + width = circleData.width; + height = circleData.height; + } + + if (width === 0 || height === 0) { + return; + } + + var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius)) || Math.floor(15 * Math.sqrt(circleData.width + circleData.height)); + + var seg = Math.PI * 2 / totalSegs; + + if (graphicsData.fill) { + var color = (0, _utils.hex2rgb)(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var verts = webGLData.points; + var indices = webGLData.indices; + + var vecPos = verts.length / 6; + + indices.push(vecPos); + + for (var i = 0; i < totalSegs + 1; i++) { + verts.push(x, y, r, g, b, alpha); + + verts.push(x + Math.sin(seg * i) * width, y + Math.cos(seg * i) * height, r, g, b, alpha); + + indices.push(vecPos++, vecPos++); + } + + indices.push(vecPos - 1); + } + + if (graphicsData.lineWidth) { + var tempPoints = graphicsData.points; + + graphicsData.points = []; + + for (var _i = 0; _i < totalSegs; _i++) { + graphicsData.points.push(x + Math.sin(seg * -_i) * width, y + Math.cos(seg * -_i) * height); + } + + graphicsData.points.push(graphicsData.points[0], graphicsData.points[1]); + + (0, _buildLine2.default)(graphicsData, webGLData, webGLDataNativeLines); + + graphicsData.points = tempPoints; + } + } + + }, { "../../../const": 46, "../../../utils": 125, "./buildLine": 61 }], 61: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + exports.default = function (graphicsData, webGLData, webGLDataNativeLines) { + if (graphicsData.nativeLines) { + buildNativeLine(graphicsData, webGLDataNativeLines); + } else { + buildLine(graphicsData, webGLData); + } + }; + + var _math = require('../../../math'); + + var _utils = require('../../../utils'); + + /** + * Builds a line to draw using the poligon method. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + */ + function buildLine(graphicsData, webGLData) { + // TODO OPTIMISE! + var points = graphicsData.points; + + if (points.length === 0) { + return; + } + // if the line width is an odd number add 0.5 to align to a whole pixel + // commenting this out fixes #711 and #1620 + // if (graphicsData.lineWidth%2) + // { + // for (i = 0; i < points.length; i++) + // { + // points[i] += 0.5; + // } + // } + + // get first and last point.. figure out the middle! + var firstPoint = new _math.Point(points[0], points[1]); + var lastPoint = new _math.Point(points[points.length - 2], points[points.length - 1]); + + // if the first point is the last point - gonna have issues :) + if (firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y) { + // need to clone as we are going to slightly modify the shape.. + points = points.slice(); + + points.pop(); + points.pop(); + + lastPoint = new _math.Point(points[points.length - 2], points[points.length - 1]); + + var midPointX = lastPoint.x + (firstPoint.x - lastPoint.x) * 0.5; + var midPointY = lastPoint.y + (firstPoint.y - lastPoint.y) * 0.5; + + points.unshift(midPointX, midPointY); + points.push(midPointX, midPointY); + } + + var verts = webGLData.points; + var indices = webGLData.indices; + var length = points.length / 2; + var indexCount = points.length; + var indexStart = verts.length / 6; + + // DRAW the Line + var width = graphicsData.lineWidth / 2; + + // sort color + var color = (0, _utils.hex2rgb)(graphicsData.lineColor); + var alpha = graphicsData.lineAlpha; + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var p1x = points[0]; + var p1y = points[1]; + var p2x = points[2]; + var p2y = points[3]; + var p3x = 0; + var p3y = 0; + + var perpx = -(p1y - p2y); + var perpy = p1x - p2x; + var perp2x = 0; + var perp2y = 0; + var perp3x = 0; + var perp3y = 0; + + var dist = Math.sqrt(perpx * perpx + perpy * perpy); + + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + var ratio = graphicsData.lineAlignment; // 0.5; + var r1 = (1 - ratio) * 2; + var r2 = ratio * 2; + + // start + verts.push(p1x - perpx * r1, p1y - perpy * r1, r, g, b, alpha); + + verts.push(p1x + perpx * r2, p1y + perpy * r2, r, g, b, alpha); + + for (var i = 1; i < length - 1; ++i) { + p1x = points[(i - 1) * 2]; + p1y = points[(i - 1) * 2 + 1]; + + p2x = points[i * 2]; + p2y = points[i * 2 + 1]; + + p3x = points[(i + 1) * 2]; + p3y = points[(i + 1) * 2 + 1]; + + perpx = -(p1y - p2y); + perpy = p1x - p2x; + + dist = Math.sqrt(perpx * perpx + perpy * perpy); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + perp2x = -(p2y - p3y); + perp2y = p2x - p3x; + + dist = Math.sqrt(perp2x * perp2x + perp2y * perp2y); + perp2x /= dist; + perp2y /= dist; + perp2x *= width; + perp2y *= width; + + var a1 = -perpy + p1y - (-perpy + p2y); + var b1 = -perpx + p2x - (-perpx + p1x); + var c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y); + var a2 = -perp2y + p3y - (-perp2y + p2y); + var b2 = -perp2x + p2x - (-perp2x + p3x); + var c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y); + + var denom = a1 * b2 - a2 * b1; + + if (Math.abs(denom) < 0.1) { + denom += 10.1; + verts.push(p2x - perpx * r1, p2y - perpy * r1, r, g, b, alpha); + + verts.push(p2x + perpx * r2, p2y + perpy * r2, r, g, b, alpha); + + continue; + } + + var px = (b1 * c2 - b2 * c1) / denom; + var py = (a2 * c1 - a1 * c2) / denom; + var pdist = (px - p2x) * (px - p2x) + (py - p2y) * (py - p2y); + + if (pdist > 196 * width * width) { + perp3x = perpx - perp2x; + perp3y = perpy - perp2y; + + dist = Math.sqrt(perp3x * perp3x + perp3y * perp3y); + perp3x /= dist; + perp3y /= dist; + perp3x *= width; + perp3y *= width; + + verts.push(p2x - perp3x * r1, p2y - perp3y * r1); + verts.push(r, g, b, alpha); + + verts.push(p2x + perp3x * r2, p2y + perp3y * r2); + verts.push(r, g, b, alpha); + + verts.push(p2x - perp3x * r2 * r1, p2y - perp3y * r1); + verts.push(r, g, b, alpha); + + indexCount++; + } else { + verts.push(p2x + (px - p2x) * r1, p2y + (py - p2y) * r1); + verts.push(r, g, b, alpha); + + verts.push(p2x - (px - p2x) * r2, p2y - (py - p2y) * r2); + verts.push(r, g, b, alpha); + } + } + + p1x = points[(length - 2) * 2]; + p1y = points[(length - 2) * 2 + 1]; + + p2x = points[(length - 1) * 2]; + p2y = points[(length - 1) * 2 + 1]; + + perpx = -(p1y - p2y); + perpy = p1x - p2x; + + dist = Math.sqrt(perpx * perpx + perpy * perpy); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + verts.push(p2x - perpx * r1, p2y - perpy * r1); + verts.push(r, g, b, alpha); + + verts.push(p2x + perpx * r2, p2y + perpy * r2); + verts.push(r, g, b, alpha); + + indices.push(indexStart); + + for (var _i = 0; _i < indexCount; ++_i) { + indices.push(indexStart++); + } + + indices.push(indexStart - 1); + } + + /** + * Builds a line to draw using the gl.drawArrays(gl.LINES) method + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + */ + + + /** + * Builds a line to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + */ + function buildNativeLine(graphicsData, webGLData) { + var i = 0; + var points = graphicsData.points; + + if (points.length === 0) return; + + var verts = webGLData.points; + var length = points.length / 2; + + // sort color + var color = (0, _utils.hex2rgb)(graphicsData.lineColor); + var alpha = graphicsData.lineAlpha; + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + for (i = 1; i < length; i++) { + var p1x = points[(i - 1) * 2]; + var p1y = points[(i - 1) * 2 + 1]; + + var p2x = points[i * 2]; + var p2y = points[i * 2 + 1]; + + verts.push(p1x, p1y); + verts.push(r, g, b, alpha); + + verts.push(p2x, p2y); + verts.push(r, g, b, alpha); + } + } + + }, { "../../../math": 70, "../../../utils": 125 }], 62: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = buildPoly; + + var _buildLine = require('./buildLine'); + + var _buildLine2 = _interopRequireDefault(_buildLine); + + var _utils = require('../../../utils'); + + var _earcut = require('earcut'); + + var _earcut2 = _interopRequireDefault(_earcut); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Builds a polygon to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + */ + function buildPoly(graphicsData, webGLData, webGLDataNativeLines) { + graphicsData.points = graphicsData.shape.points.slice(); + + var points = graphicsData.points; + + if (graphicsData.fill && points.length >= 6) { + var holeArray = []; + // Process holes.. + var holes = graphicsData.holes; + + for (var i = 0; i < holes.length; i++) { + var hole = holes[i]; + + holeArray.push(points.length / 2); + + points = points.concat(hole.points); + } + + // get first and last point.. figure out the middle! + var verts = webGLData.points; + var indices = webGLData.indices; + + var length = points.length / 2; + + // sort color + var color = (0, _utils.hex2rgb)(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var triangles = (0, _earcut2.default)(points, holeArray, 2); + + if (!triangles) { + return; + } + + var vertPos = verts.length / 6; + + for (var _i = 0; _i < triangles.length; _i += 3) { + indices.push(triangles[_i] + vertPos); + indices.push(triangles[_i] + vertPos); + indices.push(triangles[_i + 1] + vertPos); + indices.push(triangles[_i + 2] + vertPos); + indices.push(triangles[_i + 2] + vertPos); + } + + for (var _i2 = 0; _i2 < length; _i2++) { + verts.push(points[_i2 * 2], points[_i2 * 2 + 1], r, g, b, alpha); + } + } + + if (graphicsData.lineWidth > 0) { + (0, _buildLine2.default)(graphicsData, webGLData, webGLDataNativeLines); + } + } + + }, { "../../../utils": 125, "./buildLine": 61, "earcut": 2 }], 63: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = buildRectangle; + + var _buildLine = require('./buildLine'); + + var _buildLine2 = _interopRequireDefault(_buildLine); + + var _utils = require('../../../utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Builds a rectangle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + */ + function buildRectangle(graphicsData, webGLData, webGLDataNativeLines) { + // --- // + // need to convert points to a nice regular data + // + var rectData = graphicsData.shape; + var x = rectData.x; + var y = rectData.y; + var width = rectData.width; + var height = rectData.height; + + if (graphicsData.fill) { + var color = (0, _utils.hex2rgb)(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var verts = webGLData.points; + var indices = webGLData.indices; + + var vertPos = verts.length / 6; + + // start + verts.push(x, y); + verts.push(r, g, b, alpha); + + verts.push(x + width, y); + verts.push(r, g, b, alpha); + + verts.push(x, y + height); + verts.push(r, g, b, alpha); + + verts.push(x + width, y + height); + verts.push(r, g, b, alpha); + + // insert 2 dead triangles.. + indices.push(vertPos, vertPos, vertPos + 1, vertPos + 2, vertPos + 3, vertPos + 3); + } + + if (graphicsData.lineWidth) { + var tempPoints = graphicsData.points; + + graphicsData.points = [x, y, x + width, y, x + width, y + height, x, y + height, x, y]; + + (0, _buildLine2.default)(graphicsData, webGLData, webGLDataNativeLines); + + graphicsData.points = tempPoints; + } + } + + }, { "../../../utils": 125, "./buildLine": 61 }], 64: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = buildRoundedRectangle; + + var _earcut = require('earcut'); + + var _earcut2 = _interopRequireDefault(_earcut); + + var _buildLine = require('./buildLine'); + + var _buildLine2 = _interopRequireDefault(_buildLine); + + var _utils = require('../../../utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Builds a rounded rectangle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + */ + function buildRoundedRectangle(graphicsData, webGLData, webGLDataNativeLines) { + var rrectData = graphicsData.shape; + var x = rrectData.x; + var y = rrectData.y; + var width = rrectData.width; + var height = rrectData.height; + + var radius = rrectData.radius; + + var recPoints = []; + + recPoints.push(x + radius, y); + quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, recPoints); + quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, recPoints); + quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, recPoints); + quadraticBezierCurve(x, y + radius, x, y, x + radius + 0.0000000001, y, recPoints); + + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. + // TODO - fix this properly, this is not very elegant.. but it works for now. + + if (graphicsData.fill) { + var color = (0, _utils.hex2rgb)(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var verts = webGLData.points; + var indices = webGLData.indices; + + var vecPos = verts.length / 6; + + var triangles = (0, _earcut2.default)(recPoints, null, 2); + + for (var i = 0, j = triangles.length; i < j; i += 3) { + indices.push(triangles[i] + vecPos); + indices.push(triangles[i] + vecPos); + indices.push(triangles[i + 1] + vecPos); + indices.push(triangles[i + 2] + vecPos); + indices.push(triangles[i + 2] + vecPos); + } + + for (var _i = 0, _j = recPoints.length; _i < _j; _i++) { + verts.push(recPoints[_i], recPoints[++_i], r, g, b, alpha); + } + } + + if (graphicsData.lineWidth) { + var tempPoints = graphicsData.points; + + graphicsData.points = recPoints; + + (0, _buildLine2.default)(graphicsData, webGLData, webGLDataNativeLines); + + graphicsData.points = tempPoints; + } + } + + /** + * Calculate a single point for a quadratic bezier curve. + * Utility function used by quadraticBezierCurve. + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} n1 - first number + * @param {number} n2 - second number + * @param {number} perc - percentage + * @return {number} the result + * + */ + function getPt(n1, n2, perc) { + var diff = n2 - n1; + + return n1 + diff * perc; + } + + /** + * Calculate the points for a quadratic bezier curve. (helper function..) + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} fromX - Origin point x + * @param {number} fromY - Origin point x + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created. + * @return {number[]} an array of points + */ + function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) { + var out = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : []; + + var n = 20; + var points = out; + + var xa = 0; + var ya = 0; + var xb = 0; + var yb = 0; + var x = 0; + var y = 0; + + for (var i = 0, j = 0; i <= n; ++i) { + j = i / n; + + // The Green Line + xa = getPt(fromX, cpX, j); + ya = getPt(fromY, cpY, j); + xb = getPt(cpX, toX, j); + yb = getPt(cpY, toY, j); + + // The Black Dot + x = getPt(xa, xb, j); + y = getPt(ya, yb, j); + + points.push(x, y); + } + + return points; + } + + }, { "../../../utils": 125, "./buildLine": 61, "earcut": 2 }], 65: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.autoDetectRenderer = exports.Application = exports.Filter = exports.SpriteMaskFilter = exports.Quad = exports.RenderTarget = exports.ObjectRenderer = exports.WebGLManager = exports.Shader = exports.CanvasRenderTarget = exports.TextureUvs = exports.VideoBaseTexture = exports.BaseRenderTexture = exports.RenderTexture = exports.BaseTexture = exports.TextureMatrix = exports.Texture = exports.Spritesheet = exports.CanvasGraphicsRenderer = exports.GraphicsRenderer = exports.GraphicsData = exports.Graphics = exports.TextMetrics = exports.TextStyle = exports.Text = exports.SpriteRenderer = exports.CanvasTinter = exports.CanvasSpriteRenderer = exports.Sprite = exports.TransformBase = exports.TransformStatic = exports.Transform = exports.Container = exports.DisplayObject = exports.Bounds = exports.glCore = exports.WebGLRenderer = exports.CanvasRenderer = exports.ticker = exports.utils = exports.settings = undefined; + + var _const = require('./const'); + + Object.keys(_const).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _const[key]; + } + }); + }); + + var _math = require('./math'); + + Object.keys(_math).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _math[key]; + } + }); + }); + + var _pixiGlCore = require('pixi-gl-core'); + + Object.defineProperty(exports, 'glCore', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_pixiGlCore).default; + } + }); + + var _Bounds = require('./display/Bounds'); + + Object.defineProperty(exports, 'Bounds', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Bounds).default; + } + }); + + var _DisplayObject = require('./display/DisplayObject'); + + Object.defineProperty(exports, 'DisplayObject', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_DisplayObject).default; + } + }); + + var _Container = require('./display/Container'); + + Object.defineProperty(exports, 'Container', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Container).default; + } + }); + + var _Transform = require('./display/Transform'); + + Object.defineProperty(exports, 'Transform', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Transform).default; + } + }); + + var _TransformStatic = require('./display/TransformStatic'); + + Object.defineProperty(exports, 'TransformStatic', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TransformStatic).default; + } + }); + + var _TransformBase = require('./display/TransformBase'); + + Object.defineProperty(exports, 'TransformBase', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TransformBase).default; + } + }); + + var _Sprite = require('./sprites/Sprite'); + + Object.defineProperty(exports, 'Sprite', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Sprite).default; + } + }); + + var _CanvasSpriteRenderer = require('./sprites/canvas/CanvasSpriteRenderer'); + + Object.defineProperty(exports, 'CanvasSpriteRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasSpriteRenderer).default; + } + }); + + var _CanvasTinter = require('./sprites/canvas/CanvasTinter'); + + Object.defineProperty(exports, 'CanvasTinter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasTinter).default; + } + }); + + var _SpriteRenderer = require('./sprites/webgl/SpriteRenderer'); + + Object.defineProperty(exports, 'SpriteRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_SpriteRenderer).default; + } + }); + + var _Text = require('./text/Text'); + + Object.defineProperty(exports, 'Text', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Text).default; + } + }); + + var _TextStyle = require('./text/TextStyle'); + + Object.defineProperty(exports, 'TextStyle', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TextStyle).default; + } + }); + + var _TextMetrics = require('./text/TextMetrics'); + + Object.defineProperty(exports, 'TextMetrics', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TextMetrics).default; + } + }); + + var _Graphics = require('./graphics/Graphics'); + + Object.defineProperty(exports, 'Graphics', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Graphics).default; + } + }); + + var _GraphicsData = require('./graphics/GraphicsData'); + + Object.defineProperty(exports, 'GraphicsData', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_GraphicsData).default; + } + }); + + var _GraphicsRenderer = require('./graphics/webgl/GraphicsRenderer'); + + Object.defineProperty(exports, 'GraphicsRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_GraphicsRenderer).default; + } + }); + + var _CanvasGraphicsRenderer = require('./graphics/canvas/CanvasGraphicsRenderer'); + + Object.defineProperty(exports, 'CanvasGraphicsRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasGraphicsRenderer).default; + } + }); + + var _Spritesheet = require('./textures/Spritesheet'); + + Object.defineProperty(exports, 'Spritesheet', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Spritesheet).default; + } + }); + + var _Texture = require('./textures/Texture'); + + Object.defineProperty(exports, 'Texture', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Texture).default; + } + }); + + var _TextureMatrix = require('./textures/TextureMatrix'); + + Object.defineProperty(exports, 'TextureMatrix', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TextureMatrix).default; + } + }); + + var _BaseTexture = require('./textures/BaseTexture'); + + Object.defineProperty(exports, 'BaseTexture', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BaseTexture).default; + } + }); + + var _RenderTexture = require('./textures/RenderTexture'); + + Object.defineProperty(exports, 'RenderTexture', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_RenderTexture).default; + } + }); + + var _BaseRenderTexture = require('./textures/BaseRenderTexture'); + + Object.defineProperty(exports, 'BaseRenderTexture', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BaseRenderTexture).default; + } + }); + + var _VideoBaseTexture = require('./textures/VideoBaseTexture'); + + Object.defineProperty(exports, 'VideoBaseTexture', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_VideoBaseTexture).default; + } + }); + + var _TextureUvs = require('./textures/TextureUvs'); + + Object.defineProperty(exports, 'TextureUvs', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TextureUvs).default; + } + }); + + var _CanvasRenderTarget = require('./renderers/canvas/utils/CanvasRenderTarget'); + + Object.defineProperty(exports, 'CanvasRenderTarget', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasRenderTarget).default; + } + }); + + var _Shader = require('./Shader'); + + Object.defineProperty(exports, 'Shader', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Shader).default; + } + }); + + var _WebGLManager = require('./renderers/webgl/managers/WebGLManager'); + + Object.defineProperty(exports, 'WebGLManager', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_WebGLManager).default; + } + }); + + var _ObjectRenderer = require('./renderers/webgl/utils/ObjectRenderer'); + + Object.defineProperty(exports, 'ObjectRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_ObjectRenderer).default; + } + }); + + var _RenderTarget = require('./renderers/webgl/utils/RenderTarget'); + + Object.defineProperty(exports, 'RenderTarget', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_RenderTarget).default; + } + }); + + var _Quad = require('./renderers/webgl/utils/Quad'); + + Object.defineProperty(exports, 'Quad', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Quad).default; + } + }); + + var _SpriteMaskFilter = require('./renderers/webgl/filters/spriteMask/SpriteMaskFilter'); + + Object.defineProperty(exports, 'SpriteMaskFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_SpriteMaskFilter).default; + } + }); + + var _Filter = require('./renderers/webgl/filters/Filter'); + + Object.defineProperty(exports, 'Filter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Filter).default; + } + }); + + var _Application = require('./Application'); + + Object.defineProperty(exports, 'Application', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Application).default; + } + }); + + var _autoDetectRenderer = require('./autoDetectRenderer'); + + Object.defineProperty(exports, 'autoDetectRenderer', { + enumerable: true, + get: function get() { + return _autoDetectRenderer.autoDetectRenderer; + } + }); + + var _utils = require('./utils'); + + var utils = _interopRequireWildcard(_utils); + + var _ticker = require('./ticker'); + + var ticker = _interopRequireWildcard(_ticker); + + var _settings = require('./settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _CanvasRenderer = require('./renderers/canvas/CanvasRenderer'); + + var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); + + var _WebGLRenderer = require('./renderers/webgl/WebGLRenderer'); + + var _WebGLRenderer2 = _interopRequireDefault(_WebGLRenderer); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.settings = _settings2.default; + exports.utils = utils; + exports.ticker = ticker; + exports.CanvasRenderer = _CanvasRenderer2.default; + exports.WebGLRenderer = _WebGLRenderer2.default; /** + * @namespace PIXI + */ + + }, { "./Application": 43, "./Shader": 44, "./autoDetectRenderer": 45, "./const": 46, "./display/Bounds": 47, "./display/Container": 48, "./display/DisplayObject": 49, "./display/Transform": 50, "./display/TransformBase": 51, "./display/TransformStatic": 52, "./graphics/Graphics": 53, "./graphics/GraphicsData": 54, "./graphics/canvas/CanvasGraphicsRenderer": 55, "./graphics/webgl/GraphicsRenderer": 57, "./math": 70, "./renderers/canvas/CanvasRenderer": 77, "./renderers/canvas/utils/CanvasRenderTarget": 79, "./renderers/webgl/WebGLRenderer": 84, "./renderers/webgl/filters/Filter": 86, "./renderers/webgl/filters/spriteMask/SpriteMaskFilter": 89, "./renderers/webgl/managers/WebGLManager": 93, "./renderers/webgl/utils/ObjectRenderer": 94, "./renderers/webgl/utils/Quad": 95, "./renderers/webgl/utils/RenderTarget": 96, "./settings": 101, "./sprites/Sprite": 102, "./sprites/canvas/CanvasSpriteRenderer": 103, "./sprites/canvas/CanvasTinter": 104, "./sprites/webgl/SpriteRenderer": 106, "./text/Text": 108, "./text/TextMetrics": 109, "./text/TextStyle": 110, "./textures/BaseRenderTexture": 111, "./textures/BaseTexture": 112, "./textures/RenderTexture": 113, "./textures/Spritesheet": 114, "./textures/Texture": 115, "./textures/TextureMatrix": 116, "./textures/TextureUvs": 117, "./textures/VideoBaseTexture": 118, "./ticker": 121, "./utils": 125, "pixi-gl-core": 15 }], 66: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Matrix = require('./Matrix'); + + var _Matrix2 = _interopRequireDefault(_Matrix); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group of order 16 + + var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; + var tempMatrices = []; + + var mul = []; + + function signum(x) { + if (x < 0) { + return -1; + } + if (x > 0) { + return 1; + } + + return 0; + } + + function init() { + for (var i = 0; i < 16; i++) { + var row = []; + + mul.push(row); + + for (var j = 0; j < 16; j++) { + var _ux = signum(ux[i] * ux[j] + vx[i] * uy[j]); + var _uy = signum(uy[i] * ux[j] + vy[i] * uy[j]); + var _vx = signum(ux[i] * vx[j] + vx[i] * vy[j]); + var _vy = signum(uy[i] * vx[j] + vy[i] * vy[j]); + + for (var k = 0; k < 16; k++) { + if (ux[k] === _ux && uy[k] === _uy && vx[k] === _vx && vy[k] === _vy) { + row.push(k); + break; + } + } + } + } + + for (var _i = 0; _i < 16; _i++) { + var mat = new _Matrix2.default(); + + mat.set(ux[_i], uy[_i], vx[_i], vy[_i], 0, 0); + tempMatrices.push(mat); + } + } + + init(); + + /** + * Implements Dihedral Group D_8, see [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}, + * D8 is the same but with diagonals. Used for texture rotations. + * + * Vector xX(i), xY(i) is U-axis of sprite with rotation i + * Vector yY(i), yY(i) is V-axis of sprite with rotation i + * Rotations: 0 grad (0), 90 grad (2), 180 grad (4), 270 grad (6) + * Mirrors: vertical (8), main diagonal (10), horizontal (12), reverse diagonal (14) + * This is the small part of gameofbombs.com portal system. It works. + * + * @author Ivan @ivanpopelyshev + * @class + * @memberof PIXI + */ + var GroupD8 = { + E: 0, + SE: 1, + S: 2, + SW: 3, + W: 4, + NW: 5, + N: 6, + NE: 7, + MIRROR_VERTICAL: 8, + MIRROR_HORIZONTAL: 12, + uX: function uX(ind) { + return ux[ind]; + }, + uY: function uY(ind) { + return uy[ind]; + }, + vX: function vX(ind) { + return vx[ind]; + }, + vY: function vY(ind) { + return vy[ind]; + }, + inv: function inv(rotation) { + if (rotation & 8) { + return rotation & 15; + } + + return -rotation & 7; + }, + add: function add(rotationSecond, rotationFirst) { + return mul[rotationSecond][rotationFirst]; + }, + sub: function sub(rotationSecond, rotationFirst) { + return mul[rotationSecond][GroupD8.inv(rotationFirst)]; + }, + + /** + * Adds 180 degrees to rotation. Commutative operation. + * + * @memberof PIXI.GroupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} rotated number + */ + rotate180: function rotate180(rotation) { + return rotation ^ 4; + }, + + /** + * Direction of main vector can be horizontal, vertical or diagonal. + * Some objects work with vertical directions different. + * + * @memberof PIXI.GroupD8 + * @param {number} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: function isVertical(rotation) { + return (rotation & 3) === 2; + }, + + /** + * @memberof PIXI.GroupD8 + * @param {number} dx - TODO + * @param {number} dy - TODO + * + * @return {number} TODO + */ + byDirection: function byDirection(dx, dy) { + if (Math.abs(dx) * 2 <= Math.abs(dy)) { + if (dy >= 0) { + return GroupD8.S; + } + + return GroupD8.N; + } else if (Math.abs(dy) * 2 <= Math.abs(dx)) { + if (dx > 0) { + return GroupD8.E; + } + + return GroupD8.W; + } else if (dy > 0) { + if (dx > 0) { + return GroupD8.SE; + } + + return GroupD8.SW; + } else if (dx > 0) { + return GroupD8.NE; + } + + return GroupD8.NW; + }, + + /** + * Helps sprite to compensate texture packer rotation. + * + * @memberof PIXI.GroupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {number} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: function matrixAppendRotationInv(matrix, rotation) { + var tx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var ty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + // Packer used "rotation", we use "inv(rotation)" + var mat = tempMatrices[GroupD8.inv(rotation)]; + + mat.tx = tx; + mat.ty = ty; + matrix.append(mat); + } + }; + + exports.default = GroupD8; + + }, { "./Matrix": 67 }], 67: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _Point = require('./Point'); + + var _Point2 = _interopRequireDefault(_Point); + + var _const = require('../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The PixiJS Matrix class as an object, which makes it a lot faster, + * here is a representation of it : + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * + * @class + * @memberof PIXI + */ + var Matrix = function () { + /** + * @param {number} [a=1] - x scale + * @param {number} [b=0] - x skew + * @param {number} [c=0] - y skew + * @param {number} [d=1] - y scale + * @param {number} [tx=0] - x translation + * @param {number} [ty=0] - y translation + */ + function Matrix() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + var tx = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var ty = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; + + _classCallCheck(this, Matrix); + + /** + * @member {number} + * @default 1 + */ + this.a = a; + + /** + * @member {number} + * @default 0 + */ + this.b = b; + + /** + * @member {number} + * @default 0 + */ + this.c = c; + + /** + * @member {number} + * @default 1 + */ + this.d = d; + + /** + * @member {number} + * @default 0 + */ + this.tx = tx; + + /** + * @member {number} + * @default 0 + */ + this.ty = ty; + + this.array = null; + } + + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * + * @param {number[]} array - The array that the matrix will be populated from. + */ + + + Matrix.prototype.fromArray = function fromArray(array) { + this.a = array[0]; + this.b = array[1]; + this.c = array[3]; + this.d = array[4]; + this.tx = array[2]; + this.ty = array[5]; + }; + + /** + * sets the matrix properties + * + * @param {number} a - Matrix component + * @param {number} b - Matrix component + * @param {number} c - Matrix component + * @param {number} d - Matrix component + * @param {number} tx - Matrix component + * @param {number} ty - Matrix component + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.set = function set(a, b, c, d, tx, ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + + return this; + }; + + /** + * Creates an array from the current Matrix object. + * + * @param {boolean} transpose - Whether we need to transpose the matrix or not + * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out + * @return {number[]} the newly created array which contains the matrix + */ + + + Matrix.prototype.toArray = function toArray(transpose, out) { + if (!this.array) { + this.array = new Float32Array(9); + } + + var array = out || this.array; + + if (transpose) { + array[0] = this.a; + array[1] = this.b; + array[2] = 0; + array[3] = this.c; + array[4] = this.d; + array[5] = 0; + array[6] = this.tx; + array[7] = this.ty; + array[8] = 1; + } else { + array[0] = this.a; + array[1] = this.c; + array[2] = this.tx; + array[3] = this.b; + array[4] = this.d; + array[5] = this.ty; + array[6] = 0; + array[7] = 0; + array[8] = 1; + } + + return array; + }; + + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * + * @param {PIXI.Point} pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @return {PIXI.Point} The new point, transformed through this matrix + */ + + + Matrix.prototype.apply = function apply(pos, newPos) { + newPos = newPos || new _Point2.default(); + + var x = pos.x; + var y = pos.y; + + newPos.x = this.a * x + this.c * y + this.tx; + newPos.y = this.b * x + this.d * y + this.ty; + + return newPos; + }; + + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * + * @param {PIXI.Point} pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @return {PIXI.Point} The new point, inverse-transformed through this matrix + */ + + + Matrix.prototype.applyInverse = function applyInverse(pos, newPos) { + newPos = newPos || new _Point2.default(); + + var id = 1 / (this.a * this.d + this.c * -this.b); + + var x = pos.x; + var y = pos.y; + + newPos.x = this.d * id * x + -this.c * id * y + (this.ty * this.c - this.tx * this.d) * id; + newPos.y = this.a * id * y + -this.b * id * x + (-this.ty * this.a + this.tx * this.b) * id; + + return newPos; + }; + + /** + * Translates the matrix on the x and y. + * + * @param {number} x How much to translate x by + * @param {number} y How much to translate y by + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.translate = function translate(x, y) { + this.tx += x; + this.ty += y; + + return this; + }; + + /** + * Applies a scale transformation to the matrix. + * + * @param {number} x The amount to scale horizontally + * @param {number} y The amount to scale vertically + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.scale = function scale(x, y) { + this.a *= x; + this.d *= y; + this.c *= x; + this.b *= y; + this.tx *= x; + this.ty *= y; + + return this; + }; + + /** + * Applies a rotation transformation to the matrix. + * + * @param {number} angle - The angle in radians. + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.rotate = function rotate(angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + + var a1 = this.a; + var c1 = this.c; + var tx1 = this.tx; + + this.a = a1 * cos - this.b * sin; + this.b = a1 * sin + this.b * cos; + this.c = c1 * cos - this.d * sin; + this.d = c1 * sin + this.d * cos; + this.tx = tx1 * cos - this.ty * sin; + this.ty = tx1 * sin + this.ty * cos; + + return this; + }; + + /** + * Appends the given Matrix to this Matrix. + * + * @param {PIXI.Matrix} matrix - The matrix to append. + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.append = function append(matrix) { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + + this.a = matrix.a * a1 + matrix.b * c1; + this.b = matrix.a * b1 + matrix.b * d1; + this.c = matrix.c * a1 + matrix.d * c1; + this.d = matrix.c * b1 + matrix.d * d1; + + this.tx = matrix.tx * a1 + matrix.ty * c1 + this.tx; + this.ty = matrix.tx * b1 + matrix.ty * d1 + this.ty; + + return this; + }; + + /** + * Sets the matrix based on all the available properties + * + * @param {number} x - Position on the x axis + * @param {number} y - Position on the y axis + * @param {number} pivotX - Pivot on the x axis + * @param {number} pivotY - Pivot on the y axis + * @param {number} scaleX - Scale on the x axis + * @param {number} scaleY - Scale on the y axis + * @param {number} rotation - Rotation in radians + * @param {number} skewX - Skew on the x axis + * @param {number} skewY - Skew on the y axis + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.setTransform = function setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { + this.a = Math.cos(rotation + skewY) * scaleX; + this.b = Math.sin(rotation + skewY) * scaleX; + this.c = -Math.sin(rotation - skewX) * scaleY; + this.d = Math.cos(rotation - skewX) * scaleY; + + this.tx = x - (pivotX * this.a + pivotY * this.c); + this.ty = y - (pivotX * this.b + pivotY * this.d); + + return this; + }; + + /** + * Prepends the given Matrix to this Matrix. + * + * @param {PIXI.Matrix} matrix - The matrix to prepend + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.prepend = function prepend(matrix) { + var tx1 = this.tx; + + if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { + var a1 = this.a; + var c1 = this.c; + + this.a = a1 * matrix.a + this.b * matrix.c; + this.b = a1 * matrix.b + this.b * matrix.d; + this.c = c1 * matrix.a + this.d * matrix.c; + this.d = c1 * matrix.b + this.d * matrix.d; + } + + this.tx = tx1 * matrix.a + this.ty * matrix.c + matrix.tx; + this.ty = tx1 * matrix.b + this.ty * matrix.d + matrix.ty; + + return this; + }; + + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * + * @param {PIXI.Transform|PIXI.TransformStatic} transform - The transform to apply the properties to. + * @return {PIXI.Transform|PIXI.TransformStatic} The transform with the newly applied properties + */ + + + Matrix.prototype.decompose = function decompose(transform) { + // sort out rotation / skew.. + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + + var skewX = -Math.atan2(-c, d); + var skewY = Math.atan2(b, a); + + var delta = Math.abs(skewX + skewY); + + if (delta < 0.00001 || Math.abs(_const.PI_2 - delta) < 0.00001) { + transform.rotation = skewY; + transform.skew.x = transform.skew.y = 0; + } else { + transform.rotation = 0; + transform.skew.x = skewX; + transform.skew.y = skewY; + } + + // next set scale + transform.scale.x = Math.sqrt(a * a + b * b); + transform.scale.y = Math.sqrt(c * c + d * d); + + // next set position + transform.position.x = this.tx; + transform.position.y = this.ty; + + return transform; + }; + + /** + * Inverts this matrix + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.invert = function invert() { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + var tx1 = this.tx; + var n = a1 * d1 - b1 * c1; + + this.a = d1 / n; + this.b = -b1 / n; + this.c = -c1 / n; + this.d = a1 / n; + this.tx = (c1 * this.ty - d1 * tx1) / n; + this.ty = -(a1 * this.ty - b1 * tx1) / n; + + return this; + }; + + /** + * Resets this Matix to an identity (default) matrix. + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + + + Matrix.prototype.identity = function identity() { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + + return this; + }; + + /** + * Creates a new Matrix object with the same values as this one. + * + * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls. + */ + + + Matrix.prototype.clone = function clone() { + var matrix = new Matrix(); + + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + + return matrix; + }; + + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @return {PIXI.Matrix} The matrix given in parameter with its values updated. + */ + + + Matrix.prototype.copy = function copy(matrix) { + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + + return matrix; + }; + + /** + * A default (identity) matrix + * + * @static + * @const + */ + + + _createClass(Matrix, null, [{ + key: 'IDENTITY', + get: function get() { + return new Matrix(); + } + + /** + * A temp matrix + * + * @static + * @const + */ + + }, { + key: 'TEMP_MATRIX', + get: function get() { + return new Matrix(); + } + }]); + + return Matrix; + }(); + + exports.default = Matrix; + + }, { "../const": 46, "./Point": 69 }], 68: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The Point object represents a location in a two-dimensional coordinate system, where x represents + * the horizontal axis and y represents the vertical axis. + * An observable point is a point that triggers a callback when the point's position is changed. + * + * @class + * @memberof PIXI + */ + var ObservablePoint = function () { + /** + * @param {Function} cb - callback when changed + * @param {object} scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function ObservablePoint(cb, scope) { + var x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + _classCallCheck(this, ObservablePoint); + + this._x = x; + this._y = y; + + this.cb = cb; + this.scope = scope; + } + + /** + * Creates a clone of this point. + * The callback and scope params can be overidden otherwise they will default + * to the clone object's values. + * + * @override + * @param {Function} [cb=null] - callback when changed + * @param {object} [scope=null] - owner of callback + * @return {PIXI.ObservablePoint} a copy of the point + */ + + + ObservablePoint.prototype.clone = function clone() { + var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + var _cb = cb || this.cb; + var _scope = scope || this.scope; + + return new ObservablePoint(_cb, _scope, this._x, this._y); + }; + + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + + + ObservablePoint.prototype.set = function set(x, y) { + var _x = x || 0; + var _y = y || (y !== 0 ? _x : 0); + + if (this._x !== _x || this._y !== _y) { + this._x = _x; + this._y = _y; + this.cb.call(this.scope); + } + }; + + /** + * Copies the data from another point + * + * @param {PIXI.Point|PIXI.ObservablePoint} point - point to copy from + */ + + + ObservablePoint.prototype.copy = function copy(point) { + if (this._x !== point.x || this._y !== point.y) { + this._x = point.x; + this._y = point.y; + this.cb.call(this.scope); + } + }; + + /** + * Returns true if the given point is equal to this point + * + * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + + + ObservablePoint.prototype.equals = function equals(p) { + return p.x === this._x && p.y === this._y; + }; + + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * + * @member {number} + */ + + + _createClass(ObservablePoint, [{ + key: "x", + get: function get() { + return this._x; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._x !== value) { + this._x = value; + this.cb.call(this.scope); + } + } + + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * + * @member {number} + */ + + }, { + key: "y", + get: function get() { + return this._y; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._y !== value) { + this._y = value; + this.cb.call(this.scope); + } + } + }]); + + return ObservablePoint; + }(); + + exports.default = ObservablePoint; + + }, {}], 69: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The Point object represents a location in a two-dimensional coordinate system, where x represents + * the horizontal axis and y represents the vertical axis. + * + * @class + * @memberof PIXI + */ + var Point = function () { + /** + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function Point() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + _classCallCheck(this, Point); + + /** + * @member {number} + * @default 0 + */ + this.x = x; + + /** + * @member {number} + * @default 0 + */ + this.y = y; + } + + /** + * Creates a clone of this point + * + * @return {PIXI.Point} a copy of the point + */ + + + Point.prototype.clone = function clone() { + return new Point(this.x, this.y); + }; + + /** + * Copies x and y from the given point + * + * @param {PIXI.Point} p - The point to copy. + */ + + + Point.prototype.copy = function copy(p) { + this.set(p.x, p.y); + }; + + /** + * Returns true if the given point is equal to this point + * + * @param {PIXI.Point} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + + + Point.prototype.equals = function equals(p) { + return p.x === this.x && p.y === this.y; + }; + + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + + + Point.prototype.set = function set(x, y) { + this.x = x || 0; + this.y = y || (y !== 0 ? this.x : 0); + }; + + return Point; + }(); + + exports.default = Point; + + }, {}], 70: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Point = require('./Point'); + + Object.defineProperty(exports, 'Point', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Point).default; + } + }); + + var _ObservablePoint = require('./ObservablePoint'); + + Object.defineProperty(exports, 'ObservablePoint', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_ObservablePoint).default; + } + }); + + var _Matrix = require('./Matrix'); + + Object.defineProperty(exports, 'Matrix', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Matrix).default; + } + }); + + var _GroupD = require('./GroupD8'); + + Object.defineProperty(exports, 'GroupD8', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_GroupD).default; + } + }); + + var _Circle = require('./shapes/Circle'); + + Object.defineProperty(exports, 'Circle', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Circle).default; + } + }); + + var _Ellipse = require('./shapes/Ellipse'); + + Object.defineProperty(exports, 'Ellipse', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Ellipse).default; + } + }); + + var _Polygon = require('./shapes/Polygon'); + + Object.defineProperty(exports, 'Polygon', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Polygon).default; + } + }); + + var _Rectangle = require('./shapes/Rectangle'); + + Object.defineProperty(exports, 'Rectangle', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Rectangle).default; + } + }); + + var _RoundedRectangle = require('./shapes/RoundedRectangle'); + + Object.defineProperty(exports, 'RoundedRectangle', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_RoundedRectangle).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./GroupD8": 66, "./Matrix": 67, "./ObservablePoint": 68, "./Point": 69, "./shapes/Circle": 71, "./shapes/Ellipse": 72, "./shapes/Polygon": 73, "./shapes/Rectangle": 74, "./shapes/RoundedRectangle": 75 }], 71: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Rectangle = require('./Rectangle'); + + var _Rectangle2 = _interopRequireDefault(_Rectangle); + + var _const = require('../../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The Circle object can be used to specify a hit area for displayObjects + * + * @class + * @memberof PIXI + */ + var Circle = function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this circle + * @param {number} [y=0] - The Y coordinate of the center of this circle + * @param {number} [radius=0] - The radius of the circle + */ + function Circle() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + + _classCallCheck(this, Circle); + + /** + * @member {number} + * @default 0 + */ + this.x = x; + + /** + * @member {number} + * @default 0 + */ + this.y = y; + + /** + * @member {number} + * @default 0 + */ + this.radius = radius; + + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.CIRC + * @see PIXI.SHAPES + */ + this.type = _const.SHAPES.CIRC; + } + + /** + * Creates a clone of this Circle instance + * + * @return {PIXI.Circle} a copy of the Circle + */ + + + Circle.prototype.clone = function clone() { + return new Circle(this.x, this.y, this.radius); + }; + + /** + * Checks whether the x and y coordinates given are contained within this circle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Circle + */ + + + Circle.prototype.contains = function contains(x, y) { + if (this.radius <= 0) { + return false; + } + + var r2 = this.radius * this.radius; + var dx = this.x - x; + var dy = this.y - y; + + dx *= dx; + dy *= dy; + + return dx + dy <= r2; + }; + + /** + * Returns the framing rectangle of the circle as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + + + Circle.prototype.getBounds = function getBounds() { + return new _Rectangle2.default(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + + return Circle; + }(); + + exports.default = Circle; + + }, { "../../const": 46, "./Rectangle": 74 }], 72: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Rectangle = require('./Rectangle'); + + var _Rectangle2 = _interopRequireDefault(_Rectangle); + + var _const = require('../../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The Ellipse object can be used to specify a hit area for displayObjects + * + * @class + * @memberof PIXI + */ + var Ellipse = function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this ellipse + * @param {number} [y=0] - The Y coordinate of the center of this ellipse + * @param {number} [halfWidth=0] - The half width of this ellipse + * @param {number} [halfHeight=0] - The half height of this ellipse + */ + function Ellipse() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var halfWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var halfHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + _classCallCheck(this, Ellipse); + + /** + * @member {number} + * @default 0 + */ + this.x = x; + + /** + * @member {number} + * @default 0 + */ + this.y = y; + + /** + * @member {number} + * @default 0 + */ + this.width = halfWidth; + + /** + * @member {number} + * @default 0 + */ + this.height = halfHeight; + + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.ELIP + * @see PIXI.SHAPES + */ + this.type = _const.SHAPES.ELIP; + } + + /** + * Creates a clone of this Ellipse instance + * + * @return {PIXI.Ellipse} a copy of the ellipse + */ + + + Ellipse.prototype.clone = function clone() { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coords are within this ellipse + */ + + + Ellipse.prototype.contains = function contains(x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + + // normalize the coords to an ellipse with center 0,0 + var normx = (x - this.x) / this.width; + var normy = (y - this.y) / this.height; + + normx *= normx; + normy *= normy; + + return normx + normy <= 1; + }; + + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + + + Ellipse.prototype.getBounds = function getBounds() { + return new _Rectangle2.default(this.x - this.width, this.y - this.height, this.width, this.height); + }; + + return Ellipse; + }(); + + exports.default = Ellipse; + + }, { "../../const": 46, "./Rectangle": 74 }], 73: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Point = require('../Point'); + + var _Point2 = _interopRequireDefault(_Point); + + var _const = require('../../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @class + * @memberof PIXI + */ + var Polygon = function () { + /** + * @param {PIXI.Point[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + for (var _len = arguments.length, points = Array(_len), _key = 0; _key < _len; _key++) { + points[_key] = arguments[_key]; + } + + _classCallCheck(this, Polygon); + + if (Array.isArray(points[0])) { + points = points[0]; + } + + // if this is an array of points, convert it to a flat array of numbers + if (points[0] instanceof _Point2.default) { + var p = []; + + for (var i = 0, il = points.length; i < il; i++) { + p.push(points[i].x, points[i].y); + } + + points = p; + } + + this.closed = true; + + /** + * An array of the points of this polygon + * + * @member {number[]} + */ + this.points = points; + + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.POLY + * @see PIXI.SHAPES + */ + this.type = _const.SHAPES.POLY; + } + + /** + * Creates a clone of this polygon + * + * @return {PIXI.Polygon} a copy of the polygon + */ + + + Polygon.prototype.clone = function clone() { + return new Polygon(this.points.slice()); + }; + + /** + * Closes the polygon, adding points if necessary. + * + */ + + + Polygon.prototype.close = function close() { + var points = this.points; + + // close the poly if the value is true! + if (points[0] !== points[points.length - 2] || points[1] !== points[points.length - 1]) { + points.push(points[0], points[1]); + } + }; + + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this polygon + */ + + + Polygon.prototype.contains = function contains(x, y) { + var inside = false; + + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[i * 2 + 1]; + var xj = this.points[j * 2]; + var yj = this.points[j * 2 + 1]; + var intersect = yi > y !== yj > y && x < (xj - xi) * ((y - yi) / (yj - yi)) + xi; + + if (intersect) { + inside = !inside; + } + } + + return inside; + }; + + return Polygon; + }(); + + exports.default = Polygon; + + }, { "../../const": 46, "../Point": 69 }], 74: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _const = require('../../const'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Rectangle object is an area defined by its position, as indicated by its top-left corner + * point (x, y) and by its width and its height. + * + * @class + * @memberof PIXI + */ + var Rectangle = function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle + * @param {number} [width=0] - The overall width of this rectangle + * @param {number} [height=0] - The overall height of this rectangle + */ + function Rectangle() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + _classCallCheck(this, Rectangle); + + /** + * @member {number} + * @default 0 + */ + this.x = Number(x); + + /** + * @member {number} + * @default 0 + */ + this.y = Number(y); + + /** + * @member {number} + * @default 0 + */ + this.width = Number(width); + + /** + * @member {number} + * @default 0 + */ + this.height = Number(height); + + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.RECT + * @see PIXI.SHAPES + */ + this.type = _const.SHAPES.RECT; + } + + /** + * returns the left edge of the rectangle + * + * @member {number} + */ + + + /** + * Creates a clone of this Rectangle + * + * @return {PIXI.Rectangle} a copy of the rectangle + */ + Rectangle.prototype.clone = function clone() { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + + /** + * Copies another rectangle to this one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to copy. + * @return {PIXI.Rectangle} Returns itself. + */ + + + Rectangle.prototype.copy = function copy(rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + + return this; + }; + + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rectangle + */ + + + Rectangle.prototype.contains = function contains(x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + + return false; + }; + + /** + * Pads the rectangle making it grow in all directions. + * + * @param {number} paddingX - The horizontal padding amount. + * @param {number} [paddingY] - The vertical padding amount. + */ + + + Rectangle.prototype.pad = function pad(paddingX, paddingY) { + paddingX = paddingX || 0; + paddingY = paddingY || (paddingY !== 0 ? paddingX : 0); + + this.x -= paddingX; + this.y -= paddingY; + + this.width += paddingX * 2; + this.height += paddingY * 2; + }; + + /** + * Fits this rectangle around the passed one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to fit. + */ + + + Rectangle.prototype.fit = function fit(rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + }; + + /** + * Enlarges this rectangle to include the passed rectangle. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to include. + */ + + + Rectangle.prototype.enlarge = function enlarge(rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + }; + + /** + * Enlarges rectangle that way its corners lie on grid + * + * @param {number} [resolution=1] resolution + * @param {number} [eps=0.001] precision + */ + + + Rectangle.prototype.ceil = function ceil() { + var resolution = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.001; + + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + + this.width = x2 - this.x; + this.height = y2 - this.y; + }; + + _createClass(Rectangle, [{ + key: 'left', + get: function get() { + return this.x; + } + + /** + * returns the right edge of the rectangle + * + * @member {number} + */ + + }, { + key: 'right', + get: function get() { + return this.x + this.width; + } + + /** + * returns the top edge of the rectangle + * + * @member {number} + */ + + }, { + key: 'top', + get: function get() { + return this.y; + } + + /** + * returns the bottom edge of the rectangle + * + * @member {number} + */ + + }, { + key: 'bottom', + get: function get() { + return this.y + this.height; + } + + /** + * A constant empty rectangle. + * + * @static + * @constant + */ + + }], [{ + key: 'EMPTY', + get: function get() { + return new Rectangle(0, 0, 0, 0); + } + }]); + + return Rectangle; + }(); + + exports.default = Rectangle; + + }, { "../../const": 46 }], 75: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _const = require('../../const'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * + * @class + * @memberof PIXI + */ + var RoundedRectangle = function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle + * @param {number} [width=0] - The overall width of this rounded rectangle + * @param {number} [height=0] - The overall height of this rounded rectangle + * @param {number} [radius=20] - Controls the radius of the rounded corners + */ + function RoundedRectangle() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var radius = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 20; + + _classCallCheck(this, RoundedRectangle); + + /** + * @member {number} + * @default 0 + */ + this.x = x; + + /** + * @member {number} + * @default 0 + */ + this.y = y; + + /** + * @member {number} + * @default 0 + */ + this.width = width; + + /** + * @member {number} + * @default 0 + */ + this.height = height; + + /** + * @member {number} + * @default 20 + */ + this.radius = radius; + + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readonly + * @default PIXI.SHAPES.RREC + * @see PIXI.SHAPES + */ + this.type = _const.SHAPES.RREC; + } + + /** + * Creates a clone of this Rounded Rectangle + * + * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle + */ + + + RoundedRectangle.prototype.clone = function clone() { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle + */ + + + RoundedRectangle.prototype.contains = function contains(x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + if (y >= this.y + this.radius && y <= this.y + this.height - this.radius || x >= this.x + this.radius && x <= this.x + this.width - this.radius) { + return true; + } + var dx = x - (this.x + this.radius); + var dy = y - (this.y + this.radius); + var radius2 = this.radius * this.radius; + + if (dx * dx + dy * dy <= radius2) { + return true; + } + dx = x - (this.x + this.width - this.radius); + if (dx * dx + dy * dy <= radius2) { + return true; + } + dy = y - (this.y + this.height - this.radius); + if (dx * dx + dy * dy <= radius2) { + return true; + } + dx = x - (this.x + this.radius); + if (dx * dx + dy * dy <= radius2) { + return true; + } + } + } + + return false; + }; + + return RoundedRectangle; + }(); + + exports.default = RoundedRectangle; + + }, { "../../const": 46 }], 76: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _utils = require('../utils'); + + var _math = require('../math'); + + var _const = require('../const'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _Container = require('../display/Container'); + + var _Container2 = _interopRequireDefault(_Container); + + var _RenderTexture = require('../textures/RenderTexture'); + + var _RenderTexture2 = _interopRequireDefault(_RenderTexture); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var tempMatrix = new _math.Matrix(); + + /** + * The SystemRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.WebGLRenderer} which can be used for rendering a PixiJS scene. + * + * @abstract + * @class + * @extends EventEmitter + * @memberof PIXI + */ + + var SystemRenderer = function (_EventEmitter) { + _inherits(SystemRenderer, _EventEmitter); + + // eslint-disable-next-line valid-jsdoc + /** + * @param {string} system - The name of the system this renderer is for. + * @param {object} [options] - The optional renderer parameters + * @param {number} [options.width=800] - the width of the screen + * @param {number} [options.height=600] - the height of the screen + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false + * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment) + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The + * resolution of the renderer retina would be 2. + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the webgl context. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, + * stopping pixel interpolation. + */ + function SystemRenderer(system, options, arg2, arg3) { + _classCallCheck(this, SystemRenderer); + + var _this = _possibleConstructorReturn(this, _EventEmitter.call(this)); + + (0, _utils.sayHello)(system); + + // Support for constructor(system, screenWidth, screenHeight, options) + if (typeof options === 'number') { + options = Object.assign({ + width: options, + height: arg2 || _settings2.default.RENDER_OPTIONS.height + }, arg3); + } + + // Add the default render options + options = Object.assign({}, _settings2.default.RENDER_OPTIONS, options); + + /** + * The supplied constructor options. + * + * @member {Object} + * @readOnly + */ + _this.options = options; + + /** + * The type of the renderer. + * + * @member {number} + * @default PIXI.RENDERER_TYPE.UNKNOWN + * @see PIXI.RENDERER_TYPE + */ + _this.type = _const.RENDERER_TYPE.UNKNOWN; + + /** + * Measurements of the screen. (0, 0, screenWidth, screenHeight) + * + * Its safe to use as filterArea or hitArea for whole stage + * + * @member {PIXI.Rectangle} + */ + _this.screen = new _math.Rectangle(0, 0, options.width, options.height); + + /** + * The canvas element that everything is drawn to + * + * @member {HTMLCanvasElement} + */ + _this.view = options.view || document.createElement('canvas'); + + /** + * The resolution / device pixel ratio of the renderer + * + * @member {number} + * @default 1 + */ + _this.resolution = options.resolution || _settings2.default.RESOLUTION; + + /** + * Whether the render view is transparent + * + * @member {boolean} + */ + _this.transparent = options.transparent; + + /** + * Whether css dimensions of canvas view should be resized to screen dimensions automatically + * + * @member {boolean} + */ + _this.autoResize = options.autoResize || false; + + /** + * Tracks the blend modes useful for this renderer. + * + * @member {object} + */ + _this.blendModes = null; + + /** + * The value of the preserveDrawingBuffer flag affects whether or not the contents of + * the stencil buffer is retained after rendering. + * + * @member {boolean} + */ + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; + + /** + * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. + * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every + * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect + * to clear the canvas every frame. Disable this by setting this to false. For example if + * your game has a canvas filling background image you often don't need this set. + * + * @member {boolean} + * @default + */ + _this.clearBeforeRender = options.clearBeforeRender; + + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Handy for crisp pixel art and speed on legacy devices. + * + * @member {boolean} + */ + _this.roundPixels = options.roundPixels; + + /** + * The background color as a number. + * + * @member {number} + * @private + */ + _this._backgroundColor = 0x000000; + + /** + * The background color as an [R, G, B] array. + * + * @member {number[]} + * @private + */ + _this._backgroundColorRgba = [0, 0, 0, 0]; + + /** + * The background color as a string. + * + * @member {string} + * @private + */ + _this._backgroundColorString = '#000000'; + + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter + + /** + * This temporary display object used as the parent of the currently being rendered item + * + * @member {PIXI.DisplayObject} + * @private + */ + _this._tempDisplayObjectParent = new _Container2.default(); + + /** + * The last root object that the renderer tried to render. + * + * @member {PIXI.DisplayObject} + * @private + */ + _this._lastObjectRendered = _this._tempDisplayObjectParent; + return _this; + } + + /** + * Same as view.width, actual number of pixels in the canvas by horizontal + * + * @member {number} + * @readonly + * @default 800 + */ + + + /** + * Resizes the screen and canvas to the specified width and height + * Canvas dimensions are multiplied by resolution + * + * @param {number} screenWidth - the new width of the screen + * @param {number} screenHeight - the new height of the screen + */ + SystemRenderer.prototype.resize = function resize(screenWidth, screenHeight) { + this.screen.width = screenWidth; + this.screen.height = screenHeight; + + this.view.width = screenWidth * this.resolution; + this.view.height = screenHeight * this.resolution; + + if (this.autoResize) { + this.view.style.width = screenWidth + 'px'; + this.view.style.height = screenHeight + 'px'; + } + }; + + /** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. + * + * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from + * @param {number} scaleMode - Should be one of the scaleMode consts + * @param {number} resolution - The resolution / device pixel ratio of the texture being generated + * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, + * if no region is specified, defaults to the local bounds of the displayObject. + * @return {PIXI.Texture} a texture of the graphics object + */ + + + SystemRenderer.prototype.generateTexture = function generateTexture(displayObject, scaleMode, resolution, region) { + region = region || displayObject.getLocalBounds(); + + var renderTexture = _RenderTexture2.default.create(region.width | 0, region.height | 0, scaleMode, resolution); + + tempMatrix.tx = -region.x; + tempMatrix.ty = -region.y; + + this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent); + + return renderTexture; + }; + + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * + * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. + */ + + + SystemRenderer.prototype.destroy = function destroy(removeView) { + if (removeView && this.view.parentNode) { + this.view.parentNode.removeChild(this.view); + } + + this.type = _const.RENDERER_TYPE.UNKNOWN; + + this.view = null; + + this.screen = null; + + this.resolution = 0; + + this.transparent = false; + + this.autoResize = false; + + this.blendModes = null; + + this.options = null; + + this.preserveDrawingBuffer = false; + this.clearBeforeRender = false; + + this.roundPixels = false; + + this._backgroundColor = 0; + this._backgroundColorRgba = null; + this._backgroundColorString = null; + + this._tempDisplayObjectParent = null; + this._lastObjectRendered = null; + }; + + /** + * The background color to fill if not transparent + * + * @member {number} + */ + + + _createClass(SystemRenderer, [{ + key: 'width', + get: function get() { + return this.view.width; + } + + /** + * Same as view.height, actual number of pixels in the canvas by vertical + * + * @member {number} + * @readonly + * @default 600 + */ + + }, { + key: 'height', + get: function get() { + return this.view.height; + } + }, { + key: 'backgroundColor', + get: function get() { + return this._backgroundColor; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._backgroundColor = value; + this._backgroundColorString = (0, _utils.hex2string)(value); + (0, _utils.hex2rgb)(value, this._backgroundColorRgba); + } + }]); + + return SystemRenderer; + }(_eventemitter2.default); + + exports.default = SystemRenderer; + + }, { "../const": 46, "../display/Container": 48, "../math": 70, "../settings": 101, "../textures/RenderTexture": 113, "../utils": 125, "eventemitter3": 3 }], 77: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _SystemRenderer2 = require('../SystemRenderer'); + + var _SystemRenderer3 = _interopRequireDefault(_SystemRenderer2); + + var _CanvasMaskManager = require('./utils/CanvasMaskManager'); + + var _CanvasMaskManager2 = _interopRequireDefault(_CanvasMaskManager); + + var _CanvasRenderTarget = require('./utils/CanvasRenderTarget'); + + var _CanvasRenderTarget2 = _interopRequireDefault(_CanvasRenderTarget); + + var _mapCanvasBlendModesToPixi = require('./utils/mapCanvasBlendModesToPixi'); + + var _mapCanvasBlendModesToPixi2 = _interopRequireDefault(_mapCanvasBlendModesToPixi); + + var _utils = require('../../utils'); + + var _const = require('../../const'); + + var _settings = require('../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should + * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to + * your DOM or you will not see anything :) + * + * @class + * @memberof PIXI + * @extends PIXI.SystemRenderer + */ + var CanvasRenderer = function (_SystemRenderer) { + _inherits(CanvasRenderer, _SystemRenderer); + + // eslint-disable-next-line valid-jsdoc + /** + * @param {object} [options] - The optional renderer parameters + * @param {number} [options.width=800] - the width of the screen + * @param {number} [options.height=600] - the height of the screen + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false + * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment) + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The + * resolution of the renderer retina would be 2. + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the webgl context. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, + * stopping pixel interpolation. + */ + function CanvasRenderer(options, arg2, arg3) { + _classCallCheck(this, CanvasRenderer); + + var _this = _possibleConstructorReturn(this, _SystemRenderer.call(this, 'Canvas', options, arg2, arg3)); + + _this.type = _const.RENDERER_TYPE.CANVAS; + + /** + * The root canvas 2d context that everything is drawn with. + * + * @member {CanvasRenderingContext2D} + */ + _this.rootContext = _this.view.getContext('2d', { alpha: _this.transparent }); + + /** + * The currently active canvas 2d context (could change with renderTextures) + * + * @member {CanvasRenderingContext2D} + */ + _this.context = _this.rootContext; + + /** + * Boolean flag controlling canvas refresh. + * + * @member {boolean} + */ + _this.refresh = true; + + /** + * Instance of a CanvasMaskManager, handles masking when using the canvas renderer. + * + * @member {PIXI.CanvasMaskManager} + */ + _this.maskManager = new _CanvasMaskManager2.default(_this); + + /** + * The canvas property used to set the canvas smoothing property. + * + * @member {string} + */ + _this.smoothProperty = 'imageSmoothingEnabled'; + + if (!_this.rootContext.imageSmoothingEnabled) { + if (_this.rootContext.webkitImageSmoothingEnabled) { + _this.smoothProperty = 'webkitImageSmoothingEnabled'; + } else if (_this.rootContext.mozImageSmoothingEnabled) { + _this.smoothProperty = 'mozImageSmoothingEnabled'; + } else if (_this.rootContext.oImageSmoothingEnabled) { + _this.smoothProperty = 'oImageSmoothingEnabled'; + } else if (_this.rootContext.msImageSmoothingEnabled) { + _this.smoothProperty = 'msImageSmoothingEnabled'; + } + } + + _this.initPlugins(); + + _this.blendModes = (0, _mapCanvasBlendModesToPixi2.default)(); + _this._activeBlendMode = null; + + _this.renderingToScreen = false; + + _this.resize(_this.options.width, _this.options.height); + + /** + * Fired after rendering finishes. + * + * @event PIXI.CanvasRenderer#postrender + */ + + /** + * Fired before rendering starts. + * + * @event PIXI.CanvasRenderer#prerender + */ + return _this; + } + + /** + * Renders the object to this canvas view + * + * @param {PIXI.DisplayObject} displayObject - The object to be rendered + * @param {PIXI.RenderTexture} [renderTexture] - A render texture to be rendered to. + * If unset, it will render to the root context. + * @param {boolean} [clear=false] - Whether to clear the canvas before drawing + * @param {PIXI.Matrix} [transform] - A transformation to be applied + * @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform + */ + + + CanvasRenderer.prototype.render = function render(displayObject, renderTexture, clear, transform, skipUpdateTransform) { + if (!this.view) { + return; + } + + // can be handy to know! + this.renderingToScreen = !renderTexture; + + this.emit('prerender'); + + var rootResolution = this.resolution; + + if (renderTexture) { + renderTexture = renderTexture.baseTexture || renderTexture; + + if (!renderTexture._canvasRenderTarget) { + renderTexture._canvasRenderTarget = new _CanvasRenderTarget2.default(renderTexture.width, renderTexture.height, renderTexture.resolution); + renderTexture.source = renderTexture._canvasRenderTarget.canvas; + renderTexture.valid = true; + } + + this.context = renderTexture._canvasRenderTarget.context; + this.resolution = renderTexture._canvasRenderTarget.resolution; + } else { + this.context = this.rootContext; + } + + var context = this.context; + + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.parent; + var tempWt = this._tempDisplayObjectParent.transform.worldTransform; + + if (transform) { + transform.copy(tempWt); + + // lets not forget to flag the parent transform as dirty... + this._tempDisplayObjectParent.transform._worldID = -1; + } else { + tempWt.identity(); + } + + displayObject.parent = this._tempDisplayObjectParent; + + displayObject.updateTransform(); + displayObject.parent = cacheParent; + // displayObject.hitArea = //TODO add a temp hit area + } + + context.save(); + context.setTransform(1, 0, 0, 1, 0, 0); + context.globalAlpha = 1; + this._activeBlendMode = _const.BLEND_MODES.NORMAL; + context.globalCompositeOperation = this.blendModes[_const.BLEND_MODES.NORMAL]; + + if (navigator.isCocoonJS && this.view.screencanvas) { + context.fillStyle = 'black'; + context.clear(); + } + + if (clear !== undefined ? clear : this.clearBeforeRender) { + if (this.renderingToScreen) { + if (this.transparent) { + context.clearRect(0, 0, this.width, this.height); + } else { + context.fillStyle = this._backgroundColorString; + context.fillRect(0, 0, this.width, this.height); + } + } // else { + // TODO: implement background for CanvasRenderTarget or RenderTexture? + // } + } + + // TODO RENDER TARGET STUFF HERE.. + var tempContext = this.context; + + this.context = context; + displayObject.renderCanvas(this); + this.context = tempContext; + + context.restore(); + + this.resolution = rootResolution; + + this.emit('postrender'); + }; + + /** + * Clear the canvas of renderer. + * + * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent. + */ + + + CanvasRenderer.prototype.clear = function clear(clearColor) { + var context = this.context; + + clearColor = clearColor || this._backgroundColorString; + + if (!this.transparent && clearColor) { + context.fillStyle = clearColor; + context.fillRect(0, 0, this.width, this.height); + } else { + context.clearRect(0, 0, this.width, this.height); + } + }; + + /** + * Sets the blend mode of the renderer. + * + * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values. + */ + + + CanvasRenderer.prototype.setBlendMode = function setBlendMode(blendMode) { + if (this._activeBlendMode === blendMode) { + return; + } + + this._activeBlendMode = blendMode; + this.context.globalCompositeOperation = this.blendModes[blendMode]; + }; + + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * + * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. + */ + + + CanvasRenderer.prototype.destroy = function destroy(removeView) { + this.destroyPlugins(); + + // call the base destroy + _SystemRenderer.prototype.destroy.call(this, removeView); + + this.context = null; + + this.refresh = true; + + this.maskManager.destroy(); + this.maskManager = null; + + this.smoothProperty = null; + }; + + /** + * Resizes the canvas view to the specified width and height. + * + * @extends PIXI.SystemRenderer#resize + * + * @param {number} screenWidth - the new width of the screen + * @param {number} screenHeight - the new height of the screen + */ + + + CanvasRenderer.prototype.resize = function resize(screenWidth, screenHeight) { + _SystemRenderer.prototype.resize.call(this, screenWidth, screenHeight); + + // reset the scale mode.. oddly this seems to be reset when the canvas is resized. + // surely a browser bug?? Let PixiJS fix that for you.. + if (this.smoothProperty) { + this.rootContext[this.smoothProperty] = _settings2.default.SCALE_MODE === _const.SCALE_MODES.LINEAR; + } + }; + + /** + * Checks if blend mode has changed. + */ + + + CanvasRenderer.prototype.invalidateBlendMode = function invalidateBlendMode() { + this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation); + }; + + return CanvasRenderer; + }(_SystemRenderer3.default); + + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @name PIXI.CanvasRenderer#plugins + * @type {object} + * @readonly + * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.extract.CanvasExtract} extract Extract image data from renderer. + * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.prepare.CanvasPrepare} prepare Pre-render display objects. + */ + + /** + * Adds a plugin to the renderer. + * + * @method PIXI.CanvasRenderer#registerPlugin + * @param {string} pluginName - The name of the plugin. + * @param {Function} ctor - The constructor function or class for the plugin. + */ + + exports.default = CanvasRenderer; + _utils.pluginTarget.mixin(CanvasRenderer); + + }, { "../../const": 46, "../../settings": 101, "../../utils": 125, "../SystemRenderer": 76, "./utils/CanvasMaskManager": 78, "./utils/CanvasRenderTarget": 79, "./utils/mapCanvasBlendModesToPixi": 81 }], 78: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _const = require('../../../const'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * A set of functions used to handle masking. + * + * @class + * @memberof PIXI + */ + var CanvasMaskManager = function () { + /** + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. + */ + function CanvasMaskManager(renderer) { + _classCallCheck(this, CanvasMaskManager); + + this.renderer = renderer; + } + + /** + * This method adds it to the current stack of masks. + * + * @param {object} maskData - the maskData that will be pushed + */ + + + CanvasMaskManager.prototype.pushMask = function pushMask(maskData) { + var renderer = this.renderer; + + renderer.context.save(); + + var cacheAlpha = maskData.alpha; + var transform = maskData.transform.worldTransform; + var resolution = renderer.resolution; + + renderer.context.setTransform(transform.a * resolution, transform.b * resolution, transform.c * resolution, transform.d * resolution, transform.tx * resolution, transform.ty * resolution); + + // TODO suport sprite alpha masks?? + // lots of effort required. If demand is great enough.. + if (!maskData._texture) { + this.renderGraphicsShape(maskData); + renderer.context.clip(); + } + + maskData.worldAlpha = cacheAlpha; + }; + + /** + * Renders a PIXI.Graphics shape. + * + * @param {PIXI.Graphics} graphics - The object to render. + */ + + + CanvasMaskManager.prototype.renderGraphicsShape = function renderGraphicsShape(graphics) { + var context = this.renderer.context; + var len = graphics.graphicsData.length; + + if (len === 0) { + return; + } + + context.beginPath(); + + for (var i = 0; i < len; i++) { + var data = graphics.graphicsData[i]; + var shape = data.shape; + + if (data.type === _const.SHAPES.POLY) { + var points = shape.points; + var holes = data.holes; + var outerArea = void 0; + var innerArea = void 0; + + context.moveTo(points[0], points[1]); + + for (var j = 2; j < points.length; j += 2) { + context.lineTo(points[j], points[j + 1]); + } + + // if the first and last point are the same close the path - much neater :) + if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1]) { + context.closePath(); + } + + if (holes.length > 0) { + outerArea = 0; + for (var _j = 0; _j < points.length; _j += 2) { + outerArea += points[_j] * points[_j + 3] - points[_j + 1] * points[_j + 2]; + } + + for (var k = 0; k < holes.length; k++) { + points = holes[k].points; + + innerArea = 0; + for (var _j2 = 0; _j2 < points.length; _j2 += 2) { + innerArea += points[_j2] * points[_j2 + 3] - points[_j2 + 1] * points[_j2 + 2]; + } + + context.moveTo(points[0], points[1]); + + if (innerArea * outerArea < 0) { + for (var _j3 = 2; _j3 < points.length; _j3 += 2) { + context.lineTo(points[_j3], points[_j3 + 1]); + } + } else { + for (var _j4 = points.length - 2; _j4 >= 2; _j4 -= 2) { + context.lineTo(points[_j4], points[_j4 + 1]); + } + } + } + } + } else if (data.type === _const.SHAPES.RECT) { + context.rect(shape.x, shape.y, shape.width, shape.height); + context.closePath(); + } else if (data.type === _const.SHAPES.CIRC) { + // TODO - need to be Undefined! + context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI); + context.closePath(); + } else if (data.type === _const.SHAPES.ELIP) { + // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + + var w = shape.width * 2; + var h = shape.height * 2; + + var x = shape.x - w / 2; + var y = shape.y - h / 2; + + var kappa = 0.5522848; + var ox = w / 2 * kappa; // control point offset horizontal + var oy = h / 2 * kappa; // control point offset vertical + var xe = x + w; // x-end + var ye = y + h; // y-end + var xm = x + w / 2; // x-middle + var ym = y + h / 2; // y-middle + + context.moveTo(x, ym); + context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + context.closePath(); + } else if (data.type === _const.SHAPES.RREC) { + var rx = shape.x; + var ry = shape.y; + var width = shape.width; + var height = shape.height; + var radius = shape.radius; + + var maxRadius = Math.min(width, height) / 2 | 0; + + radius = radius > maxRadius ? maxRadius : radius; + + context.moveTo(rx, ry + radius); + context.lineTo(rx, ry + height - radius); + context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height); + context.lineTo(rx + width - radius, ry + height); + context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius); + context.lineTo(rx + width, ry + radius); + context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry); + context.lineTo(rx + radius, ry); + context.quadraticCurveTo(rx, ry, rx, ry + radius); + context.closePath(); + } + } + }; + + /** + * Restores the current drawing context to the state it was before the mask was applied. + * + * @param {PIXI.CanvasRenderer} renderer - The renderer context to use. + */ + + + CanvasMaskManager.prototype.popMask = function popMask(renderer) { + renderer.context.restore(); + renderer.invalidateBlendMode(); + }; + + /** + * Destroys this canvas mask manager. + * + */ + + + CanvasMaskManager.prototype.destroy = function destroy() { + /* empty */ + }; + + return CanvasMaskManager; + }(); + + exports.default = CanvasMaskManager; + + }, { "../../../const": 46 }], 79: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _settings = require('../../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Creates a Canvas element of the given size. + * + * @class + * @memberof PIXI + */ + var CanvasRenderTarget = function () { + /** + * @param {number} width - the width for the newly created canvas + * @param {number} height - the height for the newly created canvas + * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + _classCallCheck(this, CanvasRenderTarget); + + /** + * The Canvas object that belongs to this CanvasRenderTarget. + * + * @member {HTMLCanvasElement} + */ + this.canvas = document.createElement('canvas'); + + /** + * A CanvasRenderingContext2D object representing a two-dimensional rendering context. + * + * @member {CanvasRenderingContext2D} + */ + this.context = this.canvas.getContext('2d'); + + this.resolution = resolution || _settings2.default.RESOLUTION; + + this.resize(width, height); + } + + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * + * @private + */ + + + CanvasRenderTarget.prototype.clear = function clear() { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + + /** + * Resizes the canvas to the specified width and height. + * + * @param {number} width - the new width of the canvas + * @param {number} height - the new height of the canvas + */ + + + CanvasRenderTarget.prototype.resize = function resize(width, height) { + this.canvas.width = width * this.resolution; + this.canvas.height = height * this.resolution; + }; + + /** + * Destroys this canvas. + * + */ + + + CanvasRenderTarget.prototype.destroy = function destroy() { + this.context = null; + this.canvas = null; + }; + + /** + * The width of the canvas buffer in pixels. + * + * @member {number} + */ + + + _createClass(CanvasRenderTarget, [{ + key: 'width', + get: function get() { + return this.canvas.width; + }, + set: function set(val) // eslint-disable-line require-jsdoc + { + this.canvas.width = val; + } + + /** + * The height of the canvas buffer in pixels. + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return this.canvas.height; + }, + set: function set(val) // eslint-disable-line require-jsdoc + { + this.canvas.height = val; + } + }]); + + return CanvasRenderTarget; + }(); + + exports.default = CanvasRenderTarget; + + }, { "../../../settings": 101 }], 80: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = canUseNewCanvasBlendModes; + /** + * Creates a little colored canvas + * + * @ignore + * @param {string} color - The color to make the canvas + * @return {canvas} a small canvas element + */ + function createColoredCanvas(color) { + var canvas = document.createElement('canvas'); + + canvas.width = 6; + canvas.height = 1; + + var context = canvas.getContext('2d'); + + context.fillStyle = color; + context.fillRect(0, 0, 6, 1); + + return canvas; + } + + /** + * Checks whether the Canvas BlendModes are supported by the current browser + * + * @return {boolean} whether they are supported + */ + function canUseNewCanvasBlendModes() { + if (typeof document === 'undefined') { + return false; + } + + var magenta = createColoredCanvas('#ff00ff'); + var yellow = createColoredCanvas('#ffff00'); + + var canvas = document.createElement('canvas'); + + canvas.width = 6; + canvas.height = 1; + + var context = canvas.getContext('2d'); + + context.globalCompositeOperation = 'multiply'; + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + var imageData = context.getImageData(2, 0, 1, 1); + + if (!imageData) { + return false; + } + + var data = imageData.data; + + return data[0] === 255 && data[1] === 0 && data[2] === 0; + } + + }, {}], 81: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = mapCanvasBlendModesToPixi; + + var _const = require('../../../const'); + + var _canUseNewCanvasBlendModes = require('./canUseNewCanvasBlendModes'); + + var _canUseNewCanvasBlendModes2 = _interopRequireDefault(_canUseNewCanvasBlendModes); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Maps blend combinations to Canvas. + * + * @memberof PIXI + * @function mapCanvasBlendModesToPixi + * @private + * @param {string[]} [array=[]] - The array to output into. + * @return {string[]} Mapped modes. + */ + function mapCanvasBlendModesToPixi() { + var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + if ((0, _canUseNewCanvasBlendModes2.default)()) { + array[_const.BLEND_MODES.NORMAL] = 'source-over'; + array[_const.BLEND_MODES.ADD] = 'lighter'; // IS THIS OK??? + array[_const.BLEND_MODES.MULTIPLY] = 'multiply'; + array[_const.BLEND_MODES.SCREEN] = 'screen'; + array[_const.BLEND_MODES.OVERLAY] = 'overlay'; + array[_const.BLEND_MODES.DARKEN] = 'darken'; + array[_const.BLEND_MODES.LIGHTEN] = 'lighten'; + array[_const.BLEND_MODES.COLOR_DODGE] = 'color-dodge'; + array[_const.BLEND_MODES.COLOR_BURN] = 'color-burn'; + array[_const.BLEND_MODES.HARD_LIGHT] = 'hard-light'; + array[_const.BLEND_MODES.SOFT_LIGHT] = 'soft-light'; + array[_const.BLEND_MODES.DIFFERENCE] = 'difference'; + array[_const.BLEND_MODES.EXCLUSION] = 'exclusion'; + array[_const.BLEND_MODES.HUE] = 'hue'; + array[_const.BLEND_MODES.SATURATION] = 'saturate'; + array[_const.BLEND_MODES.COLOR] = 'color'; + array[_const.BLEND_MODES.LUMINOSITY] = 'luminosity'; + } else { + // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough' + array[_const.BLEND_MODES.NORMAL] = 'source-over'; + array[_const.BLEND_MODES.ADD] = 'lighter'; // IS THIS OK??? + array[_const.BLEND_MODES.MULTIPLY] = 'source-over'; + array[_const.BLEND_MODES.SCREEN] = 'source-over'; + array[_const.BLEND_MODES.OVERLAY] = 'source-over'; + array[_const.BLEND_MODES.DARKEN] = 'source-over'; + array[_const.BLEND_MODES.LIGHTEN] = 'source-over'; + array[_const.BLEND_MODES.COLOR_DODGE] = 'source-over'; + array[_const.BLEND_MODES.COLOR_BURN] = 'source-over'; + array[_const.BLEND_MODES.HARD_LIGHT] = 'source-over'; + array[_const.BLEND_MODES.SOFT_LIGHT] = 'source-over'; + array[_const.BLEND_MODES.DIFFERENCE] = 'source-over'; + array[_const.BLEND_MODES.EXCLUSION] = 'source-over'; + array[_const.BLEND_MODES.HUE] = 'source-over'; + array[_const.BLEND_MODES.SATURATION] = 'source-over'; + array[_const.BLEND_MODES.COLOR] = 'source-over'; + array[_const.BLEND_MODES.LUMINOSITY] = 'source-over'; + } + // not-premultiplied, only for webgl + array[_const.BLEND_MODES.NORMAL_NPM] = array[_const.BLEND_MODES.NORMAL]; + array[_const.BLEND_MODES.ADD_NPM] = array[_const.BLEND_MODES.ADD]; + array[_const.BLEND_MODES.SCREEN_NPM] = array[_const.BLEND_MODES.SCREEN]; + + return array; + } + + }, { "../../../const": 46, "./canUseNewCanvasBlendModes": 80 }], 82: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _const = require('../../const'); + + var _settings = require('../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged + * up with textures that are no longer being used. + * + * @class + * @memberof PIXI + */ + var TextureGarbageCollector = function () { + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for. + */ + function TextureGarbageCollector(renderer) { + _classCallCheck(this, TextureGarbageCollector); + + this.renderer = renderer; + + this.count = 0; + this.checkCount = 0; + this.maxIdle = _settings2.default.GC_MAX_IDLE; + this.checkCountMax = _settings2.default.GC_MAX_CHECK_COUNT; + this.mode = _settings2.default.GC_MODE; + } + + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + + + TextureGarbageCollector.prototype.update = function update() { + this.count++; + + if (this.mode === _const.GC_MODES.MANUAL) { + return; + } + + this.checkCount++; + + if (this.checkCount > this.checkCountMax) { + this.checkCount = 0; + + this.run(); + } + }; + + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + + + TextureGarbageCollector.prototype.run = function run() { + var tm = this.renderer.textureManager; + var managedTextures = tm._managedTextures; + var wasRemoved = false; + + for (var i = 0; i < managedTextures.length; i++) { + var texture = managedTextures[i]; + + // only supports non generated textures at the moment! + if (!texture._glRenderTargets && this.count - texture.touched > this.maxIdle) { + tm.destroyTexture(texture, true); + managedTextures[i] = null; + wasRemoved = true; + } + } + + if (wasRemoved) { + var j = 0; + + for (var _i = 0; _i < managedTextures.length; _i++) { + if (managedTextures[_i] !== null) { + managedTextures[j++] = managedTextures[_i]; + } + } + + managedTextures.length = j; + } + }; + + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + + + TextureGarbageCollector.prototype.unload = function unload(displayObject) { + var tm = this.renderer.textureManager; + + // only destroy non generated textures + if (displayObject._texture && displayObject._texture._glRenderTargets) { + tm.destroyTexture(displayObject._texture, true); + } + + for (var i = displayObject.children.length - 1; i >= 0; i--) { + this.unload(displayObject.children[i]); + } + }; + + return TextureGarbageCollector; + }(); + + exports.default = TextureGarbageCollector; + + }, { "../../const": 46, "../../settings": 101 }], 83: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _pixiGlCore = require('pixi-gl-core'); + + var _const = require('../../const'); + + var _RenderTarget = require('./utils/RenderTarget'); + + var _RenderTarget2 = _interopRequireDefault(_RenderTarget); + + var _utils = require('../../utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Helper class to create a webGL Texture + * + * @class + * @memberof PIXI + */ + var TextureManager = function () { + /** + * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer + */ + function TextureManager(renderer) { + _classCallCheck(this, TextureManager); + + /** + * A reference to the current renderer + * + * @member {PIXI.WebGLRenderer} + */ + this.renderer = renderer; + + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = renderer.gl; + + /** + * Track textures in the renderer so we can no longer listen to them on destruction. + * + * @member {Array<*>} + * @private + */ + this._managedTextures = []; + } + + /** + * Binds a texture. + * + */ + + + TextureManager.prototype.bindTexture = function bindTexture() { } + // empty + + + /** + * Gets a texture. + * + */ + ; + + TextureManager.prototype.getTexture = function getTexture() { } + // empty + + + /** + * Updates and/or Creates a WebGL texture for the renderer's context. + * + * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to update + * @param {number} location - the location the texture will be bound to. + * @return {GLTexture} The gl texture. + */ + ; + + TextureManager.prototype.updateTexture = function updateTexture(texture, location) { + // assume it good! + // texture = texture.baseTexture || texture; + + var gl = this.gl; + + var isRenderTexture = !!texture._glRenderTargets; + + if (!texture.hasLoaded) { + return null; + } + + var boundTextures = this.renderer.boundTextures; + + // if the location is undefined then this may have been called by n event. + // this being the case the texture may already be bound to a slot. As a texture can only be bound once + // we need to find its current location if it exists. + if (location === undefined) { + location = 0; + + // TODO maybe we can use texture bound ids later on... + // check if texture is already bound.. + for (var i = 0; i < boundTextures.length; ++i) { + if (boundTextures[i] === texture) { + location = i; + break; + } + } + } + + boundTextures[location] = texture; + + gl.activeTexture(gl.TEXTURE0 + location); + + var glTexture = texture._glTextures[this.renderer.CONTEXT_UID]; + + if (!glTexture) { + if (isRenderTexture) { + var renderTarget = new _RenderTarget2.default(this.gl, texture.width, texture.height, texture.scaleMode, texture.resolution); + + renderTarget.resize(texture.width, texture.height); + texture._glRenderTargets[this.renderer.CONTEXT_UID] = renderTarget; + glTexture = renderTarget.texture; + + // framebuffer constructor disactivates current framebuffer + if (!this.renderer._activeRenderTarget.root) { + this.renderer._activeRenderTarget.frameBuffer.bind(); + } + } else { + glTexture = new _pixiGlCore.GLTexture(this.gl, null, null, null, null); + glTexture.bind(location); + glTexture.premultiplyAlpha = true; + glTexture.upload(texture.source); + } + + texture._glTextures[this.renderer.CONTEXT_UID] = glTexture; + + texture.on('update', this.updateTexture, this); + texture.on('dispose', this.destroyTexture, this); + + this._managedTextures.push(texture); + + if (texture.isPowerOfTwo) { + if (texture.mipmap) { + glTexture.enableMipmap(); + } + + if (texture.wrapMode === _const.WRAP_MODES.CLAMP) { + glTexture.enableWrapClamp(); + } else if (texture.wrapMode === _const.WRAP_MODES.REPEAT) { + glTexture.enableWrapRepeat(); + } else { + glTexture.enableWrapMirrorRepeat(); + } + } else { + glTexture.enableWrapClamp(); + } + + if (texture.scaleMode === _const.SCALE_MODES.NEAREST) { + glTexture.enableNearestScaling(); + } else { + glTexture.enableLinearScaling(); + } + } + // the texture already exists so we only need to update it.. + else if (isRenderTexture) { + texture._glRenderTargets[this.renderer.CONTEXT_UID].resize(texture.width, texture.height); + } else { + glTexture.upload(texture.source); + } + + return glTexture; + }; + + /** + * Deletes the texture from WebGL + * + * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to destroy + * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + + + TextureManager.prototype.destroyTexture = function destroyTexture(texture, skipRemove) { + texture = texture.baseTexture || texture; + + if (!texture.hasLoaded) { + return; + } + + var renderer = this.renderer; + var uid = renderer.CONTEXT_UID; + var glTextures = texture._glTextures; + var glRenderTargets = texture._glRenderTargets; + + if (glTextures[uid]) { + renderer.unbindTexture(texture); + + glTextures[uid].destroy(); + texture.off('update', this.updateTexture, this); + texture.off('dispose', this.destroyTexture, this); + + delete glTextures[uid]; + + if (!skipRemove) { + var i = this._managedTextures.indexOf(texture); + + if (i !== -1) { + (0, _utils.removeItems)(this._managedTextures, i, 1); + } + } + } + + if (glRenderTargets && glRenderTargets[uid]) { + if (renderer._activeRenderTarget === glRenderTargets[uid]) { + renderer.bindRenderTarget(renderer.rootRenderTarget); + } + + glRenderTargets[uid].destroy(); + delete glRenderTargets[uid]; + } + }; + + /** + * Deletes all the textures from WebGL + */ + + + TextureManager.prototype.removeAll = function removeAll() { + // empty all the old gl textures as they are useless now + for (var i = 0; i < this._managedTextures.length; ++i) { + var texture = this._managedTextures[i]; + + if (texture._glTextures[this.renderer.CONTEXT_UID]) { + delete texture._glTextures[this.renderer.CONTEXT_UID]; + } + } + }; + + /** + * Destroys this manager and removes all its textures + */ + + + TextureManager.prototype.destroy = function destroy() { + // destroy managed textures + for (var i = 0; i < this._managedTextures.length; ++i) { + var texture = this._managedTextures[i]; + + this.destroyTexture(texture, true); + + texture.off('update', this.updateTexture, this); + texture.off('dispose', this.destroyTexture, this); + } + + this._managedTextures = null; + }; + + return TextureManager; + }(); + + exports.default = TextureManager; + + }, { "../../const": 46, "../../utils": 125, "./utils/RenderTarget": 96, "pixi-gl-core": 15 }], 84: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _SystemRenderer2 = require('../SystemRenderer'); + + var _SystemRenderer3 = _interopRequireDefault(_SystemRenderer2); + + var _MaskManager = require('./managers/MaskManager'); + + var _MaskManager2 = _interopRequireDefault(_MaskManager); + + var _StencilManager = require('./managers/StencilManager'); + + var _StencilManager2 = _interopRequireDefault(_StencilManager); + + var _FilterManager = require('./managers/FilterManager'); + + var _FilterManager2 = _interopRequireDefault(_FilterManager); + + var _RenderTarget = require('./utils/RenderTarget'); + + var _RenderTarget2 = _interopRequireDefault(_RenderTarget); + + var _ObjectRenderer = require('./utils/ObjectRenderer'); + + var _ObjectRenderer2 = _interopRequireDefault(_ObjectRenderer); + + var _TextureManager = require('./TextureManager'); + + var _TextureManager2 = _interopRequireDefault(_TextureManager); + + var _BaseTexture = require('../../textures/BaseTexture'); + + var _BaseTexture2 = _interopRequireDefault(_BaseTexture); + + var _TextureGarbageCollector = require('./TextureGarbageCollector'); + + var _TextureGarbageCollector2 = _interopRequireDefault(_TextureGarbageCollector); + + var _WebGLState = require('./WebGLState'); + + var _WebGLState2 = _interopRequireDefault(_WebGLState); + + var _mapWebGLDrawModesToPixi = require('./utils/mapWebGLDrawModesToPixi'); + + var _mapWebGLDrawModesToPixi2 = _interopRequireDefault(_mapWebGLDrawModesToPixi); + + var _validateContext = require('./utils/validateContext'); + + var _validateContext2 = _interopRequireDefault(_validateContext); + + var _utils = require('../../utils'); + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + var _const = require('../../const'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var CONTEXT_UID = 0; + + /** + * The WebGLRenderer draws the scene and all its content onto a webGL enabled canvas. This renderer + * should be used for browsers that support webGL. This Render works by automatically managing webGLBatchs. + * So no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything :) + * + * @class + * @memberof PIXI + * @extends PIXI.SystemRenderer + */ + + var WebGLRenderer = function (_SystemRenderer) { + _inherits(WebGLRenderer, _SystemRenderer); + + // eslint-disable-next-line valid-jsdoc + /** + * + * @param {object} [options] - The optional renderer parameters + * @param {number} [options.width=800] - the width of the screen + * @param {number} [options.height=600] - the height of the screen + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false + * @param {boolean} [options.antialias=false] - sets antialias. If not available natively then FXAA + * antialiasing is used + * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. + * FXAA is faster, but may not always look as great + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. + * The resolution of the renderer retina would be 2. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear + * the canvas or not before the new render pass. If you wish to set this to false, you *must* set + * preserveDrawingBuffer to `true`. + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the webgl context. + * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when + * rendering, stopping pixel interpolation. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.legacy=false] - If true PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering try setting this to true. + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card + */ + function WebGLRenderer(options, arg2, arg3) { + _classCallCheck(this, WebGLRenderer); + + var _this = _possibleConstructorReturn(this, _SystemRenderer.call(this, 'WebGL', options, arg2, arg3)); + + _this.legacy = _this.options.legacy; + + if (_this.legacy) { + _pixiGlCore2.default.VertexArrayObject.FORCE_NATIVE = true; + } + + /** + * The type of this renderer as a standardised const + * + * @member {number} + * @see PIXI.RENDERER_TYPE + */ + _this.type = _const.RENDERER_TYPE.WEBGL; + + _this.handleContextLost = _this.handleContextLost.bind(_this); + _this.handleContextRestored = _this.handleContextRestored.bind(_this); + + _this.view.addEventListener('webglcontextlost', _this.handleContextLost, false); + _this.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false); + + /** + * The options passed in to create a new webgl context. + * + * @member {object} + * @private + */ + _this._contextOptions = { + alpha: _this.transparent, + antialias: _this.options.antialias, + premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied', + stencil: true, + preserveDrawingBuffer: _this.options.preserveDrawingBuffer, + powerPreference: _this.options.powerPreference + }; + + _this._backgroundColorRgba[3] = _this.transparent ? 0 : 1; + + /** + * Manages the masks using the stencil buffer. + * + * @member {PIXI.MaskManager} + */ + _this.maskManager = new _MaskManager2.default(_this); + + /** + * Manages the stencil buffer. + * + * @member {PIXI.StencilManager} + */ + _this.stencilManager = new _StencilManager2.default(_this); + + /** + * An empty renderer. + * + * @member {PIXI.ObjectRenderer} + */ + _this.emptyRenderer = new _ObjectRenderer2.default(_this); + + /** + * The currently active ObjectRenderer. + * + * @member {PIXI.ObjectRenderer} + */ + _this.currentRenderer = _this.emptyRenderer; + + /** + * Manages textures + * @member {PIXI.TextureManager} + */ + _this.textureManager = null; + + /** + * Manages the filters. + * + * @member {PIXI.FilterManager} + */ + _this.filterManager = null; + + _this.initPlugins(); + + /** + * The current WebGL rendering context, it is created here + * + * @member {WebGLRenderingContext} + */ + // initialize the context so it is ready for the managers. + if (_this.options.context) { + // checks to see if a context is valid.. + (0, _validateContext2.default)(_this.options.context); + } + + _this.gl = _this.options.context || _pixiGlCore2.default.createContext(_this.view, _this._contextOptions); + + _this.CONTEXT_UID = CONTEXT_UID++; + + /** + * The currently active ObjectRenderer. + * + * @member {PIXI.WebGLState} + */ + _this.state = new _WebGLState2.default(_this.gl); + + _this.renderingToScreen = true; + + /** + * Holds the current state of textures bound to the GPU. + * @type {Array} + */ + _this.boundTextures = null; + + /** + * Holds the current shader + * + * @member {PIXI.Shader} + */ + _this._activeShader = null; + + _this._activeVao = null; + + /** + * Holds the current render target + * + * @member {PIXI.RenderTarget} + */ + _this._activeRenderTarget = null; + + _this._initContext(); + + // map some webGL blend and drawmodes.. + _this.drawModes = (0, _mapWebGLDrawModesToPixi2.default)(_this.gl); + + _this._nextTextureLocation = 0; + + _this.setBlendMode(0); + + /** + * Fired after rendering finishes. + * + * @event PIXI.WebGLRenderer#postrender + */ + + /** + * Fired before rendering starts. + * + * @event PIXI.WebGLRenderer#prerender + */ + + /** + * Fired when the WebGL context is set. + * + * @event PIXI.WebGLRenderer#context + * @param {WebGLRenderingContext} gl - WebGL context. + */ + return _this; + } + + /** + * Creates the WebGL context + * + * @private + */ + + + WebGLRenderer.prototype._initContext = function _initContext() { + var gl = this.gl; + + // restore a context if it was previously lost + if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) { + gl.getExtension('WEBGL_lose_context').restoreContext(); + } + + var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + + this._activeShader = null; + this._activeVao = null; + + this.boundTextures = new Array(maxTextures); + this.emptyTextures = new Array(maxTextures); + + /** + * Did someone temper with textures state? We'll overwrite them when we need to unbind something. + * @member {boolean} + * @private + */ + this._unknownBoundTextures = false; + + // create a texture manager... + this.textureManager = new _TextureManager2.default(this); + this.filterManager = new _FilterManager2.default(this); + this.textureGC = new _TextureGarbageCollector2.default(this); + + this.state.resetToDefault(); + + this.rootRenderTarget = new _RenderTarget2.default(gl, this.width, this.height, null, this.resolution, true); + this.rootRenderTarget.clearColor = this._backgroundColorRgba; + + this.bindRenderTarget(this.rootRenderTarget); + + // now lets fill up the textures with empty ones! + var emptyGLTexture = new _pixiGlCore2.default.GLTexture.fromData(gl, null, 1, 1); + + var tempObj = { _glTextures: {} }; + + tempObj._glTextures[this.CONTEXT_UID] = {}; + + for (var i = 0; i < maxTextures; i++) { + var empty = new _BaseTexture2.default(); + + empty._glTextures[this.CONTEXT_UID] = emptyGLTexture; + + this.boundTextures[i] = tempObj; + this.emptyTextures[i] = empty; + this.bindTexture(null, i); + } + + this.emit('context', gl); + + // setup the width/height properties and gl viewport + this.resize(this.screen.width, this.screen.height); + }; + + /** + * Renders the object to its webGL view + * + * @param {PIXI.DisplayObject} displayObject - the object to be rendered + * @param {PIXI.RenderTexture} renderTexture - The render texture to render to. + * @param {boolean} [clear] - Should the canvas be cleared before the new render + * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering. + * @param {boolean} [skipUpdateTransform] - Should we skip the update transform pass? + */ + + + WebGLRenderer.prototype.render = function render(displayObject, renderTexture, clear, transform, skipUpdateTransform) { + // can be handy to know! + this.renderingToScreen = !renderTexture; + + this.emit('prerender'); + + // no point rendering if our context has been blown up! + if (!this.gl || this.gl.isContextLost()) { + return; + } + + this._nextTextureLocation = 0; + + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.parent; + + displayObject.parent = this._tempDisplayObjectParent; + displayObject.updateTransform(); + displayObject.parent = cacheParent; + // displayObject.hitArea = //TODO add a temp hit area + } + + this.bindRenderTexture(renderTexture, transform); + + this.currentRenderer.start(); + + if (clear !== undefined ? clear : this.clearBeforeRender) { + this._activeRenderTarget.clear(); + } + + displayObject.renderWebGL(this); + + // apply transform.. + this.currentRenderer.flush(); + + // this.setObjectRenderer(this.emptyRenderer); + + this.textureGC.update(); + + this.emit('postrender'); + }; + + /** + * Changes the current renderer to the one given in parameter + * + * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use. + */ + + + WebGLRenderer.prototype.setObjectRenderer = function setObjectRenderer(objectRenderer) { + if (this.currentRenderer === objectRenderer) { + return; + } + + this.currentRenderer.stop(); + this.currentRenderer = objectRenderer; + this.currentRenderer.start(); + }; + + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + * + */ + + + WebGLRenderer.prototype.flush = function flush() { + this.setObjectRenderer(this.emptyRenderer); + }; + + /** + * Resizes the webGL view to the specified width and height. + * + * @param {number} screenWidth - the new width of the screen + * @param {number} screenHeight - the new height of the screen + */ + + + WebGLRenderer.prototype.resize = function resize(screenWidth, screenHeight) { + // if(width * this.resolution === this.width && height * this.resolution === this.height)return; + + _SystemRenderer3.default.prototype.resize.call(this, screenWidth, screenHeight); + + this.rootRenderTarget.resize(screenWidth, screenHeight); + + if (this._activeRenderTarget === this.rootRenderTarget) { + this.rootRenderTarget.activate(); + + if (this._activeShader) { + this._activeShader.uniforms.projectionMatrix = this.rootRenderTarget.projectionMatrix.toArray(true); + } + } + }; + + /** + * Resizes the webGL view to the specified width and height. + * + * @param {number} blendMode - the desired blend mode + */ + + + WebGLRenderer.prototype.setBlendMode = function setBlendMode(blendMode) { + this.state.setBlendMode(blendMode); + }; + + /** + * Erases the active render target and fills the drawing area with a colour + * + * @param {number} [clearColor] - The colour + */ + + + WebGLRenderer.prototype.clear = function clear(clearColor) { + this._activeRenderTarget.clear(clearColor); + }; + + /** + * Sets the transform of the active render target to the given matrix + * + * @param {PIXI.Matrix} matrix - The transformation matrix + */ + + + WebGLRenderer.prototype.setTransform = function setTransform(matrix) { + this._activeRenderTarget.transform = matrix; + }; + + /** + * Erases the render texture and fills the drawing area with a colour + * + * @param {PIXI.RenderTexture} renderTexture - The render texture to clear + * @param {number} [clearColor] - The colour + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.clearRenderTexture = function clearRenderTexture(renderTexture, clearColor) { + var baseTexture = renderTexture.baseTexture; + var renderTarget = baseTexture._glRenderTargets[this.CONTEXT_UID]; + + if (renderTarget) { + renderTarget.clear(clearColor); + } + + return this; + }; + + /** + * Binds a render texture for rendering + * + * @param {PIXI.RenderTexture} renderTexture - The render texture to render + * @param {PIXI.Matrix} transform - The transform to be applied to the render texture + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.bindRenderTexture = function bindRenderTexture(renderTexture, transform) { + var renderTarget = void 0; + + if (renderTexture) { + var baseTexture = renderTexture.baseTexture; + + if (!baseTexture._glRenderTargets[this.CONTEXT_UID]) { + // bind the current texture + this.textureManager.updateTexture(baseTexture, 0); + } + + this.unbindTexture(baseTexture); + + renderTarget = baseTexture._glRenderTargets[this.CONTEXT_UID]; + renderTarget.setFrame(renderTexture.frame); + } else { + renderTarget = this.rootRenderTarget; + } + + renderTarget.transform = transform; + this.bindRenderTarget(renderTarget); + + return this; + }; + + /** + * Changes the current render target to the one given in parameter + * + * @param {PIXI.RenderTarget} renderTarget - the new render target + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.bindRenderTarget = function bindRenderTarget(renderTarget) { + if (renderTarget !== this._activeRenderTarget) { + this._activeRenderTarget = renderTarget; + renderTarget.activate(); + + if (this._activeShader) { + this._activeShader.uniforms.projectionMatrix = renderTarget.projectionMatrix.toArray(true); + } + + this.stencilManager.setMaskStack(renderTarget.stencilMaskStack); + } + + return this; + }; + + /** + * Changes the current shader to the one given in parameter + * + * @param {PIXI.Shader} shader - the new shader + * @param {boolean} [autoProject=true] - Whether automatically set the projection matrix + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.bindShader = function bindShader(shader, autoProject) { + // TODO cache + if (this._activeShader !== shader) { + this._activeShader = shader; + shader.bind(); + + // `autoProject` normally would be a default parameter set to true + // but because of how Babel transpiles default parameters + // it hinders the performance of this method. + if (autoProject !== false) { + // automatically set the projection matrix + shader.uniforms.projectionMatrix = this._activeRenderTarget.projectionMatrix.toArray(true); + } + } + + return this; + }; + + /** + * Binds the texture. This will return the location of the bound texture. + * It may not be the same as the one you pass in. This is due to optimisation that prevents + * needless binding of textures. For example if the texture is already bound it will return the + * current location of the texture instead of the one provided. To bypass this use force location + * + * @param {PIXI.Texture} texture - the new texture + * @param {number} location - the suggested texture location + * @param {boolean} forceLocation - force the location + * @return {number} bound texture location + */ + + + WebGLRenderer.prototype.bindTexture = function bindTexture(texture, location, forceLocation) { + texture = texture || this.emptyTextures[location]; + texture = texture.baseTexture || texture; + texture.touched = this.textureGC.count; + + if (!forceLocation) { + // TODO - maybe look into adding boundIds.. save us the loop? + for (var i = 0; i < this.boundTextures.length; i++) { + if (this.boundTextures[i] === texture) { + return i; + } + } + + if (location === undefined) { + this._nextTextureLocation++; + this._nextTextureLocation %= this.boundTextures.length; + location = this.boundTextures.length - this._nextTextureLocation - 1; + } + } else { + location = location || 0; + } + + var gl = this.gl; + var glTexture = texture._glTextures[this.CONTEXT_UID]; + + if (!glTexture) { + // this will also bind the texture.. + this.textureManager.updateTexture(texture, location); + } else { + // bind the current texture + this.boundTextures[location] = texture; + gl.activeTexture(gl.TEXTURE0 + location); + gl.bindTexture(gl.TEXTURE_2D, glTexture.texture); + } + + return location; + }; + + /** + * unbinds the texture ... + * + * @param {PIXI.Texture} texture - the texture to unbind + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.unbindTexture = function unbindTexture(texture) { + var gl = this.gl; + + texture = texture.baseTexture || texture; + + if (this._unknownBoundTextures) { + this._unknownBoundTextures = false; + // someone changed webGL state, + // we have to be sure that our texture does not appear in multitexture renderer samplers + + for (var i = 0; i < this.boundTextures.length; i++) { + if (this.boundTextures[i] === this.emptyTextures[i]) { + gl.activeTexture(gl.TEXTURE0 + i); + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[i]._glTextures[this.CONTEXT_UID].texture); + } + } + } + + for (var _i = 0; _i < this.boundTextures.length; _i++) { + if (this.boundTextures[_i] === texture) { + this.boundTextures[_i] = this.emptyTextures[_i]; + + gl.activeTexture(gl.TEXTURE0 + _i); + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[_i]._glTextures[this.CONTEXT_UID].texture); + } + } + + return this; + }; + + /** + * Creates a new VAO from this renderer's context and state. + * + * @return {VertexArrayObject} The new VAO. + */ + + + WebGLRenderer.prototype.createVao = function createVao() { + return new _pixiGlCore2.default.VertexArrayObject(this.gl, this.state.attribState); + }; + + /** + * Changes the current Vao to the one given in parameter + * + * @param {PIXI.VertexArrayObject} vao - the new Vao + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.bindVao = function bindVao(vao) { + if (this._activeVao === vao) { + return this; + } + + if (vao) { + vao.bind(); + } else if (this._activeVao) { + // TODO this should always be true i think? + this._activeVao.unbind(); + } + + this._activeVao = vao; + + return this; + }; + + /** + * Resets the WebGL state so you can render things however you fancy! + * + * @return {PIXI.WebGLRenderer} Returns itself. + */ + + + WebGLRenderer.prototype.reset = function reset() { + this.setObjectRenderer(this.emptyRenderer); + + this.bindVao(null); + this._activeShader = null; + this._activeRenderTarget = this.rootRenderTarget; + + this._unknownBoundTextures = true; + + for (var i = 0; i < this.boundTextures.length; i++) { + this.boundTextures[i] = this.emptyTextures[i]; + } + + // bind the main frame buffer (the screen); + this.rootRenderTarget.activate(); + + this.state.resetToDefault(); + + return this; + }; + + /** + * Handles a lost webgl context + * + * @private + * @param {WebGLContextEvent} event - The context lost event. + */ + + + WebGLRenderer.prototype.handleContextLost = function handleContextLost(event) { + event.preventDefault(); + }; + + /** + * Handles a restored webgl context + * + * @private + */ + + + WebGLRenderer.prototype.handleContextRestored = function handleContextRestored() { + this.textureManager.removeAll(); + this.filterManager.destroy(true); + this._initContext(); + }; + + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * + * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + + + WebGLRenderer.prototype.destroy = function destroy(removeView) { + this.destroyPlugins(); + + // remove listeners + this.view.removeEventListener('webglcontextlost', this.handleContextLost); + this.view.removeEventListener('webglcontextrestored', this.handleContextRestored); + + this.textureManager.destroy(); + + // call base destroy + _SystemRenderer.prototype.destroy.call(this, removeView); + + this.uid = 0; + + // destroy the managers + this.maskManager.destroy(); + this.stencilManager.destroy(); + this.filterManager.destroy(); + + this.maskManager = null; + this.filterManager = null; + this.textureManager = null; + this.currentRenderer = null; + + this.handleContextLost = null; + this.handleContextRestored = null; + + this._contextOptions = null; + this.gl.useProgram(null); + + if (this.gl.getExtension('WEBGL_lose_context')) { + this.gl.getExtension('WEBGL_lose_context').loseContext(); + } + + this.gl = null; + + // this = null; + }; + + return WebGLRenderer; + }(_SystemRenderer3.default); + + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @name PIXI.WebGLRenderer#plugins + * @type {object} + * @readonly + * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer. + * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects. + */ + + /** + * Adds a plugin to the renderer. + * + * @method PIXI.WebGLRenderer#registerPlugin + * @param {string} pluginName - The name of the plugin. + * @param {Function} ctor - The constructor function or class for the plugin. + */ + + exports.default = WebGLRenderer; + _utils.pluginTarget.mixin(WebGLRenderer); + + }, { "../../const": 46, "../../textures/BaseTexture": 112, "../../utils": 125, "../SystemRenderer": 76, "./TextureGarbageCollector": 82, "./TextureManager": 83, "./WebGLState": 85, "./managers/FilterManager": 90, "./managers/MaskManager": 91, "./managers/StencilManager": 92, "./utils/ObjectRenderer": 94, "./utils/RenderTarget": 96, "./utils/mapWebGLDrawModesToPixi": 99, "./utils/validateContext": 100, "pixi-gl-core": 15 }], 85: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _mapWebGLBlendModesToPixi = require('./utils/mapWebGLBlendModesToPixi'); + + var _mapWebGLBlendModesToPixi2 = _interopRequireDefault(_mapWebGLBlendModesToPixi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var BLEND = 0; + var DEPTH_TEST = 1; + var FRONT_FACE = 2; + var CULL_FACE = 3; + var BLEND_FUNC = 4; + + /** + * A WebGL state machines + * + * @memberof PIXI + * @class + */ + + var WebGLState = function () { + /** + * @param {WebGLRenderingContext} gl - The current WebGL rendering context + */ + function WebGLState(gl) { + _classCallCheck(this, WebGLState); + + /** + * The current active state + * + * @member {Uint8Array} + */ + this.activeState = new Uint8Array(16); + + /** + * The default state + * + * @member {Uint8Array} + */ + this.defaultState = new Uint8Array(16); + + // default blend mode.. + this.defaultState[0] = 1; + + /** + * The current state index in the stack + * + * @member {number} + * @private + */ + this.stackIndex = 0; + + /** + * The stack holding all the different states + * + * @member {Array<*>} + * @private + */ + this.stack = []; + + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + this.maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); + + this.attribState = { + tempAttribState: new Array(this.maxAttribs), + attribState: new Array(this.maxAttribs) + }; + + this.blendModes = (0, _mapWebGLBlendModesToPixi2.default)(gl); + + // check we have vao.. + this.nativeVaoExtension = gl.getExtension('OES_vertex_array_object') || gl.getExtension('MOZ_OES_vertex_array_object') || gl.getExtension('WEBKIT_OES_vertex_array_object'); + } + + /** + * Pushes a new active state + */ + + + WebGLState.prototype.push = function push() { + // next state.. + var state = this.stack[this.stackIndex]; + + if (!state) { + state = this.stack[this.stackIndex] = new Uint8Array(16); + } + + ++this.stackIndex; + + // copy state.. + // set active state so we can force overrides of gl state + for (var i = 0; i < this.activeState.length; i++) { + state[i] = this.activeState[i]; + } + }; + + /** + * Pops a state out + */ + + + WebGLState.prototype.pop = function pop() { + var state = this.stack[--this.stackIndex]; + + this.setState(state); + }; + + /** + * Sets the current state + * + * @param {*} state - The state to set. + */ + + + WebGLState.prototype.setState = function setState(state) { + this.setBlend(state[BLEND]); + this.setDepthTest(state[DEPTH_TEST]); + this.setFrontFace(state[FRONT_FACE]); + this.setCullFace(state[CULL_FACE]); + this.setBlendMode(state[BLEND_FUNC]); + }; + + /** + * Enables or disabled blending. + * + * @param {boolean} value - Turn on or off webgl blending. + */ + + + WebGLState.prototype.setBlend = function setBlend(value) { + value = value ? 1 : 0; + + if (this.activeState[BLEND] === value) { + return; + } + + this.activeState[BLEND] = value; + this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); + }; + + /** + * Sets the blend mode. + * + * @param {number} value - The blend mode to set to. + */ + + + WebGLState.prototype.setBlendMode = function setBlendMode(value) { + if (value === this.activeState[BLEND_FUNC]) { + return; + } + + this.activeState[BLEND_FUNC] = value; + + var mode = this.blendModes[value]; + + if (mode.length === 2) { + this.gl.blendFunc(mode[0], mode[1]); + } else { + this.gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); + } + }; + + /** + * Sets whether to enable or disable depth test. + * + * @param {boolean} value - Turn on or off webgl depth testing. + */ + + + WebGLState.prototype.setDepthTest = function setDepthTest(value) { + value = value ? 1 : 0; + + if (this.activeState[DEPTH_TEST] === value) { + return; + } + + this.activeState[DEPTH_TEST] = value; + this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); + }; + + /** + * Sets whether to enable or disable cull face. + * + * @param {boolean} value - Turn on or off webgl cull face. + */ + + + WebGLState.prototype.setCullFace = function setCullFace(value) { + value = value ? 1 : 0; + + if (this.activeState[CULL_FACE] === value) { + return; + } + + this.activeState[CULL_FACE] = value; + this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); + }; + + /** + * Sets the gl front face. + * + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + + + WebGLState.prototype.setFrontFace = function setFrontFace(value) { + value = value ? 1 : 0; + + if (this.activeState[FRONT_FACE] === value) { + return; + } + + this.activeState[FRONT_FACE] = value; + this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); + }; + + /** + * Disables all the vaos in use + * + */ + + + WebGLState.prototype.resetAttributes = function resetAttributes() { + for (var i = 0; i < this.attribState.tempAttribState.length; i++) { + this.attribState.tempAttribState[i] = 0; + } + + for (var _i = 0; _i < this.attribState.attribState.length; _i++) { + this.attribState.attribState[_i] = 0; + } + + // im going to assume one is always active for performance reasons. + for (var _i2 = 1; _i2 < this.maxAttribs; _i2++) { + this.gl.disableVertexAttribArray(_i2); + } + }; + + // used + /** + * Resets all the logic and disables the vaos + */ + + + WebGLState.prototype.resetToDefault = function resetToDefault() { + // unbind any VAO if they exist.. + if (this.nativeVaoExtension) { + this.nativeVaoExtension.bindVertexArrayOES(null); + } + + // reset all attributes.. + this.resetAttributes(); + + // set active state so we can force overrides of gl state + for (var i = 0; i < this.activeState.length; ++i) { + this.activeState[i] = 32; + } + + this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); + + this.setState(this.defaultState); + }; + + return WebGLState; + }(); + + exports.default = WebGLState; + + }, { "./utils/mapWebGLBlendModesToPixi": 98 }], 86: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _extractUniformsFromSrc = require('./extractUniformsFromSrc'); + + var _extractUniformsFromSrc2 = _interopRequireDefault(_extractUniformsFromSrc); + + var _utils = require('../../../utils'); + + var _const = require('../../../const'); + + var _settings = require('../../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var SOURCE_KEY_MAP = {}; + + // let math = require('../../../math'); + /** + * @class + * @memberof PIXI + * @extends PIXI.Shader + */ + + var Filter = function () { + /** + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {object} [uniformData] - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniformData) { + _classCallCheck(this, Filter); + + /** + * The vertex shader. + * + * @member {string} + */ + this.vertexSrc = vertexSrc || Filter.defaultVertexSrc; + + /** + * The fragment shader. + * + * @member {string} + */ + this.fragmentSrc = fragmentSrc || Filter.defaultFragmentSrc; + + this._blendMode = _const.BLEND_MODES.NORMAL; + + this.uniformData = uniformData || (0, _extractUniformsFromSrc2.default)(this.vertexSrc, this.fragmentSrc, 'projectionMatrix|uSampler'); + + /** + * An object containing the current values of custom uniforms. + * @example Updating the value of a custom uniform + * filter.uniforms.time = performance.now(); + * + * @member {object} + */ + this.uniforms = {}; + + for (var i in this.uniformData) { + this.uniforms[i] = this.uniformData[i].value; + if (this.uniformData[i].type) { + this.uniformData[i].type = this.uniformData[i].type.toLowerCase(); + } + } + + // this is where we store shader references.. + // TODO we could cache this! + this.glShaders = {}; + + // used for caching.. sure there is a better way! + if (!SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc]) { + SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc] = (0, _utils.uid)(); + } + + this.glShaderKey = SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc]; + + /** + * The padding of the filter. Some filters require extra space to breath such as a blur. + * Increasing this will add extra width and height to the bounds of the object that the + * filter is applied to. + * + * @member {number} + */ + this.padding = 4; + + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + * + * @member {number} + */ + this.resolution = _settings2.default.FILTER_RESOLUTION; + + /** + * If enabled is true the filter is applied, if false it will not. + * + * @member {boolean} + */ + this.enabled = true; + + /** + * If enabled, PixiJS will fit the filter area into boundaries for better performance. + * Switch it off if it does not work for specific shader. + * + * @member {boolean} + */ + this.autoFit = true; + } + + /** + * Applies the filter + * + * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTarget} input - The input render target. + * @param {PIXI.RenderTarget} output - The target to output to. + * @param {boolean} clear - Should the output be cleared before rendering to it + * @param {object} [currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + + + Filter.prototype.apply = function apply(filterManager, input, output, clear, currentState) // eslint-disable-line no-unused-vars + { + // --- // + // this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(tempMatrix, window.panda ); + + // do as you please! + + filterManager.applyFilter(this, input, output, clear); + + // or just do a regular render.. + }; + + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + + + _createClass(Filter, [{ + key: 'blendMode', + get: function get() { + return this._blendMode; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._blendMode = value; + } + + /** + * The default vertex shader source + * + * @static + * @constant + */ + + }], [{ + key: 'defaultVertexSrc', + get: function get() { + return ['attribute vec2 aVertexPosition;', 'attribute vec2 aTextureCoord;', 'uniform mat3 projectionMatrix;', 'uniform mat3 filterMatrix;', 'varying vec2 vTextureCoord;', 'varying vec2 vFilterCoord;', 'void main(void){', ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);', ' vFilterCoord = ( filterMatrix * vec3( aTextureCoord, 1.0) ).xy;', ' vTextureCoord = aTextureCoord ;', '}'].join('\n'); + } + + /** + * The default fragment shader source + * + * @static + * @constant + */ + + }, { + key: 'defaultFragmentSrc', + get: function get() { + return ['varying vec2 vTextureCoord;', 'varying vec2 vFilterCoord;', 'uniform sampler2D uSampler;', 'uniform sampler2D filterSampler;', 'void main(void){', ' vec4 masky = texture2D(filterSampler, vFilterCoord);', ' vec4 sample = texture2D(uSampler, vTextureCoord);', ' vec4 color;', ' if(mod(vFilterCoord.x, 1.0) > 0.5)', ' {', ' color = vec4(1.0, 0.0, 0.0, 1.0);', ' }', ' else', ' {', ' color = vec4(0.0, 1.0, 0.0, 1.0);', ' }', + // ' gl_FragColor = vec4(mod(vFilterCoord.x, 1.5), vFilterCoord.y,0.0,1.0);', + ' gl_FragColor = mix(sample, masky, 0.5);', ' gl_FragColor *= sample.a;', '}'].join('\n'); + } + }]); + + return Filter; + }(); + + exports.default = Filter; + + }, { "../../../const": 46, "../../../settings": 101, "../../../utils": 125, "./extractUniformsFromSrc": 87 }], 87: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = extractUniformsFromSrc; + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var defaultValue = _pixiGlCore2.default.shader.defaultValue; + + function extractUniformsFromSrc(vertexSrc, fragmentSrc, mask) { + var vertUniforms = extractUniformsFromString(vertexSrc, mask); + var fragUniforms = extractUniformsFromString(fragmentSrc, mask); + + return Object.assign(vertUniforms, fragUniforms); + } + + function extractUniformsFromString(string) { + var maskRegex = new RegExp('^(projectionMatrix|uSampler|filterArea|filterClamp)$'); + + var uniforms = {}; + var nameSplit = void 0; + + // clean the lines a little - remove extra spaces / tabs etc + // then split along ';' + var lines = string.replace(/\s+/g, ' ').split(/\s*;\s*/); + + // loop through.. + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim(); + + if (line.indexOf('uniform') > -1) { + var splitLine = line.split(' '); + var type = splitLine[1]; + + var name = splitLine[2]; + var size = 1; + + if (name.indexOf('[') > -1) { + // array! + nameSplit = name.split(/\[|]/); + name = nameSplit[0]; + size *= Number(nameSplit[1]); + } + + if (!name.match(maskRegex)) { + uniforms[name] = { + value: defaultValue(type, size), + name: name, + type: type + }; + } + } + } + + return uniforms; + } + + }, { "pixi-gl-core": 15 }], 88: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.calculateScreenSpaceMatrix = calculateScreenSpaceMatrix; + exports.calculateNormalizedScreenSpaceMatrix = calculateNormalizedScreenSpaceMatrix; + exports.calculateSpriteMatrix = calculateSpriteMatrix; + + var _math = require('../../../math'); + + /** + * Calculates the mapped matrix + * @param filterArea {Rectangle} The filter area + * @param sprite {Sprite} the target sprite + * @param outputMatrix {Matrix} @alvin + * @private + */ + // TODO playing around here.. this is temporary - (will end up in the shader) + // this returns a matrix that will normalise map filter cords in the filter to screen space + function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { + // let worldTransform = sprite.worldTransform.copy(Matrix.TEMP_MATRIX), + // let texture = {width:1136, height:700};//sprite._texture.baseTexture; + + // TODO unwrap? + var mappedMatrix = outputMatrix.identity(); + + mappedMatrix.translate(filterArea.x / textureSize.width, filterArea.y / textureSize.height); + + mappedMatrix.scale(textureSize.width, textureSize.height); + + return mappedMatrix; + } + + function calculateNormalizedScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { + var mappedMatrix = outputMatrix.identity(); + + mappedMatrix.translate(filterArea.x / textureSize.width, filterArea.y / textureSize.height); + + var translateScaleX = textureSize.width / filterArea.width; + var translateScaleY = textureSize.height / filterArea.height; + + mappedMatrix.scale(translateScaleX, translateScaleY); + + return mappedMatrix; + } + + // this will map the filter coord so that a texture can be used based on the transform of a sprite + function calculateSpriteMatrix(outputMatrix, filterArea, textureSize, sprite) { + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(textureSize.width, 0, 0, textureSize.height, filterArea.x, filterArea.y); + var worldTransform = sprite.worldTransform.copy(_math.Matrix.TEMP_MATRIX); + + worldTransform.invert(); + mappedMatrix.prepend(worldTransform); + mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); + mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); + + return mappedMatrix; + } + + }, { "../../../math": 70 }], 89: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Filter2 = require('../Filter'); + + var _Filter3 = _interopRequireDefault(_Filter2); + + var _math = require('../../../../math'); + + var _path = require('path'); + + var _TextureMatrix = require('../../../../textures/TextureMatrix'); + + var _TextureMatrix2 = _interopRequireDefault(_TextureMatrix); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The SpriteMaskFilter class + * + * @class + * @extends PIXI.Filter + * @memberof PIXI + */ + var SpriteMaskFilter = function (_Filter) { + _inherits(SpriteMaskFilter, _Filter); + + /** + * @param {PIXI.Sprite} sprite - the target sprite + */ + function SpriteMaskFilter(sprite) { + _classCallCheck(this, SpriteMaskFilter); + + var maskMatrix = new _math.Matrix(); + + var _this = _possibleConstructorReturn(this, _Filter.call(this, 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n', 'varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n\n original *= (masky.r * masky.a * alpha * clip);\n\n gl_FragColor = original;\n}\n')); + + sprite.renderable = false; + + _this.maskSprite = sprite; + _this.maskMatrix = maskMatrix; + return _this; + } + + /** + * Applies the filter + * + * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTarget} input - The input render target. + * @param {PIXI.RenderTarget} output - The target to output to. + * @param {boolean} clear - Should the output be cleared before rendering to it + */ + + + SpriteMaskFilter.prototype.apply = function apply(filterManager, input, output, clear) { + var maskSprite = this.maskSprite; + var tex = this.maskSprite.texture; + + if (!tex.valid) { + return; + } + if (!tex.transform) { + // margin = 0.0, let it bleed a bit, shader code becomes easier + // assuming that atlas textures were made with 1-pixel padding + tex.transform = new _TextureMatrix2.default(tex, 0.0); + } + tex.transform.update(); + + this.uniforms.mask = tex; + this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite).prepend(tex.transform.mapCoord); + this.uniforms.alpha = maskSprite.worldAlpha; + this.uniforms.maskClamp = tex.transform.uClampFrame; + + filterManager.applyFilter(this, input, output, clear); + }; + + return SpriteMaskFilter; + }(_Filter3.default); + + exports.default = SpriteMaskFilter; + + }, { "../../../../math": 70, "../../../../textures/TextureMatrix": 116, "../Filter": 86, "path": 8 }], 90: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLManager2 = require('./WebGLManager'); + + var _WebGLManager3 = _interopRequireDefault(_WebGLManager2); + + var _RenderTarget = require('../utils/RenderTarget'); + + var _RenderTarget2 = _interopRequireDefault(_RenderTarget); + + var _Quad = require('../utils/Quad'); + + var _Quad2 = _interopRequireDefault(_Quad); + + var _math = require('../../../math'); + + var _Shader = require('../../../Shader'); + + var _Shader2 = _interopRequireDefault(_Shader); + + var _filterTransforms = require('../filters/filterTransforms'); + + var filterTransforms = _interopRequireWildcard(_filterTransforms); + + var _bitTwiddle = require('bit-twiddle'); + + var _bitTwiddle2 = _interopRequireDefault(_bitTwiddle); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @ignore + * @class + */ + var FilterState = function () { + /** + * + */ + function FilterState() { + _classCallCheck(this, FilterState); + + this.renderTarget = null; + this.target = null; + this.resolution = 1; + + // those three objects are used only for root + // re-assigned for everything else + this.sourceFrame = new _math.Rectangle(); + this.destinationFrame = new _math.Rectangle(); + this.filters = []; + } + + /** + * clears the state + */ + + + FilterState.prototype.clear = function clear() { + this.filters = null; + this.target = null; + this.renderTarget = null; + }; + + return FilterState; + }(); + + var screenKey = 'screen'; + + /** + * @class + * @memberof PIXI + * @extends PIXI.WebGLManager + */ + + var FilterManager = function (_WebGLManager) { + _inherits(FilterManager, _WebGLManager); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for. + */ + function FilterManager(renderer) { + _classCallCheck(this, FilterManager); + + var _this = _possibleConstructorReturn(this, _WebGLManager.call(this, renderer)); + + _this.gl = _this.renderer.gl; + // know about sprites! + _this.quad = new _Quad2.default(_this.gl, renderer.state.attribState); + + _this.shaderCache = {}; + // todo add default! + _this.pool = {}; + + _this.filterData = null; + + _this.managedFilters = []; + + _this.renderer.on('prerender', _this.onPrerender, _this); + + _this._screenWidth = renderer.view.width; + _this._screenHeight = renderer.view.height; + return _this; + } + + /** + * Adds a new filter to the manager. + * + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param {PIXI.Filter[]} filters - The filters to apply. + */ + + + FilterManager.prototype.pushFilter = function pushFilter(target, filters) { + var renderer = this.renderer; + + var filterData = this.filterData; + + if (!filterData) { + filterData = this.renderer._activeRenderTarget.filterStack; + + // add new stack + var filterState = new FilterState(); + + filterState.sourceFrame = filterState.destinationFrame = this.renderer._activeRenderTarget.size; + filterState.renderTarget = renderer._activeRenderTarget; + + this.renderer._activeRenderTarget.filterData = filterData = { + index: 0, + stack: [filterState] + }; + + this.filterData = filterData; + } + + // get the current filter state.. + var currentState = filterData.stack[++filterData.index]; + var renderTargetFrame = filterData.stack[0].destinationFrame; + + if (!currentState) { + currentState = filterData.stack[filterData.index] = new FilterState(); + } + + var fullScreen = target.filterArea && target.filterArea.x === 0 && target.filterArea.y === 0 && target.filterArea.width === renderer.screen.width && target.filterArea.height === renderer.screen.height; + + // for now we go off the filter of the first resolution.. + var resolution = filters[0].resolution; + var padding = filters[0].padding | 0; + var targetBounds = fullScreen ? renderer.screen : target.filterArea || target.getBounds(true); + var sourceFrame = currentState.sourceFrame; + var destinationFrame = currentState.destinationFrame; + + sourceFrame.x = (targetBounds.x * resolution | 0) / resolution; + sourceFrame.y = (targetBounds.y * resolution | 0) / resolution; + sourceFrame.width = (targetBounds.width * resolution | 0) / resolution; + sourceFrame.height = (targetBounds.height * resolution | 0) / resolution; + + if (!fullScreen) { + if (filterData.stack[0].renderTarget.transform) {// + + // TODO we should fit the rect around the transform.. + } else if (filters[0].autoFit) { + sourceFrame.fit(renderTargetFrame); + } + + // lets apply the padding After we fit the element to the screen. + // this should stop the strange side effects that can occur when cropping to the edges + sourceFrame.pad(padding); + } + + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + + // lets play the padding after we fit the element to the screen. + // this should stop the strange side effects that can occur when cropping to the edges + + var renderTarget = this.getPotRenderTarget(renderer.gl, sourceFrame.width, sourceFrame.height, resolution); + + currentState.target = target; + currentState.filters = filters; + currentState.resolution = resolution; + currentState.renderTarget = renderTarget; + + // bind the render target to draw the shape in the top corner.. + + renderTarget.setFrame(destinationFrame, sourceFrame); + + // bind the render target + renderer.bindRenderTarget(renderTarget); + renderTarget.clear(); + }; + + /** + * Pops off the filter and applies it. + * + */ + + + FilterManager.prototype.popFilter = function popFilter() { + var filterData = this.filterData; + + var lastState = filterData.stack[filterData.index - 1]; + var currentState = filterData.stack[filterData.index]; + + this.quad.map(currentState.renderTarget.size, currentState.sourceFrame).upload(); + + var filters = currentState.filters; + + if (filters.length === 1) { + filters[0].apply(this, currentState.renderTarget, lastState.renderTarget, false, currentState); + this.freePotRenderTarget(currentState.renderTarget); + } else { + var flip = currentState.renderTarget; + var flop = this.getPotRenderTarget(this.renderer.gl, currentState.sourceFrame.width, currentState.sourceFrame.height, currentState.resolution); + + flop.setFrame(currentState.destinationFrame, currentState.sourceFrame); + + // finally lets clear the render target before drawing to it.. + flop.clear(); + + var i = 0; + + for (i = 0; i < filters.length - 1; ++i) { + filters[i].apply(this, flip, flop, true, currentState); + + var t = flip; + + flip = flop; + flop = t; + } + + filters[i].apply(this, flip, lastState.renderTarget, false, currentState); + + this.freePotRenderTarget(flip); + this.freePotRenderTarget(flop); + } + + currentState.clear(); + filterData.index--; + + if (filterData.index === 0) { + this.filterData = null; + } + }; + + /** + * Draws a filter. + * + * @param {PIXI.Filter} filter - The filter to draw. + * @param {PIXI.RenderTarget} input - The input render target. + * @param {PIXI.RenderTarget} output - The target to output to. + * @param {boolean} clear - Should the output be cleared before rendering to it + */ + + + FilterManager.prototype.applyFilter = function applyFilter(filter, input, output, clear) { + var renderer = this.renderer; + var gl = renderer.gl; + + var shader = filter.glShaders[renderer.CONTEXT_UID]; + + // caching.. + if (!shader) { + if (filter.glShaderKey) { + shader = this.shaderCache[filter.glShaderKey]; + + if (!shader) { + shader = new _Shader2.default(this.gl, filter.vertexSrc, filter.fragmentSrc); + + filter.glShaders[renderer.CONTEXT_UID] = this.shaderCache[filter.glShaderKey] = shader; + this.managedFilters.push(filter); + } + } else { + shader = filter.glShaders[renderer.CONTEXT_UID] = new _Shader2.default(this.gl, filter.vertexSrc, filter.fragmentSrc); + this.managedFilters.push(filter); + } + + // TODO - this only needs to be done once? + renderer.bindVao(null); + + this.quad.initVao(shader); + } + + renderer.bindVao(this.quad.vao); + + renderer.bindRenderTarget(output); + + if (clear) { + gl.disable(gl.SCISSOR_TEST); + renderer.clear(); // [1, 1, 1, 1]); + gl.enable(gl.SCISSOR_TEST); + } + + // in case the render target is being masked using a scissor rect + if (output === renderer.maskManager.scissorRenderTarget) { + renderer.maskManager.pushScissorMask(null, renderer.maskManager.scissorData); + } + + renderer.bindShader(shader); + + // free unit 0 for us, doesn't matter what was there + // don't try to restore it, because syncUniforms can upload it to another slot + // and it'll be a problem + var tex = this.renderer.emptyTextures[0]; + + this.renderer.boundTextures[0] = tex; + // this syncs the PixiJS filters uniforms with glsl uniforms + this.syncUniforms(shader, filter); + + renderer.state.setBlendMode(filter.blendMode); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, input.texture.texture); + + this.quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0); + + gl.bindTexture(gl.TEXTURE_2D, tex._glTextures[this.renderer.CONTEXT_UID].texture); + }; + + /** + * Uploads the uniforms of the filter. + * + * @param {GLShader} shader - The underlying gl shader. + * @param {PIXI.Filter} filter - The filter we are synchronizing. + */ + + + FilterManager.prototype.syncUniforms = function syncUniforms(shader, filter) { + var uniformData = filter.uniformData; + var uniforms = filter.uniforms; + + // 0 is reserved for the PixiJS texture so we start at 1! + var textureCount = 1; + var currentState = void 0; + + // filterArea and filterClamp that are handled by FilterManager directly + // they must not appear in uniformData + + if (shader.uniforms.filterArea) { + currentState = this.filterData.stack[this.filterData.index]; + + var filterArea = shader.uniforms.filterArea; + + filterArea[0] = currentState.renderTarget.size.width; + filterArea[1] = currentState.renderTarget.size.height; + filterArea[2] = currentState.sourceFrame.x; + filterArea[3] = currentState.sourceFrame.y; + + shader.uniforms.filterArea = filterArea; + } + + // use this to clamp displaced texture coords so they belong to filterArea + // see displacementFilter fragment shader for an example + if (shader.uniforms.filterClamp) { + currentState = currentState || this.filterData.stack[this.filterData.index]; + + var filterClamp = shader.uniforms.filterClamp; + + filterClamp[0] = 0; + filterClamp[1] = 0; + filterClamp[2] = (currentState.sourceFrame.width - 1) / currentState.renderTarget.size.width; + filterClamp[3] = (currentState.sourceFrame.height - 1) / currentState.renderTarget.size.height; + + shader.uniforms.filterClamp = filterClamp; + } + + // TODO Caching layer.. + for (var i in uniformData) { + if (!shader.uniforms.data[i]) { + continue; + } + + var type = uniformData[i].type; + + if (type === 'sampler2d' && uniforms[i] !== 0) { + if (uniforms[i].baseTexture) { + shader.uniforms[i] = this.renderer.bindTexture(uniforms[i].baseTexture, textureCount); + } else { + shader.uniforms[i] = textureCount; + + // TODO + // this is helpful as renderTargets can also be set. + // Although thinking about it, we could probably + // make the filter texture cache return a RenderTexture + // rather than a renderTarget + var gl = this.renderer.gl; + + this.renderer.boundTextures[textureCount] = this.renderer.emptyTextures[textureCount]; + gl.activeTexture(gl.TEXTURE0 + textureCount); + + uniforms[i].texture.bind(); + } + + textureCount++; + } else if (type === 'mat3') { + // check if its PixiJS matrix.. + if (uniforms[i].a !== undefined) { + shader.uniforms[i] = uniforms[i].toArray(true); + } else { + shader.uniforms[i] = uniforms[i]; + } + } else if (type === 'vec2') { + // check if its a point.. + if (uniforms[i].x !== undefined) { + var val = shader.uniforms[i] || new Float32Array(2); + + val[0] = uniforms[i].x; + val[1] = uniforms[i].y; + shader.uniforms[i] = val; + } else { + shader.uniforms[i] = uniforms[i]; + } + } else if (type === 'float') { + if (shader.uniforms.data[i].value !== uniformData[i]) { + shader.uniforms[i] = uniforms[i]; + } + } else { + shader.uniforms[i] = uniforms[i]; + } + } + }; + + /** + * Gets a render target from the pool, or creates a new one. + * + * @param {boolean} clear - Should we clear the render texture when we get it? + * @param {number} resolution - The resolution of the target. + * @return {PIXI.RenderTarget} The new render target + */ + + + FilterManager.prototype.getRenderTarget = function getRenderTarget(clear, resolution) { + var currentState = this.filterData.stack[this.filterData.index]; + var renderTarget = this.getPotRenderTarget(this.renderer.gl, currentState.sourceFrame.width, currentState.sourceFrame.height, resolution || currentState.resolution); + + renderTarget.setFrame(currentState.destinationFrame, currentState.sourceFrame); + + return renderTarget; + }; + + /** + * Returns a render target to the pool. + * + * @param {PIXI.RenderTarget} renderTarget - The render target to return. + */ + + + FilterManager.prototype.returnRenderTarget = function returnRenderTarget(renderTarget) { + this.freePotRenderTarget(renderTarget); + }; + + /** + * Calculates the mapped matrix. + * + * TODO playing around here.. this is temporary - (will end up in the shader) + * this returns a matrix that will normalise map filter cords in the filter to screen space + * + * @param {PIXI.Matrix} outputMatrix - the matrix to output to. + * @return {PIXI.Matrix} The mapped matrix. + */ + + + FilterManager.prototype.calculateScreenSpaceMatrix = function calculateScreenSpaceMatrix(outputMatrix) { + var currentState = this.filterData.stack[this.filterData.index]; + + return filterTransforms.calculateScreenSpaceMatrix(outputMatrix, currentState.sourceFrame, currentState.renderTarget.size); + }; + + /** + * Multiply vTextureCoord to this matrix to achieve (0,0,1,1) for filterArea + * + * @param {PIXI.Matrix} outputMatrix - The matrix to output to. + * @return {PIXI.Matrix} The mapped matrix. + */ + + + FilterManager.prototype.calculateNormalizedScreenSpaceMatrix = function calculateNormalizedScreenSpaceMatrix(outputMatrix) { + var currentState = this.filterData.stack[this.filterData.index]; + + return filterTransforms.calculateNormalizedScreenSpaceMatrix(outputMatrix, currentState.sourceFrame, currentState.renderTarget.size, currentState.destinationFrame); + }; + + /** + * This will map the filter coord so that a texture can be used based on the transform of a sprite + * + * @param {PIXI.Matrix} outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @return {PIXI.Matrix} The mapped matrix. + */ + + + FilterManager.prototype.calculateSpriteMatrix = function calculateSpriteMatrix(outputMatrix, sprite) { + var currentState = this.filterData.stack[this.filterData.index]; + + return filterTransforms.calculateSpriteMatrix(outputMatrix, currentState.sourceFrame, currentState.renderTarget.size, sprite); + }; + + /** + * Destroys this Filter Manager. + * + * @param {boolean} [contextLost=false] context was lost, do not free shaders + * + */ + + + FilterManager.prototype.destroy = function destroy() { + var contextLost = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var renderer = this.renderer; + var filters = this.managedFilters; + + renderer.off('prerender', this.onPrerender, this); + + for (var i = 0; i < filters.length; i++) { + if (!contextLost) { + filters[i].glShaders[renderer.CONTEXT_UID].destroy(); + } + delete filters[i].glShaders[renderer.CONTEXT_UID]; + } + + this.shaderCache = {}; + if (!contextLost) { + this.emptyPool(); + } else { + this.pool = {}; + } + }; + + /** + * Gets a Power-of-Two render texture. + * + * TODO move to a separate class could be on renderer? + * also - could cause issue with multiple contexts? + * + * @private + * @param {WebGLRenderingContext} gl - The webgl rendering context + * @param {number} minWidth - The minimum width of the render target. + * @param {number} minHeight - The minimum height of the render target. + * @param {number} resolution - The resolution of the render target. + * @return {PIXI.RenderTarget} The new render target. + */ + + + FilterManager.prototype.getPotRenderTarget = function getPotRenderTarget(gl, minWidth, minHeight, resolution) { + var key = screenKey; + + minWidth *= resolution; + minHeight *= resolution; + + if (minWidth !== this._screenWidth || minHeight !== this._screenHeight) { + // TODO you could return a bigger texture if there is not one in the pool? + minWidth = _bitTwiddle2.default.nextPow2(minWidth); + minHeight = _bitTwiddle2.default.nextPow2(minHeight); + key = (minWidth & 0xFFFF) << 16 | minHeight & 0xFFFF; + } + + if (!this.pool[key]) { + this.pool[key] = []; + } + + var renderTarget = this.pool[key].pop(); + + // creating render target will cause texture to be bound! + if (!renderTarget) { + // temporary bypass cache.. + var tex = this.renderer.boundTextures[0]; + + gl.activeTexture(gl.TEXTURE0); + + // internally - this will cause a texture to be bound.. + renderTarget = new _RenderTarget2.default(gl, minWidth, minHeight, null, 1); + + // set the current one back + gl.bindTexture(gl.TEXTURE_2D, tex._glTextures[this.renderer.CONTEXT_UID].texture); + } + + // manually tweak the resolution... + // this will not modify the size of the frame buffer, just its resolution. + renderTarget.resolution = resolution; + renderTarget.defaultFrame.width = renderTarget.size.width = minWidth / resolution; + renderTarget.defaultFrame.height = renderTarget.size.height = minHeight / resolution; + renderTarget.filterPoolKey = key; + + return renderTarget; + }; + + /** + * Empties the texture pool. + * + */ + + + FilterManager.prototype.emptyPool = function emptyPool() { + for (var i in this.pool) { + var textures = this.pool[i]; + + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + } + + this.pool = {}; + }; + + /** + * Frees a render target back into the pool. + * + * @param {PIXI.RenderTarget} renderTarget - The renderTarget to free + */ + + + FilterManager.prototype.freePotRenderTarget = function freePotRenderTarget(renderTarget) { + this.pool[renderTarget.filterPoolKey].push(renderTarget); + }; + + /** + * Called before the renderer starts rendering. + * + */ + + + FilterManager.prototype.onPrerender = function onPrerender() { + if (this._screenWidth !== this.renderer.view.width || this._screenHeight !== this.renderer.view.height) { + this._screenWidth = this.renderer.view.width; + this._screenHeight = this.renderer.view.height; + + var textures = this.pool[screenKey]; + + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.pool[screenKey] = []; + } + }; + + return FilterManager; + }(_WebGLManager3.default); + + exports.default = FilterManager; + + }, { "../../../Shader": 44, "../../../math": 70, "../filters/filterTransforms": 88, "../utils/Quad": 95, "../utils/RenderTarget": 96, "./WebGLManager": 93, "bit-twiddle": 1 }], 91: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLManager2 = require('./WebGLManager'); + + var _WebGLManager3 = _interopRequireDefault(_WebGLManager2); + + var _SpriteMaskFilter = require('../filters/spriteMask/SpriteMaskFilter'); + + var _SpriteMaskFilter2 = _interopRequireDefault(_SpriteMaskFilter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @class + * @extends PIXI.WebGLManager + * @memberof PIXI + */ + var MaskManager = function (_WebGLManager) { + _inherits(MaskManager, _WebGLManager); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for. + */ + function MaskManager(renderer) { + _classCallCheck(this, MaskManager); + + // TODO - we don't need both! + var _this = _possibleConstructorReturn(this, _WebGLManager.call(this, renderer)); + + _this.scissor = false; + _this.scissorData = null; + _this.scissorRenderTarget = null; + + _this.enableScissor = true; + + _this.alphaMaskPool = []; + _this.alphaMaskIndex = 0; + return _this; + } + + /** + * Applies the Mask and adds it to the current filter stack. + * + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data. + */ + + + MaskManager.prototype.pushMask = function pushMask(target, maskData) { + // TODO the root check means scissor rect will not + // be used on render textures more info here: + // https://github.com/pixijs/pixi.js/pull/3545 + + if (maskData.texture) { + this.pushSpriteMask(target, maskData); + } else if (this.enableScissor && !this.scissor && this.renderer._activeRenderTarget.root && !this.renderer.stencilManager.stencilMaskStack.length && maskData.isFastRect()) { + var matrix = maskData.worldTransform; + + var rot = Math.atan2(matrix.b, matrix.a); + + // use the nearest degree! + rot = Math.round(rot * (180 / Math.PI)); + + if (rot % 90) { + this.pushStencilMask(maskData); + } else { + this.pushScissorMask(target, maskData); + } + } else { + this.pushStencilMask(maskData); + } + }; + + /** + * Removes the last mask from the mask stack and doesn't return it. + * + * @param {PIXI.DisplayObject} target - Display Object to pop the mask from + * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data. + */ + + + MaskManager.prototype.popMask = function popMask(target, maskData) { + if (maskData.texture) { + this.popSpriteMask(target, maskData); + } else if (this.enableScissor && !this.renderer.stencilManager.stencilMaskStack.length) { + this.popScissorMask(target, maskData); + } else { + this.popStencilMask(target, maskData); + } + }; + + /** + * Applies the Mask and adds it to the current filter stack. + * + * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to + * @param {PIXI.Sprite} maskData - Sprite to be used as the mask + */ + + + MaskManager.prototype.pushSpriteMask = function pushSpriteMask(target, maskData) { + var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; + + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new _SpriteMaskFilter2.default(maskData)]; + } + + alphaMaskFilter[0].resolution = this.renderer.resolution; + alphaMaskFilter[0].maskSprite = maskData; + + var stashFilterArea = target.filterArea; + + target.filterArea = maskData.getBounds(true); + this.renderer.filterManager.pushFilter(target, alphaMaskFilter); + target.filterArea = stashFilterArea; + + this.alphaMaskIndex++; + }; + + /** + * Removes the last filter from the filter stack and doesn't return it. + * + */ + + + MaskManager.prototype.popSpriteMask = function popSpriteMask() { + this.renderer.filterManager.popFilter(); + this.alphaMaskIndex--; + }; + + /** + * Applies the Mask and adds it to the current filter stack. + * + * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data. + */ + + + MaskManager.prototype.pushStencilMask = function pushStencilMask(maskData) { + this.renderer.currentRenderer.stop(); + this.renderer.stencilManager.pushStencil(maskData); + }; + + /** + * Removes the last filter from the filter stack and doesn't return it. + * + */ + + + MaskManager.prototype.popStencilMask = function popStencilMask() { + this.renderer.currentRenderer.stop(); + this.renderer.stencilManager.popStencil(); + }; + + /** + * + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.Graphics} maskData - The masking data. + */ + + + MaskManager.prototype.pushScissorMask = function pushScissorMask(target, maskData) { + maskData.renderable = true; + + var renderTarget = this.renderer._activeRenderTarget; + + var bounds = maskData.getBounds(); + + bounds.fit(renderTarget.size); + maskData.renderable = false; + + this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST); + + var resolution = this.renderer.resolution; + + this.renderer.gl.scissor(bounds.x * resolution, (renderTarget.root ? renderTarget.size.height - bounds.y - bounds.height : bounds.y) * resolution, bounds.width * resolution, bounds.height * resolution); + + this.scissorRenderTarget = renderTarget; + this.scissorData = maskData; + this.scissor = true; + }; + + /** + * + * + */ + + + MaskManager.prototype.popScissorMask = function popScissorMask() { + this.scissorRenderTarget = null; + this.scissorData = null; + this.scissor = false; + + // must be scissor! + var gl = this.renderer.gl; + + gl.disable(gl.SCISSOR_TEST); + }; + + return MaskManager; + }(_WebGLManager3.default); + + exports.default = MaskManager; + + }, { "../filters/spriteMask/SpriteMaskFilter": 89, "./WebGLManager": 93 }], 92: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLManager2 = require('./WebGLManager'); + + var _WebGLManager3 = _interopRequireDefault(_WebGLManager2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @class + * @extends PIXI.WebGLManager + * @memberof PIXI + */ + var StencilManager = function (_WebGLManager) { + _inherits(StencilManager, _WebGLManager); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for. + */ + function StencilManager(renderer) { + _classCallCheck(this, StencilManager); + + var _this = _possibleConstructorReturn(this, _WebGLManager.call(this, renderer)); + + _this.stencilMaskStack = null; + return _this; + } + + /** + * Changes the mask stack that is used by this manager. + * + * @param {PIXI.Graphics[]} stencilMaskStack - The mask stack + */ + + + StencilManager.prototype.setMaskStack = function setMaskStack(stencilMaskStack) { + this.stencilMaskStack = stencilMaskStack; + + var gl = this.renderer.gl; + + if (stencilMaskStack.length === 0) { + gl.disable(gl.STENCIL_TEST); + } else { + gl.enable(gl.STENCIL_TEST); + } + }; + + /** + * Applies the Mask and adds it to the current stencil stack. @alvin + * + * @param {PIXI.Graphics} graphics - The mask + */ + + + StencilManager.prototype.pushStencil = function pushStencil(graphics) { + this.renderer.setObjectRenderer(this.renderer.plugins.graphics); + + this.renderer._activeRenderTarget.attachStencilBuffer(); + + var gl = this.renderer.gl; + var prevMaskCount = this.stencilMaskStack.length; + + if (prevMaskCount === 0) { + gl.enable(gl.STENCIL_TEST); + } + + this.stencilMaskStack.push(graphics); + + // Increment the reference stencil value where the new mask overlaps with the old ones. + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask()); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + this.renderer.plugins.graphics.render(graphics); + + this._useCurrent(); + }; + + /** + * Removes the last mask from the stencil stack. @alvin + */ + + + StencilManager.prototype.popStencil = function popStencil() { + this.renderer.setObjectRenderer(this.renderer.plugins.graphics); + + var gl = this.renderer.gl; + var graphics = this.stencilMaskStack.pop(); + + if (this.stencilMaskStack.length === 0) { + // the stack is empty! + gl.disable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.clearStencil(0); + } else { + // Decrement the reference stencil value where the popped mask overlaps with the other ones + gl.colorMask(false, false, false, false); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); + this.renderer.plugins.graphics.render(graphics); + + this._useCurrent(); + } + }; + + /** + * Setup renderer to use the current stencil data. + */ + + + StencilManager.prototype._useCurrent = function _useCurrent() { + var gl = this.renderer.gl; + + gl.colorMask(true, true, true, true); + gl.stencilFunc(gl.EQUAL, this.stencilMaskStack.length, this._getBitwiseMask()); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + }; + + /** + * Fill 1s equal to the number of acitve stencil masks. + * + * @return {number} The bitwise mask. + */ + + + StencilManager.prototype._getBitwiseMask = function _getBitwiseMask() { + return (1 << this.stencilMaskStack.length) - 1; + }; + + /** + * Destroys the mask stack. + * + */ + + + StencilManager.prototype.destroy = function destroy() { + _WebGLManager3.default.prototype.destroy.call(this); + + this.stencilMaskStack.stencilStack = null; + }; + + return StencilManager; + }(_WebGLManager3.default); + + exports.default = StencilManager; + + }, { "./WebGLManager": 93 }], 93: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @class + * @memberof PIXI + */ + var WebGLManager = function () { + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for. + */ + function WebGLManager(renderer) { + _classCallCheck(this, WebGLManager); + + /** + * The renderer this manager works for. + * + * @member {PIXI.WebGLRenderer} + */ + this.renderer = renderer; + + this.renderer.on('context', this.onContextChange, this); + } + + /** + * Generic method called when there is a WebGL context change. + * + */ + + + WebGLManager.prototype.onContextChange = function onContextChange() { } + // do some codes init! + + + /** + * Generic destroy methods to be overridden by the subclass + * + */ + ; + + WebGLManager.prototype.destroy = function destroy() { + this.renderer.off('context', this.onContextChange, this); + + this.renderer = null; + }; + + return WebGLManager; + }(); + + exports.default = WebGLManager; + + }, {}], 94: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLManager2 = require('../managers/WebGLManager'); + + var _WebGLManager3 = _interopRequireDefault(_WebGLManager2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * Base for a common object renderer that can be used as a system renderer plugin. + * + * @class + * @extends PIXI.WebGLManager + * @memberof PIXI + */ + var ObjectRenderer = function (_WebGLManager) { + _inherits(ObjectRenderer, _WebGLManager); + + function ObjectRenderer() { + _classCallCheck(this, ObjectRenderer); + + return _possibleConstructorReturn(this, _WebGLManager.apply(this, arguments)); + } + + /** + * Starts the renderer and sets the shader + * + */ + ObjectRenderer.prototype.start = function start() { } + // set the shader.. + + + /** + * Stops the renderer + * + */ + ; + + ObjectRenderer.prototype.stop = function stop() { + this.flush(); + }; + + /** + * Stub method for rendering content and emptying the current batch. + * + */ + + + ObjectRenderer.prototype.flush = function flush() { } + // flush! + + + /** + * Renders an object + * + * @param {PIXI.DisplayObject} object - The object to render. + */ + ; + + ObjectRenderer.prototype.render = function render(object) // eslint-disable-line no-unused-vars + { + // render the object + }; + + return ObjectRenderer; + }(_WebGLManager3.default); + + exports.default = ObjectRenderer; + + }, { "../managers/WebGLManager": 93 }], 95: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + var _createIndicesForQuads = require('../../../utils/createIndicesForQuads'); + + var _createIndicesForQuads2 = _interopRequireDefault(_createIndicesForQuads); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Helper class to create a quad + * + * @class + * @memberof PIXI + */ + var Quad = function () { + /** + * @param {WebGLRenderingContext} gl - The gl context for this quad to use. + * @param {object} state - TODO: Description + */ + function Quad(gl, state) { + _classCallCheck(this, Quad); + + /** + * the current WebGL drawing context + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + /** + * An array of vertices + * + * @member {Float32Array} + */ + this.vertices = new Float32Array([-1, -1, 1, -1, 1, 1, -1, 1]); + + /** + * The Uvs of the quad + * + * @member {Float32Array} + */ + this.uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]); + + this.interleaved = new Float32Array(8 * 2); + + for (var i = 0; i < 4; i++) { + this.interleaved[i * 4] = this.vertices[i * 2]; + this.interleaved[i * 4 + 1] = this.vertices[i * 2 + 1]; + this.interleaved[i * 4 + 2] = this.uvs[i * 2]; + this.interleaved[i * 4 + 3] = this.uvs[i * 2 + 1]; + } + + /** + * An array containing the indices of the vertices + * + * @member {Uint16Array} + */ + this.indices = (0, _createIndicesForQuads2.default)(1); + + /** + * The vertex buffer + * + * @member {glCore.GLBuffer} + */ + this.vertexBuffer = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, this.interleaved, gl.STATIC_DRAW); + + /** + * The index buffer + * + * @member {glCore.GLBuffer} + */ + this.indexBuffer = _pixiGlCore2.default.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW); + + /** + * The vertex array object + * + * @member {glCore.VertexArrayObject} + */ + this.vao = new _pixiGlCore2.default.VertexArrayObject(gl, state); + } + + /** + * Initialises the vaos and uses the shader. + * + * @param {PIXI.Shader} shader - the shader to use + */ + + + Quad.prototype.initVao = function initVao(shader) { + this.vao.clear().addIndex(this.indexBuffer).addAttribute(this.vertexBuffer, shader.attributes.aVertexPosition, this.gl.FLOAT, false, 4 * 4, 0).addAttribute(this.vertexBuffer, shader.attributes.aTextureCoord, this.gl.FLOAT, false, 4 * 4, 2 * 4); + }; + + /** + * Maps two Rectangle to the quad. + * + * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle + * @param {PIXI.Rectangle} destinationFrame - the second rectangle + * @return {PIXI.Quad} Returns itself. + */ + + + Quad.prototype.map = function map(targetTextureFrame, destinationFrame) { + var x = 0; // destinationFrame.x / targetTextureFrame.width; + var y = 0; // destinationFrame.y / targetTextureFrame.height; + + this.uvs[0] = x; + this.uvs[1] = y; + + this.uvs[2] = x + destinationFrame.width / targetTextureFrame.width; + this.uvs[3] = y; + + this.uvs[4] = x + destinationFrame.width / targetTextureFrame.width; + this.uvs[5] = y + destinationFrame.height / targetTextureFrame.height; + + this.uvs[6] = x; + this.uvs[7] = y + destinationFrame.height / targetTextureFrame.height; + + x = destinationFrame.x; + y = destinationFrame.y; + + this.vertices[0] = x; + this.vertices[1] = y; + + this.vertices[2] = x + destinationFrame.width; + this.vertices[3] = y; + + this.vertices[4] = x + destinationFrame.width; + this.vertices[5] = y + destinationFrame.height; + + this.vertices[6] = x; + this.vertices[7] = y + destinationFrame.height; + + return this; + }; + + /** + * Binds the buffer and uploads the data + * + * @return {PIXI.Quad} Returns itself. + */ + + + Quad.prototype.upload = function upload() { + for (var i = 0; i < 4; i++) { + this.interleaved[i * 4] = this.vertices[i * 2]; + this.interleaved[i * 4 + 1] = this.vertices[i * 2 + 1]; + this.interleaved[i * 4 + 2] = this.uvs[i * 2]; + this.interleaved[i * 4 + 3] = this.uvs[i * 2 + 1]; + } + + this.vertexBuffer.upload(this.interleaved); + + return this; + }; + + /** + * Removes this quad from WebGL + */ + + + Quad.prototype.destroy = function destroy() { + var gl = this.gl; + + gl.deleteBuffer(this.vertexBuffer); + gl.deleteBuffer(this.indexBuffer); + }; + + return Quad; + }(); + + exports.default = Quad; + + }, { "../../../utils/createIndicesForQuads": 123, "pixi-gl-core": 15 }], 96: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _math = require('../../../math'); + + var _const = require('../../../const'); + + var _settings = require('../../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _pixiGlCore = require('pixi-gl-core'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @class + * @memberof PIXI + */ + var RenderTarget = function () { + /** + * @param {WebGLRenderingContext} gl - The current WebGL drawing context + * @param {number} [width=0] - the horizontal range of the filter + * @param {number} [height=0] - the vertical range of the filter + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [resolution=1] - The current resolution / device pixel ratio + * @param {boolean} [root=false] - Whether this object is the root element or not + */ + function RenderTarget(gl, width, height, scaleMode, resolution, root) { + _classCallCheck(this, RenderTarget); + + // TODO Resolution could go here ( eg low res blurs ) + + /** + * The current WebGL drawing context. + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + // next time to create a frame buffer and texture + + /** + * A frame buffer + * + * @member {PIXI.glCore.GLFramebuffer} + */ + this.frameBuffer = null; + + /** + * The texture + * + * @member {PIXI.glCore.GLTexture} + */ + this.texture = null; + + /** + * The background colour of this render target, as an array of [r,g,b,a] values + * + * @member {number[]} + */ + this.clearColor = [0, 0, 0, 0]; + + /** + * The size of the object as a rectangle + * + * @member {PIXI.Rectangle} + */ + this.size = new _math.Rectangle(0, 0, 1, 1); + + /** + * The current resolution / device pixel ratio + * + * @member {number} + * @default 1 + */ + this.resolution = resolution || _settings2.default.RESOLUTION; + + /** + * The projection matrix + * + * @member {PIXI.Matrix} + */ + this.projectionMatrix = new _math.Matrix(); + + /** + * The object's transform + * + * @member {PIXI.Matrix} + */ + this.transform = null; + + /** + * The frame. + * + * @member {PIXI.Rectangle} + */ + this.frame = null; + + /** + * The stencil buffer stores masking data for the render target + * + * @member {glCore.GLBuffer} + */ + this.defaultFrame = new _math.Rectangle(); + this.destinationFrame = null; + this.sourceFrame = null; + + /** + * The stencil buffer stores masking data for the render target + * + * @member {glCore.GLBuffer} + */ + this.stencilBuffer = null; + + /** + * The data structure for the stencil masks + * + * @member {PIXI.Graphics[]} + */ + this.stencilMaskStack = []; + + /** + * Stores filter data for the render target + * + * @member {object[]} + */ + this.filterData = null; + + /** + * The key for pooled texture of FilterSystem + * @private + * @member {string} + */ + this.filterPoolKey = ''; + + /** + * The scale mode. + * + * @member {number} + * @default PIXI.settings.SCALE_MODE + * @see PIXI.SCALE_MODES + */ + this.scaleMode = scaleMode !== undefined ? scaleMode : _settings2.default.SCALE_MODE; + + /** + * Whether this object is the root element or not + * + * @member {boolean} + * @default false + */ + this.root = root || false; + + if (!this.root) { + this.frameBuffer = _pixiGlCore.GLFramebuffer.createRGBA(gl, 100, 100); + + if (this.scaleMode === _const.SCALE_MODES.NEAREST) { + this.frameBuffer.texture.enableNearestScaling(); + } else { + this.frameBuffer.texture.enableLinearScaling(); + } + /* + A frame buffer needs a target to render to.. + create a texture and bind it attach it to the framebuffer.. + */ + + // this is used by the base texture + this.texture = this.frameBuffer.texture; + } else { + // make it a null framebuffer.. + this.frameBuffer = new _pixiGlCore.GLFramebuffer(gl, 100, 100); + this.frameBuffer.framebuffer = null; + } + + this.setFrame(); + + this.resize(width, height); + } + + /** + * Clears the filter texture. + * + * @param {number[]} [clearColor=this.clearColor] - Array of [r,g,b,a] to clear the framebuffer + */ + + + RenderTarget.prototype.clear = function clear(clearColor) { + var cc = clearColor || this.clearColor; + + this.frameBuffer.clear(cc[0], cc[1], cc[2], cc[3]); // r,g,b,a); + }; + + /** + * Binds the stencil buffer. + * + */ + + + RenderTarget.prototype.attachStencilBuffer = function attachStencilBuffer() { + // TODO check if stencil is done? + /** + * The stencil buffer is used for masking in pixi + * lets create one and then add attach it to the framebuffer.. + */ + if (!this.root) { + this.frameBuffer.enableStencil(); + } + }; + + /** + * Sets the frame of the render target. + * + * @param {Rectangle} destinationFrame - The destination frame. + * @param {Rectangle} sourceFrame - The source frame. + */ + + + RenderTarget.prototype.setFrame = function setFrame(destinationFrame, sourceFrame) { + this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; + this.sourceFrame = sourceFrame || this.sourceFrame || this.destinationFrame; + }; + + /** + * Binds the buffers and initialises the viewport. + * + */ + + + RenderTarget.prototype.activate = function activate() { + // TODO refactor usage of frame.. + var gl = this.gl; + + // make sure the texture is unbound! + this.frameBuffer.bind(); + + this.calculateProjection(this.destinationFrame, this.sourceFrame); + + if (this.transform) { + this.projectionMatrix.append(this.transform); + } + + // TODO add a check as them may be the same! + if (this.destinationFrame !== this.sourceFrame) { + gl.enable(gl.SCISSOR_TEST); + gl.scissor(this.destinationFrame.x | 0, this.destinationFrame.y | 0, this.destinationFrame.width * this.resolution | 0, this.destinationFrame.height * this.resolution | 0); + } else { + gl.disable(gl.SCISSOR_TEST); + } + + // TODO - does not need to be updated all the time?? + gl.viewport(this.destinationFrame.x | 0, this.destinationFrame.y | 0, this.destinationFrame.width * this.resolution | 0, this.destinationFrame.height * this.resolution | 0); + }; + + /** + * Updates the projection matrix based on a projection frame (which is a rectangle) + * + * @param {Rectangle} destinationFrame - The destination frame. + * @param {Rectangle} sourceFrame - The source frame. + */ + + + RenderTarget.prototype.calculateProjection = function calculateProjection(destinationFrame, sourceFrame) { + var pm = this.projectionMatrix; + + sourceFrame = sourceFrame || destinationFrame; + + pm.identity(); + + // TODO: make dest scale source + if (!this.root) { + pm.a = 1 / destinationFrame.width * 2; + pm.d = 1 / destinationFrame.height * 2; + + pm.tx = -1 - sourceFrame.x * pm.a; + pm.ty = -1 - sourceFrame.y * pm.d; + } else { + pm.a = 1 / destinationFrame.width * 2; + pm.d = -1 / destinationFrame.height * 2; + + pm.tx = -1 - sourceFrame.x * pm.a; + pm.ty = 1 - sourceFrame.y * pm.d; + } + }; + + /** + * Resizes the texture to the specified width and height + * + * @param {number} width - the new width of the texture + * @param {number} height - the new height of the texture + */ + + + RenderTarget.prototype.resize = function resize(width, height) { + width = width | 0; + height = height | 0; + + if (this.size.width === width && this.size.height === height) { + return; + } + + this.size.width = width; + this.size.height = height; + + this.defaultFrame.width = width; + this.defaultFrame.height = height; + + this.frameBuffer.resize(width * this.resolution, height * this.resolution); + + var projectionFrame = this.frame || this.size; + + this.calculateProjection(projectionFrame); + }; + + /** + * Destroys the render target. + * + */ + + + RenderTarget.prototype.destroy = function destroy() { + if (this.frameBuffer.stencil) { + this.gl.deleteRenderbuffer(this.frameBuffer.stencil); + } + this.frameBuffer.destroy(); + + this.frameBuffer = null; + this.texture = null; + }; + + return RenderTarget; + }(); + + exports.default = RenderTarget; + + }, { "../../../const": 46, "../../../math": 70, "../../../settings": 101, "pixi-gl-core": 15 }], 97: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = checkMaxIfStatmentsInShader; + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var fragTemplate = ['precision mediump float;', 'void main(void){', 'float test = 0.1;', '%forloop%', 'gl_FragColor = vec4(0.0);', '}'].join('\n'); + + function checkMaxIfStatmentsInShader(maxIfs, gl) { + var createTempContext = !gl; + + if (maxIfs === 0) { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + if (createTempContext) { + var tinyCanvas = document.createElement('canvas'); + + tinyCanvas.width = 1; + tinyCanvas.height = 1; + + gl = _pixiGlCore2.default.createContext(tinyCanvas); + } + + var shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + maxIfs = maxIfs / 2 | 0; + } else { + // valid! + break; + } + } + + if (createTempContext) { + // get rid of context + if (gl.getExtension('WEBGL_lose_context')) { + gl.getExtension('WEBGL_lose_context').loseContext(); + } + } + + return maxIfs; + } + + function generateIfTestSrc(maxIfs) { + var src = ''; + + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + + if (i < maxIfs - 1) { + src += 'if(test == ' + i + '.0){}'; + } + } + + return src; + } + + }, { "pixi-gl-core": 15 }], 98: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = mapWebGLBlendModesToPixi; + + var _const = require('../../../const'); + + /** + * Maps gl blend combinations to WebGL. + * + * @memberof PIXI + * @function mapWebGLBlendModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {string[]} [array=[]] - The array to output into. + * @return {string[]} Mapped modes. + */ + function mapWebGLBlendModesToPixi(gl) { + var array = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + // TODO - premultiply alpha would be different. + // add a boolean for that! + array[_const.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; + array[_const.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + + // not-premultiplied blend modes + array[_const.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[_const.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; + array[_const.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + + return array; + } + + }, { "../../../const": 46 }], 99: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = mapWebGLDrawModesToPixi; + + var _const = require('../../../const'); + + /** + * Generic Mask Stack data structure. + * + * @memberof PIXI + * @function mapWebGLDrawModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The current WebGL drawing context + * @param {object} [object={}] - The object to map into + * @return {object} The mapped draw modes. + */ + function mapWebGLDrawModesToPixi(gl) { + var object = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + object[_const.DRAW_MODES.POINTS] = gl.POINTS; + object[_const.DRAW_MODES.LINES] = gl.LINES; + object[_const.DRAW_MODES.LINE_LOOP] = gl.LINE_LOOP; + object[_const.DRAW_MODES.LINE_STRIP] = gl.LINE_STRIP; + object[_const.DRAW_MODES.TRIANGLES] = gl.TRIANGLES; + object[_const.DRAW_MODES.TRIANGLE_STRIP] = gl.TRIANGLE_STRIP; + object[_const.DRAW_MODES.TRIANGLE_FAN] = gl.TRIANGLE_FAN; + + return object; + } + + }, { "../../../const": 46 }], 100: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = validateContext; + function validateContext(gl) { + var attributes = gl.getContextAttributes(); + + // this is going to be fairly simple for now.. but at least we have room to grow! + if (!attributes.stencil) { + /* eslint-disable no-console */ + console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); + /* eslint-enable no-console */ + } + } + + }, {}], 101: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _maxRecommendedTextures = require('./utils/maxRecommendedTextures'); + + var _maxRecommendedTextures2 = _interopRequireDefault(_maxRecommendedTextures); + + var _canUploadSameBuffer = require('./utils/canUploadSameBuffer'); + + var _canUploadSameBuffer2 = _interopRequireDefault(_canUploadSameBuffer); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ + exports.default = { + + /** + * Target frames per millisecond. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 0.06 + */ + TARGET_FPMS: 0.06, + + /** + * If set to true WebGL will attempt make textures mimpaped by default. + * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. + * + * @static + * @memberof PIXI.settings + * @type {boolean} + * @default true + */ + MIPMAP_TEXTURES: true, + + /** + * Default resolution / device pixel ratio of the renderer. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + RESOLUTION: 1, + + /** + * Default filter resolution. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + FILTER_RESOLUTION: 1, + + /** + * The maximum textures that this device supports. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 32 + */ + SPRITE_MAX_TEXTURES: (0, _maxRecommendedTextures2.default)(32), + + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + + /** + * The default sprite batch size. + * + * The default aims to balance desktop and mobile devices. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 4096 + */ + SPRITE_BATCH_SIZE: 4096, + + /** + * The prefix that denotes a URL is for a retina asset. + * + * @static + * @memberof PIXI.settings + * @type {RegExp} + * @example `@2x` + * @default /@([0-9\.]+)x/ + */ + RETINA_PREFIX: /@([0-9\.]+)x/, + + /** + * The default render options if none are supplied to {@link PIXI.WebGLRenderer} + * or {@link PIXI.CanvasRenderer}. + * + * @static + * @constant + * @memberof PIXI.settings + * @type {object} + * @property {HTMLCanvasElement} view=null + * @property {number} resolution=1 + * @property {boolean} antialias=false + * @property {boolean} forceFXAA=false + * @property {boolean} autoResize=false + * @property {boolean} transparent=false + * @property {number} backgroundColor=0x000000 + * @property {boolean} clearBeforeRender=true + * @property {boolean} preserveDrawingBuffer=false + * @property {boolean} roundPixels=false + * @property {number} width=800 + * @property {number} height=600 + * @property {boolean} legacy=false + */ + RENDER_OPTIONS: { + view: null, + antialias: false, + forceFXAA: false, + autoResize: false, + transparent: false, + backgroundColor: 0x000000, + clearBeforeRender: true, + preserveDrawingBuffer: false, + roundPixels: false, + width: 800, + height: 600, + legacy: false + }, + + /** + * Default transform type. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.TRANSFORM_MODE} + * @default PIXI.TRANSFORM_MODE.STATIC + */ + TRANSFORM_MODE: 0, + + /** + * Default Garbage Collection mode. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.GC_MODES} + * @default PIXI.GC_MODES.AUTO + */ + GC_MODE: 0, + + /** + * Default Garbage Collection max idle. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + + /** + * Default Garbage Collection maximum check count. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + + /** + * Default wrap modes that are supported by pixi. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.WRAP_MODES} + * @default PIXI.WRAP_MODES.CLAMP + */ + WRAP_MODE: 0, + + /** + * The scale modes that are supported by pixi. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.SCALE_MODES} + * @default PIXI.SCALE_MODES.LINEAR + */ + SCALE_MODE: 0, + + /** + * Default specify float precision in vertex shader. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.HIGH + */ + PRECISION_VERTEX: 'highp', + + /** + * Default specify float precision in fragment shader. + * + * @static + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.MEDIUM + */ + PRECISION_FRAGMENT: 'mediump', + + /** + * Can we upload the same buffer in a single frame? + * + * @static + * @constant + * @memberof PIXI.settings + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: (0, _canUploadSameBuffer2.default)(), + + /** + * Default Mesh `canvasPadding`. + * + * @see PIXI.mesh.Mesh#canvasPadding + * @static + * @constant + * @memberof PIXI.settings + * @type {number} + */ + MESH_CANVAS_PADDING: 0 + }; + + }, { "./utils/canUploadSameBuffer": 122, "./utils/maxRecommendedTextures": 127 }], 102: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _math = require('../math'); + + var _utils = require('../utils'); + + var _const = require('../const'); + + var _Texture = require('../textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + var _Container2 = require('../display/Container'); + + var _Container3 = _interopRequireDefault(_Container2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var tempPoint = new _math.Point(); + + /** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = new PIXI.Sprite.fromImage('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * + * ```js + * PIXI.loader.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + + var Sprite = function (_Container) { + _inherits(Sprite, _Container); + + /** + * @param {PIXI.Texture} texture - The texture for this sprite + */ + function Sprite(texture) { + _classCallCheck(this, Sprite); + + /** + * The anchor sets the origin point of the texture. + * The default is 0,0 or taken from the {@link PIXI.Texture#defaultAnchor|Texture} + * passed to the constructor. A value of 0,0 means the texture's origin is the top left. + * Setting the anchor to 0.5,0.5 means the texture's origin is centered. + * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner. + * Note: Updating the {@link PIXI.Texture#defaultAnchor} after a Texture is + * created does _not_ update the Sprite's anchor values. + * + * @member {PIXI.ObservablePoint} + * @private + */ + var _this = _possibleConstructorReturn(this, _Container.call(this)); + + _this._anchor = new _math.ObservablePoint(_this._onAnchorUpdate, _this, texture ? texture.defaultAnchor.x : 0, texture ? texture.defaultAnchor.y : 0); + + /** + * The texture that the sprite is using + * + * @private + * @member {PIXI.Texture} + */ + _this._texture = null; + + /** + * The width of the sprite (this is initially set by the texture) + * + * @private + * @member {number} + */ + _this._width = 0; + + /** + * The height of the sprite (this is initially set by the texture) + * + * @private + * @member {number} + */ + _this._height = 0; + + /** + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 0xFFFFFF + */ + _this._tint = null; + _this._tintRGB = null; + _this.tint = 0xFFFFFF; + + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + _this.blendMode = _const.BLEND_MODES.NORMAL; + + /** + * The shader that will be used to render the sprite. Set to null to remove a current shader. + * + * @member {PIXI.Filter|PIXI.Shader} + */ + _this.shader = null; + + /** + * An internal cached value of the tint. + * + * @private + * @member {number} + * @default 0xFFFFFF + */ + _this.cachedTint = 0xFFFFFF; + + // call texture setter + _this.texture = texture || _Texture2.default.EMPTY; + + /** + * this is used to store the vertex data of the sprite (basically a quad) + * + * @private + * @member {Float32Array} + */ + _this.vertexData = new Float32Array(8); + + /** + * This is used to calculate the bounds of the object IF it is a trimmed sprite + * + * @private + * @member {Float32Array} + */ + _this.vertexTrimmedData = null; + + _this._transformID = -1; + _this._textureID = -1; + + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; + + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_renderWebGL' & '_renderCanvas' methods. + * + * @member {string} + * @default 'sprite' + */ + _this.pluginName = 'sprite'; + return _this; + } + + /** + * When the texture is updated, this event will fire to update the scale and frame + * + * @private + */ + + + Sprite.prototype._onTextureUpdate = function _onTextureUpdate() { + this._textureID = -1; + this._textureTrimmedID = -1; + this.cachedTint = 0xFFFFFF; + + // so if _width is 0 then width was not set.. + if (this._width) { + this.scale.x = (0, _utils.sign)(this.scale.x) * this._width / this._texture.orig.width; + } + + if (this._height) { + this.scale.y = (0, _utils.sign)(this.scale.y) * this._height / this._texture.orig.height; + } + }; + + /** + * Called when the anchor position updates. + * + * @private + */ + + + Sprite.prototype._onAnchorUpdate = function _onAnchorUpdate() { + this._transformID = -1; + this._transformTrimmedID = -1; + }; + + /** + * calculates worldTransform * vertices, store it in vertexData + */ + + + Sprite.prototype.calculateVertices = function calculateVertices() { + if (this._transformID === this.transform._worldID && this._textureID === this._texture._updateID) { + return; + } + + this._transformID = this.transform._worldID; + this._textureID = this._texture._updateID; + + // set the vertex data + + var texture = this._texture; + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + var trim = texture.trim; + var orig = texture.orig; + var anchor = this._anchor; + + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the extra + // space before transforming the sprite coords. + w1 = trim.x - anchor._x * orig.width; + w0 = w1 + trim.width; + + h1 = trim.y - anchor._y * orig.height; + h0 = h1 + trim.height; + } else { + w1 = -anchor._x * orig.width; + w0 = w1 + orig.width; + + h1 = -anchor._y * orig.height; + h0 = h1 + orig.height; + } + + // xy + vertexData[0] = a * w1 + c * h1 + tx; + vertexData[1] = d * h1 + b * w1 + ty; + + // xy + vertexData[2] = a * w0 + c * h1 + tx; + vertexData[3] = d * h1 + b * w0 + ty; + + // xy + vertexData[4] = a * w0 + c * h0 + tx; + vertexData[5] = d * h0 + b * w0 + ty; + + // xy + vertexData[6] = a * w1 + c * h0 + tx; + vertexData[7] = d * h0 + b * w1 + ty; + }; + + /** + * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData + * This is used to ensure that the true width and height of a trimmed texture is respected + */ + + + Sprite.prototype.calculateTrimmedVertices = function calculateTrimmedVertices() { + if (!this.vertexTrimmedData) { + this.vertexTrimmedData = new Float32Array(8); + } else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { + return; + } + + this._transformTrimmedID = this.transform._worldID; + this._textureTrimmedID = this._texture._updateID; + + // lets do some special trim code! + var texture = this._texture; + var vertexData = this.vertexTrimmedData; + var orig = texture.orig; + var anchor = this._anchor; + + // lets calculate the new untrimmed bounds.. + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + + var w1 = -anchor._x * orig.width; + var w0 = w1 + orig.width; + + var h1 = -anchor._y * orig.height; + var h0 = h1 + orig.height; + + // xy + vertexData[0] = a * w1 + c * h1 + tx; + vertexData[1] = d * h1 + b * w1 + ty; + + // xy + vertexData[2] = a * w0 + c * h1 + tx; + vertexData[3] = d * h1 + b * w0 + ty; + + // xy + vertexData[4] = a * w0 + c * h0 + tx; + vertexData[5] = d * h0 + b * w0 + ty; + + // xy + vertexData[6] = a * w1 + c * h0 + tx; + vertexData[7] = d * h0 + b * w1 + ty; + }; + + /** + * + * Renders the object using the WebGL renderer + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The webgl renderer to use. + */ + + + Sprite.prototype._renderWebGL = function _renderWebGL(renderer) { + this.calculateVertices(); + + renderer.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + + + Sprite.prototype._renderCanvas = function _renderCanvas(renderer) { + renderer.plugins[this.pluginName].render(this); + }; + + /** + * Updates the bounds of the sprite. + * + * @private + */ + + + Sprite.prototype._calculateBounds = function _calculateBounds() { + var trim = this._texture.trim; + var orig = this._texture.orig; + + // First lets check to see if the current texture has a trim.. + if (!trim || trim.width === orig.width && trim.height === orig.height) { + // no trim! lets use the usual calculations.. + this.calculateVertices(); + this._bounds.addQuad(this.vertexData); + } else { + // lets calculate a special trimmed bounds... + this.calculateTrimmedVertices(); + this._bounds.addQuad(this.vertexTrimmedData); + } + }; + + /** + * Gets the local bounds of the sprite object. + * + * @param {PIXI.Rectangle} rect - The output rectangle. + * @return {PIXI.Rectangle} The bounds. + */ + + + Sprite.prototype.getLocalBounds = function getLocalBounds(rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + this._bounds.minX = this._texture.orig.width * -this._anchor._x; + this._bounds.minY = this._texture.orig.height * -this._anchor._y; + this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x); + this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y); + + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new _math.Rectangle(); + } + + rect = this._localBoundsRect; + } + + return this._bounds.getRectangle(rect); + } + + return _Container.prototype.getLocalBounds.call(this, rect); + }; + + /** + * Tests if a point is inside this sprite + * + * @param {PIXI.Point} point - the point to test + * @return {boolean} the result of the test + */ + + + Sprite.prototype.containsPoint = function containsPoint(point) { + this.worldTransform.applyInverse(point, tempPoint); + + var width = this._texture.orig.width; + var height = this._texture.orig.height; + var x1 = -width * this.anchor.x; + var y1 = 0; + + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + y1 = -height * this.anchor.y; + + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + + return false; + }; + + /** + * Destroys this sprite and optionally its texture and children + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + + + Sprite.prototype.destroy = function destroy(options) { + _Container.prototype.destroy.call(this, options); + + this._texture.off('update', this._onTextureUpdate, this); + + this._anchor = null; + + var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; + + if (destroyTexture) { + var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; + + this._texture.destroy(!!destroyBaseTexture); + } + + this._texture = null; + this.shader = null; + }; + + // some helper functions.. + + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from + * @return {PIXI.Sprite} The newly created sprite + */ + + + Sprite.from = function from(source) { + return new Sprite(_Texture2.default.from(source)); + }; + + /** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param {string} frameId - The frame Id of the texture in the cache + * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the frameId + */ + + + Sprite.fromFrame = function fromFrame(frameId) { + var texture = _utils.TextureCache[frameId]; + + if (!texture) { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache'); + } + + return new Sprite(texture); + }; + + /** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param {string} imageId - The image url of the texture + * @param {boolean} [crossorigin=(auto)] - if you want to specify the cross-origin parameter + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - if you want to specify the scale mode, + * see {@link PIXI.SCALE_MODES} for possible values + * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the image id + */ + + + Sprite.fromImage = function fromImage(imageId, crossorigin, scaleMode) { + return new Sprite(_Texture2.default.fromImage(imageId, crossorigin, scaleMode)); + }; + + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + + _createClass(Sprite, [{ + key: 'width', + get: function get() { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + var s = (0, _utils.sign)(this.scale.x) || 1; + + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + } + + /** + * The height of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + var s = (0, _utils.sign)(this.scale.y) || 1; + + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + } + + /** + * The anchor sets the origin point of the texture. + * The default is 0,0 or taken from the {@link PIXI.Texture|Texture} passed to the constructor. + * Setting the texture at a later point of time does not change the anchor. + * + * 0,0 means the texture's origin is the top left, 0.5,0.5 is the center, 1,1 the bottom right corner. + * + * @member {PIXI.ObservablePoint} + */ + + }, { + key: 'anchor', + get: function get() { + return this._anchor; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._anchor.copy(value); + } + + /** + * The tint applied to the sprite. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + + }, { + key: 'tint', + get: function get() { + return this._tint; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + } + + /** + * The texture that the sprite is using + * + * @member {PIXI.Texture} + */ + + }, { + key: 'texture', + get: function get() { + return this._texture; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._texture === value) { + return; + } + + this._texture = value || _Texture2.default.EMPTY; + this.cachedTint = 0xFFFFFF; + + this._textureID = -1; + this._textureTrimmedID = -1; + + if (value) { + // wait for the texture to load + if (value.baseTexture.hasLoaded) { + this._onTextureUpdate(); + } else { + value.once('update', this._onTextureUpdate, this); + } + } + } + }]); + + return Sprite; + }(_Container3.default); + + exports.default = Sprite; + + }, { "../const": 46, "../display/Container": 48, "../math": 70, "../textures/Texture": 115, "../utils": 125 }], 103: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _CanvasRenderer = require('../../renderers/canvas/CanvasRenderer'); + + var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer); + + var _const = require('../../const'); + + var _math = require('../../math'); + + var _CanvasTinter = require('./CanvasTinter'); + + var _CanvasTinter2 = _interopRequireDefault(_CanvasTinter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var canvasRenderWorldTransform = new _math.Matrix(); + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now + * share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's CanvasSpriteRenderer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java + */ + + /** + * Renderer dedicated to drawing and batching sprites. + * + * @class + * @private + * @memberof PIXI + */ + + var CanvasSpriteRenderer = function () { + /** + * @param {PIXI.WebGLRenderer} renderer -The renderer sprite this batch works for. + */ + function CanvasSpriteRenderer(renderer) { + _classCallCheck(this, CanvasSpriteRenderer); + + this.renderer = renderer; + } + + /** + * Renders the sprite object. + * + * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch + */ + + + CanvasSpriteRenderer.prototype.render = function render(sprite) { + var texture = sprite._texture; + var renderer = this.renderer; + + var width = texture._frame.width; + var height = texture._frame.height; + + var wt = sprite.transform.worldTransform; + var dx = 0; + var dy = 0; + + if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.baseTexture.source) { + return; + } + + renderer.setBlendMode(sprite.blendMode); + + // Ignore null sources + if (texture.valid) { + renderer.context.globalAlpha = sprite.worldAlpha; + + // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture + var smoothingEnabled = texture.baseTexture.scaleMode === _const.SCALE_MODES.LINEAR; + + if (renderer.smoothProperty && renderer.context[renderer.smoothProperty] !== smoothingEnabled) { + renderer.context[renderer.smoothProperty] = smoothingEnabled; + } + + if (texture.trim) { + dx = texture.trim.width / 2 + texture.trim.x - sprite.anchor.x * texture.orig.width; + dy = texture.trim.height / 2 + texture.trim.y - sprite.anchor.y * texture.orig.height; + } else { + dx = (0.5 - sprite.anchor.x) * texture.orig.width; + dy = (0.5 - sprite.anchor.y) * texture.orig.height; + } + + if (texture.rotate) { + wt.copy(canvasRenderWorldTransform); + wt = canvasRenderWorldTransform; + _math.GroupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy); + // the anchor has already been applied above, so lets set it to zero + dx = 0; + dy = 0; + } + + dx -= width / 2; + dy -= height / 2; + + // Allow for pixel rounding + if (renderer.roundPixels) { + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution | 0, wt.ty * renderer.resolution | 0); + + dx = dx | 0; + dy = dy | 0; + } else { + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + + var resolution = texture.baseTexture.resolution; + + if (sprite.tint !== 0xFFFFFF) { + if (sprite.cachedTint !== sprite.tint || sprite.tintedTexture.tintId !== sprite._texture._updateID) { + sprite.cachedTint = sprite.tint; + + // TODO clean up caching - how to clean up the caches? + sprite.tintedTexture = _CanvasTinter2.default.getTintedTexture(sprite, sprite.tint); + } + + renderer.context.drawImage(sprite.tintedTexture, 0, 0, width * resolution, height * resolution, dx * renderer.resolution, dy * renderer.resolution, width * renderer.resolution, height * renderer.resolution); + } else { + renderer.context.drawImage(texture.baseTexture.source, texture._frame.x * resolution, texture._frame.y * resolution, width * resolution, height * resolution, dx * renderer.resolution, dy * renderer.resolution, width * renderer.resolution, height * renderer.resolution); + } + } + }; + + /** + * destroy the sprite object. + * + */ + + + CanvasSpriteRenderer.prototype.destroy = function destroy() { + this.renderer = null; + }; + + return CanvasSpriteRenderer; + }(); + + exports.default = CanvasSpriteRenderer; + + + _CanvasRenderer2.default.registerPlugin('sprite', CanvasSpriteRenderer); + + }, { "../../const": 46, "../../math": 70, "../../renderers/canvas/CanvasRenderer": 77, "./CanvasTinter": 104 }], 104: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _utils = require('../../utils'); + + var _canUseNewCanvasBlendModes = require('../../renderers/canvas/utils/canUseNewCanvasBlendModes'); + + var _canUseNewCanvasBlendModes2 = _interopRequireDefault(_canUseNewCanvasBlendModes); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Utility methods for Sprite/Texture tinting. + * + * @class + * @memberof PIXI + */ + var CanvasTinter = { + /** + * Basically this method just needs a sprite and a color and tints the sprite with the given color. + * + * @memberof PIXI.CanvasTinter + * @param {PIXI.Sprite} sprite - the sprite to tint + * @param {number} color - the color to use to tint the sprite with + * @return {HTMLCanvasElement} The tinted canvas + */ + getTintedTexture: function getTintedTexture(sprite, color) { + var texture = sprite._texture; + + color = CanvasTinter.roundColor(color); + + var stringColor = '#' + ('00000' + (color | 0).toString(16)).substr(-6); + + texture.tintCache = texture.tintCache || {}; + + var cachedTexture = texture.tintCache[stringColor]; + + var canvas = void 0; + + if (cachedTexture) { + if (cachedTexture.tintId === texture._updateID) { + return texture.tintCache[stringColor]; + } + + canvas = texture.tintCache[stringColor]; + } else { + canvas = CanvasTinter.canvas || document.createElement('canvas'); + } + + CanvasTinter.tintMethod(texture, color, canvas); + + canvas.tintId = texture._updateID; + + if (CanvasTinter.convertTintToImage) { + // is this better? + var tintImage = new Image(); + + tintImage.src = canvas.toDataURL(); + + texture.tintCache[stringColor] = tintImage; + } else { + texture.tintCache[stringColor] = canvas; + // if we are not converting the texture to an image then we need to lose the reference to the canvas + CanvasTinter.canvas = null; + } + + return canvas; + }, + + /** + * Tint a texture using the 'multiply' operation. + * + * @memberof PIXI.CanvasTinter + * @param {PIXI.Texture} texture - the texture to tint + * @param {number} color - the color to use to tint the sprite with + * @param {HTMLCanvasElement} canvas - the current canvas + */ + tintWithMultiply: function tintWithMultiply(texture, color, canvas) { + var context = canvas.getContext('2d'); + var crop = texture._frame.clone(); + var resolution = texture.baseTexture.resolution; + + crop.x *= resolution; + crop.y *= resolution; + crop.width *= resolution; + crop.height *= resolution; + + canvas.width = Math.ceil(crop.width); + canvas.height = Math.ceil(crop.height); + + context.save(); + context.fillStyle = '#' + ('00000' + (color | 0).toString(16)).substr(-6); + + context.fillRect(0, 0, crop.width, crop.height); + + context.globalCompositeOperation = 'multiply'; + + context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); + + context.globalCompositeOperation = 'destination-atop'; + + context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); + context.restore(); + }, + + /** + * Tint a texture using the 'overlay' operation. + * + * @memberof PIXI.CanvasTinter + * @param {PIXI.Texture} texture - the texture to tint + * @param {number} color - the color to use to tint the sprite with + * @param {HTMLCanvasElement} canvas - the current canvas + */ + tintWithOverlay: function tintWithOverlay(texture, color, canvas) { + var context = canvas.getContext('2d'); + var crop = texture._frame.clone(); + var resolution = texture.baseTexture.resolution; + + crop.x *= resolution; + crop.y *= resolution; + crop.width *= resolution; + crop.height *= resolution; + + canvas.width = Math.ceil(crop.width); + canvas.height = Math.ceil(crop.height); + + context.save(); + context.globalCompositeOperation = 'copy'; + context.fillStyle = '#' + ('00000' + (color | 0).toString(16)).substr(-6); + context.fillRect(0, 0, crop.width, crop.height); + + context.globalCompositeOperation = 'destination-atop'; + context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); + + // context.globalCompositeOperation = 'copy'; + context.restore(); + }, + + + /** + * Tint a texture pixel per pixel. + * + * @memberof PIXI.CanvasTinter + * @param {PIXI.Texture} texture - the texture to tint + * @param {number} color - the color to use to tint the sprite with + * @param {HTMLCanvasElement} canvas - the current canvas + */ + tintWithPerPixel: function tintWithPerPixel(texture, color, canvas) { + var context = canvas.getContext('2d'); + var crop = texture._frame.clone(); + var resolution = texture.baseTexture.resolution; + + crop.x *= resolution; + crop.y *= resolution; + crop.width *= resolution; + crop.height *= resolution; + + canvas.width = Math.ceil(crop.width); + canvas.height = Math.ceil(crop.height); + + context.save(); + context.globalCompositeOperation = 'copy'; + context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height); + context.restore(); + + var rgbValues = (0, _utils.hex2rgb)(color); + var r = rgbValues[0]; + var g = rgbValues[1]; + var b = rgbValues[2]; + + var pixelData = context.getImageData(0, 0, crop.width, crop.height); + + var pixels = pixelData.data; + + for (var i = 0; i < pixels.length; i += 4) { + pixels[i + 0] *= r; + pixels[i + 1] *= g; + pixels[i + 2] *= b; + } + + context.putImageData(pixelData, 0, 0); + }, + + /** + * Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel. + * + * @memberof PIXI.CanvasTinter + * @param {number} color - the color to round, should be a hex color + * @return {number} The rounded color. + */ + roundColor: function roundColor(color) { + var step = CanvasTinter.cacheStepsPerColorChannel; + + var rgbValues = (0, _utils.hex2rgb)(color); + + rgbValues[0] = Math.min(255, rgbValues[0] / step * step); + rgbValues[1] = Math.min(255, rgbValues[1] / step * step); + rgbValues[2] = Math.min(255, rgbValues[2] / step * step); + + return (0, _utils.rgb2hex)(rgbValues); + }, + + /** + * Number of steps which will be used as a cap when rounding colors. + * + * @memberof PIXI.CanvasTinter + * @type {number} + */ + cacheStepsPerColorChannel: 8, + + /** + * Tint cache boolean flag. + * + * @memberof PIXI.CanvasTinter + * @type {boolean} + */ + convertTintToImage: false, + + /** + * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method. + * + * @memberof PIXI.CanvasTinter + * @type {boolean} + */ + canUseMultiply: (0, _canUseNewCanvasBlendModes2.default)(), + + /** + * The tinting method that will be used. + * + * @memberof PIXI.CanvasTinter + * @type {tintMethodFunctionType} + */ + tintMethod: 0 + }; + + CanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel; + + /** + * The tintMethod type. + * + * @memberof PIXI.CanvasTinter + * @callback tintMethodFunctionType + * @param texture {PIXI.Texture} the texture to tint + * @param color {number} the color to use to tint the sprite with + * @param canvas {HTMLCanvasElement} the current canvas + */ + + exports.default = CanvasTinter; + + }, { "../../renderers/canvas/utils/canUseNewCanvasBlendModes": 80, "../../utils": 125 }], 105: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @class + * @memberof PIXI + */ + var Buffer = function () { + /** + * @param {number} size - The size of the buffer in bytes. + */ + function Buffer(size) { + _classCallCheck(this, Buffer); + + this.vertices = new ArrayBuffer(size); + + /** + * View on the vertices as a Float32Array for positions + * + * @member {Float32Array} + */ + this.float32View = new Float32Array(this.vertices); + + /** + * View on the vertices as a Uint32Array for uvs + * + * @member {Float32Array} + */ + this.uint32View = new Uint32Array(this.vertices); + } + + /** + * Destroys the buffer. + * + */ + + + Buffer.prototype.destroy = function destroy() { + this.vertices = null; + this.positions = null; + this.uvs = null; + this.colors = null; + }; + + return Buffer; + }(); + + exports.default = Buffer; + + }, {}], 106: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _ObjectRenderer2 = require('../../renderers/webgl/utils/ObjectRenderer'); + + var _ObjectRenderer3 = _interopRequireDefault(_ObjectRenderer2); + + var _WebGLRenderer = require('../../renderers/webgl/WebGLRenderer'); + + var _WebGLRenderer2 = _interopRequireDefault(_WebGLRenderer); + + var _createIndicesForQuads = require('../../utils/createIndicesForQuads'); + + var _createIndicesForQuads2 = _interopRequireDefault(_createIndicesForQuads); + + var _generateMultiTextureShader = require('./generateMultiTextureShader'); + + var _generateMultiTextureShader2 = _interopRequireDefault(_generateMultiTextureShader); + + var _checkMaxIfStatmentsInShader = require('../../renderers/webgl/utils/checkMaxIfStatmentsInShader'); + + var _checkMaxIfStatmentsInShader2 = _interopRequireDefault(_checkMaxIfStatmentsInShader); + + var _BatchBuffer = require('./BatchBuffer'); + + var _BatchBuffer2 = _interopRequireDefault(_BatchBuffer); + + var _settings = require('../../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _utils = require('../../utils'); + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + var _bitTwiddle = require('bit-twiddle'); + + var _bitTwiddle2 = _interopRequireDefault(_bitTwiddle); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var TICK = 0; + var TEXTURE_TICK = 0; + + /** + * Renderer dedicated to drawing and batching sprites. + * + * @class + * @private + * @memberof PIXI + * @extends PIXI.ObjectRenderer + */ + + var SpriteRenderer = function (_ObjectRenderer) { + _inherits(SpriteRenderer, _ObjectRenderer); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this sprite batch works for. + */ + function SpriteRenderer(renderer) { + _classCallCheck(this, SpriteRenderer); + + /** + * Number of values sent in the vertex buffer. + * aVertexPosition(2), aTextureCoord(1), aColor(1), aTextureId(1) = 5 + * + * @member {number} + */ + var _this = _possibleConstructorReturn(this, _ObjectRenderer.call(this, renderer)); + + _this.vertSize = 5; + + /** + * The size of the vertex information in bytes. + * + * @member {number} + */ + _this.vertByteSize = _this.vertSize * 4; + + /** + * The number of images in the SpriteRenderer before it flushes. + * + * @member {number} + */ + _this.size = _settings2.default.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop + + // the total number of bytes in our batch + // let numVerts = this.size * 4 * this.vertByteSize; + + _this.buffers = []; + for (var i = 1; i <= _bitTwiddle2.default.nextPow2(_this.size); i *= 2) { + _this.buffers.push(new _BatchBuffer2.default(i * 4 * _this.vertByteSize)); + } + + /** + * Holds the indices of the geometry (quads) to draw + * + * @member {Uint16Array} + */ + _this.indices = (0, _createIndicesForQuads2.default)(_this.size); + + /** + * The default shaders that is used if a sprite doesn't have a more specific one. + * there is a shader for each number of textures that can be rendererd. + * These shaders will also be generated on the fly as required. + * @member {PIXI.Shader[]} + */ + _this.shader = null; + + _this.currentIndex = 0; + _this.groups = []; + + for (var k = 0; k < _this.size; k++) { + _this.groups[k] = { textures: [], textureCount: 0, ids: [], size: 0, start: 0, blend: 0 }; + } + + _this.sprites = []; + + _this.vertexBuffers = []; + _this.vaos = []; + + _this.vaoMax = 2; + _this.vertexCount = 0; + + _this.renderer.on('prerender', _this.onPrerender, _this); + return _this; + } + + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + + + SpriteRenderer.prototype.onContextChange = function onContextChange() { + var gl = this.renderer.gl; + + if (this.renderer.legacy) { + this.MAX_TEXTURES = 1; + } else { + // step 1: first check max textures the GPU can handle. + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), _settings2.default.SPRITE_MAX_TEXTURES); + + // step 2: check the maximum number of if statements the shader can have too.. + this.MAX_TEXTURES = (0, _checkMaxIfStatmentsInShader2.default)(this.MAX_TEXTURES, gl); + } + + this.shader = (0, _generateMultiTextureShader2.default)(gl, this.MAX_TEXTURES); + + // create a couple of buffers + this.indexBuffer = _pixiGlCore2.default.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW); + + // we use the second shader as the first one depending on your browser may omit aTextureId + // as it is not used by the shader so is optimized out. + + this.renderer.bindVao(null); + + var attrs = this.shader.attributes; + + for (var i = 0; i < this.vaoMax; i++) { + /* eslint-disable max-len */ + var vertexBuffer = this.vertexBuffers[i] = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW); + /* eslint-enable max-len */ + + // build the vao object that will render.. + var vao = this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(vertexBuffer, attrs.aVertexPosition, gl.FLOAT, false, this.vertByteSize, 0).addAttribute(vertexBuffer, attrs.aTextureCoord, gl.UNSIGNED_SHORT, true, this.vertByteSize, 2 * 4).addAttribute(vertexBuffer, attrs.aColor, gl.UNSIGNED_BYTE, true, this.vertByteSize, 3 * 4); + + if (attrs.aTextureId) { + vao.addAttribute(vertexBuffer, attrs.aTextureId, gl.FLOAT, false, this.vertByteSize, 4 * 4); + } + + this.vaos[i] = vao; + } + + this.vao = this.vaos[0]; + this.currentBlendMode = 99999; + + this.boundTextures = new Array(this.MAX_TEXTURES); + }; + + /** + * Called before the renderer starts rendering. + * + */ + + + SpriteRenderer.prototype.onPrerender = function onPrerender() { + this.vertexCount = 0; + }; + + /** + * Renders the sprite object. + * + * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch + */ + + + SpriteRenderer.prototype.render = function render(sprite) { + // TODO set blend modes.. + // check texture.. + if (this.currentIndex >= this.size) { + this.flush(); + } + + // get the uvs for the texture + + // if the uvs have not updated then no point rendering just yet! + if (!sprite._texture._uvs) { + return; + } + + // push a texture. + // increment the batchsize + this.sprites[this.currentIndex++] = sprite; + }; + + /** + * Renders the content and empties the current batch. + * + */ + + + SpriteRenderer.prototype.flush = function flush() { + if (this.currentIndex === 0) { + return; + } + + var gl = this.renderer.gl; + var MAX_TEXTURES = this.MAX_TEXTURES; + + var np2 = _bitTwiddle2.default.nextPow2(this.currentIndex); + var log2 = _bitTwiddle2.default.log2(np2); + var buffer = this.buffers[log2]; + + var sprites = this.sprites; + var groups = this.groups; + + var float32View = buffer.float32View; + var uint32View = buffer.uint32View; + + var boundTextures = this.boundTextures; + var rendererBoundTextures = this.renderer.boundTextures; + var touch = this.renderer.textureGC.count; + + var index = 0; + var nextTexture = void 0; + var currentTexture = void 0; + var groupCount = 1; + var textureCount = 0; + var currentGroup = groups[0]; + var vertexData = void 0; + var uvs = void 0; + var blendMode = _utils.premultiplyBlendMode[sprites[0]._texture.baseTexture.premultipliedAlpha ? 1 : 0][sprites[0].blendMode]; + + currentGroup.textureCount = 0; + currentGroup.start = 0; + currentGroup.blend = blendMode; + + TICK++; + + var i = void 0; + + // copy textures.. + for (i = 0; i < MAX_TEXTURES; ++i) { + var bt = rendererBoundTextures[i]; + + if (bt._enabled === TICK) { + boundTextures[i] = this.renderer.emptyTextures[i]; + continue; + } + + boundTextures[i] = bt; + bt._virtalBoundId = i; + bt._enabled = TICK; + } + TICK++; + + for (i = 0; i < this.currentIndex; ++i) { + // upload the sprite elemetns... + // they have all ready been calculated so we just need to push them into the buffer. + var sprite = sprites[i]; + + sprites[i] = null; + + nextTexture = sprite._texture.baseTexture; + + var spriteBlendMode = _utils.premultiplyBlendMode[Number(nextTexture.premultipliedAlpha)][sprite.blendMode]; + + if (blendMode !== spriteBlendMode) { + // finish a group.. + blendMode = spriteBlendMode; + + // force the batch to break! + currentTexture = null; + textureCount = MAX_TEXTURES; + TICK++; + } + + if (currentTexture !== nextTexture) { + currentTexture = nextTexture; + + if (nextTexture._enabled !== TICK) { + if (textureCount === MAX_TEXTURES) { + TICK++; + + currentGroup.size = i - currentGroup.start; + + textureCount = 0; + + currentGroup = groups[groupCount++]; + currentGroup.blend = blendMode; + currentGroup.textureCount = 0; + currentGroup.start = i; + } + + nextTexture.touched = touch; + + if (nextTexture._virtalBoundId === -1) { + for (var j = 0; j < MAX_TEXTURES; ++j) { + var tIndex = (j + TEXTURE_TICK) % MAX_TEXTURES; + + var t = boundTextures[tIndex]; + + if (t._enabled !== TICK) { + TEXTURE_TICK++; + + t._virtalBoundId = -1; + + nextTexture._virtalBoundId = tIndex; + + boundTextures[tIndex] = nextTexture; + break; + } + } + } + + nextTexture._enabled = TICK; + + currentGroup.textureCount++; + currentGroup.ids[textureCount] = nextTexture._virtalBoundId; + currentGroup.textures[textureCount++] = nextTexture; + } + } + + vertexData = sprite.vertexData; + + // TODO this sum does not need to be set each frame.. + uvs = sprite._texture._uvs.uvsUint32; + + if (this.renderer.roundPixels) { + var resolution = this.renderer.resolution; + + // xy + float32View[index] = (vertexData[0] * resolution | 0) / resolution; + float32View[index + 1] = (vertexData[1] * resolution | 0) / resolution; + + // xy + float32View[index + 5] = (vertexData[2] * resolution | 0) / resolution; + float32View[index + 6] = (vertexData[3] * resolution | 0) / resolution; + + // xy + float32View[index + 10] = (vertexData[4] * resolution | 0) / resolution; + float32View[index + 11] = (vertexData[5] * resolution | 0) / resolution; + + // xy + float32View[index + 15] = (vertexData[6] * resolution | 0) / resolution; + float32View[index + 16] = (vertexData[7] * resolution | 0) / resolution; + } else { + // xy + float32View[index] = vertexData[0]; + float32View[index + 1] = vertexData[1]; + + // xy + float32View[index + 5] = vertexData[2]; + float32View[index + 6] = vertexData[3]; + + // xy + float32View[index + 10] = vertexData[4]; + float32View[index + 11] = vertexData[5]; + + // xy + float32View[index + 15] = vertexData[6]; + float32View[index + 16] = vertexData[7]; + } + + uint32View[index + 2] = uvs[0]; + uint32View[index + 7] = uvs[1]; + uint32View[index + 12] = uvs[2]; + uint32View[index + 17] = uvs[3]; + /* eslint-disable max-len */ + var alpha = Math.min(sprite.worldAlpha, 1.0); + // we dont call extra function if alpha is 1.0, that's faster + var argb = alpha < 1.0 && nextTexture.premultipliedAlpha ? (0, _utils.premultiplyTint)(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); + + uint32View[index + 3] = uint32View[index + 8] = uint32View[index + 13] = uint32View[index + 18] = argb; + float32View[index + 4] = float32View[index + 9] = float32View[index + 14] = float32View[index + 19] = nextTexture._virtalBoundId; + /* eslint-enable max-len */ + + index += 20; + } + + currentGroup.size = i - currentGroup.start; + + if (!_settings2.default.CAN_UPLOAD_SAME_BUFFER) { + // this is still needed for IOS performance.. + // it really does not like uploading to the same buffer in a single frame! + if (this.vaoMax <= this.vertexCount) { + this.vaoMax++; + + var attrs = this.shader.attributes; + + /* eslint-disable max-len */ + var vertexBuffer = this.vertexBuffers[this.vertexCount] = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW); + /* eslint-enable max-len */ + + // build the vao object that will render.. + var vao = this.renderer.createVao().addIndex(this.indexBuffer).addAttribute(vertexBuffer, attrs.aVertexPosition, gl.FLOAT, false, this.vertByteSize, 0).addAttribute(vertexBuffer, attrs.aTextureCoord, gl.UNSIGNED_SHORT, true, this.vertByteSize, 2 * 4).addAttribute(vertexBuffer, attrs.aColor, gl.UNSIGNED_BYTE, true, this.vertByteSize, 3 * 4); + + if (attrs.aTextureId) { + vao.addAttribute(vertexBuffer, attrs.aTextureId, gl.FLOAT, false, this.vertByteSize, 4 * 4); + } + + this.vaos[this.vertexCount] = vao; + } + + this.renderer.bindVao(this.vaos[this.vertexCount]); + + this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, false); + + this.vertexCount++; + } else { + // lets use the faster option, always use buffer number 0 + this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, true); + } + + for (i = 0; i < MAX_TEXTURES; ++i) { + rendererBoundTextures[i]._virtalBoundId = -1; + } + + // render the groups.. + for (i = 0; i < groupCount; ++i) { + var group = groups[i]; + var groupTextureCount = group.textureCount; + + for (var _j = 0; _j < groupTextureCount; _j++) { + currentTexture = group.textures[_j]; + + // reset virtual ids.. + // lets do a quick check.. + if (rendererBoundTextures[group.ids[_j]] !== currentTexture) { + this.renderer.bindTexture(currentTexture, group.ids[_j], true); + } + + // reset the virtualId.. + currentTexture._virtalBoundId = -1; + } + + // set the blend mode.. + this.renderer.state.setBlendMode(group.blend); + + gl.drawElements(gl.TRIANGLES, group.size * 6, gl.UNSIGNED_SHORT, group.start * 6 * 2); + } + + // reset elements for the next flush + this.currentIndex = 0; + }; + + /** + * Starts a new sprite batch. + */ + + + SpriteRenderer.prototype.start = function start() { + this.renderer.bindShader(this.shader); + + if (_settings2.default.CAN_UPLOAD_SAME_BUFFER) { + // bind buffer #0, we don't need others + this.renderer.bindVao(this.vaos[this.vertexCount]); + + this.vertexBuffers[this.vertexCount].bind(); + } + }; + + /** + * Stops and flushes the current batch. + * + */ + + + SpriteRenderer.prototype.stop = function stop() { + this.flush(); + }; + + /** + * Destroys the SpriteRenderer. + * + */ + + + SpriteRenderer.prototype.destroy = function destroy() { + for (var i = 0; i < this.vaoMax; i++) { + if (this.vertexBuffers[i]) { + this.vertexBuffers[i].destroy(); + } + if (this.vaos[i]) { + this.vaos[i].destroy(); + } + } + + if (this.indexBuffer) { + this.indexBuffer.destroy(); + } + + this.renderer.off('prerender', this.onPrerender, this); + + _ObjectRenderer.prototype.destroy.call(this); + + if (this.shader) { + this.shader.destroy(); + this.shader = null; + } + + this.vertexBuffers = null; + this.vaos = null; + this.indexBuffer = null; + this.indices = null; + + this.sprites = null; + + for (var _i = 0; _i < this.buffers.length; ++_i) { + this.buffers[_i].destroy(); + } + }; + + return SpriteRenderer; + }(_ObjectRenderer3.default); + + exports.default = SpriteRenderer; + + + _WebGLRenderer2.default.registerPlugin('sprite', SpriteRenderer); + + }, { "../../renderers/webgl/WebGLRenderer": 84, "../../renderers/webgl/utils/ObjectRenderer": 94, "../../renderers/webgl/utils/checkMaxIfStatmentsInShader": 97, "../../settings": 101, "../../utils": 125, "../../utils/createIndicesForQuads": 123, "./BatchBuffer": 105, "./generateMultiTextureShader": 107, "bit-twiddle": 1, "pixi-gl-core": 15 }], 107: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = generateMultiTextureShader; + + var _Shader = require('../../Shader'); + + var _Shader2 = _interopRequireDefault(_Shader); + + var _path = require('path'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var fragTemplate = ['varying vec2 vTextureCoord;', 'varying vec4 vColor;', 'varying float vTextureId;', 'uniform sampler2D uSamplers[%count%];', 'void main(void){', 'vec4 color;', '%forloop%', 'gl_FragColor = color * vColor;', '}'].join('\n'); + + function generateMultiTextureShader(gl, maxTextures) { + var vertexSrc = 'precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor;\n}\n'; + var fragmentSrc = fragTemplate; + + fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures)); + + var shader = new _Shader2.default(gl, vertexSrc, fragmentSrc); + + var sampleValues = []; + + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + + shader.bind(); + shader.uniforms.uSamplers = sampleValues; + + return shader; + } + + function generateSampleSrc(maxTextures) { + var src = ''; + + src += '\n'; + src += '\n'; + + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + + if (i < maxTextures - 1) { + src += 'if(vTextureId < ' + i + '.5)'; + } + + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers[' + i + '], vTextureCoord);'; + src += '\n}'; + } + + src += '\n'; + src += '\n'; + + return src; + } + + }, { "../../Shader": 44, "path": 8 }], 108: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _Sprite2 = require('../sprites/Sprite'); + + var _Sprite3 = _interopRequireDefault(_Sprite2); + + var _Texture = require('../textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + var _math = require('../math'); + + var _utils = require('../utils'); + + var _const = require('../const'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _TextStyle = require('./TextStyle'); + + var _TextStyle2 = _interopRequireDefault(_TextStyle); + + var _TextMetrics = require('./TextMetrics'); + + var _TextMetrics2 = _interopRequireDefault(_TextMetrics); + + var _trimCanvas = require('../utils/trimCanvas'); + + var _trimCanvas2 = _interopRequireDefault(_trimCanvas); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint max-depth: [2, 8] */ + + + var defaultDestroyOptions = { + texture: true, + children: false, + baseTexture: true + }; + + /** + * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, + * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * + * A Text can be created directly from a string and a style object, + * which can be generated [here](https://pixijs.io/pixi-text-style). + * + * ```js + * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}); + * ``` + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI + */ + + var Text = function (_Sprite) { + _inherits(Text, _Sprite); + + /** + * @param {string} text - The string that you would like the text to display + * @param {object|PIXI.TextStyle} [style] - The style parameters + * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text + */ + function Text(text, style, canvas) { + _classCallCheck(this, Text); + + canvas = canvas || document.createElement('canvas'); + + canvas.width = 3; + canvas.height = 3; + + var texture = _Texture2.default.fromCanvas(canvas, _settings2.default.SCALE_MODE, 'text'); + + texture.orig = new _math.Rectangle(); + texture.trim = new _math.Rectangle(); + + // base texture is already automatically added to the cache, now adding the actual texture + var _this = _possibleConstructorReturn(this, _Sprite.call(this, texture)); + + _Texture2.default.addToCache(_this._texture, _this._texture.baseTexture.textureCacheIds[0]); + + /** + * The canvas element that everything is drawn to + * + * @member {HTMLCanvasElement} + */ + _this.canvas = canvas; + + /** + * The canvas 2d context that everything is drawn with + * @member {CanvasRenderingContext2D} + */ + _this.context = _this.canvas.getContext('2d'); + + /** + * The resolution / device pixel ratio of the canvas. This is set automatically by the renderer. + * @member {number} + * @default 1 + */ + _this.resolution = _settings2.default.RESOLUTION; + + /** + * Private tracker for the current text. + * + * @member {string} + * @private + */ + _this._text = null; + + /** + * Private tracker for the current style. + * + * @member {object} + * @private + */ + _this._style = null; + /** + * Private listener to track style changes. + * + * @member {Function} + * @private + */ + _this._styleListener = null; + + /** + * Private tracker for the current font. + * + * @member {string} + * @private + */ + _this._font = ''; + + _this.text = text; + _this.style = style; + + _this.localStyleID = -1; + return _this; + } + + /** + * Renders text and updates it when needed. + * + * @private + * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called. + */ + + + Text.prototype.updateText = function updateText(respectDirty) { + var style = this._style; + + // check if style has changed.. + if (this.localStyleID !== style.styleID) { + this.dirty = true; + this.localStyleID = style.styleID; + } + + if (!this.dirty && respectDirty) { + return; + } + + this._font = this._style.toFontString(); + + var context = this.context; + var measured = _TextMetrics2.default.measureText(this._text, this._style, this._style.wordWrap, this.canvas); + var width = measured.width; + var height = measured.height; + var lines = measured.lines; + var lineHeight = measured.lineHeight; + var lineWidths = measured.lineWidths; + var maxLineWidth = measured.maxLineWidth; + var fontProperties = measured.fontProperties; + + this.canvas.width = Math.ceil((Math.max(1, width) + style.padding * 2) * this.resolution); + this.canvas.height = Math.ceil((Math.max(1, height) + style.padding * 2) * this.resolution); + + context.scale(this.resolution, this.resolution); + + context.clearRect(0, 0, this.canvas.width, this.canvas.height); + + context.font = this._font; + context.strokeStyle = style.stroke; + context.lineWidth = style.strokeThickness; + context.textBaseline = style.textBaseline; + context.lineJoin = style.lineJoin; + context.miterLimit = style.miterLimit; + + var linePositionX = void 0; + var linePositionY = void 0; + + if (style.dropShadow) { + context.fillStyle = style.dropShadowColor; + context.globalAlpha = style.dropShadowAlpha; + context.shadowBlur = style.dropShadowBlur; + + if (style.dropShadowBlur > 0) { + context.shadowColor = style.dropShadowColor; + } + + var xShadowOffset = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; + var yShadowOffset = Math.sin(style.dropShadowAngle) * style.dropShadowDistance; + + for (var i = 0; i < lines.length; i++) { + linePositionX = style.strokeThickness / 2; + linePositionY = style.strokeThickness / 2 + i * lineHeight + fontProperties.ascent; + + if (style.align === 'right') { + linePositionX += maxLineWidth - lineWidths[i]; + } else if (style.align === 'center') { + linePositionX += (maxLineWidth - lineWidths[i]) / 2; + } + + if (style.fill) { + this.drawLetterSpacing(lines[i], linePositionX + xShadowOffset + style.padding, linePositionY + yShadowOffset + style.padding); + + if (style.stroke && style.strokeThickness) { + context.strokeStyle = style.dropShadowColor; + this.drawLetterSpacing(lines[i], linePositionX + xShadowOffset + style.padding, linePositionY + yShadowOffset + style.padding, true); + context.strokeStyle = style.stroke; + } + } + } + } + + // reset the shadow blur and alpha that was set by the drop shadow, for the regular text + context.shadowBlur = 0; + context.globalAlpha = 1; + + // set canvas text styles + context.fillStyle = this._generateFillStyle(style, lines); + + // draw lines line by line + for (var _i = 0; _i < lines.length; _i++) { + linePositionX = style.strokeThickness / 2; + linePositionY = style.strokeThickness / 2 + _i * lineHeight + fontProperties.ascent; + + if (style.align === 'right') { + linePositionX += maxLineWidth - lineWidths[_i]; + } else if (style.align === 'center') { + linePositionX += (maxLineWidth - lineWidths[_i]) / 2; + } + + if (style.stroke && style.strokeThickness) { + this.drawLetterSpacing(lines[_i], linePositionX + style.padding, linePositionY + style.padding, true); + } + + if (style.fill) { + this.drawLetterSpacing(lines[_i], linePositionX + style.padding, linePositionY + style.padding); + } + } + + this.updateTexture(); + }; + + /** + * Render the text with letter-spacing. + * @param {string} text - The text to draw + * @param {number} x - Horizontal position to draw the text + * @param {number} y - Vertical position to draw the text + * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the + * text? If not, it's for the inside fill + * @private + */ + + + Text.prototype.drawLetterSpacing = function drawLetterSpacing(text, x, y) { + var isStroke = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + var style = this._style; + + // letterSpacing of 0 means normal + var letterSpacing = style.letterSpacing; + + if (letterSpacing === 0) { + if (isStroke) { + this.context.strokeText(text, x, y); + } else { + this.context.fillText(text, x, y); + } + + return; + } + + var characters = String.prototype.split.call(text, ''); + var currentPosition = x; + var index = 0; + var current = ''; + var previousWidth = this.context.measureText(text).width; + var currentWidth = 0; + + while (index < text.length) { + current = characters[index++]; + if (isStroke) { + this.context.strokeText(current, currentPosition, y); + } else { + this.context.fillText(current, currentPosition, y); + } + currentWidth = this.context.measureText(text.substring(index)).width; + currentPosition += previousWidth - currentWidth + letterSpacing; + previousWidth = currentWidth; + } + }; + + /** + * Updates texture size based on canvas size + * + * @private + */ + + + Text.prototype.updateTexture = function updateTexture() { + var canvas = this.canvas; + + if (this._style.trim) { + var trimmed = (0, _trimCanvas2.default)(canvas); + + if (trimmed.data) { + canvas.width = trimmed.width; + canvas.height = trimmed.height; + this.context.putImageData(trimmed.data, 0, 0); + } + } + + var texture = this._texture; + var style = this._style; + var padding = style.trim ? 0 : style.padding; + var baseTexture = texture.baseTexture; + + baseTexture.hasLoaded = true; + baseTexture.resolution = this.resolution; + + baseTexture.realWidth = canvas.width; + baseTexture.realHeight = canvas.height; + baseTexture.width = canvas.width / this.resolution; + baseTexture.height = canvas.height / this.resolution; + + texture.trim.width = texture._frame.width = canvas.width / this.resolution; + texture.trim.height = texture._frame.height = canvas.height / this.resolution; + texture.trim.x = -padding; + texture.trim.y = -padding; + + texture.orig.width = texture._frame.width - padding * 2; + texture.orig.height = texture._frame.height - padding * 2; + + // call sprite onTextureUpdate to update scale if _width or _height were set + this._onTextureUpdate(); + + baseTexture.emit('update', baseTexture); + + this.dirty = false; + }; + + /** + * Renders the object using the WebGL renderer + * + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + Text.prototype.renderWebGL = function renderWebGL(renderer) { + if (this.resolution !== renderer.resolution) { + this.resolution = renderer.resolution; + this.dirty = true; + } + + this.updateText(true); + + _Sprite.prototype.renderWebGL.call(this, renderer); + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The renderer + */ + + + Text.prototype._renderCanvas = function _renderCanvas(renderer) { + if (this.resolution !== renderer.resolution) { + this.resolution = renderer.resolution; + this.dirty = true; + } + + this.updateText(true); + + _Sprite.prototype._renderCanvas.call(this, renderer); + }; + + /** + * Gets the local bounds of the text object. + * + * @param {Rectangle} rect - The output rectangle. + * @return {Rectangle} The bounds. + */ + + + Text.prototype.getLocalBounds = function getLocalBounds(rect) { + this.updateText(true); + + return _Sprite.prototype.getLocalBounds.call(this, rect); + }; + + /** + * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + */ + + + Text.prototype._calculateBounds = function _calculateBounds() { + this.updateText(true); + this.calculateVertices(); + // if we have already done this on THIS frame. + this._bounds.addQuad(this.vertexData); + }; + + /** + * Method to be called upon a TextStyle change. + * @private + */ + + + Text.prototype._onStyleChange = function _onStyleChange() { + this.dirty = true; + }; + + /** + * Generates the fill style. Can automatically generate a gradient based on the fill style being an array + * + * @private + * @param {object} style - The style. + * @param {string[]} lines - The lines of text. + * @return {string|number|CanvasGradient} The fill style + */ + + + Text.prototype._generateFillStyle = function _generateFillStyle(style, lines) { + if (!Array.isArray(style.fill)) { + return style.fill; + } + + // cocoon on canvas+ cannot generate textures, so use the first colour instead + if (navigator.isCocoonJS) { + return style.fill[0]; + } + + // the gradient will be evenly spaced out according to how large the array is. + // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 + var gradient = void 0; + var totalIterations = void 0; + var currentIteration = void 0; + var stop = void 0; + + var width = this.canvas.width / this.resolution; + var height = this.canvas.height / this.resolution; + + // make a copy of the style settings, so we can manipulate them later + var fill = style.fill.slice(); + var fillGradientStops = style.fillGradientStops.slice(); + + // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 + if (!fillGradientStops.length) { + var lengthPlus1 = fill.length + 1; + + for (var i = 1; i < lengthPlus1; ++i) { + fillGradientStops.push(i / lengthPlus1); + } + } + + // stop the bleeding of the last gradient on the line above to the top gradient of the this line + // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 + fill.unshift(style.fill[0]); + fillGradientStops.unshift(0); + + fill.push(style.fill[style.fill.length - 1]); + fillGradientStops.push(1); + + if (style.fillGradientType === _const.TEXT_GRADIENT.LINEAR_VERTICAL) { + // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas + gradient = this.context.createLinearGradient(width / 2, 0, width / 2, height); + + // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect + // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 + totalIterations = (fill.length + 1) * lines.length; + currentIteration = 0; + for (var _i2 = 0; _i2 < lines.length; _i2++) { + currentIteration += 1; + for (var j = 0; j < fill.length; j++) { + if (typeof fillGradientStops[j] === 'number') { + stop = fillGradientStops[j] / lines.length + _i2 / lines.length; + } else { + stop = currentIteration / totalIterations; + } + gradient.addColorStop(stop, fill[j]); + currentIteration++; + } + } + } else { + // start the gradient at the center left of the canvas, and end at the center right of the canvas + gradient = this.context.createLinearGradient(0, height / 2, width, height / 2); + + // can just evenly space out the gradients in this case, as multiple lines makes no difference + // to an even left to right gradient + totalIterations = fill.length + 1; + currentIteration = 1; + + for (var _i3 = 0; _i3 < fill.length; _i3++) { + if (typeof fillGradientStops[_i3] === 'number') { + stop = fillGradientStops[_i3]; + } else { + stop = currentIteration / totalIterations; + } + gradient.addColorStop(stop, fill[_i3]); + currentIteration++; + } + } + + return gradient; + }; + + /** + * Destroys this text object. + * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as + * the majority of the time the texture will not be shared with any other Sprites. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their + * destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well + */ + + + Text.prototype.destroy = function destroy(options) { + if (typeof options === 'boolean') { + options = { children: options }; + } + + options = Object.assign({}, defaultDestroyOptions, options); + + _Sprite.prototype.destroy.call(this, options); + + // make sure to reset the the context and canvas.. dont want this hanging around in memory! + this.context = null; + this.canvas = null; + + this._style = null; + }; + + /** + * The width of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + + _createClass(Text, [{ + key: 'width', + get: function get() { + this.updateText(true); + + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.updateText(true); + + var s = (0, _utils.sign)(this.scale.x) || 1; + + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + } + + /** + * The height of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + this.updateText(true); + + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.updateText(true); + + var s = (0, _utils.sign)(this.scale.y) || 1; + + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + } + + /** + * Set the style of the text. Set up an event listener to listen for changes on the style + * object and mark the text as dirty. + * + * @member {object|PIXI.TextStyle} + */ + + }, { + key: 'style', + get: function get() { + return this._style; + }, + set: function set(style) // eslint-disable-line require-jsdoc + { + style = style || {}; + + if (style instanceof _TextStyle2.default) { + this._style = style; + } else { + this._style = new _TextStyle2.default(style); + } + + this.localStyleID = -1; + this.dirty = true; + } + + /** + * Set the copy for the text object. To split a line you can use '\n'. + * + * @member {string} + */ + + }, { + key: 'text', + get: function get() { + return this._text; + }, + set: function set(text) // eslint-disable-line require-jsdoc + { + text = String(text === '' || text === null || text === undefined ? ' ' : text); + + if (this._text === text) { + return; + } + this._text = text; + this.dirty = true; + } + }]); + + return Text; + }(_Sprite3.default); + + exports.default = Text; + + }, { "../const": 46, "../math": 70, "../settings": 101, "../sprites/Sprite": 102, "../textures/Texture": 115, "../utils": 125, "../utils/trimCanvas": 130, "./TextMetrics": 109, "./TextStyle": 110 }], 109: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * The TextMetrics object represents the measurement of a block of text with a specified style. + * + * ```js + * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}) + * let textMetrics = PIXI.TextMetrics.measureText('Your text', style) + * ``` + * + * @class + * @memberOf PIXI + */ + var TextMetrics = function () { + /** + * @param {string} text - the text that was measured + * @param {PIXI.TextStyle} style - the style that was measured + * @param {number} width - the measured width of the text + * @param {number} height - the measured height of the text + * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {array} lineWidths - an array of the line widths for each line matched to `lines` + * @param {number} lineHeight - the measured line height for this style + * @param {number} maxLineWidth - the maximum line width for all measured lines + * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont + */ + function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) { + _classCallCheck(this, TextMetrics); + + this.text = text; + this.style = style; + this.width = width; + this.height = height; + this.lines = lines; + this.lineWidths = lineWidths; + this.lineHeight = lineHeight; + this.maxLineWidth = maxLineWidth; + this.fontProperties = fontProperties; + } + + /** + * Measures the supplied string of text and returns a Rectangle. + * + * @param {string} text - the text to measure. + * @param {PIXI.TextStyle} style - the text style to use for measuring + * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {PIXI.TextMetrics} measured width and height of the text. + */ + + + TextMetrics.measureText = function measureText(text, style, wordWrap) { + var canvas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : TextMetrics._canvas; + + wordWrap = wordWrap === undefined || wordWrap === null ? style.wordWrap : wordWrap; + var font = style.toFontString(); + var fontProperties = TextMetrics.measureFont(font); + var context = canvas.getContext('2d'); + + context.font = font; + + var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; + var lines = outputText.split(/(?:\r\n|\r|\n)/); + var lineWidths = new Array(lines.length); + var maxLineWidth = 0; + + for (var i = 0; i < lines.length; i++) { + var lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * style.letterSpacing; + + lineWidths[i] = lineWidth; + maxLineWidth = Math.max(maxLineWidth, lineWidth); + } + var width = maxLineWidth + style.strokeThickness; + + if (style.dropShadow) { + width += style.dropShadowDistance; + } + + var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; + var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) + (lines.length - 1) * (lineHeight + style.leading); + + if (style.dropShadow) { + height += style.dropShadowDistance; + } + + return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties); + }; + + /** + * Applies newlines to a string to have it optimally fit into the horizontal + * bounds set by the Text object's wordWrapWidth property. + * + * @private + * @param {string} text - String to apply word wrapping to + * @param {PIXI.TextStyle} style - the style to use when wrapping + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {string} New string with new lines applied where required + */ + + + TextMetrics.wordWrap = function wordWrap(text, style) { + var canvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TextMetrics._canvas; + + var context = canvas.getContext('2d'); + + var width = 0; + var line = ''; + var lines = ''; + + var cache = {}; + var letterSpacing = style.letterSpacing, + whiteSpace = style.whiteSpace; + + // How to handle whitespaces + + var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); + var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); + + // whether or not spaces may be added to the beginning of lines + var canPrependSpaces = !collapseSpaces; + + // There is letterSpacing after every char except the last one + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! + // so for convenience the above needs to be compared to width + 1 extra letterSpace + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ + // ________________________________________________ + // And then the final space is simply no appended to each line + var wordWrapWidth = style.wordWrapWidth + letterSpacing; + + // break text into words, spaces and newline chars + var tokens = TextMetrics.tokenize(text); + + for (var i = 0; i < tokens.length; i++) { + // get the word, space or newlineChar + var token = tokens[i]; + + // if word is a new line + if (TextMetrics.isNewline(token)) { + // keep the new line + if (!collapseNewlines) { + lines += TextMetrics.addLine(line); + canPrependSpaces = !collapseSpaces; + line = ''; + width = 0; + continue; + } + + // if we should collapse new lines + // we simply convert it into a space + token = ' '; + } + + // if we should collapse repeated whitespaces + if (collapseSpaces) { + // check both this and the last tokens for spaces + var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); + var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); + + if (currIsBreakingSpace && lastIsBreakingSpace) { + continue; + } + } + + // get word width from cache if possible + var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); + + // word is longer than desired bounds + if (tokenWidth > wordWrapWidth) { + // if we are not already at the beginning of a line + if (line !== '') { + // start newlines for overflow words + lines += TextMetrics.addLine(line); + line = ''; + width = 0; + } + + // break large word over multiple lines + if (TextMetrics.canBreakWords(token, style.breakWords)) { + // break word into characters + var characters = token.split(''); + + // loop the characters + for (var j = 0; j < characters.length; j++) { + var char = characters[j]; + + var k = 1; + // we are not at the end of the token + + while (characters[j + k]) { + var nextChar = characters[j + k]; + var lastChar = char[char.length - 1]; + + // should not split chars + if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) { + // combine chars & move forward one + char += nextChar; + } else { + break; + } + + k++; + } + + j += char.length - 1; + + var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); + + if (characterWidth + width > wordWrapWidth) { + lines += TextMetrics.addLine(line); + canPrependSpaces = false; + line = ''; + width = 0; + } + + line += char; + width += characterWidth; + } + } + + // run word out of the bounds + else { + // if there are words in this line already + // finish that line and start a new one + if (line.length > 0) { + lines += TextMetrics.addLine(line); + line = ''; + width = 0; + } + + var isLastToken = i === tokens.length - 1; + + // give it its own line if it's not the end + lines += TextMetrics.addLine(token, !isLastToken); + canPrependSpaces = false; + line = ''; + width = 0; + } + } + + // word could fit + else { + // word won't fit because of existing words + // start a new line + if (tokenWidth + width > wordWrapWidth) { + // if its a space we don't want it + canPrependSpaces = false; + + // add a new line + lines += TextMetrics.addLine(line); + + // start a new line + line = ''; + width = 0; + } + + // don't add spaces to the beginning of lines + if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) { + // add the word to the current line + line += token; + + // update width counter + width += tokenWidth; + } + } + } + + lines += TextMetrics.addLine(line, false); + + return lines; + }; + + /** + * Convienience function for logging each line added during the wordWrap + * method + * + * @private + * @param {string} line - The line of text to add + * @param {boolean} newLine - Add new line character to end + * @return {string} A formatted line + */ + + + TextMetrics.addLine = function addLine(line) { + var newLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + line = TextMetrics.trimRight(line); + + line = newLine ? line + '\n' : line; + + return line; + }; + + /** + * Gets & sets the widths of calculated characters in a cache object + * + * @private + * @param {string} key The key + * @param {number} letterSpacing The letter spacing + * @param {object} cache The cache + * @param {CanvasRenderingContext2D} context The canvas context + * @return {number} The from cache. + */ + + + TextMetrics.getFromCache = function getFromCache(key, letterSpacing, cache, context) { + var width = cache[key]; + + if (width === undefined) { + var spacing = key.length * letterSpacing; + + width = context.measureText(key).width + spacing; + cache[key] = width; + } + + return width; + }; + + /** + * Determines whether we should collapse breaking spaces + * + * @private + * @param {string} whiteSpace The TextStyle property whiteSpace + * @return {boolean} should collapse + */ + + + TextMetrics.collapseSpaces = function collapseSpaces(whiteSpace) { + return whiteSpace === 'normal' || whiteSpace === 'pre-line'; + }; + + /** + * Determines whether we should collapse newLine chars + * + * @private + * @param {string} whiteSpace The white space + * @return {boolean} should collapse + */ + + + TextMetrics.collapseNewlines = function collapseNewlines(whiteSpace) { + return whiteSpace === 'normal'; + }; + + /** + * trims breaking whitespaces from string + * + * @private + * @param {string} text The text + * @return {string} trimmed string + */ + + + TextMetrics.trimRight = function trimRight(text) { + if (typeof text !== 'string') { + return ''; + } + + for (var i = text.length - 1; i >= 0; i--) { + var char = text[i]; + + if (!TextMetrics.isBreakingSpace(char)) { + break; + } + + text = text.slice(0, -1); + } + + return text; + }; + + /** + * Determines if char is a newline. + * + * @private + * @param {string} char The character + * @return {boolean} True if newline, False otherwise. + */ + + + TextMetrics.isNewline = function isNewline(char) { + if (typeof char !== 'string') { + return false; + } + + return TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0; + }; + + /** + * Determines if char is a breaking whitespace. + * + * @private + * @param {string} char The character + * @return {boolean} True if whitespace, False otherwise. + */ + + + TextMetrics.isBreakingSpace = function isBreakingSpace(char) { + if (typeof char !== 'string') { + return false; + } + + return TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0; + }; + + /** + * Splits a string into words, breaking-spaces and newLine characters + * + * @private + * @param {string} text The text + * @return {array} A tokenized array + */ + + + TextMetrics.tokenize = function tokenize(text) { + var tokens = []; + var token = ''; + + if (typeof text !== 'string') { + return tokens; + } + + for (var i = 0; i < text.length; i++) { + var char = text[i]; + + if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) { + if (token !== '') { + tokens.push(token); + token = ''; + } + + tokens.push(char); + + continue; + } + + token += char; + } + + if (token !== '') { + tokens.push(token); + } + + return tokens; + }; + + /** + * This method exists to be easily overridden + * It allows one to customise which words should break + * Examples are if the token is CJK or numbers. + * It must return a boolean. + * + * @private + * @param {string} token The token + * @param {boolean} breakWords The style attr break words + * @return {boolean} whether to break word or not + */ + + + TextMetrics.canBreakWords = function canBreakWords(token, breakWords) { + return breakWords; + }; + + /** + * This method exists to be easily overridden + * It allows one to determine whether a pair of characters + * should be broken by newlines + * For example certain characters in CJK langs or numbers. + * It must return a boolean. + * + * @private + * @param {string} char The character + * @param {string} nextChar The next character + * @param {string} token The token/word the characters are from + * @param {number} index The index in the token of the char + * @param {boolean} breakWords The style attr break words + * @return {boolean} whether to break word or not + */ + + + TextMetrics.canBreakChars = function canBreakChars(char, nextChar, token, index, breakWords) // eslint-disable-line no-unused-vars + { + return true; + }; + + /** + * Calculates the ascent, descent and fontSize of a given font-style + * + * @static + * @param {string} font - String representing the style of the font + * @return {PIXI.TextMetrics~FontMetrics} Font properties object + */ + + + TextMetrics.measureFont = function measureFont(font) { + // as this method is used for preparing assets, don't recalculate things if we don't need to + if (TextMetrics._fonts[font]) { + return TextMetrics._fonts[font]; + } + + var properties = {}; + + var canvas = TextMetrics._canvas; + var context = TextMetrics._context; + + context.font = font; + + var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; + var width = Math.ceil(context.measureText(metricsString).width); + var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); + var height = 2 * baseline; + + baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; + + canvas.width = width; + canvas.height = height; + + context.fillStyle = '#f00'; + context.fillRect(0, 0, width, height); + + context.font = font; + + context.textBaseline = 'alphabetic'; + context.fillStyle = '#000'; + context.fillText(metricsString, 0, baseline); + + var imagedata = context.getImageData(0, 0, width, height).data; + var pixels = imagedata.length; + var line = width * 4; + + var i = 0; + var idx = 0; + var stop = false; + + // ascent. scan from top to bottom until we find a non red pixel + for (i = 0; i < baseline; ++i) { + for (var j = 0; j < line; j += 4) { + if (imagedata[idx + j] !== 255) { + stop = true; + break; + } + } + if (!stop) { + idx += line; + } else { + break; + } + } + + properties.ascent = baseline - i; + + idx = pixels - line; + stop = false; + + // descent. scan from bottom to top until we find a non red pixel + for (i = height; i > baseline; --i) { + for (var _j = 0; _j < line; _j += 4) { + if (imagedata[idx + _j] !== 255) { + stop = true; + break; + } + } + + if (!stop) { + idx -= line; + } else { + break; + } + } + + properties.descent = i - baseline; + properties.fontSize = properties.ascent + properties.descent; + + TextMetrics._fonts[font] = properties; + + return properties; + }; + + /** + * Clear font metrics in metrics cache. + * + * @static + * @param {string} [font] - font name. If font name not set then clear cache for all fonts. + */ + + + TextMetrics.clearMetrics = function clearMetrics() { + var font = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + if (font) { + delete TextMetrics._fonts[font]; + } else { + TextMetrics._fonts = {}; + } + }; + + return TextMetrics; + }(); + + /** + * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. + * @class FontMetrics + * @memberof PIXI.TextMetrics~ + * @property {number} ascent - The ascent distance + * @property {number} descent - The descent distance + * @property {number} fontSize - Font size from ascent to descent + */ + + exports.default = TextMetrics; + var canvas = document.createElement('canvas'); + + canvas.width = canvas.height = 10; + + /** + * Cached canvas element for measuring text + * @memberof PIXI.TextMetrics + * @type {HTMLCanvasElement} + * @private + */ + TextMetrics._canvas = canvas; + + /** + * Cache for context to use. + * @memberof PIXI.TextMetrics + * @type {CanvasRenderingContext2D} + * @private + */ + TextMetrics._context = canvas.getContext('2d'); + + /** + * Cache of PIXI.TextMetrics~FontMetrics objects. + * @memberof PIXI.TextMetrics + * @type {Object} + * @private + */ + TextMetrics._fonts = {}; + + /** + * String used for calculate font metrics. + * @static + * @memberof PIXI.TextMetrics + * @name METRICS_STRING + * @type {string} + * @default |Éq + */ + TextMetrics.METRICS_STRING = '|Éq'; + + /** + * Baseline symbol for calculate font metrics. + * @static + * @memberof PIXI.TextMetrics + * @name BASELINE_SYMBOL + * @type {string} + * @default M + */ + TextMetrics.BASELINE_SYMBOL = 'M'; + + /** + * Baseline multiplier for calculate font metrics. + * @static + * @memberof PIXI.TextMetrics + * @name BASELINE_MULTIPLIER + * @type {number} + * @default 1.4 + */ + TextMetrics.BASELINE_MULTIPLIER = 1.4; + + /** + * Cache of new line chars. + * @memberof PIXI.TextMetrics + * @type {number[]} + * @private + */ + TextMetrics._newlines = [0x000A, // line feed + 0x000D]; + + /** + * Cache of breaking spaces. + * @memberof PIXI.TextMetrics + * @type {number[]} + * @private + */ + TextMetrics._breakingSpaces = [0x0009, // character tabulation + 0x0020, // space + 0x2000, // en quad + 0x2001, // em quad + 0x2002, // en space + 0x2003, // em space + 0x2004, // three-per-em space + 0x2005, // four-per-em space + 0x2006, // six-per-em space + 0x2008, // punctuation space + 0x2009, // thin space + 0x200A, // hair space + 0x205F, // medium mathematical space + 0x3000]; + + }, {}], 110: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // disabling eslint for now, going to rewrite this in v5 + /* eslint-disable */ + + var _const = require('../const'); + + var _utils = require('../utils'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var defaultStyle = { + align: 'left', + breakWords: false, + dropShadow: false, + dropShadowAlpha: 1, + dropShadowAngle: Math.PI / 6, + dropShadowBlur: 0, + dropShadowColor: 'black', + dropShadowDistance: 5, + fill: 'black', + fillGradientType: _const.TEXT_GRADIENT.LINEAR_VERTICAL, + fillGradientStops: [], + fontFamily: 'Arial', + fontSize: 26, + fontStyle: 'normal', + fontVariant: 'normal', + fontWeight: 'normal', + letterSpacing: 0, + lineHeight: 0, + lineJoin: 'miter', + miterLimit: 10, + padding: 0, + stroke: 'black', + strokeThickness: 0, + textBaseline: 'alphabetic', + trim: false, + whiteSpace: 'pre', + wordWrap: false, + wordWrapWidth: 100, + leading: 0 + }; + + var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui']; + + /** + * A TextStyle Object decorates a Text Object. It can be shared between + * multiple Text objects. Changing the style will update all text objects using it. + * It can be generated [here](https://pixijs.io/pixi-text-style). + * + * @class + * @memberof PIXI + */ + + var TextStyle = function () { + /** + * @param {object} [style] - The style parameters + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), + * does not affect single line text + * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it + * needs wordWrap to be set to true + * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text + * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow + * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow + * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius + * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow + * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas + * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient + * eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours + * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT} + * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set + * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * @param {string|string[]} [style.fontFamily='Arial'] - The font family + * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string, + * equivalents are '26px','20pt','160%' or '1.6em') + * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique') + * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps') + * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100', + * '200', '300', '400', '500', '600', '700', 800' or '900') + * @param {number} [style.leading=0] - The space between lines + * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0 + * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses + * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve + * spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" + * (creates a squared corner). + * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce + * or increase the spikiness of rendered text. + * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from + * happening by adding padding to all sides of the text. + * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * @param {boolean} [style.trim=false] - Trim transparent borders + * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered. + * @param {boolean} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved "normal" + * (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true + * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used + * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true + */ + function TextStyle(style) { + _classCallCheck(this, TextStyle); + + this.styleID = 0; + + this.reset(); + + deepCopyProperties(this, style, style); + } + + /** + * Creates a new TextStyle object with the same values as this one. + * Note that the only the properties of the object are cloned. + * + * @return {PIXI.TextStyle} New cloned TextStyle object + */ + + + TextStyle.prototype.clone = function clone() { + var clonedProperties = {}; + + deepCopyProperties(clonedProperties, this, defaultStyle); + + return new TextStyle(clonedProperties); + }; + + /** + * Resets all properties to the defaults specified in TextStyle.prototype._default + */ + + + TextStyle.prototype.reset = function reset() { + deepCopyProperties(this, defaultStyle, defaultStyle); + }; + + /** + * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text + * + * @member {string} + */ + + + /** + * Generates a font style string to use for `TextMetrics.measureFont()`. + * + * @return {string} Font style string, for passing to `TextMetrics.measureFont()` + */ + TextStyle.prototype.toFontString = function toFontString() { + // build canvas api font setting from individual components. Convert a numeric this.fontSize to px + var fontSizeString = typeof this.fontSize === 'number' ? this.fontSize + 'px' : this.fontSize; + + // Clean-up fontFamily property by quoting each font name + // this will support font names with spaces + var fontFamilies = this.fontFamily; + + if (!Array.isArray(this.fontFamily)) { + fontFamilies = this.fontFamily.split(','); + } + + for (var i = fontFamilies.length - 1; i >= 0; i--) { + // Trim any extra white-space + var fontFamily = fontFamilies[i].trim(); + + // Check if font is already escaped in quotes except for CSS generic fonts + if (!/([\"\'])[^\'\"]+\1/.test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) { + fontFamily = '"' + fontFamily + '"'; + } + fontFamilies[i] = fontFamily; + } + + return this.fontStyle + ' ' + this.fontVariant + ' ' + this.fontWeight + ' ' + fontSizeString + ' ' + fontFamilies.join(','); + }; + + _createClass(TextStyle, [{ + key: 'align', + get: function get() { + return this._align; + }, + set: function set(align) // eslint-disable-line require-jsdoc + { + if (this._align !== align) { + this._align = align; + this.styleID++; + } + } + + /** + * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true + * + * @member {boolean} + */ + + }, { + key: 'breakWords', + get: function get() { + return this._breakWords; + }, + set: function set(breakWords) // eslint-disable-line require-jsdoc + { + if (this._breakWords !== breakWords) { + this._breakWords = breakWords; + this.styleID++; + } + } + + /** + * Set a drop shadow for the text + * + * @member {boolean} + */ + + }, { + key: 'dropShadow', + get: function get() { + return this._dropShadow; + }, + set: function set(dropShadow) // eslint-disable-line require-jsdoc + { + if (this._dropShadow !== dropShadow) { + this._dropShadow = dropShadow; + this.styleID++; + } + } + + /** + * Set alpha for the drop shadow + * + * @member {number} + */ + + }, { + key: 'dropShadowAlpha', + get: function get() { + return this._dropShadowAlpha; + }, + set: function set(dropShadowAlpha) // eslint-disable-line require-jsdoc + { + if (this._dropShadowAlpha !== dropShadowAlpha) { + this._dropShadowAlpha = dropShadowAlpha; + this.styleID++; + } + } + + /** + * Set a angle of the drop shadow + * + * @member {number} + */ + + }, { + key: 'dropShadowAngle', + get: function get() { + return this._dropShadowAngle; + }, + set: function set(dropShadowAngle) // eslint-disable-line require-jsdoc + { + if (this._dropShadowAngle !== dropShadowAngle) { + this._dropShadowAngle = dropShadowAngle; + this.styleID++; + } + } + + /** + * Set a shadow blur radius + * + * @member {number} + */ + + }, { + key: 'dropShadowBlur', + get: function get() { + return this._dropShadowBlur; + }, + set: function set(dropShadowBlur) // eslint-disable-line require-jsdoc + { + if (this._dropShadowBlur !== dropShadowBlur) { + this._dropShadowBlur = dropShadowBlur; + this.styleID++; + } + } + + /** + * A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * + * @member {string|number} + */ + + }, { + key: 'dropShadowColor', + get: function get() { + return this._dropShadowColor; + }, + set: function set(dropShadowColor) // eslint-disable-line require-jsdoc + { + var outputColor = getColor(dropShadowColor); + if (this._dropShadowColor !== outputColor) { + this._dropShadowColor = outputColor; + this.styleID++; + } + } + + /** + * Set a distance of the drop shadow + * + * @member {number} + */ + + }, { + key: 'dropShadowDistance', + get: function get() { + return this._dropShadowDistance; + }, + set: function set(dropShadowDistance) // eslint-disable-line require-jsdoc + { + if (this._dropShadowDistance !== dropShadowDistance) { + this._dropShadowDistance = dropShadowDistance; + this.styleID++; + } + } + + /** + * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. + * Can be an array to create a gradient eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * + * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} + */ + + }, { + key: 'fill', + get: function get() { + return this._fill; + }, + set: function set(fill) // eslint-disable-line require-jsdoc + { + var outputColor = getColor(fill); + if (this._fill !== outputColor) { + this._fill = outputColor; + this.styleID++; + } + } + + /** + * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. + * See {@link PIXI.TEXT_GRADIENT} + * + * @member {number} + */ + + }, { + key: 'fillGradientType', + get: function get() { + return this._fillGradientType; + }, + set: function set(fillGradientType) // eslint-disable-line require-jsdoc + { + if (this._fillGradientType !== fillGradientType) { + this._fillGradientType = fillGradientType; + this.styleID++; + } + } + + /** + * If fill is an array of colours to create a gradient, this array can set the stop points + * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * + * @member {number[]} + */ + + }, { + key: 'fillGradientStops', + get: function get() { + return this._fillGradientStops; + }, + set: function set(fillGradientStops) // eslint-disable-line require-jsdoc + { + if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) { + this._fillGradientStops = fillGradientStops; + this.styleID++; + } + } + + /** + * The font family + * + * @member {string|string[]} + */ + + }, { + key: 'fontFamily', + get: function get() { + return this._fontFamily; + }, + set: function set(fontFamily) // eslint-disable-line require-jsdoc + { + if (this.fontFamily !== fontFamily) { + this._fontFamily = fontFamily; + this.styleID++; + } + } + + /** + * The font size + * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') + * + * @member {number|string} + */ + + }, { + key: 'fontSize', + get: function get() { + return this._fontSize; + }, + set: function set(fontSize) // eslint-disable-line require-jsdoc + { + if (this._fontSize !== fontSize) { + this._fontSize = fontSize; + this.styleID++; + } + } + + /** + * The font style + * ('normal', 'italic' or 'oblique') + * + * @member {string} + */ + + }, { + key: 'fontStyle', + get: function get() { + return this._fontStyle; + }, + set: function set(fontStyle) // eslint-disable-line require-jsdoc + { + if (this._fontStyle !== fontStyle) { + this._fontStyle = fontStyle; + this.styleID++; + } + } + + /** + * The font variant + * ('normal' or 'small-caps') + * + * @member {string} + */ + + }, { + key: 'fontVariant', + get: function get() { + return this._fontVariant; + }, + set: function set(fontVariant) // eslint-disable-line require-jsdoc + { + if (this._fontVariant !== fontVariant) { + this._fontVariant = fontVariant; + this.styleID++; + } + } + + /** + * The font weight + * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') + * + * @member {string} + */ + + }, { + key: 'fontWeight', + get: function get() { + return this._fontWeight; + }, + set: function set(fontWeight) // eslint-disable-line require-jsdoc + { + if (this._fontWeight !== fontWeight) { + this._fontWeight = fontWeight; + this.styleID++; + } + } + + /** + * The amount of spacing between letters, default is 0 + * + * @member {number} + */ + + }, { + key: 'letterSpacing', + get: function get() { + return this._letterSpacing; + }, + set: function set(letterSpacing) // eslint-disable-line require-jsdoc + { + if (this._letterSpacing !== letterSpacing) { + this._letterSpacing = letterSpacing; + this.styleID++; + } + } + + /** + * The line height, a number that represents the vertical space that a letter uses + * + * @member {number} + */ + + }, { + key: 'lineHeight', + get: function get() { + return this._lineHeight; + }, + set: function set(lineHeight) // eslint-disable-line require-jsdoc + { + if (this._lineHeight !== lineHeight) { + this._lineHeight = lineHeight; + this.styleID++; + } + } + + /** + * The space between lines + * + * @member {number} + */ + + }, { + key: 'leading', + get: function get() { + return this._leading; + }, + set: function set(leading) // eslint-disable-line require-jsdoc + { + if (this._leading !== leading) { + this._leading = leading; + this.styleID++; + } + } + + /** + * The lineJoin property sets the type of corner created, it can resolve spiked text issues. + * Default is 'miter' (creates a sharp corner). + * + * @member {string} + */ + + }, { + key: 'lineJoin', + get: function get() { + return this._lineJoin; + }, + set: function set(lineJoin) // eslint-disable-line require-jsdoc + { + if (this._lineJoin !== lineJoin) { + this._lineJoin = lineJoin; + this.styleID++; + } + } + + /** + * The miter limit to use when using the 'miter' lineJoin mode + * This can reduce or increase the spikiness of rendered text. + * + * @member {number} + */ + + }, { + key: 'miterLimit', + get: function get() { + return this._miterLimit; + }, + set: function set(miterLimit) // eslint-disable-line require-jsdoc + { + if (this._miterLimit !== miterLimit) { + this._miterLimit = miterLimit; + this.styleID++; + } + } + + /** + * Occasionally some fonts are cropped. Adding some padding will prevent this from happening + * by adding padding to all sides of the text. + * + * @member {number} + */ + + }, { + key: 'padding', + get: function get() { + return this._padding; + }, + set: function set(padding) // eslint-disable-line require-jsdoc + { + if (this._padding !== padding) { + this._padding = padding; + this.styleID++; + } + } + + /** + * A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * + * @member {string|number} + */ + + }, { + key: 'stroke', + get: function get() { + return this._stroke; + }, + set: function set(stroke) // eslint-disable-line require-jsdoc + { + var outputColor = getColor(stroke); + if (this._stroke !== outputColor) { + this._stroke = outputColor; + this.styleID++; + } + } + + /** + * A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * + * @member {number} + */ + + }, { + key: 'strokeThickness', + get: function get() { + return this._strokeThickness; + }, + set: function set(strokeThickness) // eslint-disable-line require-jsdoc + { + if (this._strokeThickness !== strokeThickness) { + this._strokeThickness = strokeThickness; + this.styleID++; + } + } + + /** + * The baseline of the text that is rendered. + * + * @member {string} + */ + + }, { + key: 'textBaseline', + get: function get() { + return this._textBaseline; + }, + set: function set(textBaseline) // eslint-disable-line require-jsdoc + { + if (this._textBaseline !== textBaseline) { + this._textBaseline = textBaseline; + this.styleID++; + } + } + + /** + * Trim transparent borders + * + * @member {boolean} + */ + + }, { + key: 'trim', + get: function get() { + return this._trim; + }, + set: function set(trim) // eslint-disable-line require-jsdoc + { + if (this._trim !== trim) { + this._trim = trim; + this.styleID++; + } + } + + /** + * How newlines and spaces should be handled. + * Default is 'pre' (preserve, preserve). + * + * value | New lines | Spaces + * --- | --- | --- + * 'normal' | Collapse | Collapse + * 'pre' | Preserve | Preserve + * 'pre-line' | Preserve | Collapse + * + * @member {string} + */ + + }, { + key: 'whiteSpace', + get: function get() { + return this._whiteSpace; + }, + set: function set(whiteSpace) // eslint-disable-line require-jsdoc + { + if (this._whiteSpace !== whiteSpace) { + this._whiteSpace = whiteSpace; + this.styleID++; + } + } + + /** + * Indicates if word wrap should be used + * + * @member {boolean} + */ + + }, { + key: 'wordWrap', + get: function get() { + return this._wordWrap; + }, + set: function set(wordWrap) // eslint-disable-line require-jsdoc + { + if (this._wordWrap !== wordWrap) { + this._wordWrap = wordWrap; + this.styleID++; + } + } + + /** + * The width at which text will wrap, it needs wordWrap to be set to true + * + * @member {number} + */ + + }, { + key: 'wordWrapWidth', + get: function get() { + return this._wordWrapWidth; + }, + set: function set(wordWrapWidth) // eslint-disable-line require-jsdoc + { + if (this._wordWrapWidth !== wordWrapWidth) { + this._wordWrapWidth = wordWrapWidth; + this.styleID++; + } + } + }]); + + return TextStyle; + }(); + + /** + * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. + * @private + * @param {number|number[]} color + * @return {string} The color as a string. + */ + + + exports.default = TextStyle; + function getSingleColor(color) { + if (typeof color === 'number') { + return (0, _utils.hex2string)(color); + } else if (typeof color === 'string') { + if (color.indexOf('0x') === 0) { + color = color.replace('0x', '#'); + } + } + + return color; + } + + /** + * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. + * This version can also convert array of colors + * @private + * @param {number|number[]} color + * @return {string} The color as a string. + */ + function getColor(color) { + if (!Array.isArray(color)) { + return getSingleColor(color); + } else { + for (var i = 0; i < color.length; ++i) { + color[i] = getSingleColor(color[i]); + } + + return color; + } + } + + /** + * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. + * This version can also convert array of colors + * @private + * @param {Array} array1 First array to compare + * @param {Array} array2 Second array to compare + * @return {boolean} Do the arrays contain the same values in the same order + */ + function areArraysEqual(array1, array2) { + if (!Array.isArray(array1) || !Array.isArray(array2)) { + return false; + } + + if (array1.length !== array2.length) { + return false; + } + + for (var i = 0; i < array1.length; ++i) { + if (array1[i] !== array2[i]) { + return false; + } + } + + return true; + } + + /** + * Utility function to ensure that object properties are copied by value, and not by reference + * @private + * @param {Object} target Target object to copy properties into + * @param {Object} source Source object for the proporties to copy + * @param {string} propertyObj Object containing properties names we want to loop over + */ + function deepCopyProperties(target, source, propertyObj) { + for (var prop in propertyObj) { + if (Array.isArray(source[prop])) { + target[prop] = source[prop].slice(); + } else { + target[prop] = source[prop]; + } + } + } + + }, { "../const": 46, "../utils": 125 }], 111: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _BaseTexture2 = require('./BaseTexture'); + + var _BaseTexture3 = _interopRequireDefault(_BaseTexture2); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(1024, 1024); + * let baseRenderTexture = new PIXI.BaseRenderTexture(800, 600); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.fromImage("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, renderTexture); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture(100, 100); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture + * ``` + * + * @class + * @extends PIXI.BaseTexture + * @memberof PIXI + */ + var BaseRenderTexture = function (_BaseTexture) { + _inherits(BaseRenderTexture, _BaseTexture); + + /** + * @param {number} [width=100] - The width of the base render texture + * @param {number} [height=100] - The height of the base render texture + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture being generated + */ + function BaseRenderTexture() { + var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; + var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100; + var scaleMode = arguments[2]; + var resolution = arguments[3]; + + _classCallCheck(this, BaseRenderTexture); + + var _this = _possibleConstructorReturn(this, _BaseTexture.call(this, null, scaleMode)); + + _this.resolution = resolution || _settings2.default.RESOLUTION; + + _this.width = Math.ceil(width); + _this.height = Math.ceil(height); + + _this.realWidth = _this.width * _this.resolution; + _this.realHeight = _this.height * _this.resolution; + + _this.scaleMode = scaleMode !== undefined ? scaleMode : _settings2.default.SCALE_MODE; + _this.hasLoaded = true; + + /** + * A map of renderer IDs to webgl renderTargets + * + * @private + * @member {object} + */ + _this._glRenderTargets = {}; + + /** + * A reference to the canvas render target (we only need one as this can be shared across renderers) + * + * @private + * @member {object} + */ + _this._canvasRenderTarget = null; + + /** + * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. + * + * @member {boolean} + */ + _this.valid = false; + return _this; + } + + /** + * Resizes the BaseRenderTexture. + * + * @param {number} width - The width to resize to. + * @param {number} height - The height to resize to. + */ + + + BaseRenderTexture.prototype.resize = function resize(width, height) { + width = Math.ceil(width); + height = Math.ceil(height); + + if (width === this.width && height === this.height) { + return; + } + + this.valid = width > 0 && height > 0; + + this.width = width; + this.height = height; + + this.realWidth = this.width * this.resolution; + this.realHeight = this.height * this.resolution; + + if (!this.valid) { + return; + } + + this.emit('update', this); + }; + + /** + * Destroys this texture + * + */ + + + BaseRenderTexture.prototype.destroy = function destroy() { + _BaseTexture.prototype.destroy.call(this, true); + this.renderer = null; + }; + + return BaseRenderTexture; + }(_BaseTexture3.default); + + exports.default = BaseRenderTexture; + + }, { "../settings": 101, "./BaseTexture": 112 }], 112: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _utils = require('../utils'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _determineCrossOrigin = require('../utils/determineCrossOrigin'); + + var _determineCrossOrigin2 = _interopRequireDefault(_determineCrossOrigin); + + var _bitTwiddle = require('bit-twiddle'); + + var _bitTwiddle2 = _interopRequireDefault(_bitTwiddle); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A texture stores the information that represents an image. All textures have a base texture. + * + * @class + * @extends EventEmitter + * @memberof PIXI + */ + var BaseTexture = function (_EventEmitter) { + _inherits(BaseTexture, _EventEmitter); + + /** + * @param {HTMLImageElement|HTMLCanvasElement} [source] - the source object of the texture. + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture + */ + function BaseTexture(source, scaleMode, resolution) { + _classCallCheck(this, BaseTexture); + + var _this = _possibleConstructorReturn(this, _EventEmitter.call(this)); + + _this.uid = (0, _utils.uid)(); + + _this.touched = 0; + + /** + * The resolution / device pixel ratio of the texture + * + * @member {number} + * @default 1 + */ + _this.resolution = resolution || _settings2.default.RESOLUTION; + + /** + * The width of the base texture set when the image has loaded + * + * @readonly + * @member {number} + */ + _this.width = 100; + + /** + * The height of the base texture set when the image has loaded + * + * @readonly + * @member {number} + */ + _this.height = 100; + + // TODO docs + // used to store the actual dimensions of the source + /** + * Used to store the actual width of the source of this texture + * + * @readonly + * @member {number} + */ + _this.realWidth = 100; + /** + * Used to store the actual height of the source of this texture + * + * @readonly + * @member {number} + */ + _this.realHeight = 100; + + /** + * The scale mode to apply when scaling this texture + * + * @member {number} + * @default PIXI.settings.SCALE_MODE + * @see PIXI.SCALE_MODES + */ + _this.scaleMode = scaleMode !== undefined ? scaleMode : _settings2.default.SCALE_MODE; + + /** + * Set to true once the base texture has successfully loaded. + * + * This is never true if the underlying source fails to load or has no texture data. + * + * @readonly + * @member {boolean} + */ + _this.hasLoaded = false; + + /** + * Set to true if the source is currently loading. + * + * If an Image source is loading the 'loaded' or 'error' event will be + * dispatched when the operation ends. An underyling source that is + * immediately-available bypasses loading entirely. + * + * @readonly + * @member {boolean} + */ + _this.isLoading = false; + + /** + * The image source that is used to create the texture. + * + * TODO: Make this a setter that calls loadSource(); + * + * @readonly + * @member {HTMLImageElement|HTMLCanvasElement} + */ + _this.source = null; // set in loadSource, if at all + + /** + * The image source that is used to create the texture. This is used to + * store the original Svg source when it is replaced with a canvas element. + * + * TODO: Currently not in use but could be used when re-scaling svg. + * + * @readonly + * @member {Image} + */ + _this.origSource = null; // set in loadSvg, if at all + + /** + * Type of image defined in source, eg. `png` or `svg` + * + * @readonly + * @member {string} + */ + _this.imageType = null; // set in updateImageType + + /** + * Scale for source image. Used with Svg images to scale them before rasterization. + * + * @readonly + * @member {number} + */ + _this.sourceScale = 1.0; + + /** + * Controls if RGB channels should be pre-multiplied by Alpha (WebGL only) + * All blend modes, and shaders written for default value. Change it on your own risk. + * + * @member {boolean} + * @default true + */ + _this.premultipliedAlpha = true; + + /** + * The image url of the texture + * + * @member {string} + */ + _this.imageUrl = null; + + /** + * Whether or not the texture is a power of two, try to use power of two textures as much + * as you can + * + * @private + * @member {boolean} + */ + _this.isPowerOfTwo = false; + + // used for webGL + + /** + * + * Set this to true if a mipmap of this texture needs to be generated. This value needs + * to be set before the texture is used + * Also the texture must be a power of two size to work + * + * @member {boolean} + * @see PIXI.MIPMAP_TEXTURES + */ + _this.mipmap = _settings2.default.MIPMAP_TEXTURES; + + /** + * + * WebGL Texture wrap mode + * + * @member {number} + * @see PIXI.WRAP_MODES + */ + _this.wrapMode = _settings2.default.WRAP_MODE; + + /** + * A map of renderer IDs to webgl textures + * + * @private + * @member {object} + */ + _this._glTextures = {}; + + _this._enabled = 0; + _this._virtalBoundId = -1; + + /** + * If the object has been destroyed via destroy(). If true, it should not be used. + * + * @member {boolean} + * @private + * @readonly + */ + _this._destroyed = false; + + /** + * The ids under which this BaseTexture has been added to the base texture cache. This is + * automatically set as long as BaseTexture.addToCache is used, but may not be set if a + * BaseTexture is added directly to the BaseTextureCache array. + * + * @member {string[]} + */ + _this.textureCacheIds = []; + + // if no source passed don't try to load + if (source) { + _this.loadSource(source); + } + + /** + * Fired when a not-immediately-available source finishes loading. + * + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + + /** + * Fired when a not-immediately-available source fails to load. + * + * @protected + * @event PIXI.BaseTexture#error + * @param {PIXI.BaseTexture} baseTexture - Resource errored. + */ + + /** + * Fired when BaseTexture is updated. + * + * @protected + * @event PIXI.BaseTexture#update + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. + */ + + /** + * Fired when BaseTexture is destroyed. + * + * @protected + * @event PIXI.BaseTexture#dispose + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. + */ + return _this; + } + + /** + * Updates the texture on all the webgl renderers, this also assumes the src has changed. + * + * @fires PIXI.BaseTexture#update + */ + + + BaseTexture.prototype.update = function update() { + // Svg size is handled during load + if (this.imageType !== 'svg') { + this.realWidth = this.source.naturalWidth || this.source.videoWidth || this.source.width; + this.realHeight = this.source.naturalHeight || this.source.videoHeight || this.source.height; + + this._updateDimensions(); + } + + this.emit('update', this); + }; + + /** + * Update dimensions from real values + */ + + + BaseTexture.prototype._updateDimensions = function _updateDimensions() { + this.width = this.realWidth / this.resolution; + this.height = this.realHeight / this.resolution; + + this.isPowerOfTwo = _bitTwiddle2.default.isPow2(this.realWidth) && _bitTwiddle2.default.isPow2(this.realHeight); + }; + + /** + * Load a source. + * + * If the source is not-immediately-available, such as an image that needs to be + * downloaded, then the 'loaded' or 'error' event will be dispatched in the future + * and `hasLoaded` will remain false after this call. + * + * The logic state after calling `loadSource` directly or indirectly (eg. `fromImage`, `new BaseTexture`) is: + * + * if (texture.hasLoaded) { + * // texture ready for use + * } else if (texture.isLoading) { + * // listen to 'loaded' and/or 'error' events on texture + * } else { + * // not loading, not going to load UNLESS the source is reloaded + * // (it may still make sense to listen to the events) + * } + * + * @protected + * @param {HTMLImageElement|HTMLCanvasElement} source - the source object of the texture. + */ + + + BaseTexture.prototype.loadSource = function loadSource(source) { + var wasLoading = this.isLoading; + + this.hasLoaded = false; + this.isLoading = false; + + if (wasLoading && this.source) { + this.source.onload = null; + this.source.onerror = null; + } + + var firstSourceLoaded = !this.source; + + this.source = source; + + // Apply source if loaded. Otherwise setup appropriate loading monitors. + if ((source.src && source.complete || source.getContext) && source.width && source.height) { + this._updateImageType(); + + if (this.imageType === 'svg') { + this._loadSvgSource(); + } else { + this._sourceLoaded(); + } + + if (firstSourceLoaded) { + // send loaded event if previous source was null and we have been passed a pre-loaded IMG element + this.emit('loaded', this); + } + } else if (!source.getContext) { + // Image fail / not ready + this.isLoading = true; + + var scope = this; + + source.onload = function () { + scope._updateImageType(); + source.onload = null; + source.onerror = null; + + if (!scope.isLoading) { + return; + } + + scope.isLoading = false; + scope._sourceLoaded(); + + if (scope.imageType === 'svg') { + scope._loadSvgSource(); + + return; + } + + scope.emit('loaded', scope); + }; + + source.onerror = function () { + source.onload = null; + source.onerror = null; + + if (!scope.isLoading) { + return; + } + + scope.isLoading = false; + scope.emit('error', scope); + }; + + // Per http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element + // "The value of `complete` can thus change while a script is executing." + // So complete needs to be re-checked after the callbacks have been added.. + // NOTE: complete will be true if the image has no src so best to check if the src is set. + if (source.complete && source.src) { + // ..and if we're complete now, no need for callbacks + source.onload = null; + source.onerror = null; + + if (scope.imageType === 'svg') { + scope._loadSvgSource(); + + return; + } + + this.isLoading = false; + + if (source.width && source.height) { + this._sourceLoaded(); + + // If any previous subscribers possible + if (wasLoading) { + this.emit('loaded', this); + } + } + // If any previous subscribers possible + else if (wasLoading) { + this.emit('error', this); + } + } + } + }; + + /** + * Updates type of the source image. + */ + + + BaseTexture.prototype._updateImageType = function _updateImageType() { + if (!this.imageUrl) { + return; + } + + var dataUri = (0, _utils.decomposeDataUri)(this.imageUrl); + var imageType = void 0; + + if (dataUri && dataUri.mediaType === 'image') { + // Check for subType validity + var firstSubType = dataUri.subType.split('+')[0]; + + imageType = (0, _utils.getUrlFileExtension)('.' + firstSubType); + + if (!imageType) { + throw new Error('Invalid image type in data URI.'); + } + } else { + imageType = (0, _utils.getUrlFileExtension)(this.imageUrl); + + if (!imageType) { + imageType = 'png'; + } + } + + this.imageType = imageType; + }; + + /** + * Checks if `source` is an SVG image and whether it's loaded via a URL or a data URI. Then calls + * `_loadSvgSourceUsingDataUri` or `_loadSvgSourceUsingXhr`. + */ + + + BaseTexture.prototype._loadSvgSource = function _loadSvgSource() { + if (this.imageType !== 'svg') { + // Do nothing if source is not svg + return; + } + + var dataUri = (0, _utils.decomposeDataUri)(this.imageUrl); + + if (dataUri) { + this._loadSvgSourceUsingDataUri(dataUri); + } else { + // We got an URL, so we need to do an XHR to check the svg size + this._loadSvgSourceUsingXhr(); + } + }; + + /** + * Reads an SVG string from data URI and then calls `_loadSvgSourceUsingString`. + * + * @param {string} dataUri - The data uri to load from. + */ + + + BaseTexture.prototype._loadSvgSourceUsingDataUri = function _loadSvgSourceUsingDataUri(dataUri) { + var svgString = void 0; + + if (dataUri.encoding === 'base64') { + if (!atob) { + throw new Error('Your browser doesn\'t support base64 conversions.'); + } + svgString = atob(dataUri.data); + } else { + svgString = dataUri.data; + } + + this._loadSvgSourceUsingString(svgString); + }; + + /** + * Loads an SVG string from `imageUrl` using XHR and then calls `_loadSvgSourceUsingString`. + */ + + + BaseTexture.prototype._loadSvgSourceUsingXhr = function _loadSvgSourceUsingXhr() { + var _this2 = this; + + var svgXhr = new XMLHttpRequest(); + + // This throws error on IE, so SVG Document can't be used + // svgXhr.responseType = 'document'; + + // This is not needed since we load the svg as string (breaks IE too) + // but overrideMimeType() can be used to force the response to be parsed as XML + // svgXhr.overrideMimeType('image/svg+xml'); + + svgXhr.onload = function () { + if (svgXhr.readyState !== svgXhr.DONE || svgXhr.status !== 200) { + throw new Error('Failed to load SVG using XHR.'); + } + + _this2._loadSvgSourceUsingString(svgXhr.response); + }; + + svgXhr.onerror = function () { + return _this2.emit('error', _this2); + }; + + svgXhr.open('GET', this.imageUrl, true); + svgXhr.send(); + }; + + /** + * Loads texture using an SVG string. The original SVG Image is stored as `origSource` and the + * created canvas is the new `source`. The SVG is scaled using `sourceScale`. Called by + * `_loadSvgSourceUsingXhr` or `_loadSvgSourceUsingDataUri`. + * + * @param {string} svgString SVG source as string + * + * @fires PIXI.BaseTexture#loaded + */ + + + BaseTexture.prototype._loadSvgSourceUsingString = function _loadSvgSourceUsingString(svgString) { + var svgSize = (0, _utils.getSvgSize)(svgString); + + var svgWidth = svgSize.width; + var svgHeight = svgSize.height; + + if (!svgWidth || !svgHeight) { + throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.'); + } + + // Scale realWidth and realHeight + this.realWidth = Math.round(svgWidth * this.sourceScale); + this.realHeight = Math.round(svgHeight * this.sourceScale); + + this._updateDimensions(); + + // Create a canvas element + var canvas = document.createElement('canvas'); + + canvas.width = this.realWidth; + canvas.height = this.realHeight; + canvas._pixiId = 'canvas_' + (0, _utils.uid)(); + + // Draw the Svg to the canvas + canvas.getContext('2d').drawImage(this.source, 0, 0, svgWidth, svgHeight, 0, 0, this.realWidth, this.realHeight); + + // Replace the original source image with the canvas + this.origSource = this.source; + this.source = canvas; + + // Add also the canvas in cache (destroy clears by `imageUrl` and `source._pixiId`) + BaseTexture.addToCache(this, canvas._pixiId); + + this.isLoading = false; + this._sourceLoaded(); + this.emit('loaded', this); + }; + + /** + * Used internally to update the width, height, and some other tracking vars once + * a source has successfully loaded. + * + * @private + */ + + + BaseTexture.prototype._sourceLoaded = function _sourceLoaded() { + this.hasLoaded = true; + this.update(); + }; + + /** + * Destroys this base texture + * + */ + + + BaseTexture.prototype.destroy = function destroy() { + if (this.imageUrl) { + delete _utils.TextureCache[this.imageUrl]; + + this.imageUrl = null; + + if (!navigator.isCocoonJS) { + this.source.src = ''; + } + } + + this.source = null; + + this.dispose(); + + BaseTexture.removeFromCache(this); + this.textureCacheIds = null; + + this._destroyed = true; + }; + + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * + * @fires PIXI.BaseTexture#dispose + */ + + + BaseTexture.prototype.dispose = function dispose() { + this.emit('dispose', this); + }; + + /** + * Changes the source image of the texture. + * The original source must be an Image element. + * + * @param {string} newSrc - the path of the image + */ + + + BaseTexture.prototype.updateSourceImage = function updateSourceImage(newSrc) { + this.source.src = newSrc; + + this.loadSource(this.source); + }; + + /** + * Helper function that creates a base texture from the given image url. + * If the image is not in the base texture cache it will be created and loaded. + * + * @static + * @param {string} imageUrl - The image url of the texture + * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI. + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [sourceScale=(auto)] - Scale for the original image, used with Svg images. + * @return {PIXI.BaseTexture} The new base texture. + */ + + + BaseTexture.fromImage = function fromImage(imageUrl, crossorigin, scaleMode, sourceScale) { + var baseTexture = _utils.BaseTextureCache[imageUrl]; + + if (!baseTexture) { + // new Image() breaks tex loading in some versions of Chrome. + // See https://code.google.com/p/chromium/issues/detail?id=238071 + var image = new Image(); // document.createElement('img'); + + if (crossorigin === undefined && imageUrl.indexOf('data:') !== 0) { + image.crossOrigin = (0, _determineCrossOrigin2.default)(imageUrl); + } else if (crossorigin) { + image.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + + baseTexture = new BaseTexture(image, scaleMode); + baseTexture.imageUrl = imageUrl; + + if (sourceScale) { + baseTexture.sourceScale = sourceScale; + } + + // if there is an @2x at the end of the url we are going to assume its a highres image + baseTexture.resolution = (0, _utils.getResolutionOfUrl)(imageUrl); + + image.src = imageUrl; // Setting this triggers load + + BaseTexture.addToCache(baseTexture, imageUrl); + } + + return baseTexture; + }; + + /** + * Helper function that creates a base texture from the given canvas element. + * + * @static + * @param {HTMLCanvasElement} canvas - The canvas element source of the texture + * @param {number} scaleMode - See {@link PIXI.SCALE_MODES} for possible values + * @param {string} [origin='canvas'] - A string origin of who created the base texture + * @return {PIXI.BaseTexture} The new base texture. + */ + + + BaseTexture.fromCanvas = function fromCanvas(canvas, scaleMode) { + var origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'canvas'; + + if (!canvas._pixiId) { + canvas._pixiId = origin + '_' + (0, _utils.uid)(); + } + + var baseTexture = _utils.BaseTextureCache[canvas._pixiId]; + + if (!baseTexture) { + baseTexture = new BaseTexture(canvas, scaleMode); + BaseTexture.addToCache(baseTexture, canvas._pixiId); + } + + return baseTexture; + }; + + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * + * @static + * @param {string|HTMLImageElement|HTMLCanvasElement} source - The source to create base texture from. + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [sourceScale=(auto)] - Scale for the original image, used with Svg images. + * @return {PIXI.BaseTexture} The new base texture. + */ + + + BaseTexture.from = function from(source, scaleMode, sourceScale) { + if (typeof source === 'string') { + return BaseTexture.fromImage(source, undefined, scaleMode, sourceScale); + } else if (source instanceof HTMLImageElement) { + var imageUrl = source.src; + var baseTexture = _utils.BaseTextureCache[imageUrl]; + + if (!baseTexture) { + baseTexture = new BaseTexture(source, scaleMode); + baseTexture.imageUrl = imageUrl; + + if (sourceScale) { + baseTexture.sourceScale = sourceScale; + } + + // if there is an @2x at the end of the url we are going to assume its a highres image + baseTexture.resolution = (0, _utils.getResolutionOfUrl)(imageUrl); + + BaseTexture.addToCache(baseTexture, imageUrl); + } + + return baseTexture; + } else if (source instanceof HTMLCanvasElement) { + return BaseTexture.fromCanvas(source, scaleMode); + } + + // lets assume its a base texture! + return source; + }; + + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * + * @static + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + + + BaseTexture.addToCache = function addToCache(baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { + baseTexture.textureCacheIds.push(id); + } + + /* eslint-disable no-console */ + if (_utils.BaseTextureCache[id]) { + console.warn('BaseTexture added to the cache with an id [' + id + '] that already had an entry'); + } + /* eslint-enable no-console */ + + _utils.BaseTextureCache[id] = baseTexture; + } + }; + + /** + * Remove a BaseTexture from the global BaseTextureCache. + * + * @static + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @return {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + + + BaseTexture.removeFromCache = function removeFromCache(baseTexture) { + if (typeof baseTexture === 'string') { + var baseTextureFromCache = _utils.BaseTextureCache[baseTexture]; + + if (baseTextureFromCache) { + var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); + + if (index > -1) { + baseTextureFromCache.textureCacheIds.splice(index, 1); + } + + delete _utils.BaseTextureCache[baseTexture]; + + return baseTextureFromCache; + } + } else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { + delete _utils.BaseTextureCache[baseTexture.textureCacheIds[i]]; + } + + baseTexture.textureCacheIds.length = 0; + + return baseTexture; + } + + return null; + }; + + return BaseTexture; + }(_eventemitter2.default); + + exports.default = BaseTexture; + + }, { "../settings": 101, "../utils": 125, "../utils/determineCrossOrigin": 124, "bit-twiddle": 1, "eventemitter3": 3 }], 113: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _BaseRenderTexture = require('./BaseRenderTexture'); + + var _BaseRenderTexture2 = _interopRequireDefault(_BaseRenderTexture); + + var _Texture2 = require('./Texture'); + + var _Texture3 = _interopRequireDefault(_Texture2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(1024, 1024); + * let renderTexture = PIXI.RenderTexture.create(800, 600); + * let sprite = PIXI.Sprite.fromImage("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, renderTexture); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create(100, 100); + * + * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture + * ``` + * + * @class + * @extends PIXI.Texture + * @memberof PIXI + */ + var RenderTexture = function (_Texture) { + _inherits(RenderTexture, _Texture); + + /** + * @param {PIXI.BaseRenderTexture} baseRenderTexture - The renderer used for this RenderTexture + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + */ + function RenderTexture(baseRenderTexture, frame) { + _classCallCheck(this, RenderTexture); + + // support for legacy.. + var _legacyRenderer = null; + + if (!(baseRenderTexture instanceof _BaseRenderTexture2.default)) { + /* eslint-disable prefer-rest-params, no-console */ + var width = arguments[1]; + var height = arguments[2]; + var scaleMode = arguments[3]; + var resolution = arguments[4]; + + // we have an old render texture.. + console.warn('Please use RenderTexture.create(' + width + ', ' + height + ') instead of the ctor directly.'); + _legacyRenderer = arguments[0]; + /* eslint-enable prefer-rest-params, no-console */ + + frame = null; + baseRenderTexture = new _BaseRenderTexture2.default(width, height, scaleMode, resolution); + } + + /** + * The base texture object that this texture uses + * + * @member {BaseTexture} + */ + + var _this = _possibleConstructorReturn(this, _Texture.call(this, baseRenderTexture, frame)); + + _this.legacyRenderer = _legacyRenderer; + + /** + * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. + * + * @member {boolean} + */ + _this.valid = true; + + _this._updateUvs(); + return _this; + } + + /** + * Resizes the RenderTexture. + * + * @param {number} width - The width to resize to. + * @param {number} height - The height to resize to. + * @param {boolean} doNotResizeBaseTexture - Should the baseTexture.width and height values be resized as well? + */ + + + RenderTexture.prototype.resize = function resize(width, height, doNotResizeBaseTexture) { + width = Math.ceil(width); + height = Math.ceil(height); + + // TODO - could be not required.. + this.valid = width > 0 && height > 0; + + this._frame.width = this.orig.width = width; + this._frame.height = this.orig.height = height; + + if (!doNotResizeBaseTexture) { + this.baseTexture.resize(width, height); + } + + this._updateUvs(); + }; + + /** + * A short hand way of creating a render texture. + * + * @param {number} [width=100] - The width of the render texture + * @param {number} [height=100] - The height of the render texture + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture being generated + * @return {PIXI.RenderTexture} The new render texture + */ + + + RenderTexture.create = function create(width, height, scaleMode, resolution) { + return new RenderTexture(new _BaseRenderTexture2.default(width, height, scaleMode, resolution)); + }; + + return RenderTexture; + }(_Texture3.default); + + exports.default = RenderTexture; + + }, { "./BaseRenderTexture": 111, "./Texture": 115 }], 114: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _ = require('../'); + + var _utils = require('../utils'); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Utility class for maintaining reference to a collection + * of Textures on a single Spritesheet. + * + * To access a sprite sheet from your code pass its JSON data file to Pixi's loader: + * + * ```js + * PIXI.loader.add("images/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.loader.resources["images/spritesheet.json"].spritesheet; + * ... + * } + * ``` + * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite. + * + * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker}, + * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}. + * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only + * supported by TexturePacker. + * + * @class + * @memberof PIXI + */ + var Spritesheet = function () { + _createClass(Spritesheet, null, [{ + key: 'BATCH_SIZE', + + /** + * The maximum number of Textures to build per process. + * + * @type {number} + * @default 1000 + */ + get: function get() { + return 1000; + } + + /** + * @param {PIXI.BaseTexture} baseTexture Reference to the source BaseTexture object. + * @param {Object} data - Spritesheet image data. + * @param {string} [resolutionFilename] - The filename to consider when determining + * the resolution of the spritesheet. If not provided, the imageUrl will + * be used on the BaseTexture. + */ + + }]); + + function Spritesheet(baseTexture, data) { + var resolutionFilename = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + _classCallCheck(this, Spritesheet); + + /** + * Reference to ths source texture + * @type {PIXI.BaseTexture} + */ + this.baseTexture = baseTexture; + + /** + * A map containing all textures of the sprite sheet. + * Can be used to create a {@link PIXI.Sprite|Sprite}: + * ```js + * new PIXI.Sprite(sheet.textures["image.png"]); + * ``` + * @member {Object} + */ + this.textures = {}; + + /** + * A map containing the textures for each animation. + * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}: + * ```js + * new PIXI.extras.AnimatedSprite(sheet.animations["anim_name"]) + * ``` + * @member {Object} + */ + this.animations = {}; + + /** + * Reference to the original JSON data. + * @type {Object} + */ + this.data = data; + + /** + * The resolution of the spritesheet. + * @type {number} + */ + this.resolution = this._updateResolution(resolutionFilename || this.baseTexture.imageUrl); + + /** + * Map of spritesheet frames. + * @type {Object} + * @private + */ + this._frames = this.data.frames; + + /** + * Collection of frame names. + * @type {string[]} + * @private + */ + this._frameKeys = Object.keys(this._frames); + + /** + * Current batch index being processed. + * @type {number} + * @private + */ + this._batchIndex = 0; + + /** + * Callback when parse is completed. + * @type {Function} + * @private + */ + this._callback = null; + } + + /** + * Generate the resolution from the filename or fallback + * to the meta.scale field of the JSON data. + * + * @private + * @param {string} resolutionFilename - The filename to use for resolving + * the default resolution. + * @return {number} Resolution to use for spritesheet. + */ + + + Spritesheet.prototype._updateResolution = function _updateResolution(resolutionFilename) { + var scale = this.data.meta.scale; + + // Use a defaultValue of `null` to check if a url-based resolution is set + var resolution = (0, _utils.getResolutionOfUrl)(resolutionFilename, null); + + // No resolution found via URL + if (resolution === null) { + // Use the scale value or default to 1 + resolution = scale !== undefined ? parseFloat(scale) : 1; + } + + // For non-1 resolutions, update baseTexture + if (resolution !== 1) { + this.baseTexture.resolution = resolution; + this.baseTexture.update(); + } + + return resolution; + }; + + /** + * Parser spritesheet from loaded data. This is done asynchronously + * to prevent creating too many Texture within a single process. + * + * @param {Function} callback - Callback when complete returns + * a map of the Textures for this spritesheet. + */ + + + Spritesheet.prototype.parse = function parse(callback) { + this._batchIndex = 0; + this._callback = callback; + + if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) { + this._processFrames(0); + this._processAnimations(); + this._parseComplete(); + } else { + this._nextBatch(); + } + }; + + /** + * Process a batch of frames + * + * @private + * @param {number} initialFrameIndex - The index of frame to start. + */ + + + Spritesheet.prototype._processFrames = function _processFrames(initialFrameIndex) { + var frameIndex = initialFrameIndex; + var maxFrames = Spritesheet.BATCH_SIZE; + var sourceScale = this.baseTexture.sourceScale; + + while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) { + var i = this._frameKeys[frameIndex]; + var data = this._frames[i]; + var rect = data.frame; + + if (rect) { + var frame = null; + var trim = null; + var sourceSize = data.trimmed !== false && data.sourceSize ? data.sourceSize : data.frame; + + var orig = new _.Rectangle(0, 0, Math.floor(sourceSize.w * sourceScale) / this.resolution, Math.floor(sourceSize.h * sourceScale) / this.resolution); + + if (data.rotated) { + frame = new _.Rectangle(Math.floor(rect.x * sourceScale) / this.resolution, Math.floor(rect.y * sourceScale) / this.resolution, Math.floor(rect.h * sourceScale) / this.resolution, Math.floor(rect.w * sourceScale) / this.resolution); + } else { + frame = new _.Rectangle(Math.floor(rect.x * sourceScale) / this.resolution, Math.floor(rect.y * sourceScale) / this.resolution, Math.floor(rect.w * sourceScale) / this.resolution, Math.floor(rect.h * sourceScale) / this.resolution); + } + + // Check to see if the sprite is trimmed + if (data.trimmed !== false && data.spriteSourceSize) { + trim = new _.Rectangle(Math.floor(data.spriteSourceSize.x * sourceScale) / this.resolution, Math.floor(data.spriteSourceSize.y * sourceScale) / this.resolution, Math.floor(rect.w * sourceScale) / this.resolution, Math.floor(rect.h * sourceScale) / this.resolution); + } + + this.textures[i] = new _.Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor); + + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions + _.Texture.addToCache(this.textures[i], i); + } + + frameIndex++; + } + }; + + /** + * Parse animations config + * + * @private + */ + + + Spritesheet.prototype._processAnimations = function _processAnimations() { + var animations = this.data.animations || {}; + + for (var animName in animations) { + this.animations[animName] = []; + for (var _iterator = animations[animName], _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var frameName = _ref; + + this.animations[animName].push(this.textures[frameName]); + } + } + }; + + /** + * The parse has completed. + * + * @private + */ + + + Spritesheet.prototype._parseComplete = function _parseComplete() { + var callback = this._callback; + + this._callback = null; + this._batchIndex = 0; + callback.call(this, this.textures); + }; + + /** + * Begin the next batch of textures. + * + * @private + */ + + + Spritesheet.prototype._nextBatch = function _nextBatch() { + var _this = this; + + this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); + this._batchIndex++; + setTimeout(function () { + if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) { + _this._nextBatch(); + } else { + _this._processAnimations(); + _this._parseComplete(); + } + }, 0); + }; + + /** + * Destroy Spritesheet and don't use after this. + * + * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well + */ + + + Spritesheet.prototype.destroy = function destroy() { + var destroyBase = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + for (var i in this.textures) { + this.textures[i].destroy(); + } + this._frames = null; + this._frameKeys = null; + this.data = null; + this.textures = null; + if (destroyBase) { + this.baseTexture.destroy(); + } + this.baseTexture = null; + }; + + return Spritesheet; + }(); + + exports.default = Spritesheet; + + }, { "../": 65, "../utils": 125 }], 115: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _BaseTexture = require('./BaseTexture'); + + var _BaseTexture2 = _interopRequireDefault(_BaseTexture); + + var _VideoBaseTexture = require('./VideoBaseTexture'); + + var _VideoBaseTexture2 = _interopRequireDefault(_VideoBaseTexture); + + var _TextureUvs = require('./TextureUvs'); + + var _TextureUvs2 = _interopRequireDefault(_TextureUvs); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _math = require('../math'); + + var _utils = require('../utils'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A texture stores the information that represents an image or part of an image. It cannot be added + * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided + * then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.fromImage('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.fromImage('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * + * @class + * @extends EventEmitter + * @memberof PIXI + */ + var Texture = function (_EventEmitter) { + _inherits(Texture, _EventEmitter); + + /** + * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + * @param {PIXI.Rectangle} [orig] - The area of original texture + * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture + * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.GroupD8} + * @param {PIXI.Point} [anchor] - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + _classCallCheck(this, Texture); + + /** + * Does this Texture have any frame data assigned to it? + * + * @member {boolean} + */ + var _this = _possibleConstructorReturn(this, _EventEmitter.call(this)); + + _this.noFrame = false; + + if (!frame) { + _this.noFrame = true; + frame = new _math.Rectangle(0, 0, 1, 1); + } + + if (baseTexture instanceof Texture) { + baseTexture = baseTexture.baseTexture; + } + + /** + * The base texture that this texture uses. + * + * @member {PIXI.BaseTexture} + */ + _this.baseTexture = baseTexture; + + /** + * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, + * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) + * + * @member {PIXI.Rectangle} + */ + _this._frame = frame; + + /** + * This is the trimmed area of original texture, before it was put in atlas + * Please call `_updateUvs()` after you change coordinates of `trim` manually. + * + * @member {PIXI.Rectangle} + */ + _this.trim = trim; + + /** + * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. + * + * @member {boolean} + */ + _this.valid = false; + + /** + * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * + * @member {boolean} + */ + _this.requiresUpdate = false; + + /** + * The WebGL UV data cache. + * + * @member {PIXI.TextureUvs} + * @private + */ + _this._uvs = null; + + /** + * This is the area of original texture, before it was put in atlas + * + * @member {PIXI.Rectangle} + */ + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + + _this._rotate = Number(rotate || 0); + + if (rotate === true) { + // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures + _this._rotate = 2; + } else if (_this._rotate % 2 !== 0) { + throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); + } + + if (baseTexture.hasLoaded) { + if (_this.noFrame) { + frame = new _math.Rectangle(0, 0, baseTexture.width, baseTexture.height); + + // if there is no frame we should monitor for any base texture changes.. + baseTexture.on('update', _this.onBaseTextureUpdated, _this); + } + _this.frame = frame; + } else { + baseTexture.once('loaded', _this.onBaseTextureLoaded, _this); + } + + /** + * Anchor point that is used as default if sprite is created with this texture. + * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. + * @member {PIXI.Point} + * @default {0,0} + */ + _this.defaultAnchor = anchor ? new _math.Point(anchor.x, anchor.y) : new _math.Point(0, 0); + + /** + * Fired when the texture is updated. This happens if the frame or the baseTexture is updated. + * + * @event PIXI.Texture#update + * @protected + * @param {PIXI.Texture} texture - Instance of texture being updated. + */ + + _this._updateID = 0; + + /** + * Contains data for uvs. May contain clamp settings and some matrices. + * Its a bit heavy, so by default that object is not created. + * @member {PIXI.TextureMatrix} + * @default null + */ + _this.transform = null; + + /** + * The ids under which this Texture has been added to the texture cache. This is + * automatically set as long as Texture.addToCache is used, but may not be set if a + * Texture is added directly to the TextureCache array. + * + * @member {string[]} + */ + _this.textureCacheIds = []; + return _this; + } + + /** + * Updates this texture on the gpu. + * + */ + + + Texture.prototype.update = function update() { + this.baseTexture.update(); + }; + + /** + * Called when the base texture is loaded + * + * @private + * @param {PIXI.BaseTexture} baseTexture - The base texture. + */ + + + Texture.prototype.onBaseTextureLoaded = function onBaseTextureLoaded(baseTexture) { + this._updateID++; + + // TODO this code looks confusing.. boo to abusing getters and setters! + if (this.noFrame) { + this.frame = new _math.Rectangle(0, 0, baseTexture.width, baseTexture.height); + } else { + this.frame = this._frame; + } + + this.baseTexture.on('update', this.onBaseTextureUpdated, this); + this.emit('update', this); + }; + + /** + * Called when the base texture is updated + * + * @private + * @param {PIXI.BaseTexture} baseTexture - The base texture. + */ + + + Texture.prototype.onBaseTextureUpdated = function onBaseTextureUpdated(baseTexture) { + this._updateID++; + + this._frame.width = baseTexture.width; + this._frame.height = baseTexture.height; + + this.emit('update', this); + }; + + /** + * Destroys this texture + * + * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well + */ + + + Texture.prototype.destroy = function destroy(destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + // delete the texture if it exists in the texture cache.. + // this only needs to be removed if the base texture is actually destroyed too.. + if (_utils.TextureCache[this.baseTexture.imageUrl]) { + Texture.removeFromCache(this.baseTexture.imageUrl); + } + + this.baseTexture.destroy(); + } + + this.baseTexture.off('update', this.onBaseTextureUpdated, this); + this.baseTexture.off('loaded', this.onBaseTextureLoaded, this); + + this.baseTexture = null; + } + + this._frame = null; + this._uvs = null; + this.trim = null; + this.orig = null; + + this.valid = false; + + Texture.removeFromCache(this); + this.textureCacheIds = null; + }; + + /** + * Creates a new texture object that acts the same as this one. + * + * @return {PIXI.Texture} The new texture + */ + + + Texture.prototype.clone = function clone() { + return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor); + }; + + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + */ + + + Texture.prototype._updateUvs = function _updateUvs() { + if (!this._uvs) { + this._uvs = new _TextureUvs2.default(); + } + + this._uvs.set(this._frame, this.baseTexture, this.rotate); + + this._updateID++; + }; + + /** + * Helper function that creates a Texture object from the given image url. + * If the image is not in the texture cache it will be created and loaded. + * + * @static + * @param {string} imageUrl - The image url of the texture + * @param {boolean} [crossorigin] - Whether requests should be treated as crossorigin + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [sourceScale=(auto)] - Scale for the original image, used with SVG images. + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.fromImage = function fromImage(imageUrl, crossorigin, scaleMode, sourceScale) { + var texture = _utils.TextureCache[imageUrl]; + + if (!texture) { + texture = new Texture(_BaseTexture2.default.fromImage(imageUrl, crossorigin, scaleMode, sourceScale)); + Texture.addToCache(texture, imageUrl); + } + + return texture; + }; + + /** + * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param {string} frameId - The frame Id of the texture in the cache + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.fromFrame = function fromFrame(frameId) { + var texture = _utils.TextureCache[frameId]; + + if (!texture) { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache'); + } + + return texture; + }; + + /** + * Helper function that creates a new Texture based on the given canvas element. + * + * @static + * @param {HTMLCanvasElement} canvas - The canvas element source of the texture + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {string} [origin='canvas'] - A string origin of who created the base texture + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.fromCanvas = function fromCanvas(canvas, scaleMode) { + var origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'canvas'; + + return new Texture(_BaseTexture2.default.fromCanvas(canvas, scaleMode, origin)); + }; + + /** + * Helper function that creates a new Texture based on the given video element. + * + * @static + * @param {HTMLVideoElement|string} video - The URL or actual element of the video + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI. + * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.fromVideo = function fromVideo(video, scaleMode, crossorigin, autoPlay) { + if (typeof video === 'string') { + return Texture.fromVideoUrl(video, scaleMode, crossorigin, autoPlay); + } + + return new Texture(_VideoBaseTexture2.default.fromVideo(video, scaleMode, autoPlay)); + }; + + /** + * Helper function that creates a new Texture based on the video url. + * + * @static + * @param {string} videoUrl - URL of the video + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI. + * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.fromVideoUrl = function fromVideoUrl(videoUrl, scaleMode, crossorigin, autoPlay) { + return new Texture(_VideoBaseTexture2.default.fromUrl(videoUrl, scaleMode, crossorigin, autoPlay)); + }; + + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {number|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} + * source - Source to create texture from + * @return {PIXI.Texture} The newly created texture + */ + + + Texture.from = function from(source) { + // TODO auto detect cross origin.. + // TODO pass in scale mode? + if (typeof source === 'string') { + var texture = _utils.TextureCache[source]; + + if (!texture) { + // check if its a video.. + var isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) !== null; + + if (isVideo) { + return Texture.fromVideoUrl(source); + } + + return Texture.fromImage(source); + } + + return texture; + } else if (source instanceof HTMLImageElement) { + return new Texture(_BaseTexture2.default.from(source)); + } else if (source instanceof HTMLCanvasElement) { + return Texture.fromCanvas(source, _settings2.default.SCALE_MODE, 'HTMLCanvasElement'); + } else if (source instanceof HTMLVideoElement) { + return Texture.fromVideo(source); + } else if (source instanceof _BaseTexture2.default) { + return new Texture(source); + } + + // lets assume its a texture! + return source; + }; + + /** + * Create a texture from a source and add to the cache. + * + * @static + * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. + * @param {String} imageUrl - File name of texture, for cache and resolving resolution. + * @param {String} [name] - Human readible name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @return {PIXI.Texture} Output texture + */ + + + Texture.fromLoader = function fromLoader(source, imageUrl, name) { + var baseTexture = new _BaseTexture2.default(source, undefined, (0, _utils.getResolutionOfUrl)(imageUrl)); + var texture = new Texture(baseTexture); + + baseTexture.imageUrl = imageUrl; + + // No name, use imageUrl instead + if (!name) { + name = imageUrl; + } + + // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + _BaseTexture2.default.addToCache(texture.baseTexture, name); + Texture.addToCache(texture, name); + + // also add references by url if they are different. + if (name !== imageUrl) { + _BaseTexture2.default.addToCache(texture.baseTexture, imageUrl); + Texture.addToCache(texture, imageUrl); + } + + return texture; + }; + + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * + * @static + * @param {PIXI.Texture} texture - The Texture to add to the cache. + * @param {string} id - The id that the Texture will be stored against. + */ + + + Texture.addToCache = function addToCache(texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { + texture.textureCacheIds.push(id); + } + + /* eslint-disable no-console */ + if (_utils.TextureCache[id]) { + console.warn('Texture added to the cache with an id [' + id + '] that already had an entry'); + } + /* eslint-enable no-console */ + + _utils.TextureCache[id] = texture; + } + }; + + /** + * Remove a Texture from the global TextureCache. + * + * @static + * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself + * @return {PIXI.Texture|null} The Texture that was removed + */ + + + Texture.removeFromCache = function removeFromCache(texture) { + if (typeof texture === 'string') { + var textureFromCache = _utils.TextureCache[texture]; + + if (textureFromCache) { + var index = textureFromCache.textureCacheIds.indexOf(texture); + + if (index > -1) { + textureFromCache.textureCacheIds.splice(index, 1); + } + + delete _utils.TextureCache[texture]; + + return textureFromCache; + } + } else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { + // Check that texture matches the one being passed in before deleting it from the cache. + if (_utils.TextureCache[texture.textureCacheIds[i]] === texture) { + delete _utils.TextureCache[texture.textureCacheIds[i]]; + } + } + + texture.textureCacheIds.length = 0; + + return texture; + } + + return null; + }; + + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `_updateUvs()` after you change coordinates of `frame` manually. + * + * @member {PIXI.Rectangle} + */ + + + _createClass(Texture, [{ + key: 'frame', + get: function get() { + return this._frame; + }, + set: function set(frame) // eslint-disable-line require-jsdoc + { + this._frame = frame; + + this.noFrame = false; + + var x = frame.x, + y = frame.y, + width = frame.width, + height = frame.height; + + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = 'X: ' + x + ' + ' + width + ' = ' + (x + width) + ' > ' + this.baseTexture.width; + var errorY = 'Y: ' + y + ' + ' + height + ' = ' + (y + height) + ' > ' + this.baseTexture.height; + + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + (errorX + ' ' + relationship + ' ' + errorY)); + } + + // this.valid = width && height && this.baseTexture.source && this.baseTexture.hasLoaded; + this.valid = width && height && this.baseTexture.hasLoaded; + + if (!this.trim && !this.rotate) { + this.orig = frame; + } + + if (this.valid) { + this._updateUvs(); + } + } + + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.GroupD8} for explanation + * + * @member {number} + */ + + }, { + key: 'rotate', + get: function get() { + return this._rotate; + }, + set: function set(rotate) // eslint-disable-line require-jsdoc + { + this._rotate = rotate; + if (this.valid) { + this._updateUvs(); + } + } + + /** + * The width of the Texture in pixels. + * + * @member {number} + */ + + }, { + key: 'width', + get: function get() { + return this.orig.width; + } + + /** + * The height of the Texture in pixels. + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return this.orig.height; + } + }]); + + return Texture; + }(_eventemitter2.default); + + exports.default = Texture; + + + function createWhiteTexture() { + var canvas = document.createElement('canvas'); + + canvas.width = 10; + canvas.height = 10; + + var context = canvas.getContext('2d'); + + context.fillStyle = 'white'; + context.fillRect(0, 0, 10, 10); + + return new Texture(new _BaseTexture2.default(canvas)); + } + + function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() {/* empty */ }; + tex.on = function _emptyOn() {/* empty */ }; + tex.once = function _emptyOnce() {/* empty */ }; + tex.emit = function _emptyEmit() {/* empty */ }; + } + + /** + * An empty texture, used often to not have to create multiple empty textures. + * Can not be destroyed. + * + * @static + * @constant + */ + Texture.EMPTY = new Texture(new _BaseTexture2.default()); + removeAllHandlers(Texture.EMPTY); + removeAllHandlers(Texture.EMPTY.baseTexture); + + /** + * A white texture of 10x10 size, used for graphics and other things + * Can not be destroyed. + * + * @static + * @constant + */ + Texture.WHITE = createWhiteTexture(); + removeAllHandlers(Texture.WHITE); + removeAllHandlers(Texture.WHITE.baseTexture); + + }, { "../math": 70, "../settings": 101, "../utils": 125, "./BaseTexture": 112, "./TextureUvs": 117, "./VideoBaseTexture": 118, "eventemitter3": 3 }], 116: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _Matrix = require('../math/Matrix'); + + var _Matrix2 = _interopRequireDefault(_Matrix); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var tempMat = new _Matrix2.default(); + + /** + * Class controls uv transform and frame clamp for texture + * Can be used in Texture "transform" field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * @see PIXI.Texture + * @see PIXI.mesh.Mesh + * @see PIXI.extras.TilingSprite + * @class + * @memberof PIXI + */ + + var TextureMatrix = function () { + /** + * + * @param {PIXI.Texture} texture observed texture + * @param {number} [clampMargin] Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + * @constructor + */ + function TextureMatrix(texture, clampMargin) { + _classCallCheck(this, TextureMatrix); + + this._texture = texture; + + this.mapCoord = new _Matrix2.default(); + + this.uClampFrame = new Float32Array(4); + + this.uClampOffset = new Float32Array(2); + + this._lastTextureID = -1; + + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders + * + * @default 0 + * @member {number} + */ + this.clampOffset = 0; + + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + this.clampMargin = typeof clampMargin === 'undefined' ? 0.5 : clampMargin; + } + + /** + * texture property + * @member {PIXI.Texture} + */ + + + /** + * Multiplies uvs array to transform + * @param {Float32Array} uvs mesh uvs + * @param {Float32Array} [out=uvs] output + * @returns {Float32Array} output + */ + TextureMatrix.prototype.multiplyUvs = function multiplyUvs(uvs, out) { + if (out === undefined) { + out = uvs; + } + + var mat = this.mapCoord; + + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + + out[i] = x * mat.a + y * mat.c + mat.tx; + out[i + 1] = x * mat.b + y * mat.d + mat.ty; + } + + return out; + }; + + /** + * updates matrices if texture was changed + * @param {boolean} forceUpdate if true, matrices will be updated any case + * @returns {boolean} whether or not it was updated + */ + + + TextureMatrix.prototype.update = function update(forceUpdate) { + var tex = this._texture; + + if (!tex || !tex.valid) { + return false; + } + + if (!forceUpdate && this._lastTextureID === tex._updateID) { + return false; + } + + this._lastTextureID = tex._updateID; + + var uvs = tex._uvs; + + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + + var orig = tex.orig; + var trim = tex.trim; + + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + + return true; + }; + + _createClass(TextureMatrix, [{ + key: 'texture', + get: function get() { + return this._texture; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._texture = value; + this._lastTextureID = -1; + } + }]); + + return TextureMatrix; + }(); + + exports.default = TextureMatrix; + + }, { "../math/Matrix": 67 }], 117: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _GroupD = require('../math/GroupD8'); + + var _GroupD2 = _interopRequireDefault(_GroupD); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * A standard object to store the Uvs of a texture + * + * @class + * @private + * @memberof PIXI + */ + var TextureUvs = function () { + /** + * + */ + function TextureUvs() { + _classCallCheck(this, TextureUvs); + + this.x0 = 0; + this.y0 = 0; + + this.x1 = 1; + this.y1 = 0; + + this.x2 = 1; + this.y2 = 1; + + this.x3 = 0; + this.y3 = 1; + + this.uvsUint32 = new Uint32Array(4); + } + + /** + * Sets the texture Uvs based on the given frame information. + * + * @private + * @param {PIXI.Rectangle} frame - The frame of the texture + * @param {PIXI.Rectangle} baseFrame - The base frame of the texture + * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8} + */ + + + TextureUvs.prototype.set = function set(frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + + // coordinates of center + var cX = frame.x / tw + w2; + var cY = frame.y / th + h2; + + rotate = _GroupD2.default.add(rotate, _GroupD2.default.NW); // NW is top-left corner + this.x0 = cX + w2 * _GroupD2.default.uX(rotate); + this.y0 = cY + h2 * _GroupD2.default.uY(rotate); + + rotate = _GroupD2.default.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + w2 * _GroupD2.default.uX(rotate); + this.y1 = cY + h2 * _GroupD2.default.uY(rotate); + + rotate = _GroupD2.default.add(rotate, 2); + this.x2 = cX + w2 * _GroupD2.default.uX(rotate); + this.y2 = cY + h2 * _GroupD2.default.uY(rotate); + + rotate = _GroupD2.default.add(rotate, 2); + this.x3 = cX + w2 * _GroupD2.default.uX(rotate); + this.y3 = cY + h2 * _GroupD2.default.uY(rotate); + } else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + + this.uvsUint32[0] = (Math.round(this.y0 * 65535) & 0xFFFF) << 16 | Math.round(this.x0 * 65535) & 0xFFFF; + this.uvsUint32[1] = (Math.round(this.y1 * 65535) & 0xFFFF) << 16 | Math.round(this.x1 * 65535) & 0xFFFF; + this.uvsUint32[2] = (Math.round(this.y2 * 65535) & 0xFFFF) << 16 | Math.round(this.x2 * 65535) & 0xFFFF; + this.uvsUint32[3] = (Math.round(this.y3 * 65535) & 0xFFFF) << 16 | Math.round(this.x3 * 65535) & 0xFFFF; + }; + + return TextureUvs; + }(); + + exports.default = TextureUvs; + + }, { "../math/GroupD8": 66 }], 118: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _BaseTexture2 = require('./BaseTexture'); + + var _BaseTexture3 = _interopRequireDefault(_BaseTexture2); + + var _utils = require('../utils'); + + var _ticker = require('../ticker'); + + var _const = require('../const'); + + var _determineCrossOrigin = require('../utils/determineCrossOrigin'); + + var _determineCrossOrigin2 = _interopRequireDefault(_determineCrossOrigin); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A texture of a [playing] Video. + * + * Video base textures mimic PixiJS BaseTexture.from.... method in their creation process. + * + * This can be used in several ways, such as: + * + * ```js + * let texture = PIXI.VideoBaseTexture.fromUrl('http://mydomain.com/video.mp4'); + * + * let texture = PIXI.VideoBaseTexture.fromUrl({ src: 'http://mydomain.com/video.mp4', mime: 'video/mp4' }); + * + * let texture = PIXI.VideoBaseTexture.fromUrls(['/video.webm', '/video.mp4']); + * + * let texture = PIXI.VideoBaseTexture.fromUrls([ + * { src: '/video.webm', mime: 'video/webm' }, + * { src: '/video.mp4', mime: 'video/mp4' } + * ]); + * ``` + * + * See the ["deus" demo](http://www.goodboydigital.com/pixijs/examples/deus/). + * + * @class + * @extends PIXI.BaseTexture + * @memberof PIXI + */ + var VideoBaseTexture = function (_BaseTexture) { + _inherits(VideoBaseTexture, _BaseTexture); + + /** + * @param {HTMLVideoElement} source - Video source + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded + */ + function VideoBaseTexture(source, scaleMode) { + var autoPlay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + _classCallCheck(this, VideoBaseTexture); + + if (!source) { + throw new Error('No video source element specified.'); + } + + // hook in here to check if video is already available. + // BaseTexture looks for a source.complete boolean, plus width & height. + + if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) && source.width && source.height) { + source.complete = true; + } + + var _this = _possibleConstructorReturn(this, _BaseTexture.call(this, source, scaleMode)); + + _this.width = source.videoWidth; + _this.height = source.videoHeight; + + _this._autoUpdate = true; + _this._isAutoUpdating = false; + + /** + * When set to true will automatically play videos used by this texture once + * they are loaded. If false, it will not modify the playing state. + * + * @member {boolean} + * @default true + */ + _this.autoPlay = autoPlay; + + _this.update = _this.update.bind(_this); + _this._onCanPlay = _this._onCanPlay.bind(_this); + + source.addEventListener('play', _this._onPlayStart.bind(_this)); + source.addEventListener('pause', _this._onPlayStop.bind(_this)); + _this.hasLoaded = false; + _this.__loaded = false; + + if (!_this._isSourceReady()) { + source.addEventListener('canplay', _this._onCanPlay); + source.addEventListener('canplaythrough', _this._onCanPlay); + } else { + _this._onCanPlay(); + } + return _this; + } + + /** + * Returns true if the underlying source is playing. + * + * @private + * @return {boolean} True if playing. + */ + + + VideoBaseTexture.prototype._isSourcePlaying = function _isSourcePlaying() { + var source = this.source; + + return source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2; + }; + + /** + * Returns true if the underlying source is ready for playing. + * + * @private + * @return {boolean} True if ready. + */ + + + VideoBaseTexture.prototype._isSourceReady = function _isSourceReady() { + return this.source.readyState === 3 || this.source.readyState === 4; + }; + + /** + * Runs the update loop when the video is ready to play + * + * @private + */ + + + VideoBaseTexture.prototype._onPlayStart = function _onPlayStart() { + // Just in case the video has not received its can play even yet.. + if (!this.hasLoaded) { + this._onCanPlay(); + } + + if (!this._isAutoUpdating && this.autoUpdate) { + _ticker.shared.add(this.update, this, _const.UPDATE_PRIORITY.HIGH); + this._isAutoUpdating = true; + } + }; + + /** + * Fired when a pause event is triggered, stops the update loop + * + * @private + */ + + + VideoBaseTexture.prototype._onPlayStop = function _onPlayStop() { + if (this._isAutoUpdating) { + _ticker.shared.remove(this.update, this); + this._isAutoUpdating = false; + } + }; + + /** + * Fired when the video is loaded and ready to play + * + * @private + */ + + + VideoBaseTexture.prototype._onCanPlay = function _onCanPlay() { + this.hasLoaded = true; + + if (this.source) { + this.source.removeEventListener('canplay', this._onCanPlay); + this.source.removeEventListener('canplaythrough', this._onCanPlay); + + this.width = this.source.videoWidth; + this.height = this.source.videoHeight; + + // prevent multiple loaded dispatches.. + if (!this.__loaded) { + this.__loaded = true; + this.emit('loaded', this); + } + + if (this._isSourcePlaying()) { + this._onPlayStart(); + } else if (this.autoPlay) { + this.source.play(); + } + } + }; + + /** + * Destroys this texture + * + */ + + + VideoBaseTexture.prototype.destroy = function destroy() { + if (this._isAutoUpdating) { + _ticker.shared.remove(this.update, this); + } + + if (this.source && this.source._pixiId) { + _BaseTexture3.default.removeFromCache(this.source._pixiId); + delete this.source._pixiId; + + this.source.pause(); + this.source.src = ''; + this.source.load(); + } + + _BaseTexture.prototype.destroy.call(this); + }; + + /** + * Mimic PixiJS BaseTexture.from.... method. + * + * @static + * @param {HTMLVideoElement} video - Video to create texture from + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded + * @return {PIXI.VideoBaseTexture} Newly created VideoBaseTexture + */ + + + VideoBaseTexture.fromVideo = function fromVideo(video, scaleMode, autoPlay) { + if (!video._pixiId) { + video._pixiId = 'video_' + (0, _utils.uid)(); + } + + var baseTexture = _utils.BaseTextureCache[video._pixiId]; + + if (!baseTexture) { + baseTexture = new VideoBaseTexture(video, scaleMode, autoPlay); + _BaseTexture3.default.addToCache(baseTexture, video._pixiId); + } + + return baseTexture; + }; + + /** + * Helper function that creates a new BaseTexture based on the given video element. + * This BaseTexture can then be used to create a texture + * + * @static + * @param {string|object|string[]|object[]} videoSrc - The URL(s) for the video. + * @param {string} [videoSrc.src] - One of the source urls for the video + * @param {string} [videoSrc.mime] - The mimetype of the video (e.g. 'video/mp4'). If not specified + * the url's extension will be used as the second part of the mime type. + * @param {number} scaleMode - See {@link PIXI.SCALE_MODES} for possible values + * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI. + * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded + * @return {PIXI.VideoBaseTexture} Newly created VideoBaseTexture + */ + + + VideoBaseTexture.fromUrl = function fromUrl(videoSrc, scaleMode, crossorigin, autoPlay) { + var video = document.createElement('video'); + + video.setAttribute('webkit-playsinline', ''); + video.setAttribute('playsinline', ''); + + var url = Array.isArray(videoSrc) ? videoSrc[0].src || videoSrc[0] : videoSrc.src || videoSrc; + + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + video.crossOrigin = (0, _determineCrossOrigin2.default)(url); + } else if (crossorigin) { + video.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + + // array of objects or strings + if (Array.isArray(videoSrc)) { + for (var i = 0; i < videoSrc.length; ++i) { + video.appendChild(createSource(videoSrc[i].src || videoSrc[i], videoSrc[i].mime)); + } + } + // single object or string + else { + video.appendChild(createSource(url, videoSrc.mime)); + } + + video.load(); + + return VideoBaseTexture.fromVideo(video, scaleMode, autoPlay); + }; + + /** + * Should the base texture automatically update itself, set to true by default + * + * @member {boolean} + */ + + + _createClass(VideoBaseTexture, [{ + key: 'autoUpdate', + get: function get() { + return this._autoUpdate; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + + if (!this._autoUpdate && this._isAutoUpdating) { + _ticker.shared.remove(this.update, this); + this._isAutoUpdating = false; + } else if (this._autoUpdate && !this._isAutoUpdating) { + _ticker.shared.add(this.update, this, _const.UPDATE_PRIORITY.HIGH); + this._isAutoUpdating = true; + } + } + } + }]); + + return VideoBaseTexture; + }(_BaseTexture3.default); + + exports.default = VideoBaseTexture; + + + VideoBaseTexture.fromUrls = VideoBaseTexture.fromUrl; + + function createSource(path, type) { + if (!type) { + var purePath = path.split('?').shift().toLowerCase(); + + type = 'video/' + purePath.substr(purePath.lastIndexOf('.') + 1); + } + + var source = document.createElement('source'); + + source.src = path; + source.type = type; + + return source; + } + + }, { "../const": 46, "../ticker": 121, "../utils": 125, "../utils/determineCrossOrigin": 124, "./BaseTexture": 112 }], 119: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _const = require('../const'); + + var _TickerListener = require('./TickerListener'); + + var _TickerListener2 = _interopRequireDefault(_TickerListener); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * A Ticker class that runs an update loop that other objects listen to. + * This class is composed around listeners + * meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, + * e.g. When the ticker is started and the emitter has listeners. + * + * @class + * @memberof PIXI.ticker + */ + var Ticker = function () { + /** + * + */ + function Ticker() { + var _this = this; + + _classCallCheck(this, Ticker); + + /** + * The first listener. All new listeners added are chained on this. + * @private + * @type {TickerListener} + */ + this._head = new _TickerListener2.default(null, null, Infinity); + + /** + * Internal current frame request ID + * @private + */ + this._requestId = null; + + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + * @private + */ + this._maxElapsedMS = 100; + + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.ticker.Ticker#start} automatically + * when a listener is added. + * + * @member {boolean} + * @default false + */ + this.autoStart = false; + + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.ticker.Ticker#minFPS} + * and is scaled with {@link PIXI.ticker.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + * + * @member {number} + * @default 1 + */ + this.deltaTime = 1; + + /** + * Time elapsed in milliseconds from last frame to this frame. + * Opposed to what the scalar {@link PIXI.ticker.Ticker#deltaTime} + * is based, this value is neither capped nor scaled. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * Defaults to target frame time + * + * @member {number} + * @default 16.66 + */ + this.elapsedMS = 1 / _settings2.default.TARGET_FPMS; + + /** + * The last time {@link PIXI.ticker.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * + * @member {number} + * @default -1 + */ + this.lastTime = -1; + + /** + * Factor of current {@link PIXI.ticker.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + * + * @member {number} + * @default 1 + */ + this.speed = 1; + + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.ticker.Ticker#start} has been called. + * `false` if {@link PIXI.ticker.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.ticker.Ticker#autoStart} being `true` + * and a listener is added. + * + * @member {boolean} + * @default false + */ + this.started = false; + + /** + * Internal tick method bound to ticker instance. + * This is because in early 2015, Function.bind + * is still 60% slower in high performance scenarios. + * Also separating frame requests from update method + * so listeners may be called at any time and with + * any animation API, just invoke ticker.update(time). + * + * @private + * @param {number} time - Time since last tick. + */ + this._tick = function (time) { + _this._requestId = null; + + if (_this.started) { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._head.next) { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; + } + + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * + * @private + */ + + + Ticker.prototype._requestIfNeeded = function _requestIfNeeded() { + if (this._requestId === null && this._head.next) { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._requestId = requestAnimationFrame(this._tick); + } + }; + + /** + * Conditionally cancels a pending animation frame. + * + * @private + */ + + + Ticker.prototype._cancelIfNeeded = function _cancelIfNeeded() { + if (this._requestId !== null) { + cancelAnimationFrame(this._requestId); + this._requestId = null; + } + }; + + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * + * @private + */ + + + Ticker.prototype._startIfPossible = function _startIfPossible() { + if (this.started) { + this._requestIfNeeded(); + } else if (this.autoStart) { + this.start(); + } + }; + + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * + * @param {Function} fn - The listener function to be added for updates + * @param {Function} [context] - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns {PIXI.ticker.Ticker} This instance of a ticker + */ + + + Ticker.prototype.add = function add(fn, context) { + var priority = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.UPDATE_PRIORITY.NORMAL; + + return this._addListener(new _TickerListener2.default(fn, context, priority)); + }; + + /** + * Add a handler for the tick event which is only execute once. + * + * @param {Function} fn - The listener function to be added for one update + * @param {Function} [context] - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns {PIXI.ticker.Ticker} This instance of a ticker + */ + + + Ticker.prototype.addOnce = function addOnce(fn, context) { + var priority = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.UPDATE_PRIORITY.NORMAL; + + return this._addListener(new _TickerListener2.default(fn, context, priority, true)); + }; + + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * + * @private + * @param {TickerListener} listener - Current listener being added. + * @returns {PIXI.ticker.Ticker} This instance of a ticker + */ + + + Ticker.prototype._addListener = function _addListener(listener) { + // For attaching to head + var current = this._head.next; + var previous = this._head; + + // Add the first item + if (!current) { + listener.connect(previous); + } else { + // Go from highest to lowest priority + while (current) { + if (listener.priority > current.priority) { + listener.connect(previous); + break; + } + previous = current; + current = current.next; + } + + // Not yet connected + if (!listener.previous) { + listener.connect(previous); + } + } + + this._startIfPossible(); + + return this; + }; + + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * + * @param {Function} fn - The listener function to be removed + * @param {Function} [context] - The listener context to be removed + * @returns {PIXI.ticker.Ticker} This instance of a ticker + */ + + + Ticker.prototype.remove = function remove(fn, context) { + var listener = this._head.next; + + while (listener) { + // We found a match, lets remove it + // no break to delete all possible matches + // incase a listener was added 2+ times + if (listener.match(fn, context)) { + listener = listener.destroy(); + } else { + listener = listener.next; + } + } + + if (!this._head.next) { + this._cancelIfNeeded(); + } + + return this; + }; + + /** + * Starts the ticker. If the ticker has listeners + * a new animation frame is requested at this point. + */ + + + Ticker.prototype.start = function start() { + if (!this.started) { + this.started = true; + this._requestIfNeeded(); + } + }; + + /** + * Stops the ticker. If the ticker has requested + * an animation frame it is canceled at this point. + */ + + + Ticker.prototype.stop = function stop() { + if (this.started) { + this.started = false; + this._cancelIfNeeded(); + } + }; + + /** + * Destroy the ticker and don't use after this. Calling + * this method removes all references to internal events. + */ + + + Ticker.prototype.destroy = function destroy() { + this.stop(); + + var listener = this._head.next; + + while (listener) { + listener = listener.destroy(true); + } + + this._head.destroy(); + this._head = null; + }; + + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.ticker.Ticker#elapsedMS}, + * the current {@link PIXI.ticker.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.ticker.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + + + Ticker.prototype.update = function update() { + var currentTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : performance.now(); + + var elapsedMS = void 0; + + // If the difference in time is zero or negative, we ignore most of the work done here. + // If there is no valid difference, then should be no reason to let anyone know about it. + // A zero delta, is exactly that, nothing should update. + // + // The difference in time can be negative, and no this does not mean time traveling. + // This can be the result of a race condition between when an animation frame is requested + // on the current JavaScript engine event loop, and when the ticker's start method is invoked + // (which invokes the internal _requestIfNeeded method). If a frame is requested before + // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, + // can receive a time argument that can be less than the lastTime value that was set within + // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. + // + // This check covers this browser engine timing issue, as well as if consumers pass an invalid + // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. + + if (currentTime > this.lastTime) { + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; + + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) { + elapsedMS = this._maxElapsedMS; + } + + this.deltaTime = elapsedMS * _settings2.default.TARGET_FPMS * this.speed; + + // Cache a local reference, in-case ticker is destroyed + // during the emit, we can still check for head.next + var head = this._head; + + // Invoke listeners added to internal emitter + var listener = head.next; + + while (listener) { + listener = listener.emit(this.deltaTime); + } + + if (!head.next) { + this._cancelIfNeeded(); + } + } else { + this.deltaTime = this.elapsedMS = 0; + } + + this.lastTime = currentTime; + }; + + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.ticker.Ticker#speed}, which is specific + * to scaling {@link PIXI.ticker.Ticker#deltaTime}. + * + * @member {number} + * @readonly + */ + + + _createClass(Ticker, [{ + key: 'FPS', + get: function get() { + return 1000 / this.elapsedMS; + } + + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.ticker.Ticker#update}. + * This value is used to cap {@link PIXI.ticker.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.ticker.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * + * @member {number} + * @default 10 + */ + + }, { + key: 'minFPS', + get: function get() { + return 1000 / this._maxElapsedMS; + }, + set: function set(fps) // eslint-disable-line require-jsdoc + { + // Clamp: 0 to TARGET_FPMS + var minFPMS = Math.min(Math.max(0, fps) / 1000, _settings2.default.TARGET_FPMS); + + this._maxElapsedMS = 1 / minFPMS; + } + }]); + + return Ticker; + }(); + + exports.default = Ticker; + + }, { "../const": 46, "../settings": 101, "./TickerListener": 120 }], 120: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Internal class for handling the priority sorting of ticker handlers. + * + * @private + * @class + * @memberof PIXI.ticker + */ + var TickerListener = function () { + /** + * Constructor + * + * @param {Function} fn - The listener function to be added for one update + * @param {Function} [context=null] - The listener context + * @param {number} [priority=0] - The priority for emitting + * @param {boolean} [once=false] - If the handler should fire once + */ + function TickerListener(fn) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var priority = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var once = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + _classCallCheck(this, TickerListener); + + /** + * The handler function to execute. + * @member {Function} + */ + this.fn = fn; + + /** + * The calling to execute. + * @member {Function} + */ + this.context = context; + + /** + * The current priority. + * @member {number} + */ + this.priority = priority; + + /** + * If this should only execute once. + * @member {boolean} + */ + this.once = once; + + /** + * The next item in chain. + * @member {TickerListener} + */ + this.next = null; + + /** + * The previous item in chain. + * @member {TickerListener} + */ + this.previous = null; + + /** + * `true` if this listener has been destroyed already. + * @member {boolean} + * @private + */ + this._destroyed = false; + } + + /** + * Simple compare function to figure out if a function and context match. + * + * @param {Function} fn - The listener function to be added for one update + * @param {Function} context - The listener context + * @return {boolean} `true` if the listener match the arguments + */ + + + TickerListener.prototype.match = function match(fn, context) { + context = context || null; + + return this.fn === fn && this.context === context; + }; + + /** + * Emit by calling the current function. + * @param {number} deltaTime - time since the last emit. + * @return {TickerListener} Next ticker + */ + + + TickerListener.prototype.emit = function emit(deltaTime) { + if (this.fn) { + if (this.context) { + this.fn.call(this.context, deltaTime); + } else { + this.fn(deltaTime); + } + } + + var redirect = this.next; + + if (this.once) { + this.destroy(true); + } + + // Soft-destroying should remove + // the next reference + if (this._destroyed) { + this.next = null; + } + + return redirect; + }; + + /** + * Connect to the list. + * @param {TickerListener} previous - Input node, previous listener + */ + + + TickerListener.prototype.connect = function connect(previous) { + this.previous = previous; + if (previous.next) { + previous.next.previous = this; + } + this.next = previous.next; + previous.next = this; + }; + + /** + * Destroy and don't use after this. + * @param {boolean} [hard = false] `true` to remove the `next` reference, this + * is considered a hard destroy. Soft destroy maintains the next reference. + * @return {TickerListener} The listener to redirect while emitting or removing. + */ + + + TickerListener.prototype.destroy = function destroy() { + var hard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + this._destroyed = true; + this.fn = null; + this.context = null; + + // Disconnect, hook up next and previous + if (this.previous) { + this.previous.next = this.next; + } + + if (this.next) { + this.next.previous = this.previous; + } + + // Redirect to the next item + var redirect = this.next; + + // Remove references + this.next = hard ? null : redirect; + this.previous = null; + + return redirect; + }; + + return TickerListener; + }(); + + exports.default = TickerListener; + + }, {}], 121: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.Ticker = exports.shared = undefined; + + var _Ticker = require('./Ticker'); + + var _Ticker2 = _interopRequireDefault(_Ticker); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * The shared ticker instance used by {@link PIXI.extras.AnimatedSprite}. + * and by {@link PIXI.interaction.InteractionManager}. + * The property {@link PIXI.ticker.Ticker#autoStart} is set to `true` + * for this instance. Please follow the examples for usage, including + * how to opt-out of auto-starting the shared ticker. + * + * @example + * let ticker = PIXI.ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(800, 600); + * let stage = new PIXI.Container(); + * let interactionManager = PIXI.interaction.InteractionManager(renderer); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * + * @type {PIXI.ticker.Ticker} + * @memberof PIXI.ticker + */ + var shared = new _Ticker2.default(); + + shared.autoStart = true; + shared.destroy = function () { + // protect destroying shared ticker + // this is used by other internal systems + // like AnimatedSprite and InteractionManager + }; + + /** + * This namespace contains an API for interacting with PIXI's internal global update loop. + * + * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, + * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); + * @namespace PIXI.ticker + */ + exports.shared = shared; + exports.Ticker = _Ticker2.default; + + }, { "./Ticker": 119 }], 122: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + exports.default = canUploadSameBuffer; + function canUploadSameBuffer() { + // Uploading the same buffer multiple times in a single frame can cause perf issues. + // Apparent on IOS so only check for that at the moment + // this check may become more complex if this issue pops up elsewhere. + var ios = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); + + return !ios; + } + + }, {}], 123: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + exports.default = createIndicesForQuads; + /** + * Generic Mask Stack data structure + * + * @memberof PIXI + * @function createIndicesForQuads + * @private + * @param {number} size - Number of quads + * @return {Uint16Array} indices + */ + function createIndicesForQuads(size) { + // the total number of indices in our array, there are 6 points per quad. + + var totalIndices = size * 6; + + var indices = new Uint16Array(totalIndices); + + // fill the indices with the quads to draw + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { + indices[i + 0] = j + 0; + indices[i + 1] = j + 1; + indices[i + 2] = j + 2; + indices[i + 3] = j + 0; + indices[i + 4] = j + 2; + indices[i + 5] = j + 3; + } + + return indices; + } + + }, {}], 124: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = determineCrossOrigin; + + var _url2 = require('url'); + + var _url3 = _interopRequireDefault(_url2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var tempAnchor = void 0; + + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @return {string} The crossOrigin value to use (or empty string for none). + */ + function determineCrossOrigin(url) { + var loc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location; + + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + + // default is window.location + loc = loc || window.location; + + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + url = _url3.default.parse(tempAnchor.href); + + var samePort = !url.port && loc.port === '' || url.port === loc.port; + + // if cross origin + if (url.hostname !== loc.hostname || !samePort || url.protocol !== loc.protocol) { + return 'anonymous'; + } + + return ''; + } + + }, { "url": 38 }], 125: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.premultiplyBlendMode = exports.BaseTextureCache = exports.TextureCache = exports.earcut = exports.mixins = exports.pluginTarget = exports.EventEmitter = exports.removeItems = exports.isMobile = undefined; + exports.uid = uid; + exports.hex2rgb = hex2rgb; + exports.hex2string = hex2string; + exports.rgb2hex = rgb2hex; + exports.getResolutionOfUrl = getResolutionOfUrl; + exports.decomposeDataUri = decomposeDataUri; + exports.getUrlFileExtension = getUrlFileExtension; + exports.getSvgSize = getSvgSize; + exports.skipHello = skipHello; + exports.sayHello = sayHello; + exports.isWebGLSupported = isWebGLSupported; + exports.sign = sign; + exports.destroyTextureCache = destroyTextureCache; + exports.clearTextureCache = clearTextureCache; + exports.correctBlendMode = correctBlendMode; + exports.premultiplyTint = premultiplyTint; + exports.premultiplyRgba = premultiplyRgba; + exports.premultiplyTintToRgba = premultiplyTintToRgba; + + var _const = require('../const'); + + var _settings = require('../settings'); + + var _settings2 = _interopRequireDefault(_settings); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _pluginTarget = require('./pluginTarget'); + + var _pluginTarget2 = _interopRequireDefault(_pluginTarget); + + var _mixin = require('./mixin'); + + var mixins = _interopRequireWildcard(_mixin); + + var _ismobilejs = require('ismobilejs'); + + var isMobile = _interopRequireWildcard(_ismobilejs); + + var _removeArrayItems = require('remove-array-items'); + + var _removeArrayItems2 = _interopRequireDefault(_removeArrayItems); + + var _mapPremultipliedBlendModes = require('./mapPremultipliedBlendModes'); + + var _mapPremultipliedBlendModes2 = _interopRequireDefault(_mapPremultipliedBlendModes); + + var _earcut = require('earcut'); + + var _earcut2 = _interopRequireDefault(_earcut); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var nextUid = 0; + var saidHello = false; + + /** + * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" + * @namespace PIXI.utils + */ + exports.isMobile = isMobile; + exports.removeItems = _removeArrayItems2.default; + exports.EventEmitter = _eventemitter2.default; + exports.pluginTarget = _pluginTarget2.default; + exports.mixins = mixins; + exports.earcut = _earcut2.default; + + /** + * Gets the next unique identifier + * + * @memberof PIXI.utils + * @function uid + * @return {number} The next unique identifier to use. + */ + + function uid() { + return ++nextUid; + } + + /** + * Converts a hex color number to an [R, G, B] array + * + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The number to convert + * @param {number[]} [out=[]] If supplied, this array will be used rather than returning a new one + * @return {number[]} An array representing the [R, G, B] of the color. + */ + function hex2rgb(hex, out) { + out = out || []; + + out[0] = (hex >> 16 & 0xFF) / 255; + out[1] = (hex >> 8 & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + + return out; + } + + /** + * Converts a hex color number to a string. + * + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex + * @return {string} The string color. + */ + function hex2string(hex) { + hex = hex.toString(16); + hex = '000000'.substr(0, 6 - hex.length) + hex; + + return '#' + hex; + } + + /** + * Converts a color as an [R, G, B] array to a hex number + * + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - rgb array + * @return {number} The color number + */ + function rgb2hex(rgb) { + return (rgb[0] * 255 << 16) + (rgb[1] * 255 << 8) + (rgb[2] * 255 | 0); + } + + /** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @return {number} resolution / device pixel ratio of an asset + */ + function getResolutionOfUrl(url, defaultValue) { + var resolution = _settings2.default.RETINA_PREFIX.exec(url); + + if (resolution) { + return parseFloat(resolution[1]); + } + + return defaultValue !== undefined ? defaultValue : 1; + } + + /** + * Typedef for decomposeDataUri return object. + * + * @typedef {object} PIXI.utils~DecomposedDataUri + * @property {mediaType} Media type, eg. `image` + * @property {subType} Sub type, eg. `png` + * @property {encoding} Data encoding, eg. `base64` + * @property {data} The actual data + */ + + /** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @return {PIXI.utils~DecomposedDataUri|undefined} The decomposed data uri or undefined + */ + function decomposeDataUri(dataUri) { + var dataUriMatch = _const.DATA_URI.exec(dataUri); + + if (dataUriMatch) { + return { + mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, + subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, + charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, + encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, + data: dataUriMatch[5] + }; + } + + return undefined; + } + + /** + * Get type of the image by regexp for extension. Returns undefined for unknown extensions. + * + * @memberof PIXI.utils + * @function getUrlFileExtension + * @param {string} url - the image path + * @return {string|undefined} image extension + */ + function getUrlFileExtension(url) { + var extension = _const.URL_FILE_EXTENSION.exec(url); + + if (extension) { + return extension[1].toLowerCase(); + } + + return undefined; + } + + /** + * Typedef for Size object. + * + * @typedef {object} PIXI.utils~Size + * @property {width} Width component + * @property {height} Height component + */ + + /** + * Get size from an svg string using regexp. + * + * @memberof PIXI.utils + * @function getSvgSize + * @param {string} svgString - a serialized svg element + * @return {PIXI.utils~Size|undefined} image extension + */ + function getSvgSize(svgString) { + var sizeMatch = _const.SVG_SIZE.exec(svgString); + var size = {}; + + if (sizeMatch) { + size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3])); + size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7])); + } + + return size; + } + + /** + * Skips the hello message of renderers that are created after this is run. + * + * @function skipHello + * @memberof PIXI.utils + */ + function skipHello() { + saidHello = true; + } + + /** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever makes you a jerk face. + * + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ + function sayHello(type) { + if (saidHello) { + return; + } + + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + var args = ['\n %c %c %c PixiJS ' + _const.VERSION + ' - \u2730 ' + type + ' \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n', 'background: #ff66a5; padding:5px 0;', 'background: #ff66a5; padding:5px 0;', 'color: #ff66a5; background: #030307; padding:5px 0;', 'background: #ff66a5; padding:5px 0;', 'background: #ffc3dc; padding:5px 0;', 'background: #ff66a5; padding:5px 0;', 'color: #ff2424; background: #fff; padding:5px 0;', 'color: #ff2424; background: #fff; padding:5px 0;', 'color: #ff2424; background: #fff; padding:5px 0;']; + + window.console.log.apply(console, args); + } else if (window.console) { + window.console.log('PixiJS ' + _const.VERSION + ' - ' + type + ' - http://www.pixijs.com/'); + } + + saidHello = true; + } + + /** + * Helper for checking for webgl support + * + * @memberof PIXI.utils + * @function isWebGLSupported + * @return {boolean} is webgl supported + */ + function isWebGLSupported() { + var contextOptions = { stencil: true, failIfMajorPerformanceCaveat: true }; + + try { + if (!window.WebGLRenderingContext) { + return false; + } + + var canvas = document.createElement('canvas'); + var gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions); + + var success = !!(gl && gl.getContextAttributes().stencil); + + if (gl) { + var loseContext = gl.getExtension('WEBGL_lose_context'); + + if (loseContext) { + loseContext.loseContext(); + } + } + + gl = null; + + return success; + } catch (e) { + return false; + } + } + + /** + * Returns sign of number + * + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ + function sign(n) { + if (n === 0) return 0; + + return n < 0 ? -1 : 1; + } + + /** + * @todo Describe property usage + * + * @memberof PIXI.utils + * @private + */ + var TextureCache = exports.TextureCache = Object.create(null); + + /** + * @todo Describe property usage + * + * @memberof PIXI.utils + * @private + */ + var BaseTextureCache = exports.BaseTextureCache = Object.create(null); + + /** + * Destroys all texture in the cache + * + * @memberof PIXI.utils + * @function destroyTextureCache + */ + function destroyTextureCache() { + var key = void 0; + + for (key in TextureCache) { + TextureCache[key].destroy(); + } + for (key in BaseTextureCache) { + BaseTextureCache[key].destroy(); + } + } + + /** + * Removes all textures from cache, but does not destroy them + * + * @memberof PIXI.utils + * @function clearTextureCache + */ + function clearTextureCache() { + var key = void 0; + + for (key in TextureCache) { + delete TextureCache[key]; + } + for (key in BaseTextureCache) { + delete BaseTextureCache[key]; + } + } + + /** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @const premultiplyBlendMode + * @type {Array} + */ + var premultiplyBlendMode = exports.premultiplyBlendMode = (0, _mapPremultipliedBlendModes2.default)(); + + /** + * changes blendMode according to texture format + * + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode supposed blend mode + * @param {boolean} premultiplied whether source is premultiplied + * @returns {number} true blend mode for this texture + */ + function correctBlendMode(blendMode, premultiplied) { + return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; + } + + /** + * premultiplies tint + * + * @memberof PIXI.utils + * @param {number} tint integet RGB + * @param {number} alpha floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ + function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { + return (alpha * 255 << 24) + tint; + } + if (alpha === 0.0) { + return 0; + } + var R = tint >> 16 & 0xFF; + var G = tint >> 8 & 0xFF; + var B = tint & 0xFF; + + R = R * alpha + 0.5 | 0; + G = G * alpha + 0.5 | 0; + B = B * alpha + 0.5 | 0; + + return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; + } + + /** + * combines rgb and alpha to out array + * + * @memberof PIXI.utils + * @param {Float32Array|number[]} rgb input rgb + * @param {number} alpha alpha param + * @param {Float32Array} [out] output + * @param {boolean} [premultiply=true] do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyRgba(rgb, alpha, out, premultiply) { + out = out || new Float32Array(4); + if (premultiply || premultiply === undefined) { + out[0] = rgb[0] * alpha; + out[1] = rgb[1] * alpha; + out[2] = rgb[2] * alpha; + } else { + out[0] = rgb[0]; + out[1] = rgb[1]; + out[2] = rgb[2]; + } + out[3] = alpha; + + return out; + } + + /** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * + * @memberof PIXI.utils + * @param {number} tint input tint + * @param {number} alpha alpha param + * @param {Float32Array} [out] output + * @param {boolean} [premultiply=true] do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyTintToRgba(tint, alpha, out, premultiply) { + out = out || new Float32Array(4); + out[0] = (tint >> 16 & 0xFF) / 255.0; + out[1] = (tint >> 8 & 0xFF) / 255.0; + out[2] = (tint & 0xFF) / 255.0; + if (premultiply || premultiply === undefined) { + out[0] *= alpha; + out[1] *= alpha; + out[2] *= alpha; + } + out[3] = alpha; + + return out; + } + + }, { "../const": 46, "../settings": 101, "./mapPremultipliedBlendModes": 126, "./mixin": 128, "./pluginTarget": 129, "earcut": 2, "eventemitter3": 3, "ismobilejs": 4, "remove-array-items": 31 }], 126: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = mapPremultipliedBlendModes; + + var _const = require('../const'); + + /** + * Corrects PixiJS blend, takes premultiplied alpha into account + * + * @memberof PIXI + * @function mapPremultipliedBlendModes + * @private + * @param {Array} [array] - The array to output into. + * @return {Array} Mapped modes. + */ + + function mapPremultipliedBlendModes() { + var pm = []; + var npm = []; + + for (var i = 0; i < 32; i++) { + pm[i] = i; + npm[i] = i; + } + + pm[_const.BLEND_MODES.NORMAL_NPM] = _const.BLEND_MODES.NORMAL; + pm[_const.BLEND_MODES.ADD_NPM] = _const.BLEND_MODES.ADD; + pm[_const.BLEND_MODES.SCREEN_NPM] = _const.BLEND_MODES.SCREEN; + + npm[_const.BLEND_MODES.NORMAL] = _const.BLEND_MODES.NORMAL_NPM; + npm[_const.BLEND_MODES.ADD] = _const.BLEND_MODES.ADD_NPM; + npm[_const.BLEND_MODES.SCREEN] = _const.BLEND_MODES.SCREEN_NPM; + + var array = []; + + array.push(npm); + array.push(pm); + + return array; + } + + }, { "../const": 46 }], 127: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = maxRecommendedTextures; + + var _ismobilejs = require('ismobilejs'); + + var _ismobilejs2 = _interopRequireDefault(_ismobilejs); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function maxRecommendedTextures(max) { + if (_ismobilejs2.default.tablet || _ismobilejs2.default.phone) { + // check if the res is iphone 6 or higher.. + return 4; + } + + // desktop should be ok + return max; + } + + }, { "ismobilejs": 4 }], 128: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + exports.mixin = mixin; + exports.delayMixin = delayMixin; + exports.performMixins = performMixins; + /** + * Mixes all enumerable properties and methods from a source object to a target object. + * + * @memberof PIXI.utils.mixins + * @function mixin + * @param {object} target The prototype or instance that properties and methods should be added to. + * @param {object} source The source of properties and methods to mix in. + */ + function mixin(target, source) { + if (!target || !source) return; + // in ES8/ES2017, this would be really easy: + // Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + + // get all the enumerable property keys + var keys = Object.keys(source); + + // loop through properties + for (var i = 0; i < keys.length; ++i) { + var propertyName = keys[i]; + + // Set the property using the property descriptor - this works for accessors and normal value properties + Object.defineProperty(target, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); + } + } + + var mixins = []; + + /** + * Queues a mixin to be handled towards the end of the initialization of PIXI, so that deprecation + * can take effect. + * + * @memberof PIXI.utils.mixins + * @function delayMixin + * @private + * @param {object} target The prototype or instance that properties and methods should be added to. + * @param {object} source The source of properties and methods to mix in. + */ + function delayMixin(target, source) { + mixins.push(target, source); + } + + /** + * Handles all mixins queued via delayMixin(). + * + * @memberof PIXI.utils.mixins + * @function performMixins + * @private + */ + function performMixins() { + for (var i = 0; i < mixins.length; i += 2) { + mixin(mixins[i], mixins[i + 1]); + } + mixins.length = 0; + } + + }, {}], 129: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + /** + * Mixins functionality to make an object have "plugins". + * + * @example + * function MyObject() {} + * + * pluginTarget.mixin(MyObject); + * + * @mixin + * @memberof PIXI.utils + * @param {object} obj - The object to mix into. + */ + function pluginTarget(obj) { + obj.__plugins = {}; + + /** + * Adds a plugin to an object + * + * @param {string} pluginName - The events that should be listed. + * @param {Function} ctor - The constructor function for the plugin. + */ + obj.registerPlugin = function registerPlugin(pluginName, ctor) { + obj.__plugins[pluginName] = ctor; + }; + + /** + * Instantiates all the plugins of this object + * + */ + obj.prototype.initPlugins = function initPlugins() { + this.plugins = this.plugins || {}; + + for (var o in obj.__plugins) { + this.plugins[o] = new obj.__plugins[o](this); + } + }; + + /** + * Removes all the plugins of this object + * + */ + obj.prototype.destroyPlugins = function destroyPlugins() { + for (var o in this.plugins) { + this.plugins[o].destroy(); + this.plugins[o] = null; + } + + this.plugins = null; + }; + } + + exports.default = { + /** + * Mixes in the properties of the pluginTarget into another object + * + * @param {object} obj - The obj to mix into + */ + mixin: function mixin(obj) { + pluginTarget(obj); + } + }; + + }, {}], 130: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = trimCanvas; + /** + * Trim transparent borders from a canvas + * + * @memberof PIXI + * @function trimCanvas + * @private + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ + function trimCanvas(canvas) { + // https://gist.github.com/remy/784508 + + var width = canvas.width; + var height = canvas.height; + + var context = canvas.getContext('2d'); + var imageData = context.getImageData(0, 0, width, height); + var pixels = imageData.data; + var len = pixels.length; + + var bound = { + top: null, + left: null, + right: null, + bottom: null + }; + var data = null; + var i = void 0; + var x = void 0; + var y = void 0; + + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { + x = i / 4 % width; + y = ~~(i / 4 / width); + + if (bound.top === null) { + bound.top = y; + } + + if (bound.left === null) { + bound.left = x; + } else if (x < bound.left) { + bound.left = x; + } + + if (bound.right === null) { + bound.right = x + 1; + } else if (bound.right < x) { + bound.right = x + 1; + } + + if (bound.bottom === null) { + bound.bottom = y; + } else if (bound.bottom < y) { + bound.bottom = y; + } + } + } + + if (bound.top !== null) { + width = bound.right - bound.left; + height = bound.bottom - bound.top + 1; + data = context.getImageData(bound.left, bound.top, width, height); + } + + return { + height: height, + width: width, + data: data + }; + } + + }, {}], 131: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = deprecation; + // provide method to give a stack track for warnings + // useful for tracking-down where deprecated methods/properties/classes + // are being used within the code + + // A map of warning messages already fired + var warnings = {}; + + // provide method to give a stack track for warnings + // useful for tracking-down where deprecated methods/properties/classes + // are being used within the code + function warn(msg) { + // Ignore duplicat + if (warnings[msg]) { + return; + } + + /* eslint-disable no-console */ + var stack = new Error().stack; + + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('Deprecation Warning: ', msg); + } else { + // chop off the stack trace which includes pixi.js internal calls + stack = stack.split('\n').splice(3).join('\n'); + + if (console.groupCollapsed) { + console.groupCollapsed('%cDeprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', msg); + console.warn(stack); + console.groupEnd(); + } else { + console.warn('Deprecation Warning: ', msg); + console.warn(stack); + } + } + /* eslint-enable no-console */ + + warnings[msg] = true; + } + + function deprecation(core) { + var mesh = core.mesh, + particles = core.particles, + extras = core.extras, + filters = core.filters, + prepare = core.prepare, + loaders = core.loaders, + interaction = core.interaction; + + + Object.defineProperties(core, { + + /** + * @class + * @private + * @name SpriteBatch + * @memberof PIXI + * @see PIXI.ParticleContainer + * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead. + * @deprecated since version 3.0.0 + */ + SpriteBatch: { + get: function get() { + throw new ReferenceError('SpriteBatch does not exist any more, ' + 'please use the new ParticleContainer instead.'); + } + }, + + /** + * @class + * @private + * @name AssetLoader + * @memberof PIXI + * @see PIXI.loaders.Loader + * @throws {ReferenceError} The loader system was overhauled in PixiJS v3, + * please see the new PIXI.loaders.Loader class. + * @deprecated since version 3.0.0 + */ + AssetLoader: { + get: function get() { + throw new ReferenceError('The loader system was overhauled in PixiJS v3, ' + 'please see the new PIXI.loaders.Loader class.'); + } + }, + + /** + * @class + * @private + * @name Stage + * @memberof PIXI + * @see PIXI.Container + * @deprecated since version 3.0.0 + */ + Stage: { + get: function get() { + warn('You do not need to use a PIXI Stage any more, you can simply render any container.'); + + return core.Container; + } + }, + + /** + * @class + * @private + * @name DisplayObjectContainer + * @memberof PIXI + * @see PIXI.Container + * @deprecated since version 3.0.0 + */ + DisplayObjectContainer: { + get: function get() { + warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.'); + + return core.Container; + } + }, + + /** + * @class + * @private + * @name Strip + * @memberof PIXI + * @see PIXI.mesh.Mesh + * @deprecated since version 3.0.0 + */ + Strip: { + get: function get() { + warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.'); + + return mesh.Mesh; + } + }, + + /** + * @class + * @private + * @name Rope + * @memberof PIXI + * @see PIXI.mesh.Rope + * @deprecated since version 3.0.0 + */ + Rope: { + get: function get() { + warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.'); + + return mesh.Rope; + } + }, + + /** + * @class + * @private + * @name ParticleContainer + * @memberof PIXI + * @see PIXI.particles.ParticleContainer + * @deprecated since version 4.0.0 + */ + ParticleContainer: { + get: function get() { + warn('The ParticleContainer class has been moved to particles.ParticleContainer, ' + 'please use particles.ParticleContainer from now on.'); + + return particles.ParticleContainer; + } + }, + + /** + * @class + * @private + * @name MovieClip + * @memberof PIXI + * @see PIXI.extras.MovieClip + * @deprecated since version 3.0.0 + */ + MovieClip: { + get: function get() { + warn('The MovieClip class has been moved to extras.AnimatedSprite, please use extras.AnimatedSprite.'); + + return extras.AnimatedSprite; + } + }, + + /** + * @class + * @private + * @name TilingSprite + * @memberof PIXI + * @see PIXI.extras.TilingSprite + * @deprecated since version 3.0.0 + */ + TilingSprite: { + get: function get() { + warn('The TilingSprite class has been moved to extras.TilingSprite, ' + 'please use extras.TilingSprite from now on.'); + + return extras.TilingSprite; + } + }, + + /** + * @class + * @private + * @name BitmapText + * @memberof PIXI + * @see PIXI.extras.BitmapText + * @deprecated since version 3.0.0 + */ + BitmapText: { + get: function get() { + warn('The BitmapText class has been moved to extras.BitmapText, ' + 'please use extras.BitmapText from now on.'); + + return extras.BitmapText; + } + }, + + /** + * @class + * @private + * @name blendModes + * @memberof PIXI + * @see PIXI.BLEND_MODES + * @deprecated since version 3.0.0 + */ + blendModes: { + get: function get() { + warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.'); + + return core.BLEND_MODES; + } + }, + + /** + * @class + * @private + * @name scaleModes + * @memberof PIXI + * @see PIXI.SCALE_MODES + * @deprecated since version 3.0.0 + */ + scaleModes: { + get: function get() { + warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.'); + + return core.SCALE_MODES; + } + }, + + /** + * @class + * @private + * @name BaseTextureCache + * @memberof PIXI + * @see PIXI.utils.BaseTextureCache + * @deprecated since version 3.0.0 + */ + BaseTextureCache: { + get: function get() { + warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, ' + 'please use utils.BaseTextureCache from now on.'); + + return core.utils.BaseTextureCache; + } + }, + + /** + * @class + * @private + * @name TextureCache + * @memberof PIXI + * @see PIXI.utils.TextureCache + * @deprecated since version 3.0.0 + */ + TextureCache: { + get: function get() { + warn('The TextureCache class has been moved to utils.TextureCache, ' + 'please use utils.TextureCache from now on.'); + + return core.utils.TextureCache; + } + }, + + /** + * @namespace + * @private + * @name math + * @memberof PIXI + * @see PIXI + * @deprecated since version 3.0.6 + */ + math: { + get: function get() { + warn('The math namespace is deprecated, please access members already accessible on PIXI.'); + + return core; + } + }, + + /** + * @class + * @private + * @name PIXI.AbstractFilter + * @see PIXI.Filter + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function get() { + warn('AstractFilter has been renamed to Filter, please use PIXI.Filter'); + + return core.Filter; + } + }, + + /** + * @class + * @private + * @name PIXI.TransformManual + * @see PIXI.TransformBase + * @deprecated since version 4.0.0 + */ + TransformManual: { + get: function get() { + warn('TransformManual has been renamed to TransformBase, please update your pixi-spine'); + + return core.TransformBase; + } + }, + + /** + * @static + * @constant + * @name PIXI.TARGET_FPMS + * @see PIXI.settings.TARGET_FPMS + * @deprecated since version 4.2.0 + */ + TARGET_FPMS: { + get: function get() { + warn('PIXI.TARGET_FPMS has been deprecated, please use PIXI.settings.TARGET_FPMS'); + + return core.settings.TARGET_FPMS; + }, + set: function set(value) { + warn('PIXI.TARGET_FPMS has been deprecated, please use PIXI.settings.TARGET_FPMS'); + + core.settings.TARGET_FPMS = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.FILTER_RESOLUTION + * @see PIXI.settings.FILTER_RESOLUTION + * @deprecated since version 4.2.0 + */ + FILTER_RESOLUTION: { + get: function get() { + warn('PIXI.FILTER_RESOLUTION has been deprecated, please use PIXI.settings.FILTER_RESOLUTION'); + + return core.settings.FILTER_RESOLUTION; + }, + set: function set(value) { + warn('PIXI.FILTER_RESOLUTION has been deprecated, please use PIXI.settings.FILTER_RESOLUTION'); + + core.settings.FILTER_RESOLUTION = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.RESOLUTION + * @see PIXI.settings.RESOLUTION + * @deprecated since version 4.2.0 + */ + RESOLUTION: { + get: function get() { + warn('PIXI.RESOLUTION has been deprecated, please use PIXI.settings.RESOLUTION'); + + return core.settings.RESOLUTION; + }, + set: function set(value) { + warn('PIXI.RESOLUTION has been deprecated, please use PIXI.settings.RESOLUTION'); + + core.settings.RESOLUTION = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.MIPMAP_TEXTURES + * @see PIXI.settings.MIPMAP_TEXTURES + * @deprecated since version 4.2.0 + */ + MIPMAP_TEXTURES: { + get: function get() { + warn('PIXI.MIPMAP_TEXTURES has been deprecated, please use PIXI.settings.MIPMAP_TEXTURES'); + + return core.settings.MIPMAP_TEXTURES; + }, + set: function set(value) { + warn('PIXI.MIPMAP_TEXTURES has been deprecated, please use PIXI.settings.MIPMAP_TEXTURES'); + + core.settings.MIPMAP_TEXTURES = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.SPRITE_BATCH_SIZE + * @see PIXI.settings.SPRITE_BATCH_SIZE + * @deprecated since version 4.2.0 + */ + SPRITE_BATCH_SIZE: { + get: function get() { + warn('PIXI.SPRITE_BATCH_SIZE has been deprecated, please use PIXI.settings.SPRITE_BATCH_SIZE'); + + return core.settings.SPRITE_BATCH_SIZE; + }, + set: function set(value) { + warn('PIXI.SPRITE_BATCH_SIZE has been deprecated, please use PIXI.settings.SPRITE_BATCH_SIZE'); + + core.settings.SPRITE_BATCH_SIZE = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.SPRITE_MAX_TEXTURES + * @see PIXI.settings.SPRITE_MAX_TEXTURES + * @deprecated since version 4.2.0 + */ + SPRITE_MAX_TEXTURES: { + get: function get() { + warn('PIXI.SPRITE_MAX_TEXTURES has been deprecated, please use PIXI.settings.SPRITE_MAX_TEXTURES'); + + return core.settings.SPRITE_MAX_TEXTURES; + }, + set: function set(value) { + warn('PIXI.SPRITE_MAX_TEXTURES has been deprecated, please use PIXI.settings.SPRITE_MAX_TEXTURES'); + + core.settings.SPRITE_MAX_TEXTURES = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.RETINA_PREFIX + * @see PIXI.settings.RETINA_PREFIX + * @deprecated since version 4.2.0 + */ + RETINA_PREFIX: { + get: function get() { + warn('PIXI.RETINA_PREFIX has been deprecated, please use PIXI.settings.RETINA_PREFIX'); + + return core.settings.RETINA_PREFIX; + }, + set: function set(value) { + warn('PIXI.RETINA_PREFIX has been deprecated, please use PIXI.settings.RETINA_PREFIX'); + + core.settings.RETINA_PREFIX = value; + } + }, + + /** + * @static + * @constant + * @name PIXI.DEFAULT_RENDER_OPTIONS + * @see PIXI.settings.RENDER_OPTIONS + * @deprecated since version 4.2.0 + */ + DEFAULT_RENDER_OPTIONS: { + get: function get() { + warn('PIXI.DEFAULT_RENDER_OPTIONS has been deprecated, please use PIXI.settings.DEFAULT_RENDER_OPTIONS'); + + return core.settings.RENDER_OPTIONS; + } + } + }); + + // Move the default properties to settings + var defaults = [{ parent: 'TRANSFORM_MODE', target: 'TRANSFORM_MODE' }, { parent: 'GC_MODES', target: 'GC_MODE' }, { parent: 'WRAP_MODES', target: 'WRAP_MODE' }, { parent: 'SCALE_MODES', target: 'SCALE_MODE' }, { parent: 'PRECISION', target: 'PRECISION_FRAGMENT' }]; + + var _loop = function _loop(i) { + var deprecation = defaults[i]; + + Object.defineProperty(core[deprecation.parent], 'DEFAULT', { + get: function get() { + warn('PIXI.' + deprecation.parent + '.DEFAULT has been deprecated, ' + ('please use PIXI.settings.' + deprecation.target)); + + return core.settings[deprecation.target]; + }, + set: function set(value) { + warn('PIXI.' + deprecation.parent + '.DEFAULT has been deprecated, ' + ('please use PIXI.settings.' + deprecation.target)); + + core.settings[deprecation.target] = value; + } + }); + }; + + for (var i = 0; i < defaults.length; i++) { + _loop(i); + } + + Object.defineProperties(core.settings, { + + /** + * @static + * @name PRECISION + * @memberof PIXI.settings + * @see PIXI.PRECISION + * @deprecated since version 4.4.0 + */ + PRECISION: { + get: function get() { + warn('PIXI.settings.PRECISION has been deprecated, please use PIXI.settings.PRECISION_FRAGMENT'); + + return core.settings.PRECISION_FRAGMENT; + }, + set: function set(value) { + warn('PIXI.settings.PRECISION has been deprecated, please use PIXI.settings.PRECISION_FRAGMENT'); + + core.settings.PRECISION_FRAGMENT = value; + } + } + }); + + if (extras.AnimatedSprite) { + Object.defineProperties(extras, { + + /** + * @class + * @name MovieClip + * @memberof PIXI.extras + * @see PIXI.extras.AnimatedSprite + * @deprecated since version 4.2.0 + */ + MovieClip: { + get: function get() { + warn('The MovieClip class has been renamed to AnimatedSprite, please use AnimatedSprite from now on.'); + + return extras.AnimatedSprite; + } + } + }); + } + + if (extras) { + Object.defineProperties(extras, { + /** + * @class + * @name TextureTransform + * @memberof PIXI.extras + * @see PIXI.TextureMatrix + * @deprecated since version 4.6.0 + */ + TextureTransform: { + get: function get() { + warn('The TextureTransform class has been renamed to TextureMatrix, ' + 'please use PIXI.TextureMatrix from now on.'); + + return core.TextureMatrix; + } + } + }); + } + + core.DisplayObject.prototype.generateTexture = function generateTexture(renderer, scaleMode, resolution) { + warn('generateTexture has moved to the renderer, please use renderer.generateTexture(displayObject)'); + + return renderer.generateTexture(this, scaleMode, resolution); + }; + + core.Graphics.prototype.generateTexture = function generateTexture(scaleMode, resolution) { + warn('graphics generate texture has moved to the renderer. ' + 'Or to render a graphics to a texture using canvas please use generateCanvasTexture'); + + return this.generateCanvasTexture(scaleMode, resolution); + }; + + /** + * @method + * @name PIXI.GroupD8.isSwapWidthHeight + * @see PIXI.GroupD8.isVertical + * @param {number} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + * @deprecated since version 4.6.0 + */ + core.GroupD8.isSwapWidthHeight = function isSwapWidthHeight(rotation) { + warn('GroupD8.isSwapWidthHeight was renamed to GroupD8.isVertical'); + + return core.GroupD8.isVertical(rotation); + }; + + core.RenderTexture.prototype.render = function render(displayObject, matrix, clear, updateTransform) { + this.legacyRenderer.render(displayObject, this, clear, matrix, !updateTransform); + warn('RenderTexture.render is now deprecated, please use renderer.render(displayObject, renderTexture)'); + }; + + core.RenderTexture.prototype.getImage = function getImage(target) { + warn('RenderTexture.getImage is now deprecated, please use renderer.extract.image(target)'); + + return this.legacyRenderer.extract.image(target); + }; + + core.RenderTexture.prototype.getBase64 = function getBase64(target) { + warn('RenderTexture.getBase64 is now deprecated, please use renderer.extract.base64(target)'); + + return this.legacyRenderer.extract.base64(target); + }; + + core.RenderTexture.prototype.getCanvas = function getCanvas(target) { + warn('RenderTexture.getCanvas is now deprecated, please use renderer.extract.canvas(target)'); + + return this.legacyRenderer.extract.canvas(target); + }; + + core.RenderTexture.prototype.getPixels = function getPixels(target) { + warn('RenderTexture.getPixels is now deprecated, please use renderer.extract.pixels(target)'); + + return this.legacyRenderer.pixels(target); + }; + + /** + * @method + * @private + * @name PIXI.Sprite#setTexture + * @see PIXI.Sprite#texture + * @deprecated since version 3.0.0 + * @param {PIXI.Texture} texture - The texture to set to. + */ + core.Sprite.prototype.setTexture = function setTexture(texture) { + this.texture = texture; + warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;'); + }; + + if (extras.BitmapText) { + /** + * @method + * @name PIXI.extras.BitmapText#setText + * @see PIXI.extras.BitmapText#text + * @deprecated since version 3.0.0 + * @param {string} text - The text to set to. + */ + extras.BitmapText.prototype.setText = function setText(text) { + this.text = text; + warn('setText is now deprecated, please use the text property, e.g : myBitmapText.text = \'my text\';'); + }; + } + + /** + * @method + * @name PIXI.Text#setText + * @see PIXI.Text#text + * @deprecated since version 3.0.0 + * @param {string} text - The text to set to. + */ + core.Text.prototype.setText = function setText(text) { + this.text = text; + warn('setText is now deprecated, please use the text property, e.g : myText.text = \'my text\';'); + }; + + /** + * Calculates the ascent, descent and fontSize of a given fontStyle + * + * @name PIXI.Text.calculateFontProperties + * @see PIXI.TextMetrics.measureFont + * @deprecated since version 4.5.0 + * @param {string} font - String representing the style of the font + * @return {Object} Font properties object + */ + core.Text.calculateFontProperties = function calculateFontProperties(font) { + warn('Text.calculateFontProperties is now deprecated, please use the TextMetrics.measureFont'); + + return core.TextMetrics.measureFont(font); + }; + + Object.defineProperties(core.Text, { + fontPropertiesCache: { + get: function get() { + warn('Text.fontPropertiesCache is deprecated'); + + return core.TextMetrics._fonts; + } + }, + fontPropertiesCanvas: { + get: function get() { + warn('Text.fontPropertiesCanvas is deprecated'); + + return core.TextMetrics._canvas; + } + }, + fontPropertiesContext: { + get: function get() { + warn('Text.fontPropertiesContext is deprecated'); + + return core.TextMetrics._context; + } + } + }); + + /** + * @method + * @name PIXI.Text#setStyle + * @see PIXI.Text#style + * @deprecated since version 3.0.0 + * @param {*} style - The style to set to. + */ + core.Text.prototype.setStyle = function setStyle(style) { + this.style = style; + warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;'); + }; + + /** + * @method + * @name PIXI.Text#determineFontProperties + * @see PIXI.Text#measureFontProperties + * @deprecated since version 4.2.0 + * @private + * @param {string} fontStyle - String representing the style of the font + * @return {Object} Font properties object + */ + core.Text.prototype.determineFontProperties = function determineFontProperties(fontStyle) { + warn('determineFontProperties is now deprecated, please use TextMetrics.measureFont method'); + + return core.TextMetrics.measureFont(fontStyle); + }; + + /** + * @method + * @name PIXI.Text.getFontStyle + * @see PIXI.TextMetrics.getFontStyle + * @deprecated since version 4.5.0 + * @param {PIXI.TextStyle} style - The style to use. + * @return {string} Font string + */ + core.Text.getFontStyle = function getFontStyle(style) { + warn('getFontStyle is now deprecated, please use TextStyle.toFontString() instead'); + + style = style || {}; + + if (!(style instanceof core.TextStyle)) { + style = new core.TextStyle(style); + } + + return style.toFontString(); + }; + + Object.defineProperties(core.TextStyle.prototype, { + /** + * Set all properties of a font as a single string + * + * @name PIXI.TextStyle#font + * @deprecated since version 4.0.0 + */ + font: { + get: function get() { + warn('text style property \'font\' is now deprecated, please use the ' + '\'fontFamily\', \'fontSize\', \'fontStyle\', \'fontVariant\' and \'fontWeight\' properties from now on'); + + var fontSizeString = typeof this._fontSize === 'number' ? this._fontSize + 'px' : this._fontSize; + + return this._fontStyle + ' ' + this._fontVariant + ' ' + this._fontWeight + ' ' + fontSizeString + ' ' + this._fontFamily; + }, + set: function set(font) { + warn('text style property \'font\' is now deprecated, please use the ' + '\'fontFamily\',\'fontSize\',fontStyle\',\'fontVariant\' and \'fontWeight\' properties from now on'); + + // can work out fontStyle from search of whole string + if (font.indexOf('italic') > 1) { + this._fontStyle = 'italic'; + } else if (font.indexOf('oblique') > -1) { + this._fontStyle = 'oblique'; + } else { + this._fontStyle = 'normal'; + } + + // can work out fontVariant from search of whole string + if (font.indexOf('small-caps') > -1) { + this._fontVariant = 'small-caps'; + } else { + this._fontVariant = 'normal'; + } + + // fontWeight and fontFamily are tricker to find, but it's easier to find the fontSize due to it's units + var splits = font.split(' '); + var fontSizeIndex = -1; + + this._fontSize = 26; + for (var i = 0; i < splits.length; ++i) { + if (splits[i].match(/(px|pt|em|%)/)) { + fontSizeIndex = i; + this._fontSize = splits[i]; + break; + } + } + + // we can now search for fontWeight as we know it must occur before the fontSize + this._fontWeight = 'normal'; + for (var _i = 0; _i < fontSizeIndex; ++_i) { + if (splits[_i].match(/(bold|bolder|lighter|100|200|300|400|500|600|700|800|900)/)) { + this._fontWeight = splits[_i]; + break; + } + } + + // and finally join everything together after the fontSize in case the font family has multiple words + if (fontSizeIndex > -1 && fontSizeIndex < splits.length - 1) { + this._fontFamily = ''; + for (var _i2 = fontSizeIndex + 1; _i2 < splits.length; ++_i2) { + this._fontFamily += splits[_i2] + ' '; + } + + this._fontFamily = this._fontFamily.slice(0, -1); + } else { + this._fontFamily = 'Arial'; + } + + this.styleID++; + } + } + }); + + /** + * @method + * @name PIXI.Texture#setFrame + * @see PIXI.Texture#setFrame + * @deprecated since version 3.0.0 + * @param {PIXI.Rectangle} frame - The frame to set. + */ + core.Texture.prototype.setFrame = function setFrame(frame) { + this.frame = frame; + warn('setFrame is now deprecated, please use the frame property, e.g: myTexture.frame = frame;'); + }; + + /** + * @static + * @function + * @name PIXI.Texture.addTextureToCache + * @see PIXI.Texture.addToCache + * @deprecated since 4.5.0 + * @param {PIXI.Texture} texture - The Texture to add to the cache. + * @param {string} id - The id that the texture will be stored against. + */ + core.Texture.addTextureToCache = function addTextureToCache(texture, id) { + core.Texture.addToCache(texture, id); + warn('Texture.addTextureToCache is deprecated, please use Texture.addToCache from now on.'); + }; + + /** + * @static + * @function + * @name PIXI.Texture.removeTextureFromCache + * @see PIXI.Texture.removeFromCache + * @deprecated since 4.5.0 + * @param {string} id - The id of the texture to be removed + * @return {PIXI.Texture|null} The texture that was removed + */ + core.Texture.removeTextureFromCache = function removeTextureFromCache(id) { + warn('Texture.removeTextureFromCache is deprecated, please use Texture.removeFromCache from now on. ' + 'Be aware that Texture.removeFromCache does not automatically its BaseTexture from the BaseTextureCache. ' + 'For that, use BaseTexture.removeFromCache'); + + core.BaseTexture.removeFromCache(id); + + return core.Texture.removeFromCache(id); + }; + + Object.defineProperties(filters, { + + /** + * @class + * @private + * @name PIXI.filters.AbstractFilter + * @see PIXI.AbstractFilter + * @deprecated since version 3.0.6 + */ + AbstractFilter: { + get: function get() { + warn('AstractFilter has been renamed to Filter, please use PIXI.Filter'); + + return core.AbstractFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.SpriteMaskFilter + * @see PIXI.SpriteMaskFilter + * @deprecated since version 3.0.6 + */ + SpriteMaskFilter: { + get: function get() { + warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.'); + + return core.SpriteMaskFilter; + } + }, + + /** + * @class + * @private + * @name PIXI.filters.VoidFilter + * @see PIXI.filters.AlphaFilter + * @deprecated since version 4.5.7 + */ + VoidFilter: { + get: function get() { + warn('VoidFilter has been renamed to AlphaFilter, please use PIXI.filters.AlphaFilter'); + + return filters.AlphaFilter; + } + } + }); + + /** + * @method + * @name PIXI.utils.uuid + * @see PIXI.utils.uid + * @deprecated since version 3.0.6 + * @return {number} The uid + */ + core.utils.uuid = function () { + warn('utils.uuid() is deprecated, please use utils.uid() from now on.'); + + return core.utils.uid(); + }; + + /** + * @method + * @name PIXI.utils.canUseNewCanvasBlendModes + * @see PIXI.CanvasTinter + * @deprecated + * @return {boolean} Can use blend modes. + */ + core.utils.canUseNewCanvasBlendModes = function () { + warn('utils.canUseNewCanvasBlendModes() is deprecated, please use CanvasTinter.canUseMultiply from now on'); + + return core.CanvasTinter.canUseMultiply; + }; + + var saidHello = true; + + /** + * @name PIXI.utils._saidHello + * @type {boolean} + * @see PIXI.utils.skipHello + * @deprecated since 4.1.0 + */ + Object.defineProperty(core.utils, '_saidHello', { + set: function set(bool) { + if (bool) { + warn('PIXI.utils._saidHello is deprecated, please use PIXI.utils.skipHello()'); + this.skipHello(); + } + saidHello = bool; + }, + get: function get() { + return saidHello; + } + }); + + if (prepare.BasePrepare) { + /** + * @method + * @name PIXI.prepare.BasePrepare#register + * @see PIXI.prepare.BasePrepare#registerFindHook + * @deprecated since version 4.4.2 + * @param {Function} [addHook] - Function call that takes two parameters: `item:*, queue:Array` + * function must return `true` if it was able to add item to the queue. + * @param {Function} [uploadHook] - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and + * function must return `true` if it was able to handle upload of item. + * @return {PIXI.BasePrepare} Instance of plugin for chaining. + */ + prepare.BasePrepare.prototype.register = function register(addHook, uploadHook) { + warn('renderer.plugins.prepare.register is now deprecated, ' + 'please use renderer.plugins.prepare.registerFindHook & renderer.plugins.prepare.registerUploadHook'); + + if (addHook) { + this.registerFindHook(addHook); + } + + if (uploadHook) { + this.registerUploadHook(uploadHook); + } + + return this; + }; + } + + if (prepare.canvas) { + /** + * The number of graphics or textures to upload to the GPU. + * + * @name PIXI.prepare.canvas.UPLOADS_PER_FRAME + * @static + * @type {number} + * @see PIXI.prepare.BasePrepare.limiter + * @deprecated since 4.2.0 + */ + Object.defineProperty(prepare.canvas, 'UPLOADS_PER_FRAME', { + set: function set() { + warn('PIXI.CanvasPrepare.UPLOADS_PER_FRAME has been removed. Please set ' + 'renderer.plugins.prepare.limiter.maxItemsPerFrame on your renderer'); + // because we don't have a reference to the renderer, we can't actually set + // the uploads per frame, so we'll have to stick with the warning. + }, + get: function get() { + warn('PIXI.CanvasPrepare.UPLOADS_PER_FRAME has been removed. Please use ' + 'renderer.plugins.prepare.limiter'); + + return NaN; + } + }); + } + + if (prepare.webgl) { + /** + * The number of graphics or textures to upload to the GPU. + * + * @name PIXI.prepare.webgl.UPLOADS_PER_FRAME + * @static + * @type {number} + * @see PIXI.prepare.BasePrepare.limiter + * @deprecated since 4.2.0 + */ + Object.defineProperty(prepare.webgl, 'UPLOADS_PER_FRAME', { + set: function set() { + warn('PIXI.WebGLPrepare.UPLOADS_PER_FRAME has been removed. Please set ' + 'renderer.plugins.prepare.limiter.maxItemsPerFrame on your renderer'); + // because we don't have a reference to the renderer, we can't actually set + // the uploads per frame, so we'll have to stick with the warning. + }, + get: function get() { + warn('PIXI.WebGLPrepare.UPLOADS_PER_FRAME has been removed. Please use ' + 'renderer.plugins.prepare.limiter'); + + return NaN; + } + }); + } + + if (loaders.Loader) { + var Resource = loaders.Resource; + var Loader = loaders.Loader; + + Object.defineProperties(Resource.prototype, { + isJson: { + get: function get() { + warn('The isJson property is deprecated, please use `resource.type === Resource.TYPE.JSON`.'); + + return this.type === Resource.TYPE.JSON; + } + }, + isXml: { + get: function get() { + warn('The isXml property is deprecated, please use `resource.type === Resource.TYPE.XML`.'); + + return this.type === Resource.TYPE.XML; + } + }, + isImage: { + get: function get() { + warn('The isImage property is deprecated, please use `resource.type === Resource.TYPE.IMAGE`.'); + + return this.type === Resource.TYPE.IMAGE; + } + }, + isAudio: { + get: function get() { + warn('The isAudio property is deprecated, please use `resource.type === Resource.TYPE.AUDIO`.'); + + return this.type === Resource.TYPE.AUDIO; + } + }, + isVideo: { + get: function get() { + warn('The isVideo property is deprecated, please use `resource.type === Resource.TYPE.VIDEO`.'); + + return this.type === Resource.TYPE.VIDEO; + } + } + }); + + Object.defineProperties(Loader.prototype, { + before: { + get: function get() { + warn('The before() method is deprecated, please use pre().'); + + return this.pre; + } + }, + after: { + get: function get() { + warn('The after() method is deprecated, please use use().'); + + return this.use; + } + } + }); + } + + if (interaction.interactiveTarget) { + /** + * @name PIXI.interaction.interactiveTarget#defaultCursor + * @static + * @type {number} + * @see PIXI.interaction.interactiveTarget#cursor + * @deprecated since 4.3.0 + */ + Object.defineProperty(interaction.interactiveTarget, 'defaultCursor', { + set: function set(value) { + warn('Property defaultCursor has been replaced with \'cursor\'. '); + this.cursor = value; + }, + get: function get() { + warn('Property defaultCursor has been replaced with \'cursor\'. '); + + return this.cursor; + } + }); + } + + if (interaction.InteractionManager) { + /** + * @name PIXI.interaction.InteractionManager#defaultCursorStyle + * @static + * @type {string} + * @see PIXI.interaction.InteractionManager#cursorStyles + * @deprecated since 4.3.0 + */ + Object.defineProperty(interaction.InteractionManager, 'defaultCursorStyle', { + set: function set(value) { + warn('Property defaultCursorStyle has been replaced with \'cursorStyles.default\'. '); + this.cursorStyles.default = value; + }, + get: function get() { + warn('Property defaultCursorStyle has been replaced with \'cursorStyles.default\'. '); + + return this.cursorStyles.default; + } + }); + + /** + * @name PIXI.interaction.InteractionManager#currentCursorStyle + * @static + * @type {string} + * @see PIXI.interaction.InteractionManager#cursorStyles + * @deprecated since 4.3.0 + */ + Object.defineProperty(interaction.InteractionManager, 'currentCursorStyle', { + set: function set(value) { + warn('Property currentCursorStyle has been removed.' + 'See the currentCursorMode property, which works differently.'); + this.currentCursorMode = value; + }, + get: function get() { + warn('Property currentCursorStyle has been removed.' + 'See the currentCursorMode property, which works differently.'); + + return this.currentCursorMode; + } + }); + } + } + + }, {}], 132: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var TEMP_RECT = new core.Rectangle(); + + /** + * The extract manager provides functionality to export content from the renderers. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * + * @class + * @memberof PIXI.extract + */ + + var CanvasExtract = function () { + /** + * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer + */ + function CanvasExtract(renderer) { + _classCallCheck(this, CanvasExtract); + + this.renderer = renderer; + /** + * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture + * + * @member {PIXI.extract.CanvasExtract} extract + * @memberof PIXI.CanvasRenderer# + * @see PIXI.extract.CanvasExtract + */ + renderer.extract = this; + } + + /** + * Will return a HTML Image of the target + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {HTMLImageElement} HTML Image of the target + */ + + + CanvasExtract.prototype.image = function image(target) { + var image = new Image(); + + image.src = this.base64(target); + + return image; + }; + + /** + * Will return a a base64 encoded string of this target. It works by calling + * `CanvasExtract.getCanvas` and then running toDataURL on that. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ + + + CanvasExtract.prototype.base64 = function base64(target) { + return this.canvas(target).toDataURL(); + }; + + /** + * Creates a Canvas element, renders this target to it and then returns it. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ + + + CanvasExtract.prototype.canvas = function canvas(target) { + var renderer = this.renderer; + var context = void 0; + var resolution = void 0; + var frame = void 0; + var renderTexture = void 0; + + if (target) { + if (target instanceof core.RenderTexture) { + renderTexture = target; + } else { + renderTexture = renderer.generateTexture(target); + } + } + + if (renderTexture) { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } else { + context = renderer.rootContext; + resolution = renderer.resolution; + frame = TEMP_RECT; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + } + + var width = Math.floor(frame.width * resolution + 1e-4); + var height = Math.floor(frame.height * resolution + 1e-4); + + var canvasBuffer = new core.CanvasRenderTarget(width, height, 1); + var canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height); + + canvasBuffer.context.putImageData(canvasData, 0, 0); + + // send the canvas back.. + return canvasBuffer.canvas; + }; + + /** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA + * order, with integer values between 0 and 255 (included). + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture + */ + + + CanvasExtract.prototype.pixels = function pixels(target) { + var renderer = this.renderer; + var context = void 0; + var resolution = void 0; + var frame = void 0; + var renderTexture = void 0; + + if (target) { + if (target instanceof core.RenderTexture) { + renderTexture = target; + } else { + renderTexture = renderer.generateTexture(target); + } + } + + if (renderTexture) { + context = renderTexture.baseTexture._canvasRenderTarget.context; + resolution = renderTexture.baseTexture._canvasRenderTarget.resolution; + frame = renderTexture.frame; + } else { + context = renderer.rootContext; + + frame = TEMP_RECT; + frame.width = renderer.width; + frame.height = renderer.height; + } + + return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data; + }; + + /** + * Destroys the extract + * + */ + + + CanvasExtract.prototype.destroy = function destroy() { + this.renderer.extract = null; + this.renderer = null; + }; + + return CanvasExtract; + }(); + + exports.default = CanvasExtract; + + + core.CanvasRenderer.registerPlugin('extract', CanvasExtract); + + }, { "../../core": 65 }], 133: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLExtract = require('./webgl/WebGLExtract'); + + Object.defineProperty(exports, 'webgl', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_WebGLExtract).default; + } + }); + + var _CanvasExtract = require('./canvas/CanvasExtract'); + + Object.defineProperty(exports, 'canvas', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasExtract).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./canvas/CanvasExtract": 132, "./webgl/WebGLExtract": 134 }], 134: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var TEMP_RECT = new core.Rectangle(); + var BYTES_PER_PIXEL = 4; + + /** + * The extract manager provides functionality to export content from the renderers. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * + * @class + * @memberof PIXI.extract + */ + + var WebGLExtract = function () { + /** + * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer + */ + function WebGLExtract(renderer) { + _classCallCheck(this, WebGLExtract); + + this.renderer = renderer; + /** + * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture + * + * @member {PIXI.extract.WebGLExtract} extract + * @memberof PIXI.WebGLRenderer# + * @see PIXI.extract.WebGLExtract + */ + renderer.extract = this; + } + + /** + * Will return a HTML Image of the target + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {HTMLImageElement} HTML Image of the target + */ + + + WebGLExtract.prototype.image = function image(target) { + var image = new Image(); + + image.src = this.base64(target); + + return image; + }; + + /** + * Will return a a base64 encoded string of this target. It works by calling + * `WebGLExtract.getCanvas` and then running toDataURL on that. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {string} A base64 encoded string of the texture. + */ + + + WebGLExtract.prototype.base64 = function base64(target) { + return this.canvas(target).toDataURL(); + }; + + /** + * Creates a Canvas element, renders this target to it and then returns it. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ + + + WebGLExtract.prototype.canvas = function canvas(target) { + var renderer = this.renderer; + var textureBuffer = void 0; + var resolution = void 0; + var frame = void 0; + var flipY = false; + var renderTexture = void 0; + var generated = false; + + if (target) { + if (target instanceof core.RenderTexture) { + renderTexture = target; + } else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } + } + + if (renderTexture) { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + // BlueMoon Edit - 01/20 for resolution error. + if (!textureBuffer) { return document.createElement("canvas") } + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + flipY = false; + } else { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + flipY = true; + + frame = TEMP_RECT; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + } + + var width = Math.floor(frame.width * resolution + 1e-4); + var height = Math.floor(frame.height * resolution + 1e-4); + + var canvasBuffer = new core.CanvasRenderTarget(width, height, 1); + + if (textureBuffer) { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + + // set up an array of pixels + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + + // read pixels to the array + var gl = renderer.gl; + + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + + // add the pixels to the canvas + var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); + + canvasData.data.set(webglPixels); + + canvasBuffer.context.putImageData(canvasData, 0, 0); + + // pulling pixels + if (flipY) { + canvasBuffer.context.scale(1, -1); + canvasBuffer.context.drawImage(canvasBuffer.canvas, 0, -height); + } + } + + if (generated) { + renderTexture.destroy(true); + } + // send the canvas back.. + + return canvasBuffer.canvas; + }; + + /** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA + * order, with integer values between 0 and 255 (included). + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use use the main renderer + * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture + */ + + + WebGLExtract.prototype.pixels = function pixels(target) { + var renderer = this.renderer; + var textureBuffer = void 0; + var resolution = void 0; + var frame = void 0; + var renderTexture = void 0; + var generated = false; + + if (target) { + if (target instanceof core.RenderTexture) { + renderTexture = target; + } else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } + } + + if (renderTexture) { + textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID]; + resolution = textureBuffer.resolution; + frame = renderTexture.frame; + } else { + textureBuffer = this.renderer.rootRenderTarget; + resolution = textureBuffer.resolution; + + frame = TEMP_RECT; + frame.width = textureBuffer.size.width; + frame.height = textureBuffer.size.height; + } + + var width = frame.width * resolution; + var height = frame.height * resolution; + + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + + if (textureBuffer) { + // bind the buffer + renderer.bindRenderTarget(textureBuffer); + // read pixels to the array + var gl = renderer.gl; + + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + } + + if (generated) { + renderTexture.destroy(true); + } + + return webglPixels; + }; + + /** + * Destroys the extract + * + */ + + + WebGLExtract.prototype.destroy = function destroy() { + this.renderer.extract = null; + this.renderer = null; + }; + + return WebGLExtract; + }(); + + exports.default = WebGLExtract; + + + core.WebGLRenderer.registerPlugin('extract', WebGLExtract); + + }, { "../../core": 65 }], 135: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @typedef PIXI.extras.AnimatedSprite~FrameObject + * @type {object} + * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame + * @property {number} time - the duration of the frame in ms + */ + + /** + * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. + * + * ```js + * let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; + * let textureArray = []; + * + * for (let i=0; i < 4; i++) + * { + * let texture = PIXI.Texture.fromImage(alienImages[i]); + * textureArray.push(texture); + * }; + * + * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray); + * ``` + * + * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} + * containing the animation definitions: + * + * ```js + * PIXI.loader.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet; + * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations["image_sequence"]); + * ... + * } + * ``` + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI.extras + */ + var AnimatedSprite = function (_core$Sprite) { + _inherits(AnimatedSprite, _core$Sprite); + + /** + * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - an array of {@link PIXI.Texture} or frame + * objects that make up the animation + * @param {boolean} [autoUpdate=true] - Whether to use PIXI.ticker.shared to auto update animation time. + */ + function AnimatedSprite(textures, autoUpdate) { + _classCallCheck(this, AnimatedSprite); + + /** + * @private + */ + var _this = _possibleConstructorReturn(this, _core$Sprite.call(this, textures[0] instanceof core.Texture ? textures[0] : textures[0].texture)); + + _this._textures = null; + + /** + * @private + */ + _this._durations = null; + + _this.textures = textures; + + /** + * `true` uses PIXI.ticker.shared to auto update animation time. + * @type {boolean} + * @default true + * @private + */ + _this._autoUpdate = autoUpdate !== false; + + /** + * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower + * + * @member {number} + * @default 1 + */ + _this.animationSpeed = 1; + + /** + * Whether or not the animate sprite repeats after playing. + * + * @member {boolean} + * @default true + */ + _this.loop = true; + + /** + * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes. + * + * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools. + * Changing anchor for each frame allows to pin sprite origin to certain moving feature + * of the frame (e.g. left foot). + * + * Note: Enabling this will override any previously set `anchor` on each frame change. + * + * @member {boolean} + * @default false + */ + _this.updateAnchor = false; + + /** + * Function to call when a AnimatedSprite finishes playing + * + * @member {Function} + */ + _this.onComplete = null; + + /** + * Function to call when a AnimatedSprite changes which texture is being rendered + * + * @member {Function} + */ + _this.onFrameChange = null; + + /** + * Function to call when 'loop' is true, and an AnimatedSprite is played and loops around to start again + * + * @member {Function} + */ + _this.onLoop = null; + + /** + * Elapsed time since animation has been started, used internally to display current texture + * + * @member {number} + * @private + */ + _this._currentTime = 0; + + /** + * Indicates if the AnimatedSprite is currently playing + * + * @member {boolean} + * @readonly + */ + _this.playing = false; + return _this; + } + + /** + * Stops the AnimatedSprite + * + */ + + + AnimatedSprite.prototype.stop = function stop() { + if (!this.playing) { + return; + } + + this.playing = false; + if (this._autoUpdate) { + core.ticker.shared.remove(this.update, this); + } + }; + + /** + * Plays the AnimatedSprite + * + */ + + + AnimatedSprite.prototype.play = function play() { + if (this.playing) { + return; + } + + this.playing = true; + if (this._autoUpdate) { + core.ticker.shared.add(this.update, this, core.UPDATE_PRIORITY.HIGH); + } + }; + + /** + * Stops the AnimatedSprite and goes to a specific frame + * + * @param {number} frameNumber - frame index to stop at + */ + + + AnimatedSprite.prototype.gotoAndStop = function gotoAndStop(frameNumber) { + this.stop(); + + var previousFrame = this.currentFrame; + + this._currentTime = frameNumber; + + if (previousFrame !== this.currentFrame) { + this.updateTexture(); + } + }; + + /** + * Goes to a specific frame and begins playing the AnimatedSprite + * + * @param {number} frameNumber - frame index to start at + */ + + + AnimatedSprite.prototype.gotoAndPlay = function gotoAndPlay(frameNumber) { + var previousFrame = this.currentFrame; + + this._currentTime = frameNumber; + + if (previousFrame !== this.currentFrame) { + this.updateTexture(); + } + + this.play(); + }; + + /** + * Updates the object transform for rendering. + * + * @private + * @param {number} deltaTime - Time since last tick. + */ + + + AnimatedSprite.prototype.update = function update(deltaTime) { + var elapsed = this.animationSpeed * deltaTime; + var previousFrame = this.currentFrame; + + if (this._durations !== null) { + var lag = this._currentTime % 1 * this._durations[this.currentFrame]; + + lag += elapsed / 60 * 1000; + + while (lag < 0) { + this._currentTime--; + lag += this._durations[this.currentFrame]; + } + + var sign = Math.sign(this.animationSpeed * deltaTime); + + this._currentTime = Math.floor(this._currentTime); + + while (lag >= this._durations[this.currentFrame]) { + lag -= this._durations[this.currentFrame] * sign; + this._currentTime += sign; + } + + this._currentTime += lag / this._durations[this.currentFrame]; + } else { + this._currentTime += elapsed; + } + + if (this._currentTime < 0 && !this.loop) { + this.gotoAndStop(0); + + if (this.onComplete) { + this.onComplete(); + } + } else if (this._currentTime >= this._textures.length && !this.loop) { + this.gotoAndStop(this._textures.length - 1); + + if (this.onComplete) { + this.onComplete(); + } + } else if (previousFrame !== this.currentFrame) { + if (this.loop && this.onLoop) { + if (this.animationSpeed > 0 && this.currentFrame < previousFrame) { + this.onLoop(); + } else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) { + this.onLoop(); + } + } + + this.updateTexture(); + } + }; + + /** + * Updates the displayed texture to match the current frame index + * + * @private + */ + + + AnimatedSprite.prototype.updateTexture = function updateTexture() { + this._texture = this._textures[this.currentFrame]; + this._textureID = -1; + this.cachedTint = 0xFFFFFF; + + if (this.updateAnchor) { + this._anchor.copy(this._texture.defaultAnchor); + } + + if (this.onFrameChange) { + this.onFrameChange(this.currentFrame); + } + }; + + /** + * Stops the AnimatedSprite and destroys it + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + + + AnimatedSprite.prototype.destroy = function destroy(options) { + this.stop(); + _core$Sprite.prototype.destroy.call(this, options); + }; + + /** + * A short hand way of creating a movieclip from an array of frame ids + * + * @static + * @param {string[]} frames - The array of frames ids the movieclip will use as its texture frames + * @return {AnimatedSprite} The new animated sprite with the specified frames. + */ + + + AnimatedSprite.fromFrames = function fromFrames(frames) { + var textures = []; + + for (var i = 0; i < frames.length; ++i) { + textures.push(core.Texture.fromFrame(frames[i])); + } + + return new AnimatedSprite(textures); + }; + + /** + * A short hand way of creating a movieclip from an array of image ids + * + * @static + * @param {string[]} images - the array of image urls the movieclip will use as its texture frames + * @return {AnimatedSprite} The new animate sprite with the specified images as frames. + */ + + + AnimatedSprite.fromImages = function fromImages(images) { + var textures = []; + + for (var i = 0; i < images.length; ++i) { + textures.push(core.Texture.fromImage(images[i])); + } + + return new AnimatedSprite(textures); + }; + + /** + * totalFrames is the total number of frames in the AnimatedSprite. This is the same as number of textures + * assigned to the AnimatedSprite. + * + * @readonly + * @member {number} + * @default 0 + */ + + + _createClass(AnimatedSprite, [{ + key: 'totalFrames', + get: function get() { + return this._textures.length; + } + + /** + * The array of textures used for this AnimatedSprite + * + * @member {PIXI.Texture[]} + */ + + }, { + key: 'textures', + get: function get() { + return this._textures; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (value[0] instanceof core.Texture) { + this._textures = value; + this._durations = null; + } else { + this._textures = []; + this._durations = []; + + for (var i = 0; i < value.length; i++) { + this._textures.push(value[i].texture); + this._durations.push(value[i].time); + } + } + this.gotoAndStop(0); + this.updateTexture(); + } + + /** + * The AnimatedSprites current frame index + * + * @member {number} + * @readonly + */ + + }, { + key: 'currentFrame', + get: function get() { + var currentFrame = Math.floor(this._currentTime) % this._textures.length; + + if (currentFrame < 0) { + currentFrame += this._textures.length; + } + + return currentFrame; + } + }]); + + return AnimatedSprite; + }(core.Sprite); + + exports.default = AnimatedSprite; + + }, { "../core": 65 }], 136: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _ObservablePoint = require('../core/math/ObservablePoint'); + + var _ObservablePoint2 = _interopRequireDefault(_ObservablePoint); + + var _utils = require('../core/utils'); + + var _settings = require('../core/settings'); + + var _settings2 = _interopRequireDefault(_settings); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * A BitmapText object will create a line or multiple lines of text using bitmap font. To + * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * + * A BitmapText can only be created when the font is loaded + * + * ```js + * // in this case the font is in a file called 'desyrel.fnt' + * let bitmapText = new PIXI.extras.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); + * ``` + * + * http://www.angelcode.com/products/bmfont/ for windows or + * http://www.bmglyph.com/ for mac. + * + * @class + * @extends PIXI.Container + * @memberof PIXI.extras + */ + var BitmapText = function (_core$Container) { + _inherits(BitmapText, _core$Container); + + /** + * @param {string} text - The copy that you would like the text to display + * @param {object} style - The style parameters + * @param {string|object} style.font - The font descriptor for the object, can be passed as a string of form + * "24px FontName" or "FontName" or as an object with explicit name/size properties. + * @param {string} [style.font.name] - The bitmap font id + * @param {number} [style.font.size] - The size of the font in pixels, e.g. 24 + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), does not affect + * single line text + * @param {number} [style.tint=0xFFFFFF] - The tint color + */ + function BitmapText(text) { + var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + _classCallCheck(this, BitmapText); + + /** + * Private tracker for the width of the overall text + * + * @member {number} + * @private + */ + var _this = _possibleConstructorReturn(this, _core$Container.call(this)); + + _this._textWidth = 0; + + /** + * Private tracker for the height of the overall text + * + * @member {number} + * @private + */ + _this._textHeight = 0; + + /** + * Private tracker for the letter sprite pool. + * + * @member {PIXI.Sprite[]} + * @private + */ + _this._glyphs = []; + + /** + * Private tracker for the current style. + * + * @member {object} + * @private + */ + _this._font = { + tint: style.tint !== undefined ? style.tint : 0xFFFFFF, + align: style.align || 'left', + name: null, + size: 0 + }; + + /** + * Private tracker for the current font. + * + * @member {object} + * @private + */ + _this.font = style.font; // run font setter + + /** + * Private tracker for the current text. + * + * @member {string} + * @private + */ + _this._text = text; + + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the + * value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting value to 0 + * + * @member {number} + * @private + */ + _this._maxWidth = 0; + + /** + * The max line height. This is useful when trying to use the total height of the Text, + * ie: when trying to vertically align. + * + * @member {number} + * @private + */ + _this._maxLineHeight = 0; + + /** + * Letter spacing. This is useful for setting the space between characters. + * @member {number} + * @private + */ + _this._letterSpacing = 0; + + /** + * Text anchor. read-only + * + * @member {PIXI.ObservablePoint} + * @private + */ + _this._anchor = new _ObservablePoint2.default(function () { + _this.dirty = true; + }, _this, 0, 0); + + /** + * The dirty state of this object. + * + * @member {boolean} + */ + _this.dirty = false; + + _this.updateText(); + return _this; + } + + /** + * Renders text and updates it when needed + * + * @private + */ + + + BitmapText.prototype.updateText = function updateText() { + var data = BitmapText.fonts[this._font.name]; + var scale = this._font.size / data.size; + var pos = new core.Point(); + var chars = []; + var lineWidths = []; + var text = this.text.replace(/(?:\r\n|\r)/g, '\n'); + var textLength = text.length; + var maxWidth = this._maxWidth * data.size / this._font.size; + + var prevCharCode = null; + var lastLineWidth = 0; + var maxLineWidth = 0; + var line = 0; + var lastBreakPos = -1; + var lastBreakWidth = 0; + var spacesRemoved = 0; + var maxLineHeight = 0; + + for (var i = 0; i < textLength; i++) { + var charCode = text.charCodeAt(i); + var char = text.charAt(i); + + if (/(?:\s)/.test(char)) { + lastBreakPos = i; + lastBreakWidth = lastLineWidth; + } + + if (char === '\r' || char === '\n') { + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + ++line; + ++spacesRemoved; + + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + continue; + } + + var charData = data.chars[charCode]; + + if (!charData) { + continue; + } + + if (prevCharCode && charData.kerning[prevCharCode]) { + pos.x += charData.kerning[prevCharCode]; + } + + chars.push({ + texture: charData.texture, + line: line, + charCode: charCode, + position: new core.Point(pos.x + charData.xOffset + this._letterSpacing / 2, pos.y + charData.yOffset) + }); + pos.x += charData.xAdvance + this._letterSpacing; + lastLineWidth = pos.x; + maxLineHeight = Math.max(maxLineHeight, charData.yOffset + charData.texture.height); + prevCharCode = charCode; + + if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) { + ++spacesRemoved; + core.utils.removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos); + i = lastBreakPos; + lastBreakPos = -1; + + lineWidths.push(lastBreakWidth); + maxLineWidth = Math.max(maxLineWidth, lastBreakWidth); + line++; + + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + } + } + + var lastChar = text.charAt(text.length - 1); + + if (lastChar !== '\r' && lastChar !== '\n') { + if (/(?:\s)/.test(lastChar)) { + lastLineWidth = lastBreakWidth; + } + + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + } + + var lineAlignOffsets = []; + + for (var _i = 0; _i <= line; _i++) { + var alignOffset = 0; + + if (this._font.align === 'right') { + alignOffset = maxLineWidth - lineWidths[_i]; + } else if (this._font.align === 'center') { + alignOffset = (maxLineWidth - lineWidths[_i]) / 2; + } + + lineAlignOffsets.push(alignOffset); + } + + var lenChars = chars.length; + var tint = this.tint; + + for (var _i2 = 0; _i2 < lenChars; _i2++) { + var c = this._glyphs[_i2]; // get the next glyph sprite + + if (c) { + c.texture = chars[_i2].texture; + } else { + c = new core.Sprite(chars[_i2].texture); + this._glyphs.push(c); + } + + c.position.x = (chars[_i2].position.x + lineAlignOffsets[chars[_i2].line]) * scale; + c.position.y = chars[_i2].position.y * scale; + c.scale.x = c.scale.y = scale; + c.tint = tint; + + if (!c.parent) { + this.addChild(c); + } + } + + // remove unnecessary children. + for (var _i3 = lenChars; _i3 < this._glyphs.length; ++_i3) { + this.removeChild(this._glyphs[_i3]); + } + + this._textWidth = maxLineWidth * scale; + this._textHeight = (pos.y + data.lineHeight) * scale; + + // apply anchor + if (this.anchor.x !== 0 || this.anchor.y !== 0) { + for (var _i4 = 0; _i4 < lenChars; _i4++) { + this._glyphs[_i4].x -= this._textWidth * this.anchor.x; + this._glyphs[_i4].y -= this._textHeight * this.anchor.y; + } + } + this._maxLineHeight = maxLineHeight * scale; + }; + + /** + * Updates the transform of this object + * + * @private + */ + + + BitmapText.prototype.updateTransform = function updateTransform() { + this.validate(); + this.containerUpdateTransform(); + }; + + /** + * Validates text before calling parent's getLocalBounds + * + * @return {PIXI.Rectangle} The rectangular bounding area + */ + + + BitmapText.prototype.getLocalBounds = function getLocalBounds() { + this.validate(); + + return _core$Container.prototype.getLocalBounds.call(this); + }; + + /** + * Updates text when needed + * + * @private + */ + + + BitmapText.prototype.validate = function validate() { + if (this.dirty) { + this.updateText(); + this.dirty = false; + } + }; + + /** + * The tint of the BitmapText object + * + * @member {number} + */ + + + /** + * Register a bitmap font with data and a texture. + * + * @static + * @param {XMLDocument} xml - The XML document data. + * @param {Object.|PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page. + * If providing an object, the key is the `` element's `file` attribute in the FNT file. + * @return {Object} Result font object with font, size, lineHeight and char fields. + */ + BitmapText.registerFont = function registerFont(xml, textures) { + var data = {}; + var info = xml.getElementsByTagName('info')[0]; + var common = xml.getElementsByTagName('common')[0]; + var pages = xml.getElementsByTagName('page'); + var res = (0, _utils.getResolutionOfUrl)(pages[0].getAttribute('file'), _settings2.default.RESOLUTION); + var pagesTextures = {}; + + data.font = info.getAttribute('face'); + data.size = parseInt(info.getAttribute('size'), 10); + data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) / res; + data.chars = {}; + + // Single texture, convert to list + if (textures instanceof core.Texture) { + textures = [textures]; + } + + // Convert the input Texture, Textures or object + // into a page Texture lookup by "id" + for (var i = 0; i < pages.length; i++) { + var id = pages[i].getAttribute('id'); + var file = pages[i].getAttribute('file'); + + pagesTextures[id] = textures instanceof Array ? textures[i] : textures[file]; + } + + // parse letters + var letters = xml.getElementsByTagName('char'); + + for (var _i5 = 0; _i5 < letters.length; _i5++) { + var letter = letters[_i5]; + var charCode = parseInt(letter.getAttribute('id'), 10); + var page = letter.getAttribute('page') || 0; + var textureRect = new core.Rectangle(parseInt(letter.getAttribute('x'), 10) / res + pagesTextures[page].frame.x / res, parseInt(letter.getAttribute('y'), 10) / res + pagesTextures[page].frame.y / res, parseInt(letter.getAttribute('width'), 10) / res, parseInt(letter.getAttribute('height'), 10) / res); + + data.chars[charCode] = { + xOffset: parseInt(letter.getAttribute('xoffset'), 10) / res, + yOffset: parseInt(letter.getAttribute('yoffset'), 10) / res, + xAdvance: parseInt(letter.getAttribute('xadvance'), 10) / res, + kerning: {}, + texture: new core.Texture(pagesTextures[page].baseTexture, textureRect), + page: page + }; + } + + // parse kernings + var kernings = xml.getElementsByTagName('kerning'); + + for (var _i6 = 0; _i6 < kernings.length; _i6++) { + var kerning = kernings[_i6]; + var first = parseInt(kerning.getAttribute('first'), 10) / res; + var second = parseInt(kerning.getAttribute('second'), 10) / res; + var amount = parseInt(kerning.getAttribute('amount'), 10) / res; + + if (data.chars[second]) { + data.chars[second].kerning[first] = amount; + } + } + + // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3 + // but it's very likely to change + BitmapText.fonts[data.font] = data; + + return data; + }; + + _createClass(BitmapText, [{ + key: 'tint', + get: function get() { + return this._font.tint; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._font.tint = typeof value === 'number' && value >= 0 ? value : 0xFFFFFF; + + this.dirty = true; + } + + /** + * The alignment of the BitmapText object + * + * @member {string} + * @default 'left' + */ + + }, { + key: 'align', + get: function get() { + return this._font.align; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._font.align = value || 'left'; + + this.dirty = true; + } + + /** + * The anchor sets the origin point of the text. + * The default is 0,0 this means the text's origin is the top left + * Setting the anchor to 0.5,0.5 means the text's origin is centered + * Setting the anchor to 1,1 would mean the text's origin point will be the bottom right corner + * + * @member {PIXI.Point | number} + */ + + }, { + key: 'anchor', + get: function get() { + return this._anchor; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (typeof value === 'number') { + this._anchor.set(value); + } else { + this._anchor.copy(value); + } + } + + /** + * The font descriptor of the BitmapText object + * + * @member {string|object} + */ + + }, { + key: 'font', + get: function get() { + return this._font; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (!value) { + return; + } + + if (typeof value === 'string') { + value = value.split(' '); + + this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); + this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; + } else { + this._font.name = value.name; + this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); + } + + this.dirty = true; + } + + /** + * The text of the BitmapText object + * + * @member {string} + */ + + }, { + key: 'text', + get: function get() { + return this._text; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + value = value.toString() || ' '; + if (this._text === value) { + return; + } + this._text = value; + this.dirty = true; + } + + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the + * value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting value to 0 + * + * @member {number} + */ + + }, { + key: 'maxWidth', + get: function get() { + return this._maxWidth; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._maxWidth === value) { + return; + } + this._maxWidth = value; + this.dirty = true; + } + + /** + * The max line height. This is useful when trying to use the total height of the Text, + * ie: when trying to vertically align. + * + * @member {number} + * @readonly + */ + + }, { + key: 'maxLineHeight', + get: function get() { + this.validate(); + + return this._maxLineHeight; + } + + /** + * The width of the overall text, different from fontSize, + * which is defined in the style object + * + * @member {number} + * @readonly + */ + + }, { + key: 'textWidth', + get: function get() { + this.validate(); + + return this._textWidth; + } + + /** + * Additional space between characters. + * + * @member {number} + */ + + }, { + key: 'letterSpacing', + get: function get() { + return this._letterSpacing; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._letterSpacing !== value) { + this._letterSpacing = value; + this.dirty = true; + } + } + + /** + * The height of the overall text, different from fontSize, + * which is defined in the style object + * + * @member {number} + * @readonly + */ + + }, { + key: 'textHeight', + get: function get() { + this.validate(); + + return this._textHeight; + } + }]); + + return BitmapText; + }(core.Container); + + exports.default = BitmapText; + + + BitmapText.fonts = {}; + + }, { "../core": 65, "../core/math/ObservablePoint": 68, "../core/settings": 101, "../core/utils": 125 }], 137: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _CanvasTinter = require('../core/sprites/canvas/CanvasTinter'); + + var _CanvasTinter2 = _interopRequireDefault(_CanvasTinter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var tempPoint = new core.Point(); + + /** + * A tiling sprite is a fast way of rendering a tiling image + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI.extras + */ + + var TilingSprite = function (_core$Sprite) { + _inherits(TilingSprite, _core$Sprite); + + /** + * @param {PIXI.Texture} texture - the texture of the tiling sprite + * @param {number} [width=100] - the width of the tiling sprite + * @param {number} [height=100] - the height of the tiling sprite + */ + function TilingSprite(texture) { + var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100; + var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100; + + _classCallCheck(this, TilingSprite); + + /** + * Tile transform + * + * @member {PIXI.TransformStatic} + */ + var _this = _possibleConstructorReturn(this, _core$Sprite.call(this, texture)); + + _this.tileTransform = new core.TransformStatic(); + + // /// private + + /** + * The with of the tiling sprite + * + * @member {number} + * @private + */ + _this._width = width; + + /** + * The height of the tiling sprite + * + * @member {number} + * @private + */ + _this._height = height; + + /** + * Canvas pattern + * + * @type {CanvasPattern} + * @private + */ + _this._canvasPattern = null; + + /** + * transform that is applied to UV to get the texture coords + * + * @member {PIXI.TextureMatrix} + */ + _this.uvTransform = texture.transform || new core.TextureMatrix(texture); + + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_renderWebGL' method. + * + * @member {string} + * @default 'tilingSprite' + */ + _this.pluginName = 'tilingSprite'; + + /** + * Whether or not anchor affects uvs + * + * @member {boolean} + * @default false + */ + _this.uvRespectAnchor = false; + return _this; + } + /** + * Changes frame clamping in corresponding textureTransform, shortcut + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + + + /** + * @private + */ + TilingSprite.prototype._onTextureUpdate = function _onTextureUpdate() { + if (this.uvTransform) { + this.uvTransform.texture = this._texture; + } + this.cachedTint = 0xFFFFFF; + }; + + /** + * Renders the object using the WebGL renderer + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The renderer + */ + + + TilingSprite.prototype._renderWebGL = function _renderWebGL(renderer) { + // tweak our texture temporarily.. + var texture = this._texture; + + if (!texture || !texture.valid) { + return; + } + + this.tileTransform.updateLocalTransform(); + this.uvTransform.update(); + + renderer.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer + */ + + + TilingSprite.prototype._renderCanvas = function _renderCanvas(renderer) { + var texture = this._texture; + + if (!texture.baseTexture.hasLoaded) { + return; + } + + var context = renderer.context; + var transform = this.worldTransform; + var resolution = renderer.resolution; + var isTextureRotated = texture.rotate === 2; + var baseTexture = texture.baseTexture; + var baseTextureResolution = baseTexture.resolution; + var modX = this.tilePosition.x / this.tileScale.x % texture.orig.width * baseTextureResolution; + var modY = this.tilePosition.y / this.tileScale.y % texture.orig.height * baseTextureResolution; + + // create a nice shiny pattern! + if (this._textureID !== this._texture._updateID || this.cachedTint !== this.tint) { + this._textureID = this._texture._updateID; + // cut an object from a spritesheet.. + var tempCanvas = new core.CanvasRenderTarget(texture.orig.width, texture.orig.height, baseTextureResolution); + + // Tint the tiling sprite + if (this.tint !== 0xFFFFFF) { + this.tintedTexture = _CanvasTinter2.default.getTintedTexture(this, this.tint); + tempCanvas.context.drawImage(this.tintedTexture, 0, 0); + } else { + var sx = texture._frame.x * baseTextureResolution; + var sy = texture._frame.y * baseTextureResolution; + var sWidth = texture._frame.width * baseTextureResolution; + var sHeight = texture._frame.height * baseTextureResolution; + var dWidth = (texture.trim ? texture.trim.width : texture.orig.width) * baseTextureResolution; + var dHeight = (texture.trim ? texture.trim.height : texture.orig.height) * baseTextureResolution; + var dx = (texture.trim ? texture.trim.x : 0) * baseTextureResolution; + var dy = (texture.trim ? texture.trim.y : 0) * baseTextureResolution; + + if (isTextureRotated) { + // Apply rotation and transform + tempCanvas.context.rotate(-Math.PI / 2); + tempCanvas.context.translate(-dHeight, 0); + tempCanvas.context.drawImage(baseTexture.source, sx, sy, sWidth, sHeight, -dy, dx, dHeight, dWidth); + } else { + tempCanvas.context.drawImage(baseTexture.source, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); + } + } + + this.cachedTint = this.tint; + this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat'); + } + + // set context state.. + context.globalAlpha = this.worldAlpha; + context.setTransform(transform.a * resolution, transform.b * resolution, transform.c * resolution, transform.d * resolution, transform.tx * resolution, transform.ty * resolution); + + renderer.setBlendMode(this.blendMode); + + // fill the pattern! + context.fillStyle = this._canvasPattern; + + // TODO - this should be rolled into the setTransform above.. + context.scale(this.tileScale.x / baseTextureResolution, this.tileScale.y / baseTextureResolution); + + var anchorX = this.anchor.x * -this._width * baseTextureResolution; + var anchorY = this.anchor.y * -this._height * baseTextureResolution; + + if (this.uvRespectAnchor) { + context.translate(modX, modY); + + context.fillRect(-modX + anchorX, -modY + anchorY, this._width / this.tileScale.x * baseTextureResolution, this._height / this.tileScale.y * baseTextureResolution); + } else { + context.translate(modX + anchorX, modY + anchorY); + + context.fillRect(-modX, -modY, this._width / this.tileScale.x * baseTextureResolution, this._height / this.tileScale.y * baseTextureResolution); + } + }; + + /** + * Updates the bounds of the tiling sprite. + * + * @private + */ + + + TilingSprite.prototype._calculateBounds = function _calculateBounds() { + var minX = this._width * -this._anchor._x; + var minY = this._height * -this._anchor._y; + var maxX = this._width * (1 - this._anchor._x); + var maxY = this._height * (1 - this._anchor._y); + + this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); + }; + + /** + * Gets the local bounds of the sprite object. + * + * @param {PIXI.Rectangle} rect - The output rectangle. + * @return {PIXI.Rectangle} The bounds. + */ + + + TilingSprite.prototype.getLocalBounds = function getLocalBounds(rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + this._bounds.minX = this._width * -this._anchor._x; + this._bounds.minY = this._height * -this._anchor._y; + this._bounds.maxX = this._width * (1 - this._anchor._x); + this._bounds.maxY = this._height * (1 - this._anchor._y); + + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new core.Rectangle(); + } + + rect = this._localBoundsRect; + } + + return this._bounds.getRectangle(rect); + } + + return _core$Sprite.prototype.getLocalBounds.call(this, rect); + }; + + /** + * Checks if a point is inside this tiling sprite. + * + * @param {PIXI.Point} point - the point to check + * @return {boolean} Whether or not the sprite contains the point. + */ + + + TilingSprite.prototype.containsPoint = function containsPoint(point) { + this.worldTransform.applyInverse(point, tempPoint); + + var width = this._width; + var height = this._height; + var x1 = -width * this.anchor._x; + + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + var y1 = -height * this.anchor._y; + + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + + return false; + }; + + /** + * Destroys this sprite and optionally its texture and children + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + + + TilingSprite.prototype.destroy = function destroy(options) { + _core$Sprite.prototype.destroy.call(this, options); + + this.tileTransform = null; + this.uvTransform = null; + }; + + /** + * Helper function that creates a new tiling sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {number} width - the width of the tiling sprite + * @param {number} height - the height of the tiling sprite + * @return {PIXI.Texture} The newly created texture + */ + + + TilingSprite.from = function from(source, width, height) { + return new TilingSprite(core.Texture.from(source), width, height); + }; + + /** + * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId + * The frame ids are created when a Texture packer file has been loaded + * + * @static + * @param {string} frameId - The frame Id of the texture in the cache + * @param {number} width - the width of the tiling sprite + * @param {number} height - the height of the tiling sprite + * @return {PIXI.extras.TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId + */ + + + TilingSprite.fromFrame = function fromFrame(frameId, width, height) { + var texture = core.utils.TextureCache[frameId]; + + if (!texture) { + throw new Error('The frameId "' + frameId + '" does not exist in the texture cache ' + this); + } + + return new TilingSprite(texture, width, height); + }; + + /** + * Helper function that creates a sprite that will contain a texture based on an image url + * If the image is not in the texture cache it will be loaded + * + * @static + * @param {string} imageId - The image url of the texture + * @param {number} width - the width of the tiling sprite + * @param {number} height - the height of the tiling sprite + * @param {boolean} [crossorigin] - if you want to specify the cross-origin parameter + * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - if you want to specify the scale mode, + * see {@link PIXI.SCALE_MODES} for possible values + * @return {PIXI.extras.TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id + */ + + + TilingSprite.fromImage = function fromImage(imageId, width, height, crossorigin, scaleMode) { + return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode), width, height); + }; + + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + + _createClass(TilingSprite, [{ + key: 'clampMargin', + get: function get() { + return this.uvTransform.clampMargin; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uvTransform.clampMargin = value; + this.uvTransform.update(true); + } + + /** + * The scaling of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + + }, { + key: 'tileScale', + get: function get() { + return this.tileTransform.scale; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.tileTransform.scale.copy(value); + } + + /** + * The offset of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + + }, { + key: 'tilePosition', + get: function get() { + return this.tileTransform.position; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.tileTransform.position.copy(value); + } + }, { + key: 'width', + get: function get() { + return this._width; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._width = value; + } + + /** + * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return this._height; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._height = value; + } + }]); + + return TilingSprite; + }(core.Sprite); + + exports.default = TilingSprite; + + }, { "../core": 65, "../core/sprites/canvas/CanvasTinter": 104 }], 138: [function (require, module, exports) { + 'use strict'; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _Texture = require('../core/textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + var _BaseTexture = require('../core/textures/BaseTexture'); + + var _BaseTexture2 = _interopRequireDefault(_BaseTexture); + + var _utils = require('../core/utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var DisplayObject = core.DisplayObject; + var _tempMatrix = new core.Matrix(); + + DisplayObject.prototype._cacheAsBitmap = false; + DisplayObject.prototype._cacheData = false; + + // figured theres no point adding ALL the extra variables to prototype. + // this model can hold the information needed. This can also be generated on demand as + // most objects are not cached as bitmaps. + /** + * @class + * @ignore + */ + + var CacheData = + /** + * + */ + function CacheData() { + _classCallCheck(this, CacheData); + + this.textureCacheId = null; + + this.originalRenderWebGL = null; + this.originalRenderCanvas = null; + this.originalCalculateBounds = null; + this.originalGetLocalBounds = null; + + this.originalUpdateTransform = null; + this.originalHitTest = null; + this.originalDestroy = null; + this.originalMask = null; + this.originalFilterArea = null; + this.sprite = null; + }; + + Object.defineProperties(DisplayObject.prototype, { + /** + * Set this to true if you want this display object to be cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can + * provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'false' + * + * IMPORTANT GOTCHA - make sure that all your textures are preloaded BEFORE setting this property to true + * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear. + * + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + cacheAsBitmap: { + get: function get() { + return this._cacheAsBitmap; + }, + set: function set(value) { + if (this._cacheAsBitmap === value) { + return; + } + + this._cacheAsBitmap = value; + + var data = void 0; + + if (value) { + if (!this._cacheData) { + this._cacheData = new CacheData(); + } + + data = this._cacheData; + + data.originalRenderWebGL = this.renderWebGL; + data.originalRenderCanvas = this.renderCanvas; + + data.originalUpdateTransform = this.updateTransform; + data.originalCalculateBounds = this.calculateBounds; + data.originalGetLocalBounds = this.getLocalBounds; + + data.originalDestroy = this.destroy; + + data.originalContainsPoint = this.containsPoint; + + data.originalMask = this._mask; + data.originalFilterArea = this.filterArea; + + this.renderWebGL = this._renderCachedWebGL; + this.renderCanvas = this._renderCachedCanvas; + + this.destroy = this._cacheAsBitmapDestroy; + } else { + data = this._cacheData; + + if (data.sprite) { + this._destroyCachedDisplayObject(); + } + + this.renderWebGL = data.originalRenderWebGL; + this.renderCanvas = data.originalRenderCanvas; + this.calculateBounds = data.originalCalculateBounds; + this.getLocalBounds = data.originalGetLocalBounds; + + this.destroy = data.originalDestroy; + + this.updateTransform = data.originalUpdateTransform; + this.containsPoint = data.originalContainsPoint; + + this._mask = data.originalMask; + this.filterArea = data.originalFilterArea; + } + } + } + }); + + /** + * Renders a cached version of the sprite with WebGL + * + * @private + * @memberof PIXI.DisplayObject# + * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._renderCachedWebGL = function _renderCachedWebGL(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + + this._initCachedDisplayObject(renderer); + + this._cacheData.sprite.transform._worldID = this.transform._worldID; + this._cacheData.sprite.worldAlpha = this.worldAlpha; + this._cacheData.sprite._renderWebGL(renderer); + }; + + /** + * Prepares the WebGL renderer to cache the sprite + * + * @private + * @memberof PIXI.DisplayObject# + * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) { + if (this._cacheData && this._cacheData.sprite) { + return; + } + + // make sure alpha is set to 1 otherwise it will get rendered as invisible! + var cacheAlpha = this.alpha; + + this.alpha = 1; + + // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) + renderer.currentRenderer.flush(); + // this.filters= []; + + // next we find the dimensions of the untransformed object + // this function also calls updatetransform on all its children as part of the measuring. + // This means we don't need to update the transform again in this function + // TODO pass an object to clone too? saves having to create a new one each time! + var bounds = this.getLocalBounds().clone(); + + // add some padding! + if (this._filters && this._filters.length) { + var padding = this._filters[0].padding; + + bounds.pad(padding); + } + + bounds.ceil(core.settings.RESOLUTION); + + // for now we cache the current renderTarget that the webGL renderer is currently using. + // this could be more elegent.. + var cachedRenderTarget = renderer._activeRenderTarget; + // We also store the filter stack - I will definitely look to change how this works a little later down the line. + var stack = renderer.filterManager.filterStack; + + // this renderTexture will be used to store the cached DisplayObject + + var renderTexture = core.RenderTexture.create(bounds.width, bounds.height); + + var textureCacheId = 'cacheAsBitmap_' + (0, _utils.uid)(); + + this._cacheData.textureCacheId = textureCacheId; + + _BaseTexture2.default.addToCache(renderTexture.baseTexture, textureCacheId); + _Texture2.default.addToCache(renderTexture, textureCacheId); + + // need to set // + var m = _tempMatrix; + + m.tx = -bounds.x; + m.ty = -bounds.y; + + // reset + this.transform.worldTransform.identity(); + + // set all properties to there original so we can render to a texture + this.renderWebGL = this._cacheData.originalRenderWebGL; + + renderer.render(this, renderTexture, true, m, true); + // now restore the state be setting the new properties + + renderer.bindRenderTarget(cachedRenderTarget); + + renderer.filterManager.filterStack = stack; + + this.renderWebGL = this._renderCachedWebGL; + // the rest is the same as for Canvas + this.updateTransform = this.displayObjectUpdateTransform; + this.calculateBounds = this._calculateCachedBounds; + this.getLocalBounds = this._getCachedLocalBounds; + + this._mask = null; + this.filterArea = null; + + // create our cached sprite + var cachedSprite = new core.Sprite(renderTexture); + + cachedSprite.transform.worldTransform = this.transform.worldTransform; + cachedSprite.anchor.x = -(bounds.x / bounds.width); + cachedSprite.anchor.y = -(bounds.y / bounds.height); + cachedSprite.alpha = cacheAlpha; + cachedSprite._bounds = this._bounds; + + this._cacheData.sprite = cachedSprite; + + this.transform._parentID = -1; + // restore the transform of the cached sprite to avoid the nasty flicker.. + if (!this.parent) { + this.parent = renderer._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } else { + this.updateTransform(); + } + + // map the hit test.. + this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); + }; + + /** + * Renders a cached version of the sprite with canvas + * + * @private + * @memberof PIXI.DisplayObject# + * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + + this._initCachedDisplayObjectCanvas(renderer); + + this._cacheData.sprite.worldAlpha = this.worldAlpha; + this._cacheData.sprite._renderCanvas(renderer); + }; + + // TODO this can be the same as the webGL verison.. will need to do a little tweaking first though.. + /** + * Prepares the Canvas renderer to cache the sprite + * + * @private + * @memberof PIXI.DisplayObject# + * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) { + if (this._cacheData && this._cacheData.sprite) { + return; + } + + // get bounds actually transforms the object for us already! + var bounds = this.getLocalBounds(); + + var cacheAlpha = this.alpha; + + this.alpha = 1; + + var cachedRenderTarget = renderer.context; + + bounds.ceil(core.settings.RESOLUTION); + + var renderTexture = core.RenderTexture.create(bounds.width, bounds.height); + + var textureCacheId = 'cacheAsBitmap_' + (0, _utils.uid)(); + + this._cacheData.textureCacheId = textureCacheId; + + _BaseTexture2.default.addToCache(renderTexture.baseTexture, textureCacheId); + _Texture2.default.addToCache(renderTexture, textureCacheId); + + // need to set // + var m = _tempMatrix; + + this.transform.localTransform.copy(m); + m.invert(); + + m.tx -= bounds.x; + m.ty -= bounds.y; + + // m.append(this.transform.worldTransform.) + // set all properties to there original so we can render to a texture + this.renderCanvas = this._cacheData.originalRenderCanvas; + + // renderTexture.render(this, m, true); + renderer.render(this, renderTexture, true, m, false); + + // now restore the state be setting the new properties + renderer.context = cachedRenderTarget; + + this.renderCanvas = this._renderCachedCanvas; + // the rest is the same as for WebGL + this.updateTransform = this.displayObjectUpdateTransform; + this.calculateBounds = this._calculateCachedBounds; + this.getLocalBounds = this._getCachedLocalBounds; + + this._mask = null; + this.filterArea = null; + + // create our cached sprite + var cachedSprite = new core.Sprite(renderTexture); + + cachedSprite.transform.worldTransform = this.transform.worldTransform; + cachedSprite.anchor.x = -(bounds.x / bounds.width); + cachedSprite.anchor.y = -(bounds.y / bounds.height); + cachedSprite.alpha = cacheAlpha; + cachedSprite._bounds = this._bounds; + + this._cacheData.sprite = cachedSprite; + + this.transform._parentID = -1; + // restore the transform of the cached sprite to avoid the nasty flicker.. + if (!this.parent) { + this.parent = renderer._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } else { + this.updateTransform(); + } + + // map the hit test.. + this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); + }; + + /** + * Calculates the bounds of the cached sprite + * + * @private + */ + DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() { + this._bounds.clear(); + this._cacheData.sprite.transform._worldID = this.transform._worldID; + this._cacheData.sprite._calculateBounds(); + this._lastBoundsID = this._boundsID; + }; + + /** + * Gets the bounds of the cached sprite. + * + * @private + * @return {Rectangle} The local bounds. + */ + DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() { + return this._cacheData.sprite.getLocalBounds(); + }; + + /** + * Destroys the cached sprite. + * + * @private + */ + DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() { + this._cacheData.sprite._texture.destroy(true); + this._cacheData.sprite = null; + + _BaseTexture2.default.removeFromCache(this._cacheData.textureCacheId); + _Texture2.default.removeFromCache(this._cacheData.textureCacheId); + + this._cacheData.textureCacheId = null; + }; + + /** + * Destroys the cached object. + * + * @private + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value. + * Used when destroying containers, see the Container.destroy method. + */ + DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) { + this.cacheAsBitmap = false; + this.destroy(options); + }; + + }, { "../core": 65, "../core/textures/BaseTexture": 112, "../core/textures/Texture": 115, "../core/utils": 125 }], 139: [function (require, module, exports) { + 'use strict'; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + /** + * The instance name of the object. + * + * @memberof PIXI.DisplayObject# + * @member {string} name + */ + core.DisplayObject.prototype.name = null; + + /** + * Returns the display object in the container + * + * @method getChildByName + * @memberof PIXI.Container# + * @param {string} name - instance name + * @return {PIXI.DisplayObject} The child with the specified name. + */ + core.Container.prototype.getChildByName = function getChildByName(name) { + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].name === name) { + return this.children[i]; + } + } + + return null; + }; + + }, { "../core": 65 }], 140: [function (require, module, exports) { + 'use strict'; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + /** + * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot. + * + * @method getGlobalPosition + * @memberof PIXI.DisplayObject# + * @param {Point} point - the point to write the global value to. If null a new point will be returned + * @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost + * @return {Point} The updated point + */ + core.DisplayObject.prototype.getGlobalPosition = function getGlobalPosition() { + var point = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new core.Point(); + var skipUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (this.parent) { + this.parent.toGlobal(this.position, point, skipUpdate); + } else { + point.x = this.position.x; + point.y = this.position.y; + } + + return point; + }; + + }, { "../core": 65 }], 141: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.BitmapText = exports.TilingSpriteRenderer = exports.TilingSprite = exports.AnimatedSprite = undefined; + + var _AnimatedSprite = require('./AnimatedSprite'); + + Object.defineProperty(exports, 'AnimatedSprite', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_AnimatedSprite).default; + } + }); + + var _TilingSprite = require('./TilingSprite'); + + Object.defineProperty(exports, 'TilingSprite', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TilingSprite).default; + } + }); + + var _TilingSpriteRenderer = require('./webgl/TilingSpriteRenderer'); + + Object.defineProperty(exports, 'TilingSpriteRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TilingSpriteRenderer).default; + } + }); + + var _BitmapText = require('./BitmapText'); + + Object.defineProperty(exports, 'BitmapText', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BitmapText).default; + } + }); + + require('./cacheAsBitmap'); + + require('./getChildByName'); + + require('./getGlobalPosition'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + // imported for side effect of extending the prototype only, contains no exports + + }, { "./AnimatedSprite": 135, "./BitmapText": 136, "./TilingSprite": 137, "./cacheAsBitmap": 138, "./getChildByName": 139, "./getGlobalPosition": 140, "./webgl/TilingSpriteRenderer": 142 }], 142: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _const = require('../../core/const'); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var tempMat = new core.Matrix(); + + /** + * WebGL renderer plugin for tiling sprites + * + * @class + * @memberof PIXI.extras + * @extends PIXI.ObjectRenderer + */ + + var TilingSpriteRenderer = function (_core$ObjectRenderer) { + _inherits(TilingSpriteRenderer, _core$ObjectRenderer); + + /** + * constructor for renderer + * + * @param {WebGLRenderer} renderer The renderer this tiling awesomeness works for. + */ + function TilingSpriteRenderer(renderer) { + _classCallCheck(this, TilingSpriteRenderer); + + var _this = _possibleConstructorReturn(this, _core$ObjectRenderer.call(this, renderer)); + + _this.shader = null; + _this.simpleShader = null; + _this.quad = null; + return _this; + } + + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + + + TilingSpriteRenderer.prototype.onContextChange = function onContextChange() { + var gl = this.renderer.gl; + + this.shader = new core.Shader(gl, 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n', 'varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 sample = texture2D(uSampler, coord);\n gl_FragColor = sample * uColor;\n}\n'); + this.simpleShader = new core.Shader(gl, 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n', 'varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n'); + + this.renderer.bindVao(null); + this.quad = new core.Quad(gl, this.renderer.state.attribState); + this.quad.initVao(this.shader); + }; + + /** + * + * @param {PIXI.extras.TilingSprite} ts tilingSprite to be rendered + */ + + + TilingSpriteRenderer.prototype.render = function render(ts) { + var renderer = this.renderer; + var quad = this.quad; + + renderer.bindVao(quad.vao); + + var vertices = quad.vertices; + + vertices[0] = vertices[6] = ts._width * -ts.anchor.x; + vertices[1] = vertices[3] = ts._height * -ts.anchor.y; + + vertices[2] = vertices[4] = ts._width * (1.0 - ts.anchor.x); + vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y); + + if (ts.uvRespectAnchor) { + vertices = quad.uvs; + + vertices[0] = vertices[6] = -ts.anchor.x; + vertices[1] = vertices[3] = -ts.anchor.y; + + vertices[2] = vertices[4] = 1.0 - ts.anchor.x; + vertices[5] = vertices[7] = 1.0 - ts.anchor.y; + } + + quad.upload(); + + var tex = ts._texture; + var baseTex = tex.baseTexture; + var lt = ts.tileTransform.localTransform; + var uv = ts.uvTransform; + var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; + + // auto, force repeat wrapMode for big tiling textures + if (isSimple) { + if (!baseTex._glTextures[renderer.CONTEXT_UID]) { + if (baseTex.wrapMode === _const.WRAP_MODES.CLAMP) { + baseTex.wrapMode = _const.WRAP_MODES.REPEAT; + } + } else { + isSimple = baseTex.wrapMode !== _const.WRAP_MODES.CLAMP; + } + } + + var shader = isSimple ? this.simpleShader : this.shader; + + renderer.bindShader(shader); + + var w = tex.width; + var h = tex.height; + var W = ts._width; + var H = ts._height; + + tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); + + // that part is the same as above: + // tempMat.identity(); + // tempMat.scale(tex.width, tex.height); + // tempMat.prepend(lt); + // tempMat.scale(1.0 / ts._width, 1.0 / ts._height); + + tempMat.invert(); + if (isSimple) { + tempMat.prepend(uv.mapCoord); + } else { + shader.uniforms.uMapCoord = uv.mapCoord.toArray(true); + shader.uniforms.uClampFrame = uv.uClampFrame; + shader.uniforms.uClampOffset = uv.uClampOffset; + } + + shader.uniforms.uTransform = tempMat.toArray(true); + shader.uniforms.uColor = core.utils.premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.premultipliedAlpha); + shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true); + + shader.uniforms.uSampler = renderer.bindTexture(tex); + + renderer.setBlendMode(core.utils.correctBlendMode(ts.blendMode, baseTex.premultipliedAlpha)); + + quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0); + }; + + return TilingSpriteRenderer; + }(core.ObjectRenderer); + + exports.default = TilingSpriteRenderer; + + + core.WebGLRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer); + + }, { "../../core": 65, "../../core/const": 46, "path": 8 }], 143: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * Simplest filter - applies alpha + * + * Use this instead of Container's alpha property to avoid visual layering of individual elements. + * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. + * If elements are not opaque, they will blend with each other anyway. + * + * Very handy if you want to use common features of all filters: + * + * 1. Assign a blendMode to this filter, blend all elements inside display object with background. + * + * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var AlphaFilter = function (_core$Filter) { + _inherits(AlphaFilter, _core$Filter); + + /** + * @param {number} [alpha=1] Amount of alpha from 0 to 1, where 0 is transparent + */ + function AlphaFilter() { + var alpha = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0; + + _classCallCheck(this, AlphaFilter); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}', + // fragment shader + 'varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n')); + + _this.alpha = alpha; + _this.glShaderKey = 'alpha'; + return _this; + } + + /** + * Coefficient for alpha multiplication + * + * @member {number} + * @default 1 + */ + + + _createClass(AlphaFilter, [{ + key: 'alpha', + get: function get() { + return this.uniforms.uAlpha; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.uAlpha = value; + } + }]); + + return AlphaFilter; + }(core.Filter); + + exports.default = AlphaFilter; + + }, { "../../core": 65, "path": 8 }], 144: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _BlurXFilter = require('./BlurXFilter'); + + var _BlurXFilter2 = _interopRequireDefault(_BlurXFilter); + + var _BlurYFilter = require('./BlurYFilter'); + + var _BlurYFilter2 = _interopRequireDefault(_BlurYFilter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The BlurFilter applies a Gaussian blur to an object. + * The strength of the blur can be set for x- and y-axis separately. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var BlurFilter = function (_core$Filter) { + _inherits(BlurFilter, _core$Filter); + + /** + * @param {number} strength - The strength of the blur filter. + * @param {number} quality - The quality of the blur filter. + * @param {number} resolution - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurFilter(strength, quality, resolution, kernelSize) { + _classCallCheck(this, BlurFilter); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this)); + + _this.blurXFilter = new _BlurXFilter2.default(strength, quality, resolution, kernelSize); + _this.blurYFilter = new _BlurYFilter2.default(strength, quality, resolution, kernelSize); + + _this.padding = 0; + _this.resolution = resolution || core.settings.RESOLUTION; + _this.quality = quality || 4; + _this.blur = strength || 8; + return _this; + } + + /** + * Applies the filter. + * + * @param {PIXI.FilterManager} filterManager - The manager. + * @param {PIXI.RenderTarget} input - The input target. + * @param {PIXI.RenderTarget} output - The output target. + */ + + + BlurFilter.prototype.apply = function apply(filterManager, input, output) { + var renderTarget = filterManager.getRenderTarget(true); + + this.blurXFilter.apply(filterManager, input, renderTarget, true); + this.blurYFilter.apply(filterManager, renderTarget, output, false); + + filterManager.returnRenderTarget(renderTarget); + }; + + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * + * @member {number} + * @default 2 + */ + + + _createClass(BlurFilter, [{ + key: 'blur', + get: function get() { + return this.blurXFilter.blur; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.blurXFilter.blur = this.blurYFilter.blur = value; + this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; + } + + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @default 1 + */ + + }, { + key: 'quality', + get: function get() { + return this.blurXFilter.quality; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.blurXFilter.quality = this.blurYFilter.quality = value; + } + + /** + * Sets the strength of the blurX property + * + * @member {number} + * @default 2 + */ + + }, { + key: 'blurX', + get: function get() { + return this.blurXFilter.blur; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.blurXFilter.blur = value; + this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; + } + + /** + * Sets the strength of the blurY property + * + * @member {number} + * @default 2 + */ + + }, { + key: 'blurY', + get: function get() { + return this.blurYFilter.blur; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.blurYFilter.blur = value; + this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; + } + + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + + }, { + key: 'blendMode', + get: function get() { + return this.blurYFilter._blendMode; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.blurYFilter._blendMode = value; + } + }]); + + return BlurFilter; + }(core.Filter); + + exports.default = BlurFilter; + + }, { "../../core": 65, "./BlurXFilter": 145, "./BlurYFilter": 146 }], 145: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _generateBlurVertSource = require('./generateBlurVertSource'); + + var _generateBlurVertSource2 = _interopRequireDefault(_generateBlurVertSource); + + var _generateBlurFragSource = require('./generateBlurFragSource'); + + var _generateBlurFragSource2 = _interopRequireDefault(_generateBlurFragSource); + + var _getMaxBlurKernelSize = require('./getMaxBlurKernelSize'); + + var _getMaxBlurKernelSize2 = _interopRequireDefault(_getMaxBlurKernelSize); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The BlurXFilter applies a horizontal Gaussian blur to an object. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var BlurXFilter = function (_core$Filter) { + _inherits(BlurXFilter, _core$Filter); + + /** + * @param {number} strength - The strength of the blur filter. + * @param {number} quality - The quality of the blur filter. + * @param {number} resolution - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurXFilter(strength, quality, resolution, kernelSize) { + _classCallCheck(this, BlurXFilter); + + kernelSize = kernelSize || 5; + var vertSrc = (0, _generateBlurVertSource2.default)(kernelSize, true); + var fragSrc = (0, _generateBlurFragSource2.default)(kernelSize); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + vertSrc, + // fragment shader + fragSrc)); + + _this.resolution = resolution || core.settings.RESOLUTION; + + _this._quality = 0; + + _this.quality = quality || 4; + _this.strength = strength || 8; + + _this.firstRun = true; + return _this; + } + + /** + * Applies the filter. + * + * @param {PIXI.FilterManager} filterManager - The manager. + * @param {PIXI.RenderTarget} input - The input target. + * @param {PIXI.RenderTarget} output - The output target. + * @param {boolean} clear - Should the output be cleared before rendering? + */ + + + BlurXFilter.prototype.apply = function apply(filterManager, input, output, clear) { + if (this.firstRun) { + var gl = filterManager.renderer.gl; + var kernelSize = (0, _getMaxBlurKernelSize2.default)(gl); + + this.vertexSrc = (0, _generateBlurVertSource2.default)(kernelSize, true); + this.fragmentSrc = (0, _generateBlurFragSource2.default)(kernelSize); + + this.firstRun = false; + } + + this.uniforms.strength = 1 / output.size.width * (output.size.width / input.size.width); + + // screen space! + this.uniforms.strength *= this.strength; + this.uniforms.strength /= this.passes; // / this.passes//Math.pow(1, this.passes); + + if (this.passes === 1) { + filterManager.applyFilter(this, input, output, clear); + } else { + var renderTarget = filterManager.getRenderTarget(true); + var flip = input; + var flop = renderTarget; + + for (var i = 0; i < this.passes - 1; i++) { + filterManager.applyFilter(this, flip, flop, true); + + var temp = flop; + + flop = flip; + flip = temp; + } + + filterManager.applyFilter(this, flip, output, clear); + + filterManager.returnRenderTarget(renderTarget); + } + }; + + /** + * Sets the strength of both the blur. + * + * @member {number} + * @default 16 + */ + + + _createClass(BlurXFilter, [{ + key: 'blur', + get: function get() { + return this.strength; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.padding = Math.abs(value) * 2; + this.strength = value; + } + + /** + * Sets the quality of the blur by modifying the number of passes. More passes means higher + * quaility bluring but the lower the performance. + * + * @member {number} + * @default 4 + */ + + }, { + key: 'quality', + get: function get() { + return this._quality; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._quality = value; + this.passes = value; + } + }]); + + return BlurXFilter; + }(core.Filter); + + exports.default = BlurXFilter; + + }, { "../../core": 65, "./generateBlurFragSource": 147, "./generateBlurVertSource": 148, "./getMaxBlurKernelSize": 149 }], 146: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _generateBlurVertSource = require('./generateBlurVertSource'); + + var _generateBlurVertSource2 = _interopRequireDefault(_generateBlurVertSource); + + var _generateBlurFragSource = require('./generateBlurFragSource'); + + var _generateBlurFragSource2 = _interopRequireDefault(_generateBlurFragSource); + + var _getMaxBlurKernelSize = require('./getMaxBlurKernelSize'); + + var _getMaxBlurKernelSize2 = _interopRequireDefault(_getMaxBlurKernelSize); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The BlurYFilter applies a horizontal Gaussian blur to an object. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var BlurYFilter = function (_core$Filter) { + _inherits(BlurYFilter, _core$Filter); + + /** + * @param {number} strength - The strength of the blur filter. + * @param {number} quality - The quality of the blur filter. + * @param {number} resolution - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurYFilter(strength, quality, resolution, kernelSize) { + _classCallCheck(this, BlurYFilter); + + kernelSize = kernelSize || 5; + var vertSrc = (0, _generateBlurVertSource2.default)(kernelSize, false); + var fragSrc = (0, _generateBlurFragSource2.default)(kernelSize); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + vertSrc, + // fragment shader + fragSrc)); + + _this.resolution = resolution || core.settings.RESOLUTION; + + _this._quality = 0; + + _this.quality = quality || 4; + _this.strength = strength || 8; + + _this.firstRun = true; + return _this; + } + + /** + * Applies the filter. + * + * @param {PIXI.FilterManager} filterManager - The manager. + * @param {PIXI.RenderTarget} input - The input target. + * @param {PIXI.RenderTarget} output - The output target. + * @param {boolean} clear - Should the output be cleared before rendering? + */ + + + BlurYFilter.prototype.apply = function apply(filterManager, input, output, clear) { + if (this.firstRun) { + var gl = filterManager.renderer.gl; + var kernelSize = (0, _getMaxBlurKernelSize2.default)(gl); + + this.vertexSrc = (0, _generateBlurVertSource2.default)(kernelSize, false); + this.fragmentSrc = (0, _generateBlurFragSource2.default)(kernelSize); + + this.firstRun = false; + } + + this.uniforms.strength = 1 / output.size.height * (output.size.height / input.size.height); + + this.uniforms.strength *= this.strength; + this.uniforms.strength /= this.passes; + + if (this.passes === 1) { + filterManager.applyFilter(this, input, output, clear); + } else { + var renderTarget = filterManager.getRenderTarget(true); + var flip = input; + var flop = renderTarget; + + for (var i = 0; i < this.passes - 1; i++) { + filterManager.applyFilter(this, flip, flop, true); + + var temp = flop; + + flop = flip; + flip = temp; + } + + filterManager.applyFilter(this, flip, output, clear); + + filterManager.returnRenderTarget(renderTarget); + } + }; + + /** + * Sets the strength of both the blur. + * + * @member {number} + * @default 2 + */ + + + _createClass(BlurYFilter, [{ + key: 'blur', + get: function get() { + return this.strength; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.padding = Math.abs(value) * 2; + this.strength = value; + } + + /** + * Sets the quality of the blur by modifying the number of passes. More passes means higher + * quaility bluring but the lower the performance. + * + * @member {number} + * @default 4 + */ + + }, { + key: 'quality', + get: function get() { + return this._quality; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._quality = value; + this.passes = value; + } + }]); + + return BlurYFilter; + }(core.Filter); + + exports.default = BlurYFilter; + + }, { "../../core": 65, "./generateBlurFragSource": 147, "./generateBlurVertSource": 148, "./getMaxBlurKernelSize": 149 }], 147: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = generateFragBlurSource; + var GAUSSIAN_VALUES = { + 5: [0.153388, 0.221461, 0.250301], + 7: [0.071303, 0.131514, 0.189879, 0.214607], + 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236], + 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596], + 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641], + 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448] + }; + + var fragTemplate = ['varying vec2 vBlurTexCoords[%size%];', 'uniform sampler2D uSampler;', 'void main(void)', '{', ' gl_FragColor = vec4(0.0);', ' %blur%', '}'].join('\n'); + + function generateFragBlurSource(kernelSize) { + var kernel = GAUSSIAN_VALUES[kernelSize]; + var halfLength = kernel.length; + + var fragSource = fragTemplate; + + var blurLoop = ''; + var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;'; + var value = void 0; + + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i); + + value = i; + + if (i >= halfLength) { + value = kernelSize - i - 1; + } + + blur = blur.replace('%value%', kernel[value]); + + blurLoop += blur; + blurLoop += '\n'; + } + + fragSource = fragSource.replace('%blur%', blurLoop); + fragSource = fragSource.replace('%size%', kernelSize); + + return fragSource; + } + + }, {}], 148: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.default = generateVertBlurSource; + var vertTemplate = ['attribute vec2 aVertexPosition;', 'attribute vec2 aTextureCoord;', 'uniform float strength;', 'uniform mat3 projectionMatrix;', 'varying vec2 vBlurTexCoords[%size%];', 'void main(void)', '{', 'gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);', '%blur%', '}'].join('\n'); + + function generateVertBlurSource(kernelSize, x) { + var halfLength = Math.ceil(kernelSize / 2); + + var vertSource = vertTemplate; + + var blurLoop = ''; + var template = void 0; + // let value; + + if (x) { + template = 'vBlurTexCoords[%index%] = aTextureCoord + vec2(%sampleIndex% * strength, 0.0);'; + } else { + template = 'vBlurTexCoords[%index%] = aTextureCoord + vec2(0.0, %sampleIndex% * strength);'; + } + + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i); + + // value = i; + + // if(i >= halfLength) + // { + // value = kernelSize - i - 1; + // } + + blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + '.0'); + + blurLoop += blur; + blurLoop += '\n'; + } + + vertSource = vertSource.replace('%blur%', blurLoop); + vertSource = vertSource.replace('%size%', kernelSize); + + return vertSource; + } + + }, {}], 149: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + exports.default = getMaxKernelSize; + function getMaxKernelSize(gl) { + var maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS); + var kernelSize = 15; + + while (kernelSize > maxVaryings) { + kernelSize -= 2; + } + + return kernelSize; + } + + }, {}], 150: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA + * color and alpha values of every pixel on your displayObject to produce a result + * with a new set of RGBA color and alpha values. It's pretty powerful! + * + * ```js + * let colorMatrix = new PIXI.filters.ColorMatrixFilter(); + * container.filters = [colorMatrix]; + * colorMatrix.contrast(2); + * ``` + * @author Clément Chenebault + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var ColorMatrixFilter = function (_core$Filter) { + _inherits(ColorMatrixFilter, _core$Filter); + + /** + * + */ + function ColorMatrixFilter() { + _classCallCheck(this, ColorMatrixFilter); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}', + // fragment shader + 'varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n')); + + _this.uniforms.m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; + + _this.alpha = 1; + return _this; + } + + /** + * Transforms current matrix and set the new one + * + * @param {number[]} matrix - 5x4 matrix + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype._loadMatrix = function _loadMatrix(matrix) { + var multiply = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var newMatrix = matrix; + + if (multiply) { + this._multiply(newMatrix, this.uniforms.m, matrix); + newMatrix = this._colorMatrix(newMatrix); + } + + // set the new matrix + this.uniforms.m = newMatrix; + }; + + /** + * Multiplies two mat5's + * + * @private + * @param {number[]} out - 5x4 matrix the receiving matrix + * @param {number[]} a - 5x4 matrix the first operand + * @param {number[]} b - 5x4 matrix the second operand + * @returns {number[]} 5x4 matrix + */ + + + ColorMatrixFilter.prototype._multiply = function _multiply(out, a, b) { + // Red Channel + out[0] = a[0] * b[0] + a[1] * b[5] + a[2] * b[10] + a[3] * b[15]; + out[1] = a[0] * b[1] + a[1] * b[6] + a[2] * b[11] + a[3] * b[16]; + out[2] = a[0] * b[2] + a[1] * b[7] + a[2] * b[12] + a[3] * b[17]; + out[3] = a[0] * b[3] + a[1] * b[8] + a[2] * b[13] + a[3] * b[18]; + out[4] = a[0] * b[4] + a[1] * b[9] + a[2] * b[14] + a[3] * b[19] + a[4]; + + // Green Channel + out[5] = a[5] * b[0] + a[6] * b[5] + a[7] * b[10] + a[8] * b[15]; + out[6] = a[5] * b[1] + a[6] * b[6] + a[7] * b[11] + a[8] * b[16]; + out[7] = a[5] * b[2] + a[6] * b[7] + a[7] * b[12] + a[8] * b[17]; + out[8] = a[5] * b[3] + a[6] * b[8] + a[7] * b[13] + a[8] * b[18]; + out[9] = a[5] * b[4] + a[6] * b[9] + a[7] * b[14] + a[8] * b[19] + a[9]; + + // Blue Channel + out[10] = a[10] * b[0] + a[11] * b[5] + a[12] * b[10] + a[13] * b[15]; + out[11] = a[10] * b[1] + a[11] * b[6] + a[12] * b[11] + a[13] * b[16]; + out[12] = a[10] * b[2] + a[11] * b[7] + a[12] * b[12] + a[13] * b[17]; + out[13] = a[10] * b[3] + a[11] * b[8] + a[12] * b[13] + a[13] * b[18]; + out[14] = a[10] * b[4] + a[11] * b[9] + a[12] * b[14] + a[13] * b[19] + a[14]; + + // Alpha Channel + out[15] = a[15] * b[0] + a[16] * b[5] + a[17] * b[10] + a[18] * b[15]; + out[16] = a[15] * b[1] + a[16] * b[6] + a[17] * b[11] + a[18] * b[16]; + out[17] = a[15] * b[2] + a[16] * b[7] + a[17] * b[12] + a[18] * b[17]; + out[18] = a[15] * b[3] + a[16] * b[8] + a[17] * b[13] + a[18] * b[18]; + out[19] = a[15] * b[4] + a[16] * b[9] + a[17] * b[14] + a[18] * b[19] + a[19]; + + return out; + }; + + /** + * Create a Float32 Array and normalize the offset component to 0-1 + * + * @private + * @param {number[]} matrix - 5x4 matrix + * @return {number[]} 5x4 matrix with all values between 0-1 + */ + + + ColorMatrixFilter.prototype._colorMatrix = function _colorMatrix(matrix) { + // Create a Float32 Array and normalize the offset component to 0-1 + var m = new Float32Array(matrix); + + m[4] /= 255; + m[9] /= 255; + m[14] /= 255; + m[19] /= 255; + + return m; + }; + + /** + * Adjusts brightness + * + * @param {number} b - value of the brigthness (0-1, where 0 is black) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.brightness = function brightness(b, multiply) { + var matrix = [b, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Set the matrices in grey scales + * + * @param {number} scale - value of the grey (0-1, where 0 is black) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.greyscale = function greyscale(scale, multiply) { + var matrix = [scale, scale, scale, 0, 0, scale, scale, scale, 0, 0, scale, scale, scale, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Set the black and white matrice. + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.blackAndWhite = function blackAndWhite(multiply) { + var matrix = [0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Set the hue property of the color + * + * @param {number} rotation - in degrees + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.hue = function hue(rotation, multiply) { + rotation = (rotation || 0) / 180 * Math.PI; + + var cosR = Math.cos(rotation); + var sinR = Math.sin(rotation); + var sqrt = Math.sqrt; + + /* a good approximation for hue rotation + This matrix is far better than the versions with magic luminance constants + formerly used here, but also used in the starling framework (flash) and known from this + old part of the internet: quasimondo.com/archives/000565.php + This new matrix is based on rgb cube rotation in space. Look here for a more descriptive + implementation as a shader not a general matrix: + https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js + This is the source for the code: + see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751 + */ + + var w = 1 / 3; + var sqrW = sqrt(w); // weight is + + var a00 = cosR + (1.0 - cosR) * w; + var a01 = w * (1.0 - cosR) - sqrW * sinR; + var a02 = w * (1.0 - cosR) + sqrW * sinR; + + var a10 = w * (1.0 - cosR) + sqrW * sinR; + var a11 = cosR + w * (1.0 - cosR); + var a12 = w * (1.0 - cosR) - sqrW * sinR; + + var a20 = w * (1.0 - cosR) - sqrW * sinR; + var a21 = w * (1.0 - cosR) + sqrW * sinR; + var a22 = cosR + w * (1.0 - cosR); + + var matrix = [a00, a01, a02, 0, 0, a10, a11, a12, 0, 0, a20, a21, a22, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Set the contrast matrix, increase the separation between dark and bright + * Increase contrast : shadows darker and highlights brighter + * Decrease contrast : bring the shadows up and the highlights down + * + * @param {number} amount - value of the contrast (0-1) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.contrast = function contrast(amount, multiply) { + var v = (amount || 0) + 1; + var o = -0.5 * (v - 1); + + var matrix = [v, 0, 0, 0, o, 0, v, 0, 0, o, 0, 0, v, 0, o, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Set the saturation matrix, increase the separation between colors + * Increase saturation : increase contrast, brightness, and sharpness + * + * @param {number} amount - The saturation amount (0-1) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.saturate = function saturate() { + var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var multiply = arguments[1]; + + var x = amount * 2 / 3 + 1; + var y = (x - 1) * -0.5; + + var matrix = [x, y, y, 0, 0, y, x, y, 0, 0, y, y, x, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Desaturate image (remove color) + * + * Call the saturate function + * + */ + + + ColorMatrixFilter.prototype.desaturate = function desaturate() // eslint-disable-line no-unused-vars + { + this.saturate(-1); + }; + + /** + * Negative image (inverse of classic rgb matrix) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.negative = function negative(multiply) { + var matrix = [-1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Sepia image + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.sepia = function sepia(multiply) { + var matrix = [0.393, 0.7689999, 0.18899999, 0, 0, 0.349, 0.6859999, 0.16799999, 0, 0, 0.272, 0.5339999, 0.13099999, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Color motion picture process invented in 1916 (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.technicolor = function technicolor(multiply) { + var matrix = [1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Polaroid filter + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.polaroid = function polaroid(multiply) { + var matrix = [1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Filter who transforms : Red -> Blue and Blue -> Red + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.toBGR = function toBGR(multiply) { + var matrix = [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.kodachrome = function kodachrome(multiply) { + var matrix = [1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Brown delicious browni filter (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.browni = function browni(multiply) { + var matrix = [0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Vintage filter (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.vintage = function vintage(multiply) { + var matrix = [0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * We don't know exactly what it does, kind of gradient map, but funny to play with! + * + * @param {number} desaturation - Tone values. + * @param {number} toned - Tone values. + * @param {string} lightColor - Tone values, example: `0xFFE580` + * @param {string} darkColor - Tone values, example: `0xFFE580` + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.colorTone = function colorTone(desaturation, toned, lightColor, darkColor, multiply) { + desaturation = desaturation || 0.2; + toned = toned || 0.15; + lightColor = lightColor || 0xFFE580; + darkColor = darkColor || 0x338000; + + var lR = (lightColor >> 16 & 0xFF) / 255; + var lG = (lightColor >> 8 & 0xFF) / 255; + var lB = (lightColor & 0xFF) / 255; + + var dR = (darkColor >> 16 & 0xFF) / 255; + var dG = (darkColor >> 8 & 0xFF) / 255; + var dB = (darkColor & 0xFF) / 255; + + var matrix = [0.3, 0.59, 0.11, 0, 0, lR, lG, lB, desaturation, 0, dR, dG, dB, toned, 0, lR - dR, lG - dG, lB - dB, 0, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Night effect + * + * @param {number} intensity - The intensity of the night effect. + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.night = function night(intensity, multiply) { + intensity = intensity || 0.1; + var matrix = [intensity * -2.0, -intensity, 0, 0, 0, -intensity, 0, intensity, 0, 0, 0, intensity, intensity * 2.0, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Predator effect + * + * Erase the current matrix by setting a new indepent one + * + * @param {number} amount - how much the predator feels his future victim + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.predator = function predator(amount, multiply) { + var matrix = [ + // row 1 + 11.224130630493164 * amount, -4.794486999511719 * amount, -2.8746118545532227 * amount, 0 * amount, 0.40342438220977783 * amount, + // row 2 + -3.6330697536468506 * amount, 9.193157196044922 * amount, -2.951810836791992 * amount, 0 * amount, -1.316135048866272 * amount, + // row 3 + -3.2184197902679443 * amount, -4.2375030517578125 * amount, 7.476448059082031 * amount, 0 * amount, 0.8044459223747253 * amount, + // row 4 + 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * LSD effect + * + * Multiply the current matrix + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + + + ColorMatrixFilter.prototype.lsd = function lsd(multiply) { + var matrix = [2, -0.4, 0.5, 0, 0, -0.5, 2, -0.4, 0, 0, -0.4, -0.5, 3, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, multiply); + }; + + /** + * Erase the current matrix by setting the default one + * + */ + + + ColorMatrixFilter.prototype.reset = function reset() { + var matrix = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; + + this._loadMatrix(matrix, false); + }; + + /** + * The matrix of the color matrix filter + * + * @member {number[]} + * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] + */ + + + _createClass(ColorMatrixFilter, [{ + key: 'matrix', + get: function get() { + return this.uniforms.m; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.m = value; + } + + /** + * The opacity value to use when mixing the original and resultant colors. + * + * When the value is 0, the original color is used without modification. + * When the value is 1, the result color is used. + * When in the range (0, 1) the color is interpolated between the original and result by this amount. + * + * @member {number} + * @default 1 + */ + + }, { + key: 'alpha', + get: function get() { + return this.uniforms.uAlpha; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.uAlpha = value; + } + }]); + + return ColorMatrixFilter; + }(core.Filter); + + // Americanized alias + + + exports.default = ColorMatrixFilter; + ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; + + }, { "../../core": 65, "path": 8 }], 151: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The DisplacementFilter class uses the pixel values from the specified texture + * (called the displacement map) to perform a displacement of an object. You can + * use this filter to apply all manor of crazy warping effects. Currently the r + * property of the texture is used to offset the x and the g property of the texture + * is used to offset the y. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var DisplacementFilter = function (_core$Filter) { + _inherits(DisplacementFilter, _core$Filter); + + /** + * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) + * @param {number} scale - The scale of the displacement + */ + function DisplacementFilter(sprite, scale) { + _classCallCheck(this, DisplacementFilter); + + var maskMatrix = new core.Matrix(); + + sprite.renderable = false; + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vFilterCoord = ( filterMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vTextureCoord = aTextureCoord;\n}', + // fragment shader + 'varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\n\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy *= scale / filterArea.xy;\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), filterClamp.xy, filterClamp.zw));\n}\n')); + + _this.maskSprite = sprite; + _this.maskMatrix = maskMatrix; + + _this.uniforms.mapSampler = sprite._texture; + _this.uniforms.filterMatrix = maskMatrix; + _this.uniforms.scale = { x: 1, y: 1 }; + + if (scale === null || scale === undefined) { + scale = 20; + } + + _this.scale = new core.Point(scale, scale); + return _this; + } + + /** + * Applies the filter. + * + * @param {PIXI.FilterManager} filterManager - The manager. + * @param {PIXI.RenderTarget} input - The input target. + * @param {PIXI.RenderTarget} output - The output target. + */ + + + DisplacementFilter.prototype.apply = function apply(filterManager, input, output) { + this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); + this.uniforms.scale.x = this.scale.x; + this.uniforms.scale.y = this.scale.y; + + // draw the filter... + filterManager.applyFilter(this, input, output); + }; + + /** + * The texture used for the displacement map. Must be power of 2 sized texture. + * + * @member {PIXI.Texture} + */ + + + _createClass(DisplacementFilter, [{ + key: 'map', + get: function get() { + return this.uniforms.mapSampler; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.mapSampler = value; + } + }]); + + return DisplacementFilter; + }(core.Filter); + + exports.default = DisplacementFilter; + + }, { "../../core": 65, "path": 8 }], 152: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * + * Basic FXAA implementation based on the code on geeks3d.com with the + * modification that the texture2DLod stuff was removed since it's + * unsupported by WebGL. + * + * @see https://github.com/mitsuhiko/webgl-meincraft + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + * + */ + var FXAAFilter = function (_core$Filter) { + _inherits(FXAAFilter, _core$Filter); + + /** + * + */ + function FXAAFilter() { + _classCallCheck(this, FXAAFilter); + + // TODO - needs work + return _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + '\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nuniform vec4 filterArea;\n\nvarying vec2 vTextureCoord;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvoid texcoords(vec2 fragCoord, vec2 resolution,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n vec2 inverseVP = 1.0 / resolution.xy;\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n\n vec2 fragCoord = vTextureCoord * filterArea.xy;\n\n texcoords(fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}', + // fragment shader + 'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n \n --\n \n From:\n https://github.com/mitsuhiko/webgl-meincraft\n \n Copyright (c) 2011 by Armin Ronacher.\n \n Some rights reserved.\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n \n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n \n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n \n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 resolution,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n \n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n \n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n \n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n \n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n \n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec2 fragCoord = vTextureCoord * filterArea.xy;\n\n vec4 color;\n\n color = fxaa(uSampler, fragCoord, filterArea.xy, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')); + } + + return FXAAFilter; + }(core.Filter); + + exports.default = FXAAFilter; + + }, { "../../core": 65, "path": 8 }], 153: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _FXAAFilter = require('./fxaa/FXAAFilter'); + + Object.defineProperty(exports, 'FXAAFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_FXAAFilter).default; + } + }); + + var _NoiseFilter = require('./noise/NoiseFilter'); + + Object.defineProperty(exports, 'NoiseFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_NoiseFilter).default; + } + }); + + var _DisplacementFilter = require('./displacement/DisplacementFilter'); + + Object.defineProperty(exports, 'DisplacementFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_DisplacementFilter).default; + } + }); + + var _BlurFilter = require('./blur/BlurFilter'); + + Object.defineProperty(exports, 'BlurFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BlurFilter).default; + } + }); + + var _BlurXFilter = require('./blur/BlurXFilter'); + + Object.defineProperty(exports, 'BlurXFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BlurXFilter).default; + } + }); + + var _BlurYFilter = require('./blur/BlurYFilter'); + + Object.defineProperty(exports, 'BlurYFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BlurYFilter).default; + } + }); + + var _ColorMatrixFilter = require('./colormatrix/ColorMatrixFilter'); + + Object.defineProperty(exports, 'ColorMatrixFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_ColorMatrixFilter).default; + } + }); + + var _AlphaFilter = require('./alpha/AlphaFilter'); + + Object.defineProperty(exports, 'AlphaFilter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_AlphaFilter).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./alpha/AlphaFilter": 143, "./blur/BlurFilter": 144, "./blur/BlurXFilter": 145, "./blur/BlurYFilter": 146, "./colormatrix/ColorMatrixFilter": 150, "./displacement/DisplacementFilter": 151, "./fxaa/FXAAFilter": 152, "./noise/NoiseFilter": 154 }], 154: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _path = require('path'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @author Vico @vicocotea + * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js + */ + + /** + * A Noise effect filter. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var NoiseFilter = function (_core$Filter) { + _inherits(NoiseFilter, _core$Filter); + + /** + * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`. + */ + function NoiseFilter() { + var noise = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5; + var seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.random(); + + _classCallCheck(this, NoiseFilter); + + var _this = _possibleConstructorReturn(this, _core$Filter.call(this, + // vertex shader + 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}', + // fragment shader + 'precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n')); + + _this.noise = noise; + _this.seed = seed; + return _this; + } + + /** + * The amount of noise to apply, this value should be in the range (0, 1]. + * + * @member {number} + * @default 0.5 + */ + + + _createClass(NoiseFilter, [{ + key: 'noise', + get: function get() { + return this.uniforms.uNoise; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.uNoise = value; + } + + /** + * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. + * + * @member {number} + */ + + }, { + key: 'seed', + get: function get() { + return this.uniforms.uSeed; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.uniforms.uSeed = value; + } + }]); + + return NoiseFilter; + }(core.Filter); + + exports.default = NoiseFilter; + + }, { "../../core": 65, "path": 8 }], 155: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Holds all information related to an Interaction event + * + * @class + * @memberof PIXI.interaction + */ + var InteractionData = function () { + /** + * + */ + function InteractionData() { + _classCallCheck(this, InteractionData); + + /** + * This point stores the global coords of where the touch/mouse event happened + * + * @member {PIXI.Point} + */ + this.global = new core.Point(); + + /** + * The target DisplayObject that was interacted with + * + * @member {PIXI.DisplayObject} + */ + this.target = null; + + /** + * When passed to an event handler, this will be the original DOM Event that was captured + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent + * @member {MouseEvent|TouchEvent|PointerEvent} + */ + this.originalEvent = null; + + /** + * Unique identifier for this interaction + * + * @member {number} + */ + this.identifier = null; + + /** + * Indicates whether or not the pointer device that created the event is the primary pointer. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary + * @type {Boolean} + */ + this.isPrimary = false; + + /** + * Indicates which button was pressed on the mouse or pointer device to trigger the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + * @type {number} + */ + this.button = 0; + + /** + * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + * @type {number} + */ + this.buttons = 0; + + /** + * The width of the pointer's contact along the x-axis, measured in CSS pixels. + * radiusX of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width + * @type {number} + */ + this.width = 0; + + /** + * The height of the pointer's contact along the y-axis, measured in CSS pixels. + * radiusY of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height + * @type {number} + */ + this.height = 0; + + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX + * @type {number} + */ + this.tiltX = 0; + + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY + * @type {number} + */ + this.tiltY = 0; + + /** + * The type of pointer that triggered the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType + * @type {string} + */ + this.pointerType = null; + + /** + * Pressure applied by the pointing device during the event. A Touch's force property + * will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure + * @type {number} + */ + this.pressure = 0; + + /** + * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle + * @type {number} + */ + this.rotationAngle = 0; + + /** + * Twist of a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.twist = 0; + + /** + * Barrel pressure on a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.tangentialPressure = 0; + } + + /** + * The unique identifier of the pointer. It will be the same as `identifier`. + * @readonly + * @member {number} + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId + */ + + + /** + * This will return the local coordinates of the specified displayObject for this InteractionData + * + * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local + * coords off + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise + * will create a new point) + * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional + * (otherwise will use the current global coords) + * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative + * to the DisplayObject + */ + InteractionData.prototype.getLocalPosition = function getLocalPosition(displayObject, point, globalPos) { + return displayObject.worldTransform.applyInverse(globalPos || this.global, point); + }; + + /** + * Copies properties from normalized event data. + * + * @param {Touch|MouseEvent|PointerEvent} event The normalized event data + */ + + + InteractionData.prototype.copyEvent = function copyEvent(event) { + // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite + // it with "false" on later events when our shim for it on touch events might not be + // accurate + if (event.isPrimary) { + this.isPrimary = true; + } + this.button = event.button; + // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard + // event.which property instead, which conveys the same information. + this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which; + this.width = event.width; + this.height = event.height; + this.tiltX = event.tiltX; + this.tiltY = event.tiltY; + this.pointerType = event.pointerType; + this.pressure = event.pressure; + this.rotationAngle = event.rotationAngle; + this.twist = event.twist || 0; + this.tangentialPressure = event.tangentialPressure || 0; + }; + + /** + * Resets the data for pooling. + */ + + + InteractionData.prototype.reset = function reset() { + // isPrimary is the only property that we really need to reset - everything else is + // guaranteed to be overwritten + this.isPrimary = false; + }; + + _createClass(InteractionData, [{ + key: 'pointerId', + get: function get() { + return this.identifier; + } + }]); + + return InteractionData; + }(); + + exports.default = InteractionData; + + }, { "../core": 65 }], 156: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event class that mimics native DOM events. + * + * @class + * @memberof PIXI.interaction + */ + var InteractionEvent = function () { + /** + * + */ + function InteractionEvent() { + _classCallCheck(this, InteractionEvent); + + /** + * Whether this event will continue propagating in the tree + * + * @member {boolean} + */ + this.stopped = false; + + /** + * The object which caused this event to be dispatched. + * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}. + * + * @member {PIXI.DisplayObject} + */ + this.target = null; + + /** + * The object whose event listener’s callback is currently being invoked. + * + * @member {PIXI.DisplayObject} + */ + this.currentTarget = null; + + /** + * Type of the event + * + * @member {string} + */ + this.type = null; + + /** + * InteractionData related to this event + * + * @member {PIXI.interaction.InteractionData} + */ + this.data = null; + } + + /** + * Prevents event from reaching any objects other than the current object. + * + */ + + + InteractionEvent.prototype.stopPropagation = function stopPropagation() { + this.stopped = true; + }; + + /** + * Resets the event. + */ + + + InteractionEvent.prototype.reset = function reset() { + this.stopped = false; + this.currentTarget = null; + this.target = null; + }; + + return InteractionEvent; + }(); + + exports.default = InteractionEvent; + + }, {}], 157: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _InteractionData = require('./InteractionData'); + + var _InteractionData2 = _interopRequireDefault(_InteractionData); + + var _InteractionEvent = require('./InteractionEvent'); + + var _InteractionEvent2 = _interopRequireDefault(_InteractionEvent); + + var _InteractionTrackingData = require('./InteractionTrackingData'); + + var _InteractionTrackingData2 = _interopRequireDefault(_InteractionTrackingData); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _interactiveTarget = require('./interactiveTarget'); + + var _interactiveTarget2 = _interopRequireDefault(_interactiveTarget); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + // Mix interactiveTarget into core.DisplayObject.prototype, after deprecation has been handled + core.utils.mixins.delayMixin(core.DisplayObject.prototype, _interactiveTarget2.default); + + var MOUSE_POINTER_ID = 1; + + // helpers for hitTest() - only used inside hitTest() + var hitTestEvent = { + target: null, + data: { + global: null + } + }; + + /** + * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive + * if its interactive parameter is set to true + * This manager also supports multitouch. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * + * @class + * @extends EventEmitter + * @memberof PIXI.interaction + */ + + var InteractionManager = function (_EventEmitter) { + _inherits(InteractionManager, _EventEmitter); + + /** + * @param {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - A reference to the current renderer + * @param {object} [options] - The options for the manager. + * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions. + * @param {number} [options.interactionFrequency=10] - Frequency increases the interaction events will be checked. + */ + function InteractionManager(renderer, options) { + _classCallCheck(this, InteractionManager); + + var _this = _possibleConstructorReturn(this, _EventEmitter.call(this)); + + options = options || {}; + + /** + * The renderer this interaction manager works for. + * + * @member {PIXI.SystemRenderer} + */ + _this.renderer = renderer; + + /** + * Should default browser actions automatically be prevented. + * Does not apply to pointer events for backwards compatibility + * preventDefault on pointer events stops mouse events from firing + * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. + * + * @member {boolean} + * @default true + */ + _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; + + /** + * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * + * @member {number} + * @default 10 + */ + _this.interactionFrequency = options.interactionFrequency || 10; + + /** + * The mouse data + * + * @member {PIXI.interaction.InteractionData} + */ + _this.mouse = new _InteractionData2.default(); + _this.mouse.identifier = MOUSE_POINTER_ID; + + // setting the mouse to start off far off screen will mean that mouse over does + // not get called before we even move the mouse. + _this.mouse.global.set(-999999); + + /** + * Actively tracked InteractionData + * + * @private + * @member {Object.} + */ + _this.activeInteractionData = {}; + _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse; + + /** + * Pool of unused InteractionData + * + * @private + * @member {PIXI.interation.InteractionData[]} + */ + _this.interactionDataPool = []; + + /** + * An event data object to handle all the event tracking/dispatching + * + * @member {object} + */ + _this.eventData = new _InteractionEvent2.default(); + + /** + * The DOM element to bind to. + * + * @private + * @member {HTMLElement} + */ + _this.interactionDOMElement = null; + + /** + * This property determines if mousemove and touchmove events are fired only when the cursor + * is over the object. + * Setting to true will make things work more in line with how the DOM verison works. + * Setting to false can make things easier for things like dragging + * It is currently set to false as this is how PixiJS used to work. This will be set to true in + * future versions of pixi. + * + * @member {boolean} + * @default false + */ + _this.moveWhenInside = false; + + /** + * Have events been attached to the dom element? + * + * @private + * @member {boolean} + */ + _this.eventsAdded = false; + + /** + * Is the mouse hovering over the renderer? + * + * @private + * @member {boolean} + */ + _this.mouseOverRenderer = false; + + /** + * Does the device support touch events + * https://www.w3.org/TR/touch-events/ + * + * @readonly + * @member {boolean} + */ + _this.supportsTouchEvents = 'ontouchstart' in window; + + /** + * Does the device support pointer events + * https://www.w3.org/Submission/pointer-events/ + * + * @readonly + * @member {boolean} + */ + _this.supportsPointerEvents = !!window.PointerEvent; + + // this will make it so that you don't have to call bind all the time + + /** + * @private + * @member {Function} + */ + _this.onPointerUp = _this.onPointerUp.bind(_this); + _this.processPointerUp = _this.processPointerUp.bind(_this); + + /** + * @private + * @member {Function} + */ + _this.onPointerCancel = _this.onPointerCancel.bind(_this); + _this.processPointerCancel = _this.processPointerCancel.bind(_this); + + /** + * @private + * @member {Function} + */ + _this.onPointerDown = _this.onPointerDown.bind(_this); + _this.processPointerDown = _this.processPointerDown.bind(_this); + + /** + * @private + * @member {Function} + */ + _this.onPointerMove = _this.onPointerMove.bind(_this); + _this.processPointerMove = _this.processPointerMove.bind(_this); + + /** + * @private + * @member {Function} + */ + _this.onPointerOut = _this.onPointerOut.bind(_this); + _this.processPointerOverOut = _this.processPointerOverOut.bind(_this); + + /** + * @private + * @member {Function} + */ + _this.onPointerOver = _this.onPointerOver.bind(_this); + + /** + * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor + * values, objects are handled as dictionaries of CSS values for interactionDOMElement, + * and functions are called instead of changing the CSS. + * Default CSS cursor values are provided for 'default' and 'pointer' modes. + * @member {Object.)>} + */ + _this.cursorStyles = { + default: 'inherit', + pointer: 'pointer' + }; + + /** + * The mode of the cursor that is being used. + * The value of this is a key from the cursorStyles dictionary. + * + * @member {string} + */ + _this.currentCursorMode = null; + + /** + * Internal cached let. + * + * @private + * @member {string} + */ + _this.cursor = null; + + /** + * Internal cached let. + * + * @private + * @member {PIXI.Point} + */ + _this._tempPoint = new core.Point(); + + /** + * The current resolution / device pixel ratio. + * + * @member {number} + * @default 1 + */ + _this.resolution = 1; + + _this.setTargetElement(_this.renderer.view, _this.renderer.resolution); + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display + * object. + * + * @event PIXI.interaction.InteractionManager#mousedown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. + * + * @event PIXI.interaction.InteractionManager#rightdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. + * + * @event PIXI.interaction.InteractionManager#mouseup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. + * + * @event PIXI.interaction.InteractionManager#rightup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. + * + * @event PIXI.interaction.InteractionManager#click + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. + * + * @event PIXI.interaction.InteractionManager#rightclick + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}. + * + * @event PIXI.interaction.InteractionManager#mouseupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}. + * + * @event PIXI.interaction.InteractionManager#rightupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object + * + * @event PIXI.interaction.InteractionManager#mousemove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object + * + * @event PIXI.interaction.InteractionManager#mouseover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved off the display object + * + * @event PIXI.interaction.InteractionManager#mouseout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed on the display object. + * + * @event PIXI.interaction.InteractionManager#pointerdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released over the display object. + * Not always fired when some buttons are held down while others are released. In those cases, + * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and + * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead. + * + * @event PIXI.interaction.InteractionManager#pointerup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a pointer event + * + * @event PIXI.interaction.InteractionManager#pointercancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed and released on the display object. + * + * @event PIXI.interaction.InteractionManager#pointertap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}. + * + * @event PIXI.interaction.InteractionManager#pointerupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved while over the display object + * + * @event PIXI.interaction.InteractionManager#pointermove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved onto the display object + * + * @event PIXI.interaction.InteractionManager#pointerover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved off the display object + * + * @event PIXI.interaction.InteractionManager#pointerout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed on the display object. + * + * @event PIXI.interaction.InteractionManager#touchstart + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed from the display object. + * + * @event PIXI.interaction.InteractionManager#touchend + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a touch + * + * @event PIXI.interaction.InteractionManager#touchcancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed and removed from the display object. + * + * @event PIXI.interaction.InteractionManager#tap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}. + * + * @event PIXI.interaction.InteractionManager#touchendoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is moved along the display object. + * + * @event PIXI.interaction.InteractionManager#touchmove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousedown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#click + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightclick + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousemove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device (usually a mouse) is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerdown + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerup + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a pointer event. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointercancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is pressed and released on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointertap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerupoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointermove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerover + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a pointer device is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerout + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchstart + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchend + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when the operating system cancels a touch. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchcancel + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is placed and removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#tap + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchendoutside + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + + /** + * Fired when a touch point is moved along the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchmove + * @param {PIXI.interaction.InteractionEvent} event - Interaction event + */ + return _this; + } + + /** + * Hit tests a point against the display tree, returning the first interactive object that is hit. + * + * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. + * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults + * to the last rendered root of the associated renderer. + * @return {PIXI.DisplayObject} The hit display object, if any. + */ + + + InteractionManager.prototype.hitTest = function hitTest(globalPoint, root) { + // clear the target for our hit test + hitTestEvent.target = null; + // assign the global point + hitTestEvent.data.global = globalPoint; + // ensure safety of the root + if (!root) { + root = this.renderer._lastObjectRendered; + } + // run the hit test + this.processInteractive(hitTestEvent, root, null, true); + // return our found object - it'll be null if we didn't hit anything + + return hitTestEvent.target; + }; + + /** + * Sets the DOM element which will receive mouse/touch events. This is useful for when you have + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * another DOM element to receive those events. + * + * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. + * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). + */ + + + InteractionManager.prototype.setTargetElement = function setTargetElement(element) { + var resolution = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + + this.removeEvents(); + + this.interactionDOMElement = element; + + this.resolution = resolution; + + this.addEvents(); + }; + + /** + * Registers all the DOM events + * + * @private + */ + + + InteractionManager.prototype.addEvents = function addEvents() { + if (!this.interactionDOMElement) { + return; + } + + core.ticker.shared.add(this.update, this, core.UPDATE_PRIORITY.INTERACTION); + + if (window.navigator.msPointerEnabled) { + this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; + this.interactionDOMElement.style['-ms-touch-action'] = 'none'; + } else if (this.supportsPointerEvents) { + this.interactionDOMElement.style['touch-action'] = 'none'; + } + + /** + * These events are added first, so that if pointer events are normalised, they are fired + * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + */ + if (this.supportsPointerEvents) { + window.document.addEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); + // pointerout is fired in addition to pointerup (for touch events) and pointercancel + // we already handle those, so for the purposes of what we do in onPointerOut, we only + // care about the pointerleave event + this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); + window.addEventListener('pointercancel', this.onPointerCancel, true); + window.addEventListener('pointerup', this.onPointerUp, true); + } else { + window.document.addEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); + window.addEventListener('mouseup', this.onPointerUp, true); + } + + // always look directly for touch events so that we can provide original data + // In a future version we should change this to being just a fallback and rely solely on + // PointerEvents whenever available + if (this.supportsTouchEvents) { + this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); + } + + this.eventsAdded = true; + }; + + /** + * Removes all the DOM events that were previously registered + * + * @private + */ + + + InteractionManager.prototype.removeEvents = function removeEvents() { + if (!this.interactionDOMElement) { + return; + } + + core.ticker.shared.remove(this.update, this); + + if (window.navigator.msPointerEnabled) { + this.interactionDOMElement.style['-ms-content-zooming'] = ''; + this.interactionDOMElement.style['-ms-touch-action'] = ''; + } else if (this.supportsPointerEvents) { + this.interactionDOMElement.style['touch-action'] = ''; + } + + if (this.supportsPointerEvents) { + window.document.removeEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); + window.removeEventListener('pointercancel', this.onPointerCancel, true); + window.removeEventListener('pointerup', this.onPointerUp, true); + } else { + window.document.removeEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); + window.removeEventListener('mouseup', this.onPointerUp, true); + } + + if (this.supportsTouchEvents) { + this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); + } + + this.interactionDOMElement = null; + + this.eventsAdded = false; + }; + + /** + * Updates the state of interactive objects. + * Invoked by a throttled ticker update from {@link PIXI.ticker.shared}. + * + * @param {number} deltaTime - time delta since last tick + */ + + + InteractionManager.prototype.update = function update(deltaTime) { + this._deltaTime += deltaTime; + + if (this._deltaTime < this.interactionFrequency) { + return; + } + + this._deltaTime = 0; + + if (!this.interactionDOMElement) { + return; + } + + // if the user move the mouse this check has already been done using the mouse move! + if (this.didMove) { + this.didMove = false; + + return; + } + + this.cursor = null; + + // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, + // but there was a scenario of a display object moving under a static mouse cursor. + // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function + for (var k in this.activeInteractionData) { + // eslint-disable-next-line no-prototype-builtins + if (this.activeInteractionData.hasOwnProperty(k)) { + var interactionData = this.activeInteractionData[k]; + + if (interactionData.originalEvent && interactionData.pointerType !== 'touch') { + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData); + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, true); + } + } + } + + this.setCursorMode(this.cursor); + + // TODO + }; + + /** + * Sets the current cursor mode, handling any callbacks or CSS style changes. + * + * @param {string} mode - cursor mode, a key from the cursorStyles dictionary + */ + + + InteractionManager.prototype.setCursorMode = function setCursorMode(mode) { + mode = mode || 'default'; + // if the mode didn't actually change, bail early + if (this.currentCursorMode === mode) { + return; + } + this.currentCursorMode = mode; + var style = this.cursorStyles[mode]; + + // only do things if there is a cursor style for it + if (style) { + switch (typeof style === 'undefined' ? 'undefined' : _typeof(style)) { + case 'string': + // string styles are handled as cursor CSS + this.interactionDOMElement.style.cursor = style; + break; + case 'function': + // functions are just called, and passed the cursor mode + style(mode); + break; + case 'object': + // if it is an object, assume that it is a dictionary of CSS styles, + // apply it to the interactionDOMElement + Object.assign(this.interactionDOMElement.style, style); + break; + } + } else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) { + // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry + // for the mode, then assume that the dev wants it to be CSS for the cursor. + this.interactionDOMElement.style.cursor = mode; + } + }; + + /** + * Dispatches an event on the display object that was interacted with + * + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the display object in question + * @param {string} eventString - the name of the event (e.g, mousedown) + * @param {object} eventData - the event data object + * @private + */ + + + InteractionManager.prototype.dispatchEvent = function dispatchEvent(displayObject, eventString, eventData) { + if (!eventData.stopped) { + eventData.currentTarget = displayObject; + eventData.type = eventString; + + displayObject.emit(eventString, eventData); + + if (displayObject[eventString]) { + displayObject[eventString](eventData); + } + } + }; + + /** + * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The + * resulting value is stored in the point. This takes into account the fact that the DOM + * element could be scaled and positioned anywhere on the screen. + * + * @param {PIXI.Point} point - the point that the result will be stored in + * @param {number} x - the x coord of the position to map + * @param {number} y - the y coord of the position to map + */ + + + InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint(point, x, y) { + var rect = void 0; + + // IE 11 fix + if (!this.interactionDOMElement.parentElement) { + rect = { x: 0, y: 0, width: 0, height: 0 }; + } else { + rect = this.interactionDOMElement.getBoundingClientRect(); + } + + var resolutionMultiplier = navigator.isCocoonJS ? this.resolution : 1.0 / this.resolution; + + point.x = (x - rect.left) * (this.interactionDOMElement.width / rect.width) * resolutionMultiplier; + point.y = (y - rect.top) * (this.interactionDOMElement.height / rect.height) * resolutionMultiplier; + }; + + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @param {boolean} [interactive] - Whether the displayObject is interactive + * @return {boolean} returns true if the displayObject hit the point + */ + + + InteractionManager.prototype.processInteractive = function processInteractive(interactionEvent, displayObject, func, hitTest, interactive) { + if (!displayObject || !displayObject.visible) { + return false; + } + + var point = interactionEvent.data.global; + + // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // + // This function will now loop through all objects and then only hit test the objects it HAS + // to, not all of them. MUCH faster.. + // An object will be hit test if the following is true: + // + // 1: It is interactive. + // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. + // + // As another little optimisation once an interactive object has been hit we can carry on + // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests + // A final optimisation is that an object is not hit test directly if a child has already been hit. + + interactive = displayObject.interactive || interactive; + + var hit = false; + var interactiveParent = interactive; + + // Flag here can set to false if the event is outside the parents hitArea or mask + var hitTestChildren = true; + + // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea + // There is also no longer a need to hitTest children. + if (displayObject.hitArea) { + if (hitTest) { + displayObject.worldTransform.applyInverse(point, this._tempPoint); + if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) { + hitTest = false; + hitTestChildren = false; + } else { + hit = true; + } + } + interactiveParent = false; + } + // If there is a mask, no need to test against anything else if the pointer is not within the mask + else if (displayObject._mask) { + if (hitTest) { + if (!displayObject._mask.containsPoint(point)) { + hitTest = false; + hitTestChildren = false; + } + } + } + + // ** FREE TIP **! If an object is not interactive or has no buttons in it + // (such as a game scene!) set interactiveChildren to false for that displayObject. + // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. + if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) { + var children = displayObject.children; + + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + + // time to get recursive.. if this function will return if something is hit.. + var childHit = this.processInteractive(interactionEvent, child, func, hitTest, interactiveParent); + + if (childHit) { + // its a good idea to check if a child has lost its parent. + // this means it has been removed whilst looping so its best + if (!child.parent) { + continue; + } + + // we no longer need to hit test any more objects in this container as we we + // now know the parent has been hit + interactiveParent = false; + + // If the child is interactive , that means that the object hit was actually + // interactive and not just the child of an interactive object. + // This means we no longer need to hit test anything else. We still need to run + // through all objects, but we don't need to perform any hit tests. + + if (childHit) { + if (interactionEvent.target) { + hitTest = false; + } + hit = true; + } + } + } + } + + // no point running this if the item is not interactive or does not have an interactive parent. + if (interactive) { + // if we are hit testing (as in we have no hit any objects yet) + // We also don't need to worry about hit testing if once of the displayObjects children + // has already been hit - but only if it was interactive, otherwise we need to keep + // looking for an interactive child, just in case we hit one + if (hitTest && !interactionEvent.target) { + // already tested against hitArea if it is defined + if (!displayObject.hitArea && displayObject.containsPoint) { + if (displayObject.containsPoint(point)) { + hit = true; + } + } + } + + if (displayObject.interactive) { + if (hit && !interactionEvent.target) { + interactionEvent.target = displayObject; + } + + if (func) { + func(interactionEvent, displayObject, !!hit); + } + } + } + + return hit; + }; + + /** + * Is called when the pointer button is pressed down on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down + */ + + + InteractionManager.prototype.onPointerDown = function onPointerDown(originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return; + + var events = this.normalizeToPointerData(originalEvent); + + /** + * No need to prevent default on natural pointer events, as there are no side effects + * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, + * so still need to be prevented. + */ + + // Guaranteed that there will be at least one event in events, and all events must have the same pointer type + + if (this.autoPreventDefault && events[0].isNormalized) { + originalEvent.preventDefault(); + } + + var eventLen = events.length; + + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true); + + this.emit('pointerdown', interactionEvent); + if (event.pointerType === 'touch') { + this.emit('touchstart', interactionEvent); + } + // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event + else if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + var isRightButton = event.button === 2; + + this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); + } + } + }; + + /** + * Processes the result of the pointer down check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + + + InteractionManager.prototype.processPointerDown = function processPointerDown(interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + + if (hit) { + if (!displayObject.trackedPointers[id]) { + displayObject.trackedPointers[id] = new _InteractionTrackingData2.default(id); + } + this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); + + if (data.pointerType === 'touch') { + this.dispatchEvent(displayObject, 'touchstart', interactionEvent); + } else if (data.pointerType === 'mouse' || data.pointerType === 'pen') { + var isRightButton = data.button === 2; + + if (isRightButton) { + displayObject.trackedPointers[id].rightDown = true; + } else { + displayObject.trackedPointers[id].leftDown = true; + } + + this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); + } + } + }; + + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released + * @param {boolean} cancelled - true if the pointer is cancelled + * @param {Function} func - Function passed to {@link processInteractive} + */ + + + InteractionManager.prototype.onPointerComplete = function onPointerComplete(originalEvent, cancelled, func) { + var events = this.normalizeToPointerData(originalEvent); + + var eventLen = events.length; + + // if the event wasn't targeting our canvas, then consider it to be pointerupoutside + // in all cases (unless it was a pointercancel) + var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; + + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + // perform hit testing for events targeting our canvas or cancel events + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend); + + this.emit(cancelled ? 'pointercancel' : 'pointerup' + eventAppend, interactionEvent); + + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + var isRightButton = event.button === 2; + + this.emit(isRightButton ? 'rightup' + eventAppend : 'mouseup' + eventAppend, interactionEvent); + } else if (event.pointerType === 'touch') { + this.emit(cancelled ? 'touchcancel' : 'touchend' + eventAppend, interactionEvent); + this.releaseInteractionDataForPointerId(event.pointerId, interactionData); + } + } + }; + + /** + * Is called when the pointer button is cancelled + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + + + InteractionManager.prototype.onPointerCancel = function onPointerCancel(event) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') return; + + this.onPointerComplete(event, true, this.processPointerCancel); + }; + + /** + * Processes the result of the pointer cancel check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested + */ + + + InteractionManager.prototype.processPointerCancel = function processPointerCancel(interactionEvent, displayObject) { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + if (displayObject.trackedPointers[id] !== undefined) { + delete displayObject.trackedPointers[id]; + this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); + + if (data.pointerType === 'touch') { + this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); + } + } + }; + + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + + + InteractionManager.prototype.onPointerUp = function onPointerUp(event) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') return; + + this.onPointerComplete(event, false, this.processPointerUp); + }; + + /** + * Processes the result of the pointer up check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + + + InteractionManager.prototype.processPointerUp = function processPointerUp(interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + var trackingData = displayObject.trackedPointers[id]; + + var isTouch = data.pointerType === 'touch'; + + var isMouse = data.pointerType === 'mouse' || data.pointerType === 'pen'; + // need to track mouse down status in the mouse block so that we can emit + // event in a later block + var isMouseTap = false; + + // Mouse only + if (isMouse) { + var isRightButton = data.button === 2; + + var flags = _InteractionTrackingData2.default.FLAGS; + + var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; + + var isDown = trackingData !== undefined && trackingData.flags & test; + + if (hit) { + this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); + + if (isDown) { + this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); + // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap + isMouseTap = true; + } + } else if (isDown) { + this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); + } + // update the down state of the tracking data + if (trackingData) { + if (isRightButton) { + trackingData.rightDown = false; + } else { + trackingData.leftDown = false; + } + } + } + + // Pointers and Touches, and Mouse + if (hit) { + this.dispatchEvent(displayObject, 'pointerup', interactionEvent); + if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent); + + if (trackingData) { + // emit pointertap if not a mouse, or if the mouse block decided it was a tap + if (!isMouse || isMouseTap) { + this.dispatchEvent(displayObject, 'pointertap', interactionEvent); + } + if (isTouch) { + this.dispatchEvent(displayObject, 'tap', interactionEvent); + // touches are no longer over (if they ever were) when we get the touchend + // so we should ensure that we don't keep pretending that they are + trackingData.over = false; + } + } + } else if (trackingData) { + this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); + if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); + } + // Only remove the tracking data if there is no over/down state still associated with it + if (trackingData && trackingData.none) { + delete displayObject.trackedPointers[id]; + } + }; + + /** + * Is called when the pointer moves across the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer moving + */ + + + InteractionManager.prototype.onPointerMove = function onPointerMove(originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return; + + var events = this.normalizeToPointerData(originalEvent); + + if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') { + this.didMove = true; + + this.cursor = null; + } + + var eventLen = events.length; + + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = originalEvent; + + var interactive = event.pointerType === 'touch' ? this.moveWhenInside : true; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, interactive); + this.emit('pointermove', interactionEvent); + if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent); + } + + if (events[0].pointerType === 'mouse') { + this.setCursorMode(this.cursor); + + // TODO BUG for parents interactive object (border order issue) + } + }; + + /** + * Processes the result of the pointer move check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + + + InteractionManager.prototype.processPointerMove = function processPointerMove(interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + + var isTouch = data.pointerType === 'touch'; + + var isMouse = data.pointerType === 'mouse' || data.pointerType === 'pen'; + + if (isMouse) { + this.processPointerOverOut(interactionEvent, displayObject, hit); + } + + if (!this.moveWhenInside || hit) { + this.dispatchEvent(displayObject, 'pointermove', interactionEvent); + if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent); + if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent); + } + }; + + /** + * Is called when the pointer is moved out of the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out + */ + + + InteractionManager.prototype.onPointerOut = function onPointerOut(originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return; + + var events = this.normalizeToPointerData(originalEvent); + + // Only mouse and pointer can call onPointerOut, so events will always be length 1 + var event = events[0]; + + if (event.pointerType === 'mouse') { + this.mouseOverRenderer = false; + this.setCursorMode(null); + } + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = event; + + this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false); + + this.emit('pointerout', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + this.emit('mouseout', interactionEvent); + } else { + // we can get touchleave events after touchend, so we want to make sure we don't + // introduce memory leaks + this.releaseInteractionDataForPointerId(interactionData.identifier); + } + }; + + /** + * Processes the result of the pointer over/out check and dispatches the event if need be + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + + + InteractionManager.prototype.processPointerOverOut = function processPointerOverOut(interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + + var id = interactionEvent.data.identifier; + + var isMouse = data.pointerType === 'mouse' || data.pointerType === 'pen'; + + var trackingData = displayObject.trackedPointers[id]; + + // if we just moused over the display object, then we need to track that state + if (hit && !trackingData) { + trackingData = displayObject.trackedPointers[id] = new _InteractionTrackingData2.default(id); + } + + if (trackingData === undefined) return; + + if (hit && this.mouseOverRenderer) { + if (!trackingData.over) { + trackingData.over = true; + this.dispatchEvent(displayObject, 'pointerover', interactionEvent); + if (isMouse) { + this.dispatchEvent(displayObject, 'mouseover', interactionEvent); + } + } + + // only change the cursor if it has not already been changed (by something deeper in the + // display tree) + if (isMouse && this.cursor === null) { + this.cursor = displayObject.cursor; + } + } else if (trackingData.over) { + trackingData.over = false; + this.dispatchEvent(displayObject, 'pointerout', this.eventData); + if (isMouse) { + this.dispatchEvent(displayObject, 'mouseout', interactionEvent); + } + // if there is no mouse down information for the pointer, then it is safe to delete + if (trackingData.none) { + delete displayObject.trackedPointers[id]; + } + } + }; + + /** + * Is called when the pointer is moved into the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view + */ + + + InteractionManager.prototype.onPointerOver = function onPointerOver(originalEvent) { + var events = this.normalizeToPointerData(originalEvent); + + // Only mouse and pointer can call onPointerOver, so events will always be length 1 + var event = events[0]; + + var interactionData = this.getInteractionDataForPointerId(event); + + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + + interactionEvent.data.originalEvent = event; + + if (event.pointerType === 'mouse') { + this.mouseOverRenderer = true; + } + + this.emit('pointerover', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + this.emit('mouseover', interactionEvent); + } + }; + + /** + * Get InteractionData for a given pointerId. Store that data as well + * + * @private + * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData + * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier + */ + + + InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId(event) { + var pointerId = event.pointerId; + + var interactionData = void 0; + + if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') { + interactionData = this.mouse; + } else if (this.activeInteractionData[pointerId]) { + interactionData = this.activeInteractionData[pointerId]; + } else { + interactionData = this.interactionDataPool.pop() || new _InteractionData2.default(); + interactionData.identifier = pointerId; + this.activeInteractionData[pointerId] = interactionData; + } + // copy properties from the event, so that we can make sure that touch/pointer specific + // data is available + interactionData.copyEvent(event); + + return interactionData; + }; + + /** + * Return unused InteractionData to the pool, for a given pointerId + * + * @private + * @param {number} pointerId - Identifier from a pointer event + */ + + + InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId(pointerId) { + var interactionData = this.activeInteractionData[pointerId]; + + if (interactionData) { + delete this.activeInteractionData[pointerId]; + interactionData.reset(); + this.interactionDataPool.push(interactionData); + } + }; + + /** + * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData + * + * @private + * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured + * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent + * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired + * with the InteractionEvent + * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in + */ + + + InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent(interactionEvent, pointerEvent, interactionData) { + interactionEvent.data = interactionData; + + this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); + + // This is the way InteractionManager processed touch events before the refactoring, so I've kept + // it here. But it doesn't make that much sense to me, since mapPositionToPoint already factors + // in this.resolution, so this just divides by this.resolution twice for touch events... + if (navigator.isCocoonJS && pointerEvent.pointerType === 'touch') { + interactionData.global.x = interactionData.global.x / this.resolution; + interactionData.global.y = interactionData.global.y / this.resolution; + } + + // Not really sure why this is happening, but it's how a previous version handled things + if (pointerEvent.pointerType === 'touch') { + pointerEvent.globalX = interactionData.global.x; + pointerEvent.globalY = interactionData.global.y; + } + + interactionData.originalEvent = pointerEvent; + interactionEvent.reset(); + + return interactionEvent; + }; + + /** + * Ensures that the original event object contains all data that a regular pointer event would have + * + * @private + * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event + * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer + * or mouse event, or a multiple normalized pointer events if there are multiple changed touches + */ + + + InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData(event) { + var normalizedEvents = []; + + if (this.supportsTouchEvents && event instanceof TouchEvent) { + for (var i = 0, li = event.changedTouches.length; i < li; i++) { + var touch = event.changedTouches[i]; + + if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0; + if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0; + if (typeof touch.isPrimary === 'undefined') { + touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; + } + if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1; + if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1; + if (typeof touch.tiltX === 'undefined') touch.tiltX = 0; + if (typeof touch.tiltY === 'undefined') touch.tiltY = 0; + if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch'; + if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0; + if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5; + if (typeof touch.twist === 'undefined') touch.twist = 0; + if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0; + // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven + // support, and the fill ins are not quite the same + // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top + // left is not 0,0 on the page + if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX; + if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY; + + // mark the touch as normalized, just so that we know we did it + touch.isNormalized = true; + + normalizedEvents.push(touch); + } + } + // apparently PointerEvent subclasses MouseEvent, so yay + else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) { + if (typeof event.isPrimary === 'undefined') event.isPrimary = true; + if (typeof event.width === 'undefined') event.width = 1; + if (typeof event.height === 'undefined') event.height = 1; + if (typeof event.tiltX === 'undefined') event.tiltX = 0; + if (typeof event.tiltY === 'undefined') event.tiltY = 0; + if (typeof event.pointerType === 'undefined') event.pointerType = 'mouse'; + if (typeof event.pointerId === 'undefined') event.pointerId = MOUSE_POINTER_ID; + if (typeof event.pressure === 'undefined') event.pressure = 0.5; + if (typeof event.twist === 'undefined') event.twist = 0; + if (typeof event.tangentialPressure === 'undefined') event.tangentialPressure = 0; + + // mark the mouse event as normalized, just so that we know we did it + event.isNormalized = true; + + normalizedEvents.push(event); + } else { + normalizedEvents.push(event); + } + + return normalizedEvents; + }; + + /** + * Destroys the interaction manager + * + */ + + + InteractionManager.prototype.destroy = function destroy() { + this.removeEvents(); + + this.removeAllListeners(); + + this.renderer = null; + + this.mouse = null; + + this.eventData = null; + + this.interactionDOMElement = null; + + this.onPointerDown = null; + this.processPointerDown = null; + + this.onPointerUp = null; + this.processPointerUp = null; + + this.onPointerCancel = null; + this.processPointerCancel = null; + + this.onPointerMove = null; + this.processPointerMove = null; + + this.onPointerOut = null; + this.processPointerOverOut = null; + + this.onPointerOver = null; + + this._tempPoint = null; + }; + + return InteractionManager; + }(_eventemitter2.default); + + exports.default = InteractionManager; + + + core.WebGLRenderer.registerPlugin('interaction', InteractionManager); + core.CanvasRenderer.registerPlugin('interaction', InteractionManager); + + }, { "../core": 65, "./InteractionData": 155, "./InteractionEvent": 156, "./InteractionTrackingData": 158, "./interactiveTarget": 160, "eventemitter3": 3 }], 158: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions + * + * @class + * @private + * @memberof PIXI.interaction + */ + var InteractionTrackingData = function () { + /** + * @param {number} pointerId - Unique pointer id of the event + */ + function InteractionTrackingData(pointerId) { + _classCallCheck(this, InteractionTrackingData); + + this._pointerId = pointerId; + this._flags = InteractionTrackingData.FLAGS.NONE; + } + + /** + * + * @private + * @param {number} flag - The interaction flag to set + * @param {boolean} yn - Should the flag be set or unset + */ + + + InteractionTrackingData.prototype._doSet = function _doSet(flag, yn) { + if (yn) { + this._flags = this._flags | flag; + } else { + this._flags = this._flags & ~flag; + } + }; + + /** + * Unique pointer id of the event + * + * @readonly + * @member {number} + */ + + + _createClass(InteractionTrackingData, [{ + key: "pointerId", + get: function get() { + return this._pointerId; + } + + /** + * State of the tracking data, expressed as bit flags + * + * @member {number} + * @memberof PIXI.interaction.InteractionTrackingData# + */ + + }, { + key: "flags", + get: function get() { + return this._flags; + } + + /** + * Set the flags for the tracking data + * + * @param {number} flags - Flags to set + */ + , + set: function set(flags) { + this._flags = flags; + } + + /** + * Is the tracked event inactive (not over or down)? + * + * @member {number} + * @memberof PIXI.interaction.InteractionTrackingData# + */ + + }, { + key: "none", + get: function get() { + return this._flags === this.constructor.FLAGS.NONE; + } + + /** + * Is the tracked event over the DisplayObject? + * + * @member {boolean} + * @memberof PIXI.interaction.InteractionTrackingData# + */ + + }, { + key: "over", + get: function get() { + return (this._flags & this.constructor.FLAGS.OVER) !== 0; + } + + /** + * Set the over flag + * + * @param {boolean} yn - Is the event over? + */ + , + set: function set(yn) { + this._doSet(this.constructor.FLAGS.OVER, yn); + } + + /** + * Did the right mouse button come down in the DisplayObject? + * + * @member {boolean} + * @memberof PIXI.interaction.InteractionTrackingData# + */ + + }, { + key: "rightDown", + get: function get() { + return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; + } + + /** + * Set the right down flag + * + * @param {boolean} yn - Is the right mouse button down? + */ + , + set: function set(yn) { + this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); + } + + /** + * Did the left mouse button come down in the DisplayObject? + * + * @member {boolean} + * @memberof PIXI.interaction.InteractionTrackingData# + */ + + }, { + key: "leftDown", + get: function get() { + return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; + } + + /** + * Set the left down flag + * + * @param {boolean} yn - Is the left mouse button down? + */ + , + set: function set(yn) { + this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); + } + }]); + + return InteractionTrackingData; + }(); + + exports.default = InteractionTrackingData; + + + InteractionTrackingData.FLAGS = Object.freeze({ + NONE: 0, + OVER: 1 << 0, + LEFT_DOWN: 1 << 1, + RIGHT_DOWN: 1 << 2 + }); + + }, {}], 159: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _InteractionData = require('./InteractionData'); + + Object.defineProperty(exports, 'InteractionData', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_InteractionData).default; + } + }); + + var _InteractionManager = require('./InteractionManager'); + + Object.defineProperty(exports, 'InteractionManager', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_InteractionManager).default; + } + }); + + var _interactiveTarget = require('./interactiveTarget'); + + Object.defineProperty(exports, 'interactiveTarget', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_interactiveTarget).default; + } + }); + + var _InteractionTrackingData = require('./InteractionTrackingData'); + + Object.defineProperty(exports, 'InteractionTrackingData', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_InteractionTrackingData).default; + } + }); + + var _InteractionEvent = require('./InteractionEvent'); + + Object.defineProperty(exports, 'InteractionEvent', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_InteractionEvent).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./InteractionData": 155, "./InteractionEvent": 156, "./InteractionManager": 157, "./InteractionTrackingData": 158, "./interactiveTarget": 160 }], 160: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + /** + * Default property values of interactive objects + * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties + * + * @private + * @name interactiveTarget + * @memberof PIXI.interaction + * @example + * function MyObject() {} + * + * Object.assign( + * core.DisplayObject.prototype, + * PIXI.interaction.interactiveTarget + * ); + */ + exports.default = { + + /** + * Enable interaction events for the DisplayObject. Touch, pointer and mouse + * events will not be emitted unless `interactive` is set to `true`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.on('tap', (event) => { + * //handle event + * }); + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + interactive: false, + + /** + * Determines if the children to the displayObject can be clicked/touched + * Setting this to false allows PixiJS to bypass a recursive `hitTest` function + * + * @member {boolean} + * @memberof PIXI.Container# + */ + interactiveChildren: true, + + /** + * Interaction shape. Children will be hit first, then this shape will be checked. + * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); + * @member {PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle} + * @memberof PIXI.DisplayObject# + */ + hitArea: null, + + /** + * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive + * Setting this changes the 'cursor' property to `'pointer'`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.buttonMode = true; + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + get buttonMode() { + return this.cursor === 'pointer'; + }, + set buttonMode(value) { + if (value) { + this.cursor = 'pointer'; + } else if (this.cursor === 'pointer') { + this.cursor = null; + } + }, + + /** + * This defines what cursor mode is used when the mouse cursor + * is hovered over the displayObject. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.cursor = 'wait'; + * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor + * + * @member {string} + * @memberof PIXI.DisplayObject# + */ + cursor: null, + + /** + * Internal set of all active pointers, by identifier + * + * @member {Map} + * @memberof PIXI.DisplayObject# + * @private + */ + get trackedPointers() { + if (this._trackedPointers === undefined) this._trackedPointers = {}; + + return this._trackedPointers; + }, + + /** + * Map of all tracked pointers, by identifier. Use trackedPointers to access. + * + * @private + * @type {Map} + */ + _trackedPointers: undefined + }; + + }, {}], 161: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.parse = parse; + + exports.default = function () { + return function bitmapFontParser(resource, next) { + // skip if no data or not xml data + if (!resource.data || resource.type !== _resourceLoader.Resource.TYPE.XML) { + next(); + + return; + } + + // skip if not bitmap font data, using some silly duck-typing + if (resource.data.getElementsByTagName('page').length === 0 || resource.data.getElementsByTagName('info').length === 0 || resource.data.getElementsByTagName('info')[0].getAttribute('face') === null) { + next(); + + return; + } + + var xmlUrl = !resource.isDataUrl ? path.dirname(resource.url) : ''; + + if (resource.isDataUrl) { + if (xmlUrl === '.') { + xmlUrl = ''; + } + + if (this.baseUrl && xmlUrl) { + // if baseurl has a trailing slash then add one to xmlUrl so the replace works below + if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') { + xmlUrl += '/'; + } + } + } + + // remove baseUrl from xmlUrl + xmlUrl = xmlUrl.replace(this.baseUrl, ''); + + // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. + if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') { + xmlUrl += '/'; + } + + var pages = resource.data.getElementsByTagName('page'); + var textures = {}; + + // Handle completed, when the number of textures + // load is the same number as references in the fnt file + var completed = function completed(page) { + textures[page.metadata.pageFile] = page.texture; + + if (Object.keys(textures).length === pages.length) { + parse(resource, textures); + next(); + } + }; + + for (var i = 0; i < pages.length; ++i) { + var pageFile = pages[i].getAttribute('file'); + var url = xmlUrl + pageFile; + var exists = false; + + // incase the image is loaded outside + // using the same loader, resource will be available + for (var name in this.resources) { + var bitmapResource = this.resources[name]; + + if (bitmapResource.url === url) { + bitmapResource.metadata.pageFile = pageFile; + if (bitmapResource.texture) { + completed(bitmapResource); + } else { + bitmapResource.onAfterMiddleware.add(completed); + } + exists = true; + break; + } + } + + // texture is not loaded, we'll attempt to add + // it to the load and add the texture to the list + if (!exists) { + // Standard loading options for images + var options = { + crossOrigin: resource.crossOrigin, + loadType: _resourceLoader.Resource.LOAD_TYPE.IMAGE, + metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata), + parentResource: resource + }; + + this.add(url, options, completed); + } + } + }; + }; + + var _path = require('path'); + + var path = _interopRequireWildcard(_path); + + var _resourceLoader = require('resource-loader'); + + var _extras = require('../extras'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + /** + * Register a BitmapText font from loader resource. + * + * @function parseBitmapFontData + * @memberof PIXI.loaders + * @param {PIXI.loaders.Resource} resource - Loader resource. + * @param {PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page. + */ + function parse(resource, textures) { + resource.bitmapFont = _extras.BitmapText.registerFont(resource.data, textures); + } + + }, { "../extras": 141, "path": 8, "resource-loader": 36 }], 162: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + exports.shared = exports.Resource = exports.textureParser = exports.getResourcePath = exports.spritesheetParser = exports.parseBitmapFontData = exports.bitmapFontParser = exports.Loader = undefined; + + var _bitmapFontParser = require('./bitmapFontParser'); + + Object.defineProperty(exports, 'bitmapFontParser', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_bitmapFontParser).default; + } + }); + Object.defineProperty(exports, 'parseBitmapFontData', { + enumerable: true, + get: function get() { + return _bitmapFontParser.parse; + } + }); + + var _spritesheetParser = require('./spritesheetParser'); + + Object.defineProperty(exports, 'spritesheetParser', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_spritesheetParser).default; + } + }); + Object.defineProperty(exports, 'getResourcePath', { + enumerable: true, + get: function get() { + return _spritesheetParser.getResourcePath; + } + }); + + var _textureParser = require('./textureParser'); + + Object.defineProperty(exports, 'textureParser', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_textureParser).default; + } + }); + + var _resourceLoader = require('resource-loader'); + + Object.defineProperty(exports, 'Resource', { + enumerable: true, + get: function get() { + return _resourceLoader.Resource; + } + }); + + var _Application = require('../core/Application'); + + var _Application2 = _interopRequireDefault(_Application); + + var _loader = require('./loader'); + + var _loader2 = _interopRequireDefault(_loader); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * This namespace contains APIs which extends the {@link https://github.com/englercj/resource-loader resource-loader} module + * for loading assets, data, and other resources dynamically. + * @example + * const loader = new PIXI.loaders.Loader(); + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.load((loader, resources) => { + * // resources.bunny + * // resources.spaceship + * }); + * @namespace PIXI.loaders + */ + exports.Loader = _loader2.default; + + + /** + * A premade instance of the loader that can be used to load resources. + * @name shared + * @memberof PIXI.loaders + * @type {PIXI.loaders.Loader} + */ + var shared = new _loader2.default(); + + shared.destroy = function () { + // protect destroying shared loader + }; + + exports.shared = shared; + + // Mixin the loader construction + + var AppPrototype = _Application2.default.prototype; + + AppPrototype._loader = null; + + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.loaders.Loader} + */ + Object.defineProperty(AppPrototype, 'loader', { + get: function get() { + if (!this._loader) { + var sharedLoader = this._options.sharedLoader; + + this._loader = sharedLoader ? shared : new _loader2.default(); + } + + return this._loader; + } + }); + + // Override the destroy function + // making sure to destroy the current Loader + AppPrototype._parentDestroy = AppPrototype.destroy; + AppPrototype.destroy = function destroy(removeView, stageOptions) { + if (this._loader) { + this._loader.destroy(); + this._loader = null; + } + this._parentDestroy(removeView, stageOptions); + }; + + }, { "../core/Application": 43, "./bitmapFontParser": 161, "./loader": 163, "./spritesheetParser": 164, "./textureParser": 165, "resource-loader": 36 }], 163: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _resourceLoader = require('resource-loader'); + + var _resourceLoader2 = _interopRequireDefault(_resourceLoader); + + var _blob = require('resource-loader/lib/middlewares/parsing/blob'); + + var _eventemitter = require('eventemitter3'); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _textureParser = require('./textureParser'); + + var _textureParser2 = _interopRequireDefault(_textureParser); + + var _spritesheetParser = require('./spritesheetParser'); + + var _spritesheetParser2 = _interopRequireDefault(_spritesheetParser); + + var _bitmapFontParser = require('./bitmapFontParser'); + + var _bitmapFontParser2 = _interopRequireDefault(_bitmapFontParser); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * + * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.loader; // PixiJS exposes a premade instance for you to use. + * //or + * const loader = new PIXI.loaders.Loader(); // you can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * + * @see https://github.com/englercj/resource-loader + * + * @class + * @extends module:resource-loader.ResourceLoader + * @memberof PIXI.loaders + */ + var Loader = function (_ResourceLoader) { + _inherits(Loader, _ResourceLoader); + + /** + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + _classCallCheck(this, Loader); + + var _this = _possibleConstructorReturn(this, _ResourceLoader.call(this, baseUrl, concurrency)); + + _eventemitter2.default.call(_this); + + for (var i = 0; i < Loader._pixiMiddleware.length; ++i) { + _this.use(Loader._pixiMiddleware[i]()); + } + + // Compat layer, translate the new v2 signals into old v1 events. + _this.onStart.add(function (l) { + return _this.emit('start', l); + }); + _this.onProgress.add(function (l, r) { + return _this.emit('progress', l, r); + }); + _this.onError.add(function (e, l, r) { + return _this.emit('error', e, l, r); + }); + _this.onLoad.add(function (l, r) { + return _this.emit('load', l, r); + }); + _this.onComplete.add(function (l, r) { + return _this.emit('complete', l, r); + }); + return _this; + } + + /** + * Adds a default middleware to the PixiJS loader. + * + * @static + * @param {Function} fn - The middleware to add. + */ + + + Loader.addPixiMiddleware = function addPixiMiddleware(fn) { + Loader._pixiMiddleware.push(fn); + }; + + /** + * Destroy the loader, removes references. + */ + + + Loader.prototype.destroy = function destroy() { + this.removeAllListeners(); + this.reset(); + }; + + return Loader; + }(_resourceLoader2.default); + + // Copy EE3 prototype (mixin) + + + exports.default = Loader; + for (var k in _eventemitter2.default.prototype) { + Loader.prototype[k] = _eventemitter2.default.prototype[k]; + } + + Loader._pixiMiddleware = [ + // parse any blob into more usable objects (e.g. Image) + _blob.blobMiddlewareFactory, + // parse any Image objects into textures + _textureParser2.default, + // parse any spritesheet data into multiple textures + _spritesheetParser2.default, + // parse bitmap font data into multiple textures + _bitmapFontParser2.default]; + + // Add custom extentions + var Resource = _resourceLoader2.default.Resource; + + Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT); + + }, { "./bitmapFontParser": 161, "./spritesheetParser": 164, "./textureParser": 165, "eventemitter3": 3, "resource-loader": 36, "resource-loader/lib/middlewares/parsing/blob": 37 }], 164: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + exports.default = function () { + return function spritesheetParser(resource, next) { + var imageResourceName = resource.name + '_image'; + + // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists + if (!resource.data || resource.type !== _resourceLoader.Resource.TYPE.JSON || !resource.data.frames || this.resources[imageResourceName]) { + next(); + + return; + } + + var loadOptions = { + crossOrigin: resource.crossOrigin, + metadata: resource.metadata.imageMetadata, + parentResource: resource + }; + + var resourcePath = getResourcePath(resource, this.baseUrl); + + // load the image for this sheet + this.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) { + if (res.error) { + next(res.error); + + return; + } + + var spritesheet = new _core.Spritesheet(res.texture.baseTexture, resource.data, resource.url); + + spritesheet.parse(function () { + resource.spritesheet = spritesheet; + resource.textures = spritesheet.textures; + next(); + }); + }); + }; + }; + + exports.getResourcePath = getResourcePath; + + var _resourceLoader = require('resource-loader'); + + var _url = require('url'); + + var _url2 = _interopRequireDefault(_url); + + var _core = require('../core'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function getResourcePath(resource, baseUrl) { + // Prepend url path unless the resource image is a data url + if (resource.isDataUrl) { + return resource.data.meta.image; + } + + return _url2.default.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); + } + + }, { "../core": 65, "resource-loader": 36, "url": 38 }], 165: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + exports.default = function () { + return function textureParser(resource, next) { + // create a new texture if the data is an Image object + if (resource.data && resource.type === _resourceLoader.Resource.TYPE.IMAGE) { + resource.texture = _Texture2.default.fromLoader(resource.data, resource.url, resource.name); + } + next(); + }; + }; + + var _resourceLoader = require('resource-loader'); + + var _Texture = require('../core/textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "../core/textures/Texture": 115, "resource-loader": 36 }], 166: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _Texture = require('../core/textures/Texture'); + + var _Texture2 = _interopRequireDefault(_Texture); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var tempPoint = new core.Point(); + var tempPolygon = new core.Polygon(); + + /** + * Base mesh class + * @class + * @extends PIXI.Container + * @memberof PIXI.mesh + */ + + var Mesh = function (_core$Container) { + _inherits(Mesh, _core$Container); + + /** + * @param {PIXI.Texture} texture - The texture to use + * @param {Float32Array} [vertices] - if you want to specify the vertices + * @param {Float32Array} [uvs] - if you want to specify the uvs + * @param {Uint16Array} [indices] - if you want to specify the indices + * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts + */ + function Mesh(texture, vertices, uvs, indices, drawMode) { + _classCallCheck(this, Mesh); + + /** + * The texture of the Mesh + * + * @member {PIXI.Texture} + * @default PIXI.Texture.EMPTY + * @private + */ + var _this = _possibleConstructorReturn(this, _core$Container.call(this)); + + _this._texture = texture || _Texture2.default.EMPTY; + + /** + * The Uvs of the Mesh + * + * @member {Float32Array} + */ + _this.uvs = uvs || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]); + + /** + * An array of vertices + * + * @member {Float32Array} + */ + _this.vertices = vertices || new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]); + + /** + * An array containing the indices of the vertices + * + * @member {Uint16Array} + */ + // TODO auto generate this based on draw mode! + _this.indices = indices || new Uint16Array([0, 1, 3, 2]); + + /** + * Version of mesh uvs are dirty or not + * + * @member {number} + */ + _this.dirty = 0; + + /** + * Version of mesh indices + * + * @member {number} + */ + _this.indexDirty = 0; + + /** + * Version of mesh verticies array + * + * @member {number} + */ + _this.vertexDirty = 0; + + /** + * For backwards compatibility the default is to re-upload verticies each render call. + * Set this to `false` and increase `vertexDirty` to manually re-upload the buffer. + * + * @member {boolean} + */ + _this.autoUpdate = true; + + /** + * The blend mode to be applied to the sprite. Set to `PIXI.BLEND_MODES.NORMAL` to remove + * any blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + _this.blendMode = core.BLEND_MODES.NORMAL; + + /** + * Triangles in canvas mode are automatically antialiased, use this value to force triangles + * to overlap a bit with each other. + * + * @member {number} + */ + _this.canvasPadding = core.settings.MESH_CANVAS_PADDING; + + /** + * The way the Mesh should be drawn, can be any of the {@link PIXI.mesh.Mesh.DRAW_MODES} consts + * + * @member {number} + * @see PIXI.mesh.Mesh.DRAW_MODES + */ + _this.drawMode = drawMode || Mesh.DRAW_MODES.TRIANGLE_MESH; + + /** + * The default shader that is used if a mesh doesn't have a more specific one. + * + * @member {PIXI.Shader} + */ + _this.shader = null; + + /** + * The tint applied to the mesh. This is a [r,g,b] value. A value of [1,1,1] will remove any + * tint effect. + * + * @member {number} + */ + _this.tintRgb = new Float32Array([1, 1, 1]); + + /** + * A map of renderer IDs to webgl render data + * + * @private + * @member {object} + */ + _this._glDatas = {}; + + /** + * transform that is applied to UV to get the texture coords + * its updated independently from texture uvTransform + * updates of uvs are tied to that thing + * + * @member {PIXI.TextureMatrix} + * @private + */ + _this._uvTransform = new core.TextureMatrix(_this._texture); + + /** + * whether or not upload uvTransform to shader + * if its false, then uvs should be pre-multiplied + * if you change it for generated mesh, please call 'refresh(true)' + * @member {boolean} + * @default false + */ + _this.uploadUvTransform = false; + + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_renderWebGL' & '_renderCanvas' methods. + * @member {string} + * @default 'mesh' + */ + _this.pluginName = 'mesh'; + return _this; + } + + /** + * Renders the object using the WebGL renderer + * + * @private + * @param {PIXI.WebGLRenderer} renderer - a reference to the WebGL renderer + */ + + + Mesh.prototype._renderWebGL = function _renderWebGL(renderer) { + this.refresh(); + renderer.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer. + */ + + + Mesh.prototype._renderCanvas = function _renderCanvas(renderer) { + this.refresh(); + renderer.plugins[this.pluginName].render(this); + }; + + /** + * When the texture is updated, this event will fire to update the scale and frame + * + * @private + */ + + + Mesh.prototype._onTextureUpdate = function _onTextureUpdate() { + this._uvTransform.texture = this._texture; + this.refresh(); + }; + + /** + * multiplies uvs only if uploadUvTransform is false + * call it after you change uvs manually + * make sure that texture is valid + */ + + + Mesh.prototype.multiplyUvs = function multiplyUvs() { + if (!this.uploadUvTransform) { + this._uvTransform.multiplyUvs(this.uvs); + } + }; + + /** + * Refreshes uvs for generated meshes (rope, plane) + * sometimes refreshes vertices too + * + * @param {boolean} [forceUpdate=false] if true, matrices will be updated any case + */ + + + Mesh.prototype.refresh = function refresh(forceUpdate) { + if (this.autoUpdate) { + this.vertexDirty++; + } + if (this._uvTransform.update(forceUpdate)) { + this._refresh(); + } + }; + + /** + * re-calculates mesh coords + * @protected + */ + + + Mesh.prototype._refresh = function _refresh() { } + /* empty */ + + + /** + * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. + * + */ + ; + + Mesh.prototype._calculateBounds = function _calculateBounds() { + // TODO - we can cache local bounds and use them if they are dirty (like graphics) + this._bounds.addVertices(this.transform, this.vertices, 0, this.vertices.length); + }; + + /** + * Tests if a point is inside this mesh. Works only for TRIANGLE_MESH + * + * @param {PIXI.Point} point - the point to test + * @return {boolean} the result of the test + */ + + + Mesh.prototype.containsPoint = function containsPoint(point) { + if (!this.getBounds().contains(point.x, point.y)) { + return false; + } + + this.worldTransform.applyInverse(point, tempPoint); + + var vertices = this.vertices; + var points = tempPolygon.points; + var indices = this.indices; + var len = this.indices.length; + var step = this.drawMode === Mesh.DRAW_MODES.TRIANGLES ? 3 : 1; + + for (var i = 0; i + 2 < len; i += step) { + var ind0 = indices[i] * 2; + var ind1 = indices[i + 1] * 2; + var ind2 = indices[i + 2] * 2; + + points[0] = vertices[ind0]; + points[1] = vertices[ind0 + 1]; + points[2] = vertices[ind1]; + points[3] = vertices[ind1 + 1]; + points[4] = vertices[ind2]; + points[5] = vertices[ind2 + 1]; + + if (tempPolygon.contains(tempPoint.x, tempPoint.y)) { + return true; + } + } + + return false; + }; + + /** + * The texture that the mesh uses. + * + * @member {PIXI.Texture} + */ + + + /** + * Destroys the Mesh object. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all + * options have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have + * their destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Mesh.prototype.destroy = function destroy(options) { + // for each webgl data entry, destroy the WebGLGraphicsData + for (var id in this._glDatas) { + var data = this._glDatas[id]; + + if (data.destroy) { + data.destroy(); + } else { + if (data.vertexBuffer) { + data.vertexBuffer.destroy(); + data.vertexBuffer = null; + } + if (data.indexBuffer) { + data.indexBuffer.destroy(); + data.indexBuffer = null; + } + if (data.uvBuffer) { + data.uvBuffer.destroy(); + data.uvBuffer = null; + } + if (data.vao) { + data.vao.destroy(); + data.vao = null; + } + } + } + + this._glDatas = null; + + _core$Container.prototype.destroy.call(this, options); + }; + + _createClass(Mesh, [{ + key: 'texture', + get: function get() { + return this._texture; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + if (this._texture === value) { + return; + } + + this._texture = value; + + if (value) { + // wait for the texture to load + if (value.baseTexture.hasLoaded) { + this._onTextureUpdate(); + } else { + value.once('update', this._onTextureUpdate, this); + } + } + } + + /** + * The tint applied to the mesh. This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + + }, { + key: 'tint', + get: function get() { + return core.utils.rgb2hex(this.tintRgb); + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this.tintRgb = core.utils.hex2rgb(value, this.tintRgb); + } + }]); + + return Mesh; + }(core.Container); + + /** + * Different drawing buffer modes supported + * + * @static + * @constant + * @type {object} + * @property {number} TRIANGLE_MESH + * @property {number} TRIANGLES + */ + + + exports.default = Mesh; + Mesh.DRAW_MODES = { + TRIANGLE_MESH: 0, + TRIANGLES: 1 + }; + + }, { "../core": 65, "../core/textures/Texture": 115 }], 167: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _Plane2 = require('./Plane'); + + var _Plane3 = _interopRequireDefault(_Plane2); + + var _CanvasTinter = require('../core/sprites/canvas/CanvasTinter'); + + var _CanvasTinter2 = _interopRequireDefault(_CanvasTinter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var DEFAULT_BORDER_SIZE = 10; + + /** + * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful + * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically + * + *```js + * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.fromImage('BoxWithRoundedCorners.png'), 15, 15, 15, 15); + * ``` + *
+             *      A                          B
+             *    +---+----------------------+---+
+             *  C | 1 |          2           | 3 |
+             *    +---+----------------------+---+
+             *    |   |                      |   |
+             *    | 4 |          5           | 6 |
+             *    |   |                      |   |
+             *    +---+----------------------+---+
+             *  D | 7 |          8           | 9 |
+             *    +---+----------------------+---+
+            
+             *  When changing this objects width and/or height:
+             *     areas 1 3 7 and 9 will remain unscaled.
+             *     areas 2 and 8 will be stretched horizontally
+             *     areas 4 and 6 will be stretched vertically
+             *     area 5 will be stretched both horizontally and vertically
+             * 
+ * + * @class + * @extends PIXI.mesh.Plane + * @memberof PIXI.mesh + * + */ + + var NineSlicePlane = function (_Plane) { + _inherits(NineSlicePlane, _Plane); + + /** + * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. + * @param {int} [leftWidth=10] size of the left vertical bar (A) + * @param {int} [topHeight=10] size of the top horizontal bar (C) + * @param {int} [rightWidth=10] size of the right vertical bar (B) + * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D) + */ + function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) { + _classCallCheck(this, NineSlicePlane); + + var _this = _possibleConstructorReturn(this, _Plane.call(this, texture, 4, 4)); + + _this._origWidth = texture.orig.width; + _this._origHeight = texture.orig.height; + + /** + * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._width = _this._origWidth; + + /** + * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._height = _this._origHeight; + + /** + * The width of the left column (a) + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; + + /** + * The width of the right column (b) + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; + + /** + * The height of the top row (c) + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; + + /** + * The height of the bottom row (d) + * + * @member {number} + * @memberof PIXI.NineSlicePlane# + * @override + */ + _this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; + + /** + * Cached tint value so we can tell when the tint is changed. + * + * @member {number} + * @protected + */ + _this._cachedTint = 0xFFFFFF; + + /** + * Cached tinted texture. + * + * @member {HTMLCanvasElement} + * @protected + */ + _this._tintedTexture = null; + + /** + * Temporary storage for canvas source coords + * + * @member {number[]} + * @private + */ + _this._canvasUvs = null; + + _this.refresh(true); + return _this; + } + + /** + * Updates the horizontal vertices. + * + */ + + + NineSlicePlane.prototype.updateHorizontalVertices = function updateHorizontalVertices() { + var vertices = this.vertices; + + var h = this._topHeight + this._bottomHeight; + var scale = this._height > h ? 1.0 : this._height / h; + + vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; + vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - this._bottomHeight * scale; + vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height; + }; + + /** + * Updates the vertical vertices. + * + */ + + + NineSlicePlane.prototype.updateVerticalVertices = function updateVerticalVertices() { + var vertices = this.vertices; + + var w = this._leftWidth + this._rightWidth; + var scale = this._width > w ? 1.0 : this._width / w; + + vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; + vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - this._rightWidth * scale; + vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with. + */ + + + NineSlicePlane.prototype._renderCanvas = function _renderCanvas(renderer) { + var context = renderer.context; + var transform = this.worldTransform; + var res = renderer.resolution; + var isTinted = this.tint !== 0xFFFFFF; + var texture = this._texture; + + // Work out tinting + if (isTinted) { + if (this._cachedTint !== this.tint) { + // Tint has changed, need to update the tinted texture and use that instead + + this._cachedTint = this.tint; + + this._tintedTexture = _CanvasTinter2.default.getTintedTexture(this, this.tint); + } + } + + var textureSource = !isTinted ? texture.baseTexture.source : this._tintedTexture; + + if (!this._canvasUvs) { + this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0]; + } + + var vertices = this.vertices; + var uvs = this._canvasUvs; + var u0 = isTinted ? 0 : texture.frame.x; + var v0 = isTinted ? 0 : texture.frame.y; + var u1 = u0 + texture.frame.width; + var v1 = v0 + texture.frame.height; + + uvs[0] = u0; + uvs[1] = u0 + this._leftWidth; + uvs[2] = u1 - this._rightWidth; + uvs[3] = u1; + uvs[4] = v0; + uvs[5] = v0 + this._topHeight; + uvs[6] = v1 - this._bottomHeight; + uvs[7] = v1; + + for (var i = 0; i < 8; i++) { + uvs[i] *= texture.baseTexture.resolution; + } + + context.globalAlpha = this.worldAlpha; + renderer.setBlendMode(this.blendMode); + + if (renderer.roundPixels) { + context.setTransform(transform.a * res, transform.b * res, transform.c * res, transform.d * res, transform.tx * res | 0, transform.ty * res | 0); + } else { + context.setTransform(transform.a * res, transform.b * res, transform.c * res, transform.d * res, transform.tx * res, transform.ty * res); + } + + for (var row = 0; row < 3; row++) { + for (var col = 0; col < 3; col++) { + var ind = col * 2 + row * 8; + var sw = Math.max(1, uvs[col + 1] - uvs[col]); + var sh = Math.max(1, uvs[row + 5] - uvs[row + 4]); + var dw = Math.max(1, vertices[ind + 10] - vertices[ind]); + var dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]); + + context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh, vertices[ind], vertices[ind + 1], dw, dh); + } + } + }; + + /** + * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + + + /** + * Refreshes NineSlicePlane coords. All of them. + */ + NineSlicePlane.prototype._refresh = function _refresh() { + _Plane.prototype._refresh.call(this); + + var uvs = this.uvs; + var texture = this._texture; + + this._origWidth = texture.orig.width; + this._origHeight = texture.orig.height; + + var _uvw = 1.0 / this._origWidth; + var _uvh = 1.0 / this._origHeight; + + uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0; + uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0; + uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1; + uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1; + + uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth; + uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - _uvw * this._rightWidth; + uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight; + uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - _uvh * this._bottomHeight; + + this.updateHorizontalVertices(); + this.updateVerticalVertices(); + + this.dirty++; + + this.multiplyUvs(); + }; + + _createClass(NineSlicePlane, [{ + key: 'width', + get: function get() { + return this._width; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._width = value; + this._refresh(); + } + + /** + * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + + }, { + key: 'height', + get: function get() { + return this._height; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._height = value; + this._refresh(); + } + + /** + * The width of the left column + * + * @member {number} + */ + + }, { + key: 'leftWidth', + get: function get() { + return this._leftWidth; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._leftWidth = value; + this._refresh(); + } + + /** + * The width of the right column + * + * @member {number} + */ + + }, { + key: 'rightWidth', + get: function get() { + return this._rightWidth; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._rightWidth = value; + this._refresh(); + } + + /** + * The height of the top row + * + * @member {number} + */ + + }, { + key: 'topHeight', + get: function get() { + return this._topHeight; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._topHeight = value; + this._refresh(); + } + + /** + * The height of the bottom row + * + * @member {number} + */ + + }, { + key: 'bottomHeight', + get: function get() { + return this._bottomHeight; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._bottomHeight = value; + this._refresh(); + } + }]); + + return NineSlicePlane; + }(_Plane3.default); + + exports.default = NineSlicePlane; + + }, { "../core/sprites/canvas/CanvasTinter": 104, "./Plane": 168 }], 168: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Mesh2 = require('./Mesh'); + + var _Mesh3 = _interopRequireDefault(_Mesh2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The Plane allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (let i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * let Plane = new PIXI.Plane(PIXI.Texture.fromImage("snake.png"), points); + * ``` + * + * @class + * @extends PIXI.mesh.Mesh + * @memberof PIXI.mesh + * + */ + var Plane = function (_Mesh) { + _inherits(Plane, _Mesh); + + /** + * @param {PIXI.Texture} texture - The texture to use on the Plane. + * @param {number} [verticesX=10] - The number of vertices in the x-axis + * @param {number} [verticesY=10] - The number of vertices in the y-axis + */ + function Plane(texture, verticesX, verticesY) { + _classCallCheck(this, Plane); + + /** + * Tracker for if the Plane is ready to be drawn. Needed because Mesh ctor can + * call _onTextureUpdated which could call refresh too early. + * + * @member {boolean} + * @private + */ + var _this = _possibleConstructorReturn(this, _Mesh.call(this, texture)); + + _this._ready = true; + + _this.verticesX = verticesX || 10; + _this.verticesY = verticesY || 10; + + _this.drawMode = _Mesh3.default.DRAW_MODES.TRIANGLES; + _this.refresh(); + return _this; + } + + /** + * Refreshes plane coordinates + * + */ + + + Plane.prototype._refresh = function _refresh() { + var texture = this._texture; + var total = this.verticesX * this.verticesY; + var verts = []; + var colors = []; + var uvs = []; + var indices = []; + + var segmentsX = this.verticesX - 1; + var segmentsY = this.verticesY - 1; + + var sizeX = texture.width / segmentsX; + var sizeY = texture.height / segmentsY; + + for (var i = 0; i < total; i++) { + var x = i % this.verticesX; + var y = i / this.verticesX | 0; + + verts.push(x * sizeX, y * sizeY); + + uvs.push(x / segmentsX, y / segmentsY); + } + + // cons + + var totalSub = segmentsX * segmentsY; + + for (var _i = 0; _i < totalSub; _i++) { + var xpos = _i % segmentsX; + var ypos = _i / segmentsX | 0; + + var value = ypos * this.verticesX + xpos; + var value2 = ypos * this.verticesX + xpos + 1; + var value3 = (ypos + 1) * this.verticesX + xpos; + var value4 = (ypos + 1) * this.verticesX + xpos + 1; + + indices.push(value, value2, value3); + indices.push(value2, value4, value3); + } + + // console.log(indices) + this.vertices = new Float32Array(verts); + this.uvs = new Float32Array(uvs); + this.colors = new Float32Array(colors); + this.indices = new Uint16Array(indices); + + this.dirty++; + this.indexDirty++; + + this.multiplyUvs(); + }; + + /** + * Clear texture UVs when new texture is set + * + * @private + */ + + + Plane.prototype._onTextureUpdate = function _onTextureUpdate() { + _Mesh3.default.prototype._onTextureUpdate.call(this); + + // wait for the Plane ctor to finish before calling refresh + if (this._ready) { + this.refresh(); + } + }; + + return Plane; + }(_Mesh3.default); + + exports.default = Plane; + + }, { "./Mesh": 166 }], 169: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Mesh2 = require('./Mesh'); + + var _Mesh3 = _interopRequireDefault(_Mesh2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The rope allows you to draw a texture across several points and them manipulate these points + * + *```js + * for (let i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * let rope = new PIXI.Rope(PIXI.Texture.fromImage("snake.png"), points); + * ``` + * + * @class + * @extends PIXI.mesh.Mesh + * @memberof PIXI.mesh + * + */ + var Rope = function (_Mesh) { + _inherits(Rope, _Mesh); + + /** + * @param {PIXI.Texture} texture - The texture to use on the rope. + * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope. + */ + function Rope(texture, points) { + _classCallCheck(this, Rope); + + /** + * An array of points that determine the rope + * + * @member {PIXI.Point[]} + */ + var _this = _possibleConstructorReturn(this, _Mesh.call(this, texture)); + + _this.points = points; + + /** + * An array of vertices used to construct this rope. + * + * @member {Float32Array} + */ + _this.vertices = new Float32Array(points.length * 4); + + /** + * The WebGL Uvs of the rope. + * + * @member {Float32Array} + */ + _this.uvs = new Float32Array(points.length * 4); + + /** + * An array containing the color components + * + * @member {Float32Array} + */ + _this.colors = new Float32Array(points.length * 2); + + /** + * An array containing the indices of the vertices + * + * @member {Uint16Array} + */ + _this.indices = new Uint16Array(points.length * 2); + + /** + * refreshes vertices on every updateTransform + * @member {boolean} + * @default true + */ + _this.autoUpdate = true; + + _this.refresh(); + return _this; + } + + /** + * Refreshes + * + */ + + + Rope.prototype._refresh = function _refresh() { + var points = this.points; + + // if too little points, or texture hasn't got UVs set yet just move on. + if (points.length < 1 || !this._texture._uvs) { + return; + } + + // if the number of points has changed we will need to recreate the arraybuffers + if (this.vertices.length / 4 !== points.length) { + this.vertices = new Float32Array(points.length * 4); + this.uvs = new Float32Array(points.length * 4); + this.colors = new Float32Array(points.length * 2); + this.indices = new Uint16Array(points.length * 2); + } + + var uvs = this.uvs; + + var indices = this.indices; + var colors = this.colors; + + uvs[0] = 0; + uvs[1] = 0; + uvs[2] = 0; + uvs[3] = 1; + + colors[0] = 1; + colors[1] = 1; + + indices[0] = 0; + indices[1] = 1; + + var total = points.length; + + for (var i = 1; i < total; i++) { + // time to do some smart drawing! + var index = i * 4; + var amount = i / (total - 1); + + uvs[index] = amount; + uvs[index + 1] = 0; + + uvs[index + 2] = amount; + uvs[index + 3] = 1; + + index = i * 2; + colors[index] = 1; + colors[index + 1] = 1; + + index = i * 2; + indices[index] = index; + indices[index + 1] = index + 1; + } + + // ensure that the changes are uploaded + this.dirty++; + this.indexDirty++; + + this.multiplyUvs(); + this.refreshVertices(); + }; + + /** + * refreshes vertices of Rope mesh + */ + + + Rope.prototype.refreshVertices = function refreshVertices() { + var points = this.points; + + if (points.length < 1) { + return; + } + + var lastPoint = points[0]; + var nextPoint = void 0; + var perpX = 0; + var perpY = 0; + + // this.count -= 0.2; + + var vertices = this.vertices; + var total = points.length; + + for (var i = 0; i < total; i++) { + var point = points[i]; + var index = i * 4; + + if (i < points.length - 1) { + nextPoint = points[i + 1]; + } else { + nextPoint = point; + } + + perpY = -(nextPoint.x - lastPoint.x); + perpX = nextPoint.y - lastPoint.y; + + var ratio = (1 - i / (total - 1)) * 10; + + if (ratio > 1) { + ratio = 1; + } + + var perpLength = Math.sqrt(perpX * perpX + perpY * perpY); + var num = this._texture.height / 2; // (20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio; + + perpX /= perpLength; + perpY /= perpLength; + + perpX *= num; + perpY *= num; + + vertices[index] = point.x + perpX; + vertices[index + 1] = point.y + perpY; + vertices[index + 2] = point.x - perpX; + vertices[index + 3] = point.y - perpY; + + lastPoint = point; + } + }; + + /** + * Updates the object transform for rendering + * + * @private + */ + + + Rope.prototype.updateTransform = function updateTransform() { + if (this.autoUpdate) { + this.refreshVertices(); + } + this.containerUpdateTransform(); + }; + + return Rope; + }(_Mesh3.default); + + exports.default = Rope; + + }, { "./Mesh": 166 }], 170: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _Mesh = require('../Mesh'); + + var _Mesh2 = _interopRequireDefault(_Mesh); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Renderer dedicated to meshes. + * + * @class + * @private + * @memberof PIXI + */ + var MeshSpriteRenderer = function () { + /** + * @param {PIXI.CanvasRenderer} renderer - The renderer this downport works for + */ + function MeshSpriteRenderer(renderer) { + _classCallCheck(this, MeshSpriteRenderer); + + this.renderer = renderer; + } + + /** + * Renders the Mesh + * + * @param {PIXI.mesh.Mesh} mesh - the Mesh to render + */ + + + MeshSpriteRenderer.prototype.render = function render(mesh) { + var renderer = this.renderer; + var context = renderer.context; + + var transform = mesh.worldTransform; + var res = renderer.resolution; + + if (renderer.roundPixels) { + context.setTransform(transform.a * res, transform.b * res, transform.c * res, transform.d * res, transform.tx * res | 0, transform.ty * res | 0); + } else { + context.setTransform(transform.a * res, transform.b * res, transform.c * res, transform.d * res, transform.tx * res, transform.ty * res); + } + + renderer.context.globalAlpha = mesh.worldAlpha; + renderer.setBlendMode(mesh.blendMode); + + if (mesh.drawMode === _Mesh2.default.DRAW_MODES.TRIANGLE_MESH) { + this._renderTriangleMesh(mesh); + } else { + this._renderTriangles(mesh); + } + }; + + /** + * Draws the object in Triangle Mesh mode + * + * @private + * @param {PIXI.mesh.Mesh} mesh - the Mesh to render + */ + + + MeshSpriteRenderer.prototype._renderTriangleMesh = function _renderTriangleMesh(mesh) { + // draw triangles!! + var length = mesh.vertices.length / 2; + + for (var i = 0; i < length - 2; i++) { + // draw some triangles! + var index = i * 2; + + this._renderDrawTriangle(mesh, index, index + 2, index + 4); + } + }; + + /** + * Draws the object in triangle mode using canvas + * + * @private + * @param {PIXI.mesh.Mesh} mesh - the current mesh + */ + + + MeshSpriteRenderer.prototype._renderTriangles = function _renderTriangles(mesh) { + // draw triangles!! + var indices = mesh.indices; + var length = indices.length; + + for (var i = 0; i < length; i += 3) { + // draw some triangles! + var index0 = indices[i] * 2; + var index1 = indices[i + 1] * 2; + var index2 = indices[i + 2] * 2; + + this._renderDrawTriangle(mesh, index0, index1, index2); + } + }; + + /** + * Draws one of the triangles that from the Mesh + * + * @private + * @param {PIXI.mesh.Mesh} mesh - the current mesh + * @param {number} index0 - the index of the first vertex + * @param {number} index1 - the index of the second vertex + * @param {number} index2 - the index of the third vertex + */ + + + MeshSpriteRenderer.prototype._renderDrawTriangle = function _renderDrawTriangle(mesh, index0, index1, index2) { + var context = this.renderer.context; + var uvs = mesh.uvs; + var vertices = mesh.vertices; + var texture = mesh._texture; + + if (!texture.valid) { + return; + } + + var base = texture.baseTexture; + var textureSource = base.source; + var textureWidth = base.width; + var textureHeight = base.height; + + var u0 = void 0; + var u1 = void 0; + var u2 = void 0; + var v0 = void 0; + var v1 = void 0; + var v2 = void 0; + + if (mesh.uploadUvTransform) { + var ut = mesh._uvTransform.mapCoord; + + u0 = (uvs[index0] * ut.a + uvs[index0 + 1] * ut.c + ut.tx) * base.width; + u1 = (uvs[index1] * ut.a + uvs[index1 + 1] * ut.c + ut.tx) * base.width; + u2 = (uvs[index2] * ut.a + uvs[index2 + 1] * ut.c + ut.tx) * base.width; + v0 = (uvs[index0] * ut.b + uvs[index0 + 1] * ut.d + ut.ty) * base.height; + v1 = (uvs[index1] * ut.b + uvs[index1 + 1] * ut.d + ut.ty) * base.height; + v2 = (uvs[index2] * ut.b + uvs[index2 + 1] * ut.d + ut.ty) * base.height; + } else { + u0 = uvs[index0] * base.width; + u1 = uvs[index1] * base.width; + u2 = uvs[index2] * base.width; + v0 = uvs[index0 + 1] * base.height; + v1 = uvs[index1 + 1] * base.height; + v2 = uvs[index2 + 1] * base.height; + } + + var x0 = vertices[index0]; + var x1 = vertices[index1]; + var x2 = vertices[index2]; + var y0 = vertices[index0 + 1]; + var y1 = vertices[index1 + 1]; + var y2 = vertices[index2 + 1]; + + var canvasPadding = mesh.canvasPadding / this.renderer.resolution; + + if (canvasPadding > 0) { + var paddingX = canvasPadding / Math.abs(mesh.worldTransform.a); + var paddingY = canvasPadding / Math.abs(mesh.worldTransform.d); + var centerX = (x0 + x1 + x2) / 3; + var centerY = (y0 + y1 + y2) / 3; + + var normX = x0 - centerX; + var normY = y0 - centerY; + + var dist = Math.sqrt(normX * normX + normY * normY); + + x0 = centerX + normX / dist * (dist + paddingX); + y0 = centerY + normY / dist * (dist + paddingY); + + // + + normX = x1 - centerX; + normY = y1 - centerY; + + dist = Math.sqrt(normX * normX + normY * normY); + x1 = centerX + normX / dist * (dist + paddingX); + y1 = centerY + normY / dist * (dist + paddingY); + + normX = x2 - centerX; + normY = y2 - centerY; + + dist = Math.sqrt(normX * normX + normY * normY); + x2 = centerX + normX / dist * (dist + paddingX); + y2 = centerY + normY / dist * (dist + paddingY); + } + + context.save(); + context.beginPath(); + + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); + + context.closePath(); + + context.clip(); + + // Compute matrix transform + var delta = u0 * v1 + v0 * u2 + u1 * v2 - v1 * u2 - v0 * u1 - u0 * v2; + var deltaA = x0 * v1 + v0 * x2 + x1 * v2 - v1 * x2 - v0 * x1 - x0 * v2; + var deltaB = u0 * x1 + x0 * u2 + u1 * x2 - x1 * u2 - x0 * u1 - u0 * x2; + var deltaC = u0 * v1 * x2 + v0 * x1 * u2 + x0 * u1 * v2 - x0 * v1 * u2 - v0 * u1 * x2 - u0 * x1 * v2; + var deltaD = y0 * v1 + v0 * y2 + y1 * v2 - v1 * y2 - v0 * y1 - y0 * v2; + var deltaE = u0 * y1 + y0 * u2 + u1 * y2 - y1 * u2 - y0 * u1 - u0 * y2; + var deltaF = u0 * v1 * y2 + v0 * y1 * u2 + y0 * u1 * v2 - y0 * v1 * u2 - v0 * u1 * y2 - u0 * y1 * v2; + + context.transform(deltaA / delta, deltaD / delta, deltaB / delta, deltaE / delta, deltaC / delta, deltaF / delta); + + context.drawImage(textureSource, 0, 0, textureWidth * base.resolution, textureHeight * base.resolution, 0, 0, textureWidth, textureHeight); + + context.restore(); + this.renderer.invalidateBlendMode(); + }; + + /** + * Renders a flat Mesh + * + * @private + * @param {PIXI.mesh.Mesh} mesh - The Mesh to render + */ + + + MeshSpriteRenderer.prototype.renderMeshFlat = function renderMeshFlat(mesh) { + var context = this.renderer.context; + var vertices = mesh.vertices; + var length = vertices.length / 2; + + // this.count++; + + context.beginPath(); + + for (var i = 1; i < length - 2; ++i) { + // draw some triangles! + var index = i * 2; + + var x0 = vertices[index]; + var y0 = vertices[index + 1]; + + var x1 = vertices[index + 2]; + var y1 = vertices[index + 3]; + + var x2 = vertices[index + 4]; + var y2 = vertices[index + 5]; + + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); + } + + context.fillStyle = '#FF0000'; + context.fill(); + context.closePath(); + }; + + /** + * destroy the the renderer. + * + */ + + + MeshSpriteRenderer.prototype.destroy = function destroy() { + this.renderer = null; + }; + + return MeshSpriteRenderer; + }(); + + exports.default = MeshSpriteRenderer; + + + core.CanvasRenderer.registerPlugin('mesh', MeshSpriteRenderer); + + }, { "../../core": 65, "../Mesh": 166 }], 171: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Mesh = require('./Mesh'); + + Object.defineProperty(exports, 'Mesh', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Mesh).default; + } + }); + + var _MeshRenderer = require('./webgl/MeshRenderer'); + + Object.defineProperty(exports, 'MeshRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_MeshRenderer).default; + } + }); + + var _CanvasMeshRenderer = require('./canvas/CanvasMeshRenderer'); + + Object.defineProperty(exports, 'CanvasMeshRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasMeshRenderer).default; + } + }); + + var _Plane = require('./Plane'); + + Object.defineProperty(exports, 'Plane', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Plane).default; + } + }); + + var _NineSlicePlane = require('./NineSlicePlane'); + + Object.defineProperty(exports, 'NineSlicePlane', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_NineSlicePlane).default; + } + }); + + var _Rope = require('./Rope'); + + Object.defineProperty(exports, 'Rope', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_Rope).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./Mesh": 166, "./NineSlicePlane": 167, "./Plane": 168, "./Rope": 169, "./canvas/CanvasMeshRenderer": 170, "./webgl/MeshRenderer": 172 }], 172: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + var _Mesh = require('../Mesh'); + + var _Mesh2 = _interopRequireDefault(_Mesh); + + var _path = require('path'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var matrixIdentity = core.Matrix.IDENTITY; + + /** + * WebGL renderer plugin for tiling sprites + * + * @class + * @memberof PIXI + * @extends PIXI.ObjectRenderer + */ + + var MeshRenderer = function (_core$ObjectRenderer) { + _inherits(MeshRenderer, _core$ObjectRenderer); + + /** + * constructor for renderer + * + * @param {WebGLRenderer} renderer The renderer this tiling awesomeness works for. + */ + function MeshRenderer(renderer) { + _classCallCheck(this, MeshRenderer); + + var _this = _possibleConstructorReturn(this, _core$ObjectRenderer.call(this, renderer)); + + _this.shader = null; + return _this; + } + + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + + + MeshRenderer.prototype.onContextChange = function onContextChange() { + var gl = this.renderer.gl; + + this.shader = new core.Shader(gl, 'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n', 'varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n'); + }; + + /** + * renders mesh + * + * @param {PIXI.mesh.Mesh} mesh mesh instance + */ + + + MeshRenderer.prototype.render = function render(mesh) { + var renderer = this.renderer; + var gl = renderer.gl; + var texture = mesh._texture; + + if (!texture.valid) { + return; + } + + var glData = mesh._glDatas[renderer.CONTEXT_UID]; + + if (!glData) { + renderer.bindVao(null); + + glData = { + shader: this.shader, + vertexBuffer: _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, mesh.vertices, gl.STREAM_DRAW), + uvBuffer: _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, mesh.uvs, gl.STREAM_DRAW), + indexBuffer: _pixiGlCore2.default.GLBuffer.createIndexBuffer(gl, mesh.indices, gl.STATIC_DRAW), + // build the vao object that will render.. + vao: null, + dirty: mesh.dirty, + indexDirty: mesh.indexDirty, + vertexDirty: mesh.vertexDirty + }; + + // build the vao object that will render.. + glData.vao = new _pixiGlCore2.default.VertexArrayObject(gl).addIndex(glData.indexBuffer).addAttribute(glData.vertexBuffer, glData.shader.attributes.aVertexPosition, gl.FLOAT, false, 2 * 4, 0).addAttribute(glData.uvBuffer, glData.shader.attributes.aTextureCoord, gl.FLOAT, false, 2 * 4, 0); + + mesh._glDatas[renderer.CONTEXT_UID] = glData; + } + + renderer.bindVao(glData.vao); + + if (mesh.dirty !== glData.dirty) { + glData.dirty = mesh.dirty; + glData.uvBuffer.upload(mesh.uvs); + } + + if (mesh.indexDirty !== glData.indexDirty) { + glData.indexDirty = mesh.indexDirty; + glData.indexBuffer.upload(mesh.indices); + } + + if (mesh.vertexDirty !== glData.vertexDirty) { + glData.vertexDirty = mesh.vertexDirty; + glData.vertexBuffer.upload(mesh.vertices); + } + + renderer.bindShader(glData.shader); + + glData.shader.uniforms.uSampler = renderer.bindTexture(texture); + + renderer.state.setBlendMode(core.utils.correctBlendMode(mesh.blendMode, texture.baseTexture.premultipliedAlpha)); + + if (glData.shader.uniforms.uTransform) { + if (mesh.uploadUvTransform) { + glData.shader.uniforms.uTransform = mesh._uvTransform.mapCoord.toArray(true); + } else { + glData.shader.uniforms.uTransform = matrixIdentity.toArray(true); + } + } + glData.shader.uniforms.translationMatrix = mesh.worldTransform.toArray(true); + + glData.shader.uniforms.uColor = core.utils.premultiplyRgba(mesh.tintRgb, mesh.worldAlpha, glData.shader.uniforms.uColor, texture.baseTexture.premultipliedAlpha); + + var drawMode = mesh.drawMode === _Mesh2.default.DRAW_MODES.TRIANGLE_MESH ? gl.TRIANGLE_STRIP : gl.TRIANGLES; + + glData.vao.draw(drawMode, mesh.indices.length, 0); + }; + + return MeshRenderer; + }(core.ObjectRenderer); + + exports.default = MeshRenderer; + + + core.WebGLRenderer.registerPlugin('mesh', MeshRenderer); + + }, { "../../core": 65, "../Mesh": 166, "path": 8, "pixi-gl-core": 15 }], 173: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _utils = require('../core/utils'); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The ParticleContainer class is a really fast version of the Container built solely for speed, + * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced + * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * and some advanced functionality like tint (as of v4.5.6). + * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. + * + * It's extremely easy to use : + * + * ```js + * let container = new ParticleContainer(); + * + * for (let i = 0; i < 100; ++i) + * { + * let sprite = new PIXI.Sprite.fromImage("myImage.png"); + * container.addChild(sprite); + * } + * ``` + * + * And here you have a hundred sprites that will be rendered at the speed of light. + * + * @class + * @extends PIXI.Container + * @memberof PIXI.particles + */ + var ParticleContainer = function (_core$Container) { + _inherits(ParticleContainer, _core$Container); + + /** + * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container. + * Affects size of allocated buffers. + * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied. + * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied. + * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`. + * @param {boolean} [properties.position=true] - When true, position be uploaded and applied. + * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied. + * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied. + * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied. + * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead. + * @param {boolean} [autoResize=false] If true, container allocates more batches in case + * there are more than `maxSize` particles. + */ + function ParticleContainer() { + var maxSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1500; + var properties = arguments[1]; + var batchSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 16384; + var autoResize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + _classCallCheck(this, ParticleContainer); + + // Making sure the batch size is valid + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + var _this = _possibleConstructorReturn(this, _core$Container.call(this)); + + var maxBatchSize = 16384; + + if (batchSize > maxBatchSize) { + batchSize = maxBatchSize; + } + + if (batchSize > maxSize) { + batchSize = maxSize; + } + + /** + * Set properties to be dynamic (true) / static (false) + * + * @member {boolean[]} + * @private + */ + _this._properties = [false, true, false, false, false]; + + /** + * @member {number} + * @private + */ + _this._maxSize = maxSize; + + /** + * @member {number} + * @private + */ + _this._batchSize = batchSize; + + /** + * @member {object} + * @private + */ + _this._glBuffers = {}; + + /** + * for every batch stores _updateID corresponding to the last change in that batch + * @member {number[]} + * @private + */ + _this._bufferUpdateIDs = []; + + /** + * when child inserted, removed or changes position this number goes up + * @member {number[]} + * @private + */ + _this._updateID = 0; + + /** + * @member {boolean} + * + */ + _this.interactiveChildren = false; + + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` + * to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + _this.blendMode = core.BLEND_MODES.NORMAL; + + /** + * If true, container allocates more batches in case there are more than `maxSize` particles. + * @member {boolean} + * @default false + */ + _this.autoResize = autoResize; + + /** + * Used for canvas renderering. If true then the elements will be positioned at the + * nearest pixel. This provides a nice speed boost. + * + * @member {boolean} + * @default true; + */ + _this.roundPixels = true; + + /** + * The texture used to render the children. + * + * @readonly + * @member {BaseTexture} + */ + _this.baseTexture = null; + + _this.setProperties(properties); + + /** + * The tint applied to the container. + * This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 0xFFFFFF + */ + _this._tint = 0; + _this.tintRgb = new Float32Array(4); + _this.tint = 0xFFFFFF; + return _this; + } + + /** + * Sets the private properties array to dynamic / static based on the passed properties object + * + * @param {object} properties - The properties to be uploaded + */ + + + ParticleContainer.prototype.setProperties = function setProperties(properties) { + if (properties) { + this._properties[0] = 'vertices' in properties || 'scale' in properties ? !!properties.vertices || !!properties.scale : this._properties[0]; + this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; + this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; + this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; + this._properties[4] = 'tint' in properties || 'alpha' in properties ? !!properties.tint || !!properties.alpha : this._properties[4]; + } + }; + + /** + * Updates the object transform for rendering + * + * @private + */ + + + ParticleContainer.prototype.updateTransform = function updateTransform() { + // TODO don't need to! + this.displayObjectUpdateTransform(); + // PIXI.Container.prototype.updateTransform.call( this ); + }; + + /** + * The tint applied to the container. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + * @member {number} + * @default 0xFFFFFF + */ + + + /** + * Renders the container using the WebGL renderer + * + * @private + * @param {PIXI.WebGLRenderer} renderer - The webgl renderer + */ + ParticleContainer.prototype.renderWebGL = function renderWebGL(renderer) { + var _this2 = this; + + if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { + return; + } + + if (!this.baseTexture) { + this.baseTexture = this.children[0]._texture.baseTexture; + if (!this.baseTexture.hasLoaded) { + this.baseTexture.once('update', function () { + return _this2.onChildrenChange(0); + }); + } + } + + renderer.setObjectRenderer(renderer.plugins.particle); + renderer.plugins.particle.render(this); + }; + + /** + * Set the flag that static data should be updated to true + * + * @private + * @param {number} smallestChildIndex - The smallest child index + */ + + + ParticleContainer.prototype.onChildrenChange = function onChildrenChange(smallestChildIndex) { + var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); + + while (this._bufferUpdateIDs.length < bufferIndex) { + this._bufferUpdateIDs.push(0); + } + this._bufferUpdateIDs[bufferIndex] = ++this._updateID; + }; + + /** + * Renders the object using the Canvas renderer + * + * @private + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer + */ + + + ParticleContainer.prototype.renderCanvas = function renderCanvas(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { + return; + } + + var context = renderer.context; + var transform = this.worldTransform; + var isRotated = true; + + var positionX = 0; + var positionY = 0; + + var finalWidth = 0; + var finalHeight = 0; + + renderer.setBlendMode(this.blendMode); + + context.globalAlpha = this.worldAlpha; + + this.displayObjectUpdateTransform(); + + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i]; + + if (!child.visible) { + continue; + } + + var frame = child._texture.frame; + + context.globalAlpha = this.worldAlpha * child.alpha; + + if (child.rotation % (Math.PI * 2) === 0) { + // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call + if (isRotated) { + context.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx * renderer.resolution, transform.ty * renderer.resolution); + + isRotated = false; + } + + positionX = child.anchor.x * (-frame.width * child.scale.x) + child.position.x + 0.5; + positionY = child.anchor.y * (-frame.height * child.scale.y) + child.position.y + 0.5; + + finalWidth = frame.width * child.scale.x; + finalHeight = frame.height * child.scale.y; + } else { + if (!isRotated) { + isRotated = true; + } + + child.displayObjectUpdateTransform(); + + var childTransform = child.worldTransform; + + if (renderer.roundPixels) { + context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d, childTransform.tx * renderer.resolution | 0, childTransform.ty * renderer.resolution | 0); + } else { + context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d, childTransform.tx * renderer.resolution, childTransform.ty * renderer.resolution); + } + + positionX = child.anchor.x * -frame.width + 0.5; + positionY = child.anchor.y * -frame.height + 0.5; + + finalWidth = frame.width; + finalHeight = frame.height; + } + + var resolution = child._texture.baseTexture.resolution; + + context.drawImage(child._texture.baseTexture.source, frame.x * resolution, frame.y * resolution, frame.width * resolution, frame.height * resolution, positionX * renderer.resolution, positionY * renderer.resolution, finalWidth * renderer.resolution, finalHeight * renderer.resolution); + } + }; + + /** + * Destroys the container + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their + * destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + + + ParticleContainer.prototype.destroy = function destroy(options) { + _core$Container.prototype.destroy.call(this, options); + + if (this._buffers) { + for (var i = 0; i < this._buffers.length; ++i) { + this._buffers[i].destroy(); + } + } + + this._properties = null; + this._buffers = null; + this._bufferUpdateIDs = null; + }; + + _createClass(ParticleContainer, [{ + key: 'tint', + get: function get() { + return this._tint; + }, + set: function set(value) // eslint-disable-line require-jsdoc + { + this._tint = value; + (0, _utils.hex2rgb)(value, this.tintRgb); + } + }]); + + return ParticleContainer; + }(core.Container); + + exports.default = ParticleContainer; + + }, { "../core": 65, "../core/utils": 125 }], 174: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _ParticleContainer = require('./ParticleContainer'); + + Object.defineProperty(exports, 'ParticleContainer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_ParticleContainer).default; + } + }); + + var _ParticleRenderer = require('./webgl/ParticleRenderer'); + + Object.defineProperty(exports, 'ParticleRenderer', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_ParticleRenderer).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./ParticleContainer": 173, "./webgl/ParticleRenderer": 176 }], 175: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _pixiGlCore = require('pixi-gl-core'); + + var _pixiGlCore2 = _interopRequireDefault(_pixiGlCore); + + var _createIndicesForQuads = require('../../core/utils/createIndicesForQuads'); + + var _createIndicesForQuads2 = _interopRequireDefault(_createIndicesForQuads); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that + * they now share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleBuffer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java + */ + + /** + * The particle buffer manages the static and dynamic buffers for a particle container. + * + * @class + * @private + * @memberof PIXI + */ + var ParticleBuffer = function () { + /** + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {object} properties - The properties to upload. + * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. + * @param {number} size - The size of the batch. + */ + function ParticleBuffer(gl, properties, dynamicPropertyFlags, size) { + _classCallCheck(this, ParticleBuffer); + + /** + * The current WebGL drawing context. + * + * @member {WebGLRenderingContext} + */ + this.gl = gl; + + /** + * The number of particles the buffer can hold + * + * @member {number} + */ + this.size = size; + + /** + * A list of the properties that are dynamic. + * + * @member {object[]} + */ + this.dynamicProperties = []; + + /** + * A list of the properties that are static. + * + * @member {object[]} + */ + this.staticProperties = []; + + for (var i = 0; i < properties.length; ++i) { + var property = properties[i]; + + // Make copy of properties object so that when we edit the offset it doesn't + // change all other instances of the object literal + property = { + attribute: property.attribute, + size: property.size, + uploadFunction: property.uploadFunction, + unsignedByte: property.unsignedByte, + offset: property.offset + }; + + if (dynamicPropertyFlags[i]) { + this.dynamicProperties.push(property); + } else { + this.staticProperties.push(property); + } + } + + this.staticStride = 0; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + + this.dynamicStride = 0; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + + this._updateID = 0; + + this.initBuffers(); + } + + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + + + ParticleBuffer.prototype.initBuffers = function initBuffers() { + var gl = this.gl; + var dynamicOffset = 0; + + /** + * Holds the indices of the geometry (quads) to draw + * + * @member {Uint16Array} + */ + this.indices = (0, _createIndicesForQuads2.default)(this.size); + this.indexBuffer = _pixiGlCore2.default.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW); + + this.dynamicStride = 0; + + for (var i = 0; i < this.dynamicProperties.length; ++i) { + var property = this.dynamicProperties[i]; + + property.offset = dynamicOffset; + dynamicOffset += property.size; + this.dynamicStride += property.size; + } + + var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); + + this.dynamicData = new Float32Array(dynBuffer); + this.dynamicDataUint32 = new Uint32Array(dynBuffer); + this.dynamicBuffer = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, dynBuffer, gl.STREAM_DRAW); + + // static // + var staticOffset = 0; + + this.staticStride = 0; + + for (var _i = 0; _i < this.staticProperties.length; ++_i) { + var _property = this.staticProperties[_i]; + + _property.offset = staticOffset; + staticOffset += _property.size; + this.staticStride += _property.size; + } + + var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); + + this.staticData = new Float32Array(statBuffer); + this.staticDataUint32 = new Uint32Array(statBuffer); + this.staticBuffer = _pixiGlCore2.default.GLBuffer.createVertexBuffer(gl, statBuffer, gl.STATIC_DRAW); + + this.vao = new _pixiGlCore2.default.VertexArrayObject(gl).addIndex(this.indexBuffer); + + for (var _i2 = 0; _i2 < this.dynamicProperties.length; ++_i2) { + var _property2 = this.dynamicProperties[_i2]; + + if (_property2.unsignedByte) { + this.vao.addAttribute(this.dynamicBuffer, _property2.attribute, gl.UNSIGNED_BYTE, true, this.dynamicStride * 4, _property2.offset * 4); + } else { + this.vao.addAttribute(this.dynamicBuffer, _property2.attribute, gl.FLOAT, false, this.dynamicStride * 4, _property2.offset * 4); + } + } + + for (var _i3 = 0; _i3 < this.staticProperties.length; ++_i3) { + var _property3 = this.staticProperties[_i3]; + + if (_property3.unsignedByte) { + this.vao.addAttribute(this.staticBuffer, _property3.attribute, gl.UNSIGNED_BYTE, true, this.staticStride * 4, _property3.offset * 4); + } else { + this.vao.addAttribute(this.staticBuffer, _property3.attribute, gl.FLOAT, false, this.staticStride * 4, _property3.offset * 4); + } + } + }; + + /** + * Uploads the dynamic properties. + * + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + + + ParticleBuffer.prototype.uploadDynamic = function uploadDynamic(children, startIndex, amount) { + for (var i = 0; i < this.dynamicProperties.length; i++) { + var property = this.dynamicProperties[i]; + + property.uploadFunction(children, startIndex, amount, property.unsignedByte ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset); + } + + this.dynamicBuffer.upload(); + }; + + /** + * Uploads the static properties. + * + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + + + ParticleBuffer.prototype.uploadStatic = function uploadStatic(children, startIndex, amount) { + for (var i = 0; i < this.staticProperties.length; i++) { + var property = this.staticProperties[i]; + + property.uploadFunction(children, startIndex, amount, property.unsignedByte ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset); + } + + this.staticBuffer.upload(); + }; + + /** + * Destroys the ParticleBuffer. + * + */ + + + ParticleBuffer.prototype.destroy = function destroy() { + this.dynamicProperties = null; + this.dynamicBuffer.destroy(); + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + + this.staticProperties = null; + this.staticBuffer.destroy(); + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + }; + + return ParticleBuffer; + }(); + + exports.default = ParticleBuffer; + + }, { "../../core/utils/createIndicesForQuads": 123, "pixi-gl-core": 15 }], 176: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _ParticleShader = require('./ParticleShader'); + + var _ParticleShader2 = _interopRequireDefault(_ParticleShader); + + var _ParticleBuffer = require('./ParticleBuffer'); + + var _ParticleBuffer2 = _interopRequireDefault(_ParticleBuffer); + + var _utils = require('../../core/utils'); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now + * share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleRenderer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java + */ + + /** + * + * @class + * @private + * @memberof PIXI + */ + var ParticleRenderer = function (_core$ObjectRenderer) { + _inherits(ParticleRenderer, _core$ObjectRenderer); + + /** + * @param {PIXI.WebGLRenderer} renderer - The renderer this sprite batch works for. + */ + function ParticleRenderer(renderer) { + _classCallCheck(this, ParticleRenderer); + + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + // and max number of element in the index buffer is 16384 * 6 = 98304 + // Creating a full index buffer, overhead is 98304 * 2 = 196Ko + // let numIndices = 98304; + + /** + * The default shader that is used if a sprite doesn't have a more specific one. + * + * @member {PIXI.Shader} + */ + var _this = _possibleConstructorReturn(this, _core$ObjectRenderer.call(this, renderer)); + + _this.shader = null; + + _this.indexBuffer = null; + + _this.properties = null; + + _this.tempMatrix = new core.Matrix(); + + _this.CONTEXT_UID = 0; + return _this; + } + + /** + * When there is a WebGL context change + * + * @private + */ + + + ParticleRenderer.prototype.onContextChange = function onContextChange() { + var gl = this.renderer.gl; + + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + + // setup default shader + this.shader = new _ParticleShader2.default(gl); + + this.properties = [ + // verticesData + { + attribute: this.shader.attributes.aVertexPosition, + size: 2, + uploadFunction: this.uploadVertices, + offset: 0 + }, + // positionData + { + attribute: this.shader.attributes.aPositionCoord, + size: 2, + uploadFunction: this.uploadPosition, + offset: 0 + }, + // rotationData + { + attribute: this.shader.attributes.aRotation, + size: 1, + uploadFunction: this.uploadRotation, + offset: 0 + }, + // uvsData + { + attribute: this.shader.attributes.aTextureCoord, + size: 2, + uploadFunction: this.uploadUvs, + offset: 0 + }, + // tintData + { + attribute: this.shader.attributes.aColor, + size: 1, + unsignedByte: true, + uploadFunction: this.uploadTint, + offset: 0 + }]; + }; + + /** + * Starts a new particle batch. + * + */ + + + ParticleRenderer.prototype.start = function start() { + this.renderer.bindShader(this.shader); + }; + + /** + * Renders the particle container object. + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + */ + + + ParticleRenderer.prototype.render = function render(container) { + var children = container.children; + var maxSize = container._maxSize; + var batchSize = container._batchSize; + var renderer = this.renderer; + var totalChildren = children.length; + + if (totalChildren === 0) { + return; + } else if (totalChildren > maxSize) { + totalChildren = maxSize; + } + + var buffers = container._glBuffers[renderer.CONTEXT_UID]; + + if (!buffers) { + buffers = container._glBuffers[renderer.CONTEXT_UID] = this.generateBuffers(container); + } + + var baseTexture = children[0]._texture.baseTexture; + + // if the uvs have not updated then no point rendering just yet! + this.renderer.setBlendMode(core.utils.correctBlendMode(container.blendMode, baseTexture.premultipliedAlpha)); + + var gl = renderer.gl; + + var m = container.worldTransform.copy(this.tempMatrix); + + m.prepend(renderer._activeRenderTarget.projectionMatrix); + + this.shader.uniforms.projectionMatrix = m.toArray(true); + + this.shader.uniforms.uColor = core.utils.premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.premultipliedAlpha); + + // make sure the texture is bound.. + this.shader.uniforms.uSampler = renderer.bindTexture(baseTexture); + + var updateStatic = false; + + // now lets upload and render the buffers.. + for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) { + var amount = totalChildren - i; + + if (amount > batchSize) { + amount = batchSize; + } + + if (j >= buffers.length) { + if (!container.autoResize) { + break; + } + buffers.push(this._generateOneMoreBuffer(container)); + } + + var buffer = buffers[j]; + + // we always upload the dynamic + buffer.uploadDynamic(children, i, amount); + + var bid = container._bufferUpdateIDs[j] || 0; + + updateStatic = updateStatic || buffer._updateID < bid; + // we only upload the static content when we have to! + if (updateStatic) { + buffer._updateID = container._updateID; + buffer.uploadStatic(children, i, amount); + } + + // bind the buffer + renderer.bindVao(buffer.vao); + buffer.vao.draw(gl.TRIANGLES, amount * 6); + } + }; + + /** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer[]} The buffers + */ + + + ParticleRenderer.prototype.generateBuffers = function generateBuffers(container) { + var gl = this.renderer.gl; + var buffers = []; + var size = container._maxSize; + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; + + for (var i = 0; i < size; i += batchSize) { + buffers.push(new _ParticleBuffer2.default(gl, this.properties, dynamicPropertyFlags, batchSize)); + } + + return buffers; + }; + + /** + * Creates one more particle buffer, because container has autoResize feature + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer} generated buffer + * @private + */ + + + ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer(container) { + var gl = this.renderer.gl; + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; + + return new _ParticleBuffer2.default(gl, this.properties, dynamicPropertyFlags, batchSize); + }; + + /** + * Uploads the verticies. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their vertices uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + + + ParticleRenderer.prototype.uploadVertices = function uploadVertices(children, startIndex, amount, array, stride, offset) { + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + + for (var i = 0; i < amount; ++i) { + var sprite = children[startIndex + i]; + var texture = sprite._texture; + var sx = sprite.scale.x; + var sy = sprite.scale.y; + var trim = texture.trim; + var orig = texture.orig; + + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the + // extra space before transforming the sprite coords.. + w1 = trim.x - sprite.anchor.x * orig.width; + w0 = w1 + trim.width; + + h1 = trim.y - sprite.anchor.y * orig.height; + h0 = h1 + trim.height; + } else { + w0 = orig.width * (1 - sprite.anchor.x); + w1 = orig.width * -sprite.anchor.x; + + h0 = orig.height * (1 - sprite.anchor.y); + h1 = orig.height * -sprite.anchor.y; + } + + array[offset] = w1 * sx; + array[offset + 1] = h1 * sy; + + array[offset + stride] = w0 * sx; + array[offset + stride + 1] = h1 * sy; + + array[offset + stride * 2] = w0 * sx; + array[offset + stride * 2 + 1] = h0 * sy; + + array[offset + stride * 3] = w1 * sx; + array[offset + stride * 3 + 1] = h0 * sy; + + offset += stride * 4; + } + }; + + /** + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their positions uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + + + ParticleRenderer.prototype.uploadPosition = function uploadPosition(children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { + var spritePosition = children[startIndex + i].position; + + array[offset] = spritePosition.x; + array[offset + 1] = spritePosition.y; + + array[offset + stride] = spritePosition.x; + array[offset + stride + 1] = spritePosition.y; + + array[offset + stride * 2] = spritePosition.x; + array[offset + stride * 2 + 1] = spritePosition.y; + + array[offset + stride * 3] = spritePosition.x; + array[offset + stride * 3 + 1] = spritePosition.y; + + offset += stride * 4; + } + }; + + /** + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + + + ParticleRenderer.prototype.uploadRotation = function uploadRotation(children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { + var spriteRotation = children[startIndex + i].rotation; + + array[offset] = spriteRotation; + array[offset + stride] = spriteRotation; + array[offset + stride * 2] = spriteRotation; + array[offset + stride * 3] = spriteRotation; + + offset += stride * 4; + } + }; + + /** + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + + + ParticleRenderer.prototype.uploadUvs = function uploadUvs(children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { + var textureUvs = children[startIndex + i]._texture._uvs; + + if (textureUvs) { + array[offset] = textureUvs.x0; + array[offset + 1] = textureUvs.y0; + + array[offset + stride] = textureUvs.x1; + array[offset + stride + 1] = textureUvs.y1; + + array[offset + stride * 2] = textureUvs.x2; + array[offset + stride * 2 + 1] = textureUvs.y2; + + array[offset + stride * 3] = textureUvs.x3; + array[offset + stride * 3 + 1] = textureUvs.y3; + + offset += stride * 4; + } else { + // TODO you know this can be easier! + array[offset] = 0; + array[offset + 1] = 0; + + array[offset + stride] = 0; + array[offset + stride + 1] = 0; + + array[offset + stride * 2] = 0; + array[offset + stride * 2 + 1] = 0; + + array[offset + stride * 3] = 0; + array[offset + stride * 3 + 1] = 0; + + offset += stride * 4; + } + } + }; + + /** + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + + + ParticleRenderer.prototype.uploadTint = function uploadTint(children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { + var sprite = children[startIndex + i]; + var premultiplied = sprite._texture.baseTexture.premultipliedAlpha; + var alpha = sprite.alpha; + // we dont call extra function if alpha is 1.0, that's faster + var argb = alpha < 1.0 && premultiplied ? (0, _utils.premultiplyTint)(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); + + array[offset] = argb; + array[offset + stride] = argb; + array[offset + stride * 2] = argb; + array[offset + stride * 3] = argb; + + offset += stride * 4; + } + }; + + /** + * Destroys the ParticleRenderer. + * + */ + + + ParticleRenderer.prototype.destroy = function destroy() { + if (this.renderer.gl) { + this.renderer.gl.deleteBuffer(this.indexBuffer); + } + + _core$ObjectRenderer.prototype.destroy.call(this); + + this.shader.destroy(); + + this.indices = null; + this.tempMatrix = null; + }; + + return ParticleRenderer; + }(core.ObjectRenderer); + + exports.default = ParticleRenderer; + + + core.WebGLRenderer.registerPlugin('particle', ParticleRenderer); + + }, { "../../core": 65, "../../core/utils": 125, "./ParticleBuffer": 175, "./ParticleShader": 177 }], 177: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _Shader2 = require('../../core/Shader'); + + var _Shader3 = _interopRequireDefault(_Shader2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * @class + * @extends PIXI.Shader + * @memberof PIXI + */ + var ParticleShader = function (_Shader) { + _inherits(ParticleShader, _Shader); + + /** + * @param {PIXI.Shader} gl - The webgl shader manager this shader works for. + */ + function ParticleShader(gl) { + _classCallCheck(this, ParticleShader); + + return _possibleConstructorReturn(this, _Shader.call(this, gl, + // vertex shader + ['attribute vec2 aVertexPosition;', 'attribute vec2 aTextureCoord;', 'attribute vec4 aColor;', 'attribute vec2 aPositionCoord;', 'attribute float aRotation;', 'uniform mat3 projectionMatrix;', 'uniform vec4 uColor;', 'varying vec2 vTextureCoord;', 'varying vec4 vColor;', 'void main(void){', ' float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);', ' float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);', ' vec2 v = vec2(x, y);', ' v = v + aPositionCoord;', ' gl_Position = vec4((projectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);', ' vTextureCoord = aTextureCoord;', ' vColor = aColor * uColor;', '}'].join('\n'), + // hello + ['varying vec2 vTextureCoord;', 'varying vec4 vColor;', 'uniform sampler2D uSampler;', 'void main(void){', ' vec4 color = texture2D(uSampler, vTextureCoord) * vColor;', ' gl_FragColor = color;', '}'].join('\n'))); + } + + return ParticleShader; + }(_Shader3.default); + + exports.default = ParticleShader; + + }, { "../../core/Shader": 44 }], 178: [function (require, module, exports) { + "use strict"; + + // References: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign + + if (!Math.sign) { + Math.sign = function mathSign(x) { + x = Number(x); + + if (x === 0 || isNaN(x)) { + return x; + } + + return x > 0 ? 1 : -1; + }; + } + + }, {}], 179: [function (require, module, exports) { + 'use strict'; + + // References: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger + + if (!Number.isInteger) { + Number.isInteger = function numberIsInteger(value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }; + } + + }, {}], 180: [function (require, module, exports) { + 'use strict'; + + var _objectAssign = require('object-assign'); + + var _objectAssign2 = _interopRequireDefault(_objectAssign); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!Object.assign) { + Object.assign = _objectAssign2.default; + } // References: + // https://github.com/sindresorhus/object-assign + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + + }, { "object-assign": 6 }], 181: [function (require, module, exports) { + 'use strict'; + + require('./Object.assign'); + + require('./requestAnimationFrame'); + + require('./Math.sign'); + + require('./Number.isInteger'); + + if (!window.ArrayBuffer) { + window.ArrayBuffer = Array; + } + + if (!window.Float32Array) { + window.Float32Array = Array; + } + + if (!window.Uint32Array) { + window.Uint32Array = Array; + } + + if (!window.Uint16Array) { + window.Uint16Array = Array; + } + + }, { "./Math.sign": 178, "./Number.isInteger": 179, "./Object.assign": 180, "./requestAnimationFrame": 182 }], 182: [function (require, module, exports) { + (function (global) { + 'use strict'; + + // References: + // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + // https://gist.github.com/1579671 + // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision + // https://gist.github.com/timhall/4078614 + // https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame + + // Expected to be used with Browserfiy + // Browserify automatically detects the use of `global` and passes the + // correct reference of `global`, `self`, and finally `window` + + var ONE_FRAME_TIME = 16; + + // Date.now + if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { + return new Date().getTime(); + }; + } + + // performance.now + if (!(global.performance && global.performance.now)) { + var startTime = Date.now(); + + if (!global.performance) { + global.performance = {}; + } + + global.performance.now = function () { + return Date.now() - startTime; + }; + } + + // requestAnimationFrame + var lastTime = Date.now(); + var vendors = ['ms', 'moz', 'webkit', 'o']; + + for (var x = 0; x < vendors.length && !global.requestAnimationFrame; ++x) { + var p = vendors[x]; + + global.requestAnimationFrame = global[p + 'RequestAnimationFrame']; + global.cancelAnimationFrame = global[p + 'CancelAnimationFrame'] || global[p + 'CancelRequestAnimationFrame']; + } + + if (!global.requestAnimationFrame) { + global.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + 'is not a function'); + } + + var currentTime = Date.now(); + var delay = ONE_FRAME_TIME + lastTime - currentTime; + + if (delay < 0) { + delay = 0; + } + + lastTime = currentTime; + + return setTimeout(function () { + lastTime = Date.now(); + callback(performance.now()); + }, delay); + }; + } + + if (!global.cancelAnimationFrame) { + global.cancelAnimationFrame = function (id) { + return clearTimeout(id); + }; + } + + }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + + }, {}], 183: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../core'); + + var core = _interopRequireWildcard(_core); + + var _CountLimiter = require('./limiters/CountLimiter'); + + var _CountLimiter2 = _interopRequireDefault(_CountLimiter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var SharedTicker = core.ticker.shared; + + /** + * Default number of uploads per frame using prepare plugin. + * + * @static + * @memberof PIXI.settings + * @name UPLOADS_PER_FRAME + * @type {number} + * @default 4 + */ + core.settings.UPLOADS_PER_FRAME = 4; + + /** + * The prepare manager provides functionality to upload content to the GPU. BasePrepare handles + * basic queuing functionality and is extended by {@link PIXI.prepare.WebGLPrepare} and {@link PIXI.prepare.CanvasPrepare} + * to provide preparation capabilities specific to their respective renderers. + * + * @example + * // Create a sprite + * const sprite = new PIXI.Sprite.fromImage('something.png'); + * + * // Load object into GPU + * app.renderer.plugins.prepare.upload(sprite, () => { + * + * //Texture(s) has been uploaded to GPU + * app.stage.addChild(sprite); + * + * }) + * + * @abstract + * @class + * @memberof PIXI.prepare + */ + + var BasePrepare = function () { + /** + * @param {PIXI.SystemRenderer} renderer - A reference to the current renderer + */ + function BasePrepare(renderer) { + var _this = this; + + _classCallCheck(this, BasePrepare); + + /** + * The limiter to be used to control how quickly items are prepared. + * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter} + */ + this.limiter = new _CountLimiter2.default(core.settings.UPLOADS_PER_FRAME); + + /** + * Reference to the renderer. + * @type {PIXI.SystemRenderer} + * @protected + */ + this.renderer = renderer; + + /** + * The only real difference between CanvasPrepare and WebGLPrepare is what they pass + * to upload hooks. That different parameter is stored here. + * @type {PIXI.prepare.CanvasPrepare|PIXI.WebGLRenderer} + * @protected + */ + this.uploadHookHelper = null; + + /** + * Collection of items to uploads at once. + * @type {Array<*>} + * @private + */ + this.queue = []; + + /** + * Collection of additional hooks for finding assets. + * @type {Array} + * @private + */ + this.addHooks = []; + + /** + * Collection of additional hooks for processing assets. + * @type {Array} + * @private + */ + this.uploadHooks = []; + + /** + * Callback to call after completed. + * @type {Array} + * @private + */ + this.completes = []; + + /** + * If prepare is ticking (running). + * @type {boolean} + * @private + */ + this.ticking = false; + + /** + * 'bound' call for prepareItems(). + * @type {Function} + * @private + */ + this.delayedTick = function () { + // unlikely, but in case we were destroyed between tick() and delayedTick() + if (!_this.queue) { + return; + } + _this.prepareItems(); + }; + + // hooks to find the correct texture + this.registerFindHook(findText); + this.registerFindHook(findTextStyle); + this.registerFindHook(findMultipleBaseTextures); + this.registerFindHook(findBaseTexture); + this.registerFindHook(findTexture); + + // upload hooks + this.registerUploadHook(drawText); + this.registerUploadHook(calculateTextStyle); + } + + /** + * Upload all the textures and graphics to the GPU. + * + * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - + * Either the container or display object to search for items to upload, the items to upload themselves, + * or the callback function, if items have been added using `prepare.add`. + * @param {Function} [done] - Optional callback when all queued uploads have completed + */ + + + BasePrepare.prototype.upload = function upload(item, done) { + if (typeof item === 'function') { + done = item; + item = null; + } + + // If a display object, search for items + // that we could upload + if (item) { + this.add(item); + } + + // Get the items for upload from the display + if (this.queue.length) { + if (done) { + this.completes.push(done); + } + + if (!this.ticking) { + this.ticking = true; + SharedTicker.addOnce(this.tick, this, core.UPDATE_PRIORITY.UTILITY); + } + } else if (done) { + done(); + } + }; + + /** + * Handle tick update + * + * @private + */ + + + BasePrepare.prototype.tick = function tick() { + setTimeout(this.delayedTick, 0); + }; + + /** + * Actually prepare items. This is handled outside of the tick because it will take a while + * and we do NOT want to block the current animation frame from rendering. + * + * @private + */ + + + BasePrepare.prototype.prepareItems = function prepareItems() { + this.limiter.beginFrame(); + // Upload the graphics + while (this.queue.length && this.limiter.allowedToUpload()) { + var item = this.queue[0]; + var uploaded = false; + + if (item && !item._destroyed) { + for (var i = 0, len = this.uploadHooks.length; i < len; i++) { + if (this.uploadHooks[i](this.uploadHookHelper, item)) { + this.queue.shift(); + uploaded = true; + break; + } + } + } + + if (!uploaded) { + this.queue.shift(); + } + } + + // We're finished + if (!this.queue.length) { + this.ticking = false; + + var completes = this.completes.slice(0); + + this.completes.length = 0; + + for (var _i = 0, _len = completes.length; _i < _len; _i++) { + completes[_i](); + } + } else { + // if we are not finished, on the next rAF do this again + SharedTicker.addOnce(this.tick, this, core.UPDATE_PRIORITY.UTILITY); + } + }; + + /** + * Adds hooks for finding items. + * + * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` + * function must return `true` if it was able to add item to the queue. + * @return {PIXI.BasePrepare} Instance of plugin for chaining. + */ + + + BasePrepare.prototype.registerFindHook = function registerFindHook(addHook) { + if (addHook) { + this.addHooks.push(addHook); + } + + return this; + }; + + /** + * Adds hooks for uploading items. + * + * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and + * function must return `true` if it was able to handle upload of item. + * @return {PIXI.BasePrepare} Instance of plugin for chaining. + */ + + + BasePrepare.prototype.registerUploadHook = function registerUploadHook(uploadHook) { + if (uploadHook) { + this.uploadHooks.push(uploadHook); + } + + return this; + }; + + /** + * Manually add an item to the uploading queue. + * + * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to + * add to the queue + * @return {PIXI.CanvasPrepare} Instance of plugin for chaining. + */ + + + BasePrepare.prototype.add = function add(item) { + // Add additional hooks for finding elements on special + // types of objects that + for (var i = 0, len = this.addHooks.length; i < len; i++) { + if (this.addHooks[i](item, this.queue)) { + break; + } + } + + // Get childen recursively + if (item instanceof core.Container) { + for (var _i2 = item.children.length - 1; _i2 >= 0; _i2--) { + this.add(item.children[_i2]); + } + } + + return this; + }; + + /** + * Destroys the plugin, don't use after this. + * + */ + + + BasePrepare.prototype.destroy = function destroy() { + if (this.ticking) { + SharedTicker.remove(this.tick, this); + } + this.ticking = false; + this.addHooks = null; + this.uploadHooks = null; + this.renderer = null; + this.completes = null; + this.queue = null; + this.limiter = null; + this.uploadHookHelper = null; + }; + + return BasePrepare; + }(); + + /** + * Built-in hook to find multiple textures from objects like AnimatedSprites. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + + + exports.default = BasePrepare; + function findMultipleBaseTextures(item, queue) { + var result = false; + + // Objects with mutliple textures + if (item && item._textures && item._textures.length) { + for (var i = 0; i < item._textures.length; i++) { + if (item._textures[i] instanceof core.Texture) { + var baseTexture = item._textures[i].baseTexture; + + if (queue.indexOf(baseTexture) === -1) { + queue.push(baseTexture); + result = true; + } + } + } + } + + return result; + } + + /** + * Built-in hook to find BaseTextures from Sprites. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findBaseTexture(item, queue) { + // Objects with textures, like Sprites/Text + if (item instanceof core.BaseTexture) { + if (queue.indexOf(item) === -1) { + queue.push(item); + } + + return true; + } + + return false; + } + + /** + * Built-in hook to find textures from objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findTexture(item, queue) { + if (item._texture && item._texture instanceof core.Texture) { + var texture = item._texture.baseTexture; + + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + + return true; + } + + return false; + } + + /** + * Built-in hook to draw PIXI.Text to its texture. + * + * @private + * @param {PIXI.WebGLRenderer|PIXI.CanvasPrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function drawText(helper, item) { + if (item instanceof core.Text) { + // updating text will return early if it is not dirty + item.updateText(true); + + return true; + } + + return false; + } + + /** + * Built-in hook to calculate a text style for a PIXI.Text object. + * + * @private + * @param {PIXI.WebGLRenderer|PIXI.CanvasPrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function calculateTextStyle(helper, item) { + if (item instanceof core.TextStyle) { + var font = item.toFontString(); + + core.TextMetrics.measureFont(font); + + return true; + } + + return false; + } + + /** + * Built-in hook to find Text objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Text object was found. + */ + function findText(item, queue) { + if (item instanceof core.Text) { + // push the text style to prepare it - this can be really expensive + if (queue.indexOf(item.style) === -1) { + queue.push(item.style); + } + // also push the text object so that we can render it (to canvas/texture) if needed + if (queue.indexOf(item) === -1) { + queue.push(item); + } + // also push the Text's texture for upload to GPU + var texture = item._texture.baseTexture; + + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + + return true; + } + + return false; + } + + /** + * Built-in hook to find TextStyle objects. + * + * @private + * @param {PIXI.TextStyle} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.TextStyle object was found. + */ + function findTextStyle(item, queue) { + if (item instanceof core.TextStyle) { + if (queue.indexOf(item) === -1) { + queue.push(item); + } + + return true; + } + + return false; + } + + }, { "../core": 65, "./limiters/CountLimiter": 186 }], 184: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _BasePrepare2 = require('../BasePrepare'); + + var _BasePrepare3 = _interopRequireDefault(_BasePrepare2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var CANVAS_START_SIZE = 16; + + /** + * The prepare manager provides functionality to upload content to the GPU + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. + * This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * + * @class + * @extends PIXI.prepare.BasePrepare + * @memberof PIXI.prepare + */ + + var CanvasPrepare = function (_BasePrepare) { + _inherits(CanvasPrepare, _BasePrepare); + + /** + * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer + */ + function CanvasPrepare(renderer) { + _classCallCheck(this, CanvasPrepare); + + var _this = _possibleConstructorReturn(this, _BasePrepare.call(this, renderer)); + + _this.uploadHookHelper = _this; + + /** + * An offline canvas to render textures to + * @type {HTMLCanvasElement} + * @private + */ + _this.canvas = document.createElement('canvas'); + _this.canvas.width = CANVAS_START_SIZE; + _this.canvas.height = CANVAS_START_SIZE; + + /** + * The context to the canvas + * @type {CanvasRenderingContext2D} + * @private + */ + _this.ctx = _this.canvas.getContext('2d'); + + // Add textures to upload + _this.registerUploadHook(uploadBaseTextures); + return _this; + } + + /** + * Destroys the plugin, don't use after this. + * + */ + + + CanvasPrepare.prototype.destroy = function destroy() { + _BasePrepare.prototype.destroy.call(this); + this.ctx = null; + this.canvas = null; + }; + + return CanvasPrepare; + }(_BasePrepare3.default); + + /** + * Built-in hook to upload PIXI.Texture objects to the GPU. + * + * @private + * @param {*} prepare - Instance of CanvasPrepare + * @param {*} item - Item to check + * @return {boolean} If item was uploaded. + */ + + + exports.default = CanvasPrepare; + function uploadBaseTextures(prepare, item) { + if (item instanceof core.BaseTexture) { + var image = item.source; + + // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone. + // So if the width or height is equal to zero then use the canvas size + // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions. + var imageWidth = image.width === 0 ? prepare.canvas.width : Math.min(prepare.canvas.width, image.width); + var imageHeight = image.height === 0 ? prepare.canvas.height : Math.min(prepare.canvas.height, image.height); + + // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU + // A smaller draw can be faster. + prepare.ctx.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, prepare.canvas.width, prepare.canvas.height); + + return true; + } + + return false; + } + + core.CanvasRenderer.registerPlugin('prepare', CanvasPrepare); + + }, { "../../core": 65, "../BasePrepare": 183 }], 185: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _WebGLPrepare = require('./webgl/WebGLPrepare'); + + Object.defineProperty(exports, 'webgl', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_WebGLPrepare).default; + } + }); + + var _CanvasPrepare = require('./canvas/CanvasPrepare'); + + Object.defineProperty(exports, 'canvas', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CanvasPrepare).default; + } + }); + + var _BasePrepare = require('./BasePrepare'); + + Object.defineProperty(exports, 'BasePrepare', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_BasePrepare).default; + } + }); + + var _CountLimiter = require('./limiters/CountLimiter'); + + Object.defineProperty(exports, 'CountLimiter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_CountLimiter).default; + } + }); + + var _TimeLimiter = require('./limiters/TimeLimiter'); + + Object.defineProperty(exports, 'TimeLimiter', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_TimeLimiter).default; + } + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + }, { "./BasePrepare": 183, "./canvas/CanvasPrepare": 184, "./limiters/CountLimiter": 186, "./limiters/TimeLimiter": 187, "./webgl/WebGLPrepare": 188 }], 186: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * CountLimiter limits the number of items handled by a {@link PIXI.prepare.BasePrepare} to a specified + * number of items per frame. + * + * @class + * @memberof PIXI + */ + var CountLimiter = function () { + /** + * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame. + */ + function CountLimiter(maxItemsPerFrame) { + _classCallCheck(this, CountLimiter); + + /** + * The maximum number of items that can be prepared each frame. + * @private + */ + this.maxItemsPerFrame = maxItemsPerFrame; + /** + * The number of items that can be prepared in the current frame. + * @type {number} + * @private + */ + this.itemsLeft = 0; + } + + /** + * Resets any counting properties to start fresh on a new frame. + */ + + + CountLimiter.prototype.beginFrame = function beginFrame() { + this.itemsLeft = this.maxItemsPerFrame; + }; + + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + + + CountLimiter.prototype.allowedToUpload = function allowedToUpload() { + return this.itemsLeft-- > 0; + }; + + return CountLimiter; + }(); + + exports.default = CountLimiter; + + }, {}], 187: [function (require, module, exports) { + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified + * number of milliseconds per frame. + * + * @class + * @memberof PIXI + */ + var TimeLimiter = function () { + /** + * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. + */ + function TimeLimiter(maxMilliseconds) { + _classCallCheck(this, TimeLimiter); + + /** + * The maximum milliseconds that can be spent preparing items each frame. + * @private + */ + this.maxMilliseconds = maxMilliseconds; + /** + * The start time of the current frame. + * @type {number} + * @private + */ + this.frameStart = 0; + } + + /** + * Resets any counting properties to start fresh on a new frame. + */ + + + TimeLimiter.prototype.beginFrame = function beginFrame() { + this.frameStart = Date.now(); + }; + + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + + + TimeLimiter.prototype.allowedToUpload = function allowedToUpload() { + return Date.now() - this.frameStart < this.maxMilliseconds; + }; + + return TimeLimiter; + }(); + + exports.default = TimeLimiter; + + }, {}], 188: [function (require, module, exports) { + 'use strict'; + + exports.__esModule = true; + + var _core = require('../../core'); + + var core = _interopRequireWildcard(_core); + + var _BasePrepare2 = require('../BasePrepare'); + + var _BasePrepare3 = _interopRequireDefault(_BasePrepare2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + /** + * The prepare manager provides functionality to upload content to the GPU. + * + * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * + * @class + * @extends PIXI.prepare.BasePrepare + * @memberof PIXI.prepare + */ + var WebGLPrepare = function (_BasePrepare) { + _inherits(WebGLPrepare, _BasePrepare); + + /** + * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer + */ + function WebGLPrepare(renderer) { + _classCallCheck(this, WebGLPrepare); + + var _this = _possibleConstructorReturn(this, _BasePrepare.call(this, renderer)); + + _this.uploadHookHelper = _this.renderer; + + // Add textures and graphics to upload + _this.registerFindHook(findGraphics); + _this.registerUploadHook(uploadBaseTextures); + _this.registerUploadHook(uploadGraphics); + return _this; + } + + return WebGLPrepare; + }(_BasePrepare3.default); + /** + * Built-in hook to upload PIXI.Texture objects to the GPU. + * + * @private + * @param {PIXI.WebGLRenderer} renderer - instance of the webgl renderer + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + + + exports.default = WebGLPrepare; + function uploadBaseTextures(renderer, item) { + if (item instanceof core.BaseTexture) { + // if the texture already has a GL texture, then the texture has been prepared or rendered + // before now. If the texture changed, then the changer should be calling texture.update() which + // reuploads the texture without need for preparing it again + if (!item._glTextures[renderer.CONTEXT_UID]) { + renderer.textureManager.updateTexture(item); + } + + return true; + } + + return false; + } + + /** + * Built-in hook to upload PIXI.Graphics to the GPU. + * + * @private + * @param {PIXI.WebGLRenderer} renderer - instance of the webgl renderer + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function uploadGraphics(renderer, item) { + if (item instanceof core.Graphics) { + // if the item is not dirty and already has webgl data, then it got prepared or rendered + // before now and we shouldn't waste time updating it again + if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID]) { + renderer.plugins.graphics.updateGraphics(item); + } + + return true; + } + + return false; + } + + /** + * Built-in hook to find graphics. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Graphics object was found. + */ + function findGraphics(item, queue) { + if (item instanceof core.Graphics) { + queue.push(item); + + return true; + } + + return false; + } + + core.WebGLRenderer.registerPlugin('prepare', WebGLPrepare); + + }, { "../../core": 65, "../BasePrepare": 183 }], 189: [function (require, module, exports) { + (function (global) { + 'use strict'; + + exports.__esModule = true; + exports.loader = exports.prepare = exports.particles = exports.mesh = exports.loaders = exports.interaction = exports.filters = exports.extras = exports.extract = exports.accessibility = undefined; + + var _polyfill = require('./polyfill'); + + Object.keys(_polyfill).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _polyfill[key]; + } + }); + }); + + var _core = require('./core'); + + Object.keys(_core).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _core[key]; + } + }); + }); + + var _deprecation = require('./deprecation'); + + var _deprecation2 = _interopRequireDefault(_deprecation); + + var _accessibility = require('./accessibility'); + + var accessibility = _interopRequireWildcard(_accessibility); + + var _extract = require('./extract'); + + var extract = _interopRequireWildcard(_extract); + + var _extras = require('./extras'); + + var extras = _interopRequireWildcard(_extras); + + var _filters = require('./filters'); + + var filters = _interopRequireWildcard(_filters); + + var _interaction = require('./interaction'); + + var interaction = _interopRequireWildcard(_interaction); + + var _loaders = require('./loaders'); + + var loaders = _interopRequireWildcard(_loaders); + + var _mesh = require('./mesh'); + + var mesh = _interopRequireWildcard(_mesh); + + var _particles = require('./particles'); + + var particles = _interopRequireWildcard(_particles); + + var _prepare = require('./prepare'); + + var prepare = _interopRequireWildcard(_prepare); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + // export core + _core.utils.mixins.performMixins(); + + /** + * Alias for {@link PIXI.loaders.shared}. + * @name loader + * @memberof PIXI + * @type {PIXI.loader.Loader} + */ + + + // handle mixins now, after all code has been added, including deprecation + + + // export libs + // import polyfills. Done as an export to make sure polyfills are imported first + var loader = loaders.shared || null; + + exports.accessibility = accessibility; + exports.extract = extract; + exports.extras = extras; + exports.filters = filters; + exports.interaction = interaction; + exports.loaders = loaders; + exports.mesh = mesh; + exports.particles = particles; + exports.prepare = prepare; + exports.loader = loader; + + // Apply the deprecations + + if (typeof _deprecation2.default === 'function') { + (0, _deprecation2.default)(exports); + } + + // Always export PixiJS globally. + global.PIXI = exports; // eslint-disable-line + + }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + + }, { "./accessibility": 42, "./core": 65, "./deprecation": 131, "./extract": 133, "./extras": 141, "./filters": 153, "./interaction": 159, "./loaders": 162, "./mesh": 171, "./particles": 174, "./polyfill": 181, "./prepare": 185 }] + }, {}, [189])(189) +}); - for (var k in this.resources) { - var res = this.resources[k]; - if (res._onLoadBinding) { - res._onLoadBinding.detach(); - } - - if (res.isLoading) { - res.abort(); - } - } - - this.resources = {}; - return this; - } - /** - * Starts loading the queued resources. - * - * @param {function} [cb] - Optional callback that will be bound to the `complete` event. - * @return {this} Returns itself. - */ - ; - - _proto.load = function load(cb) { - // register complete callback if they pass one - if (typeof cb === 'function') { - this.onComplete.once(cb); - } // if the queue has already started we are done here - - - if (this.loading) { - return this; - } - - if (this._queue.idle()) { - this._onStart(); - - this._onComplete(); - } else { - // distribute progress chunks - var numTasks = this._queue._tasks.length; - var chunk = MAX_PROGRESS / numTasks; - - for (var i = 0; i < this._queue._tasks.length; ++i) { - this._queue._tasks[i].data.progressChunk = chunk; - } // notify we are starting - - - this._onStart(); // start loading - - - this._queue.resume(); - } - - return this; - } - /** - * The number of resources to load concurrently. - * - * @member {number} - * @default 10 - */ - ; - - /** - * Prepares a url for usage based on the configuration of this object - * - * @private - * @param {string} url - The url to prepare. - * @return {string} The prepared url. - */ - _proto._prepareUrl = function _prepareUrl(url) { - var parsedUrl = parseUri(url, { - strictMode: true - }); - var result; // absolute url, just use it as is. - - if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { - result = url; - } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween - else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { - result = this.baseUrl + "/" + url; - } else { - result = this.baseUrl + url; - } // if we need to add a default querystring, there is a bit more work - - - if (this.defaultQueryString) { - var hash = rgxExtractUrlHash.exec(result)[0]; - result = result.substr(0, result.length - hash.length); - - if (result.indexOf('?') !== -1) { - result += "&" + this.defaultQueryString; - } else { - result += "?" + this.defaultQueryString; - } - - result += hash; - } - - return result; - } - /** - * Loads a single resource. - * - * @private - * @param {Resource} resource - The resource to load. - * @param {function} dequeue - The function to call when we need to dequeue this item. - */ - ; - - _proto._loadResource = function _loadResource(resource, dequeue) { - var _this2 = this; - - resource._dequeue = dequeue; // run before middleware - - eachSeries(this._beforeMiddleware, function (fn, next) { - fn.call(_this2, resource, function () { - // if the before middleware marks the resource as complete, - // break and don't process any more before middleware - next(resource.isComplete ? {} : null); - }); - }, function () { - if (resource.isComplete) { - _this2._onLoad(resource); - } else { - resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); - resource.load(); - } - }, true); - } - /** - * Called once loading has started. - * - * @private - */ - ; - - _proto._onStart = function _onStart() { - this.progress = 0; - this.loading = true; - this.onStart.dispatch(this); - } - /** - * Called once each resource has loaded. - * - * @private - */ - ; - - _proto._onComplete = function _onComplete() { - this.progress = MAX_PROGRESS; - this.loading = false; - this.onComplete.dispatch(this, this.resources); - } - /** - * Called each time a resources is loaded. - * - * @private - * @param {Resource} resource - The resource that was loaded - */ - ; - - _proto._onLoad = function _onLoad(resource) { - var _this3 = this; - - resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed - - this._resourcesParsing.push(resource); - - resource._dequeue(); // run all the after middleware for this resource - - - eachSeries(this._afterMiddleware, function (fn, next) { - fn.call(_this3, resource, next); - }, function () { - resource.onAfterMiddleware.dispatch(resource); - _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); - - _this3.onProgress.dispatch(_this3, resource); - - if (resource.error) { - _this3.onError.dispatch(resource.error, _this3, resource); - } else { - _this3.onLoad.dispatch(_this3, resource); - } - - _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check - - - if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { - _this3._onComplete(); - } - }, true); - }; - - _createClass(Loader, [{ - key: "concurrency", - get: function get() { - return this._queue.concurrency; - } // eslint-disable-next-line require-jsdoc - , - set: function set(concurrency) { - this._queue.concurrency = concurrency; - } - }]); - - return Loader; - }(); - /** - * A default array of middleware to run before loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - - Loader._defaultBeforeMiddleware = []; - /** - * A default array of middleware to run after loading each resource. - * Each of these middlewares are added to any new Loader instances when they are created. - * - * @private - * @member {function[]} - */ - - Loader._defaultAfterMiddleware = []; - /** - * Sets up a middleware function that will run *before* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - Loader.pre = function LoaderPreStatic(fn) { - Loader._defaultBeforeMiddleware.push(fn); - - return Loader; - }; - /** - * Sets up a middleware function that will run *after* the - * resource is loaded. - * - * @static - * @param {function} fn - The middleware function to register. - * @return {Loader} Returns itself. - */ - - - Loader.use = function LoaderUseStatic(fn) { - Loader._defaultAfterMiddleware.push(fn); - - return Loader; - }; - - /*! - * @pixi/loaders - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/loaders is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Reference to **{@link https://github.com/englercj/resource-loader - * resource-loader}**'s Resource class. - * @see http://englercj.github.io/resource-loader/Resource.html - * @class LoaderResource - * @memberof PIXI - */ - var LoaderResource = Resource$1; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$3 = function(d, b) { - extendStatics$3 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$3(d, b); - }; - - function __extends$3(d, b) { - extendStatics$3(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Loader plugin for handling Texture resources. - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var TextureLoader = /** @class */ (function () { - function TextureLoader() { - } - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - TextureLoader.use = function (resource, next) { - // create a new texture if the data is an Image object - if (resource.data && resource.type === Resource$1.TYPE.IMAGE) { - resource.texture = Texture.fromLoader(resource.data, resource.url, resource.name); - } - next(); - }; - return TextureLoader; - }()); - - /** - * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader - * - * ```js - * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. - * //or - * const loader = new PIXI.Loader(); // you can also create your own if you want - * - * const sprites = {}; - * - * // Chainable `add` to enqueue a resource - * loader.add('bunny', 'data/bunny.png') - * .add('spaceship', 'assets/spritesheet.json'); - * loader.add('scoreFont', 'assets/score.fnt'); - * - * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. - * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). - * loader.pre(cachingMiddleware); - * - * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. - * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). - * loader.use(parsingMiddleware); - * - * // The `load` method loads the queue of resources, and calls the passed in callback called once all - * // resources have loaded. - * loader.load((loader, resources) => { - * // resources is an object where the key is the name of the resource loaded and the value is the resource object. - * // They have a couple default properties: - * // - `url`: The URL that the resource was loaded from - * // - `error`: The error that happened when trying to load (if any) - * // - `data`: The raw data that was loaded - * // also may contain other properties based on the middleware that runs. - * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); - * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); - * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); - * }); - * - * // throughout the process multiple signals can be dispatched. - * loader.onProgress.add(() => {}); // called once per loaded/errored file - * loader.onError.add(() => {}); // called once per errored file - * loader.onLoad.add(() => {}); // called once per loaded file - * loader.onComplete.add(() => {}); // called once when the queued resources all load. - * ``` - * - * @see https://github.com/englercj/resource-loader - * - * @class Loader - * @memberof PIXI - * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. - * @param {number} [concurrency=10] - The number of resources to load concurrently. - */ - var Loader$1 = /** @class */ (function (_super) { - __extends$3(Loader, _super); - function Loader(baseUrl, concurrency) { - var _this = _super.call(this, baseUrl, concurrency) || this; - for (var i = 0; i < Loader._plugins.length; ++i) { - var plugin = Loader._plugins[i]; - var pre = plugin.pre, use = plugin.use; - if (pre) { - _this.pre(pre); - } - if (use) { - _this.use(use); - } - } - /** - * If this loader cannot be destroyed. - * @member {boolean} - * @default false - * @private - */ - _this._protected = false; - return _this; - } - /** - * Destroy the loader, removes references. - * @memberof PIXI.Loader# - * @method destroy - * @public - */ - Loader.prototype.destroy = function () { - if (!this._protected) { - this.reset(); - } - }; - Object.defineProperty(Loader, "shared", { - /** - * A premade instance of the loader that can be used to load resources. - * @name shared - * @type {PIXI.Loader} - * @static - * @memberof PIXI.Loader - */ - get: function () { - var shared = Loader._shared; - if (!shared) { - shared = new Loader(); - shared._protected = true; - Loader._shared = shared; - } - return shared; - }, - enumerable: false, - configurable: true - }); - /** - * Adds a Loader plugin for the global shared loader and all - * new Loader instances created. - * - * @static - * @method registerPlugin - * @memberof PIXI.Loader - * @param {PIXI.ILoaderPlugin} plugin - The plugin to add - * @return {PIXI.Loader} Reference to PIXI.Loader for chaining - */ - Loader.registerPlugin = function (plugin) { - Loader._plugins.push(plugin); - if (plugin.add) { - plugin.add(); - } - return Loader; - }; - /** - * Collection of all installed `use` middleware for Loader. - * - * @static - * @member {Array} _plugins - * @memberof PIXI.Loader - * @private - */ - Loader._plugins = []; - return Loader; - }(Loader)); - // parse any blob into more usable objects (e.g. Image) - Loader$1.registerPlugin({ use: index$1.parsing }); - // parse any Image objects into textures - Loader$1.registerPlugin(TextureLoader); - /** - * Plugin to be installed for handling specific Loader resources. - * - * @memberof PIXI - * @typedef {object} ILoaderPlugin - * @property {function} [add] - Function to call immediate after registering plugin. - * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the - * arguments for this are `(resource, next)` - * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the - * arguments for this are `(resource, next)` - */ - /** - * @memberof PIXI.Loader - * @typedef {object} ICallbackID - */ - /** - * @memberof PIXI.Loader - * @typedef {function} ISignalCallback - * @param {function} callback - Callback function - * @param {object} [context] - Context - * @returns {ICallbackID} - CallbackID - */ - /** - * @memberof PIXI.Loader - * @typedef {function} ISignalDetach - * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods - */ - /** - * @memberof PIXI.Loader - * @typedef ILoaderSignal - * @property {ISignalCallback} add - Register callback - * @property {ISignalCallback} once - Register oneshot callback - * @property {ISignalDetach} detach - Detach specific callback by ID - */ - /** - * @memberof PIXI.Loader - * @callback loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched when the loader begins to loading process. - * @member {PIXI.Loader.ILoaderSignal} onStart - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per loaded or errored resource. - * @member {PIXI.Loader.ILoaderSignal} onProgress - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per errored resource. - * @member {PIXI.Loader.ILoaderSignal} onError - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched once per loaded resource. - * @member {PIXI.Loader.ILoaderSignal} onLoad - */ - /** - * @memberof PIXI.Loader# - * @description Dispatched when completely loaded all resources. - * @member {PIXI.Loader.ILoaderSignal} onComplete - */ - - /** - * Application plugin for supporting loader option. Installing the LoaderPlugin - * is not necessary if using **pixi.js** or **pixi.js-legacy**. - * @example - * import {AppLoaderPlugin} from '@pixi/loaders'; - * import {Application} from '@pixi/app'; - * Application.registerPlugin(AppLoaderPlugin); - * @class - * @memberof PIXI - */ - var AppLoaderPlugin = /** @class */ (function () { - function AppLoaderPlugin() { - } - /** - * Called on application constructor - * @param {object} options - * @private - */ - AppLoaderPlugin.init = function (options) { - options = Object.assign({ - sharedLoader: false, - }, options); - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); - }; - /** - * Called when application destroyed - * @private - */ - AppLoaderPlugin.destroy = function () { - if (this.loader) { - this.loader.destroy(); - this.loader = null; - } - }; - return AppLoaderPlugin; - }()); - - /*! - * @pixi/particles - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/particles is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$4 = function(d, b) { - extendStatics$4 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$4(d, b); - }; - - function __extends$4(d, b) { - extendStatics$4(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. - * - * The tradeoff of the ParticleContainer is that most advanced functionality will not work. - * ParticleContainer implements the basic object transform (position, scale, rotation) - * and some advanced functionality like tint (as of v4.5.6). - * - * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. - * - * It's extremely easy to use: - * ```js - * let container = new ParticleContainer(); - * - * for (let i = 0; i < 100; ++i) - * { - * let sprite = PIXI.Sprite.from("myImage.png"); - * container.addChild(sprite); - * } - * ``` - * - * And here you have a hundred sprites that will be rendered at the speed of light. - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var ParticleContainer = /** @class */ (function (_super) { - __extends$4(ParticleContainer, _super); - /** - * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container. - * Affects size of allocated buffers. - * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied. - * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied. - * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`. - * @param {boolean} [properties.position=true] - When true, position be uploaded and applied. - * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied. - * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied. - * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied. - * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead. - * @param {boolean} [autoResize=false] - If true, container allocates more batches in case - * there are more than `maxSize` particles. - */ - function ParticleContainer(maxSize, properties, batchSize, autoResize) { - if (maxSize === void 0) { maxSize = 1500; } - if (batchSize === void 0) { batchSize = 16384; } - if (autoResize === void 0) { autoResize = false; } - var _this = _super.call(this) || this; - // Making sure the batch size is valid - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - var maxBatchSize = 16384; - if (batchSize > maxBatchSize) { - batchSize = maxBatchSize; - } - /** - * Set properties to be dynamic (true) / static (false) - * - * @member {boolean[]} - * @private - */ - _this._properties = [false, true, false, false, false]; - /** - * @member {number} - * @private - */ - _this._maxSize = maxSize; - /** - * @member {number} - * @private - */ - _this._batchSize = batchSize; - /** - * @member {Array} - * @private - */ - _this._buffers = null; - /** - * for every batch stores _updateID corresponding to the last change in that batch - * @member {number[]} - * @private - */ - _this._bufferUpdateIDs = []; - /** - * when child inserted, removed or changes position this number goes up - * @member {number[]} - * @private - */ - _this._updateID = 0; - /** - * @member {boolean} - * - */ - _this.interactiveChildren = false; - /** - * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` - * to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - _this.blendMode = exports.BLEND_MODES.NORMAL; - /** - * If true, container allocates more batches in case there are more than `maxSize` particles. - * @member {boolean} - * @default false - */ - _this.autoResize = autoResize; - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * Default to true here as performance is usually the priority for particles. - * - * @member {boolean} - * @default true - */ - _this.roundPixels = true; - /** - * The texture used to render the children. - * - * @readonly - * @member {PIXI.BaseTexture} - */ - _this.baseTexture = null; - _this.setProperties(properties); - /** - * The tint applied to the container. - * This is a hex value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 0xFFFFFF - */ - _this._tint = 0; - _this.tintRgb = new Float32Array(4); - _this.tint = 0xFFFFFF; - return _this; - } - /** - * Sets the private properties array to dynamic / static based on the passed properties object - * - * @param {object} properties - The properties to be uploaded - */ - ParticleContainer.prototype.setProperties = function (properties) { - if (properties) { - this._properties[0] = 'vertices' in properties || 'scale' in properties - ? !!properties.vertices || !!properties.scale : this._properties[0]; - this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; - this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; - this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; - this._properties[4] = 'tint' in properties || 'alpha' in properties - ? !!properties.tint || !!properties.alpha : this._properties[4]; - } - }; - /** - * Updates the object transform for rendering - * - * @private - */ - ParticleContainer.prototype.updateTransform = function () { - // TODO don't need to! - this.displayObjectUpdateTransform(); - }; - Object.defineProperty(ParticleContainer.prototype, "tint", { - /** - * The tint applied to the container. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - hex2rgb(value, this.tintRgb); - }, - enumerable: false, - configurable: true - }); - /** - * Renders the container using the WebGL renderer - * - * @private - * @param {PIXI.Renderer} renderer - The webgl renderer - */ - ParticleContainer.prototype.render = function (renderer) { - var _this = this; - if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { - return; - } - if (!this.baseTexture) { - this.baseTexture = this.children[0]._texture.baseTexture; - if (!this.baseTexture.valid) { - this.baseTexture.once('update', function () { return _this.onChildrenChange(0); }); - } - } - renderer.batch.setObjectRenderer(renderer.plugins.particle); - renderer.plugins.particle.render(this); - }; - /** - * Set the flag that static data should be updated to true - * - * @private - * @param {number} smallestChildIndex - The smallest child index - */ - ParticleContainer.prototype.onChildrenChange = function (smallestChildIndex) { - var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); - while (this._bufferUpdateIDs.length < bufferIndex) { - this._bufferUpdateIDs.push(0); - } - this._bufferUpdateIDs[bufferIndex] = ++this._updateID; - }; - ParticleContainer.prototype.dispose = function () { - if (this._buffers) { - for (var i = 0; i < this._buffers.length; ++i) { - this._buffers[i].destroy(); - } - this._buffers = null; - } - }; - /** - * Destroys the container - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their - * destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - ParticleContainer.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.dispose(); - this._properties = null; - this._buffers = null; - this._bufferUpdateIDs = null; - }; - return ParticleContainer; - }(Container)); - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that - * they now share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleBuffer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java - */ - /** - * The particle buffer manages the static and dynamic buffers for a particle container. - * - * @class - * @private - * @memberof PIXI - */ - var ParticleBuffer = /** @class */ (function () { - /** - * @private - * @param {object} properties - The properties to upload. - * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. - * @param {number} size - The size of the batch. - */ - function ParticleBuffer(properties, dynamicPropertyFlags, size) { - this.geometry = new Geometry(); - this.indexBuffer = null; - /** - * The number of particles the buffer can hold - * - * @private - * @member {number} - */ - this.size = size; - /** - * A list of the properties that are dynamic. - * - * @private - * @member {object[]} - */ - this.dynamicProperties = []; - /** - * A list of the properties that are static. - * - * @private - * @member {object[]} - */ - this.staticProperties = []; - for (var i = 0; i < properties.length; ++i) { - var property = properties[i]; - // Make copy of properties object so that when we edit the offset it doesn't - // change all other instances of the object literal - property = { - attributeName: property.attributeName, - size: property.size, - uploadFunction: property.uploadFunction, - type: property.type || exports.TYPES.FLOAT, - offset: property.offset, - }; - if (dynamicPropertyFlags[i]) { - this.dynamicProperties.push(property); - } - else { - this.staticProperties.push(property); - } - } - this.staticStride = 0; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - this.dynamicStride = 0; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - this._updateID = 0; - this.initBuffers(); - } - /** - * Sets up the renderer context and necessary buffers. - * - * @private - */ - ParticleBuffer.prototype.initBuffers = function () { - var geometry = this.geometry; - var dynamicOffset = 0; - /** - * Holds the indices of the geometry (quads) to draw - * - * @member {Uint16Array} - * @private - */ - this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); - geometry.addIndex(this.indexBuffer); - this.dynamicStride = 0; - for (var i = 0; i < this.dynamicProperties.length; ++i) { - var property = this.dynamicProperties[i]; - property.offset = dynamicOffset; - dynamicOffset += property.size; - this.dynamicStride += property.size; - } - var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); - this.dynamicData = new Float32Array(dynBuffer); - this.dynamicDataUint32 = new Uint32Array(dynBuffer); - this.dynamicBuffer = new Buffer(this.dynamicData, false, false); - // static // - var staticOffset = 0; - this.staticStride = 0; - for (var i = 0; i < this.staticProperties.length; ++i) { - var property = this.staticProperties[i]; - property.offset = staticOffset; - staticOffset += property.size; - this.staticStride += property.size; - } - var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); - this.staticData = new Float32Array(statBuffer); - this.staticDataUint32 = new Uint32Array(statBuffer); - this.staticBuffer = new Buffer(this.staticData, true, false); - for (var i = 0; i < this.dynamicProperties.length; ++i) { - var property = this.dynamicProperties[i]; - geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4); - } - for (var i = 0; i < this.staticProperties.length; ++i) { - var property = this.staticProperties[i]; - geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4); - } - }; - /** - * Uploads the dynamic properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadDynamic = function (children, startIndex, amount) { - for (var i = 0; i < this.dynamicProperties.length; i++) { - var property = this.dynamicProperties[i]; - property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset); - } - this.dynamicBuffer._updateID++; - }; - /** - * Uploads the static properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadStatic = function (children, startIndex, amount) { - for (var i = 0; i < this.staticProperties.length; i++) { - var property = this.staticProperties[i]; - property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset); - } - this.staticBuffer._updateID++; - }; - /** - * Destroys the ParticleBuffer. - * - * @private - */ - ParticleBuffer.prototype.destroy = function () { - this.indexBuffer = null; - this.dynamicProperties = null; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - this.staticProperties = null; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - // all buffers are destroyed inside geometry - this.geometry.destroy(); - }; - return ParticleBuffer; - }()); - - var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; - - var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; - - /** - * @author Mat Groves - * - * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ - * for creating the original PixiJS version! - * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now - * share 4 bytes on the vertex buffer - * - * Heavily inspired by LibGDX's ParticleRenderer: - * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java - */ - /** - * Renderer for Particles that is designer for speed over feature set. - * - * @class - * @memberof PIXI - */ - var ParticleRenderer = /** @class */ (function (_super) { - __extends$4(ParticleRenderer, _super); - /** - * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for. - */ - function ParticleRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - // 65535 is max vertex index in the index buffer (see ParticleRenderer) - // so max number of particles is 65536 / 4 = 16384 - // and max number of element in the index buffer is 16384 * 6 = 98304 - // Creating a full index buffer, overhead is 98304 * 2 = 196Ko - // let numIndices = 98304; - /** - * The default shader that is used if a sprite doesn't have a more specific one. - * - * @member {PIXI.Shader} - */ - _this.shader = null; - _this.properties = null; - _this.tempMatrix = new Matrix(); - _this.properties = [ - // verticesData - { - attributeName: 'aVertexPosition', - size: 2, - uploadFunction: _this.uploadVertices, - offset: 0, - }, - // positionData - { - attributeName: 'aPositionCoord', - size: 2, - uploadFunction: _this.uploadPosition, - offset: 0, - }, - // rotationData - { - attributeName: 'aRotation', - size: 1, - uploadFunction: _this.uploadRotation, - offset: 0, - }, - // uvsData - { - attributeName: 'aTextureCoord', - size: 2, - uploadFunction: _this.uploadUvs, - offset: 0, - }, - // tintData - { - attributeName: 'aColor', - size: 1, - type: exports.TYPES.UNSIGNED_BYTE, - uploadFunction: _this.uploadTint, - offset: 0, - } ]; - _this.shader = Shader.from(vertex$1, fragment$1, {}); - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - return _this; - } - /** - * Renders the particle container object. - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - */ - ParticleRenderer.prototype.render = function (container) { - var children = container.children; - var maxSize = container._maxSize; - var batchSize = container._batchSize; - var renderer = this.renderer; - var totalChildren = children.length; - if (totalChildren === 0) { - return; - } - else if (totalChildren > maxSize && !container.autoResize) { - totalChildren = maxSize; - } - var buffers = container._buffers; - if (!buffers) { - buffers = container._buffers = this.generateBuffers(container); - } - var baseTexture = children[0]._texture.baseTexture; - // if the uvs have not updated then no point rendering just yet! - this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); - renderer.state.set(this.state); - var gl = renderer.gl; - var m = container.worldTransform.copyTo(this.tempMatrix); - m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); - this.shader.uniforms.translationMatrix = m.toArray(true); - this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); - this.shader.uniforms.uSampler = baseTexture; - this.renderer.shader.bind(this.shader); - var updateStatic = false; - // now lets upload and render the buffers.. - for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) { - var amount = (totalChildren - i); - if (amount > batchSize) { - amount = batchSize; - } - if (j >= buffers.length) { - buffers.push(this._generateOneMoreBuffer(container)); - } - var buffer = buffers[j]; - // we always upload the dynamic - buffer.uploadDynamic(children, i, amount); - var bid = container._bufferUpdateIDs[j] || 0; - updateStatic = updateStatic || (buffer._updateID < bid); - // we only upload the static content when we have to! - if (updateStatic) { - buffer._updateID = container._updateID; - buffer.uploadStatic(children, i, amount); - } - // bind the buffer - renderer.geometry.bind(buffer.geometry); - gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); - } - }; - /** - * Creates one particle buffer for each child in the container we want to render and updates internal properties - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer[]} The buffers - * @private - */ - ParticleRenderer.prototype.generateBuffers = function (container) { - var buffers = []; - var size = container._maxSize; - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - for (var i = 0; i < size; i += batchSize) { - buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); - } - return buffers; - }; - /** - * Creates one more particle buffer, because container has autoResize feature - * - * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer - * @return {PIXI.ParticleBuffer} generated buffer - * @private - */ - ParticleRenderer.prototype._generateOneMoreBuffer = function (container) { - var batchSize = container._batchSize; - var dynamicPropertyFlags = container._properties; - return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); - }; - /** - * Uploads the vertices. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their vertices uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset) { - var w0 = 0; - var w1 = 0; - var h0 = 0; - var h1 = 0; - for (var i = 0; i < amount; ++i) { - var sprite = children[startIndex + i]; - var texture = sprite._texture; - var sx = sprite.scale.x; - var sy = sprite.scale.y; - var trim = texture.trim; - var orig = texture.orig; - if (trim) { - // if the sprite is trimmed and is not a tilingsprite then we need to add the - // extra space before transforming the sprite coords.. - w1 = trim.x - (sprite.anchor.x * orig.width); - w0 = w1 + trim.width; - h1 = trim.y - (sprite.anchor.y * orig.height); - h0 = h1 + trim.height; - } - else { - w0 = (orig.width) * (1 - sprite.anchor.x); - w1 = (orig.width) * -sprite.anchor.x; - h0 = orig.height * (1 - sprite.anchor.y); - h1 = orig.height * -sprite.anchor.y; - } - array[offset] = w1 * sx; - array[offset + 1] = h1 * sy; - array[offset + stride] = w0 * sx; - array[offset + stride + 1] = h1 * sy; - array[offset + (stride * 2)] = w0 * sx; - array[offset + (stride * 2) + 1] = h0 * sy; - array[offset + (stride * 3)] = w1 * sx; - array[offset + (stride * 3) + 1] = h0 * sy; - offset += stride * 4; - } - }; - /** - * Uploads the position. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their positions uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadPosition = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; i++) { - var spritePosition = children[startIndex + i].position; - array[offset] = spritePosition.x; - array[offset + 1] = spritePosition.y; - array[offset + stride] = spritePosition.x; - array[offset + stride + 1] = spritePosition.y; - array[offset + (stride * 2)] = spritePosition.x; - array[offset + (stride * 2) + 1] = spritePosition.y; - array[offset + (stride * 3)] = spritePosition.x; - array[offset + (stride * 3) + 1] = spritePosition.y; - offset += stride * 4; - } - }; - /** - * Uploads the rotation. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadRotation = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; i++) { - var spriteRotation = children[startIndex + i].rotation; - array[offset] = spriteRotation; - array[offset + stride] = spriteRotation; - array[offset + (stride * 2)] = spriteRotation; - array[offset + (stride * 3)] = spriteRotation; - offset += stride * 4; - } - }; - /** - * Uploads the Uvs - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadUvs = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; ++i) { - var textureUvs = children[startIndex + i]._texture._uvs; - if (textureUvs) { - array[offset] = textureUvs.x0; - array[offset + 1] = textureUvs.y0; - array[offset + stride] = textureUvs.x1; - array[offset + stride + 1] = textureUvs.y1; - array[offset + (stride * 2)] = textureUvs.x2; - array[offset + (stride * 2) + 1] = textureUvs.y2; - array[offset + (stride * 3)] = textureUvs.x3; - array[offset + (stride * 3) + 1] = textureUvs.y3; - offset += stride * 4; - } - else { - // TODO you know this can be easier! - array[offset] = 0; - array[offset + 1] = 0; - array[offset + stride] = 0; - array[offset + stride + 1] = 0; - array[offset + (stride * 2)] = 0; - array[offset + (stride * 2) + 1] = 0; - array[offset + (stride * 3)] = 0; - array[offset + (stride * 3) + 1] = 0; - offset += stride * 4; - } - } - }; - /** - * Uploads the tint. - * - * @param {PIXI.DisplayObject[]} children - the array of display objects to render - * @param {number} startIndex - the index to start from in the children array - * @param {number} amount - the amount of children that will have their rotation uploaded - * @param {number[]} array - The vertices to upload. - * @param {number} stride - Stride to use for iteration. - * @param {number} offset - Offset to start at. - */ - ParticleRenderer.prototype.uploadTint = function (children, startIndex, amount, array, stride, offset) { - for (var i = 0; i < amount; ++i) { - var sprite = children[startIndex + i]; - var premultiplied = sprite._texture.baseTexture.alphaMode > 0; - var alpha = sprite.alpha; - // we dont call extra function if alpha is 1.0, that's faster - var argb = alpha < 1.0 && premultiplied - ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); - array[offset] = argb; - array[offset + stride] = argb; - array[offset + (stride * 2)] = argb; - array[offset + (stride * 3)] = argb; - offset += stride * 4; - } - }; - /** - * Destroys the ParticleRenderer. - */ - ParticleRenderer.prototype.destroy = function () { - _super.prototype.destroy.call(this); - if (this.shader) { - this.shader.destroy(); - this.shader = null; - } - this.tempMatrix = null; - }; - return ParticleRenderer; - }(ObjectRenderer)); - - /*! - * @pixi/graphics - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/graphics is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Supported line joints in `PIXI.LineStyle` for graphics. - * - * @see PIXI.Graphics#lineStyle - * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator - * - * @name LINE_JOIN - * @memberof PIXI - * @static - * @enum {string} - * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet - * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn - * @property {string} ROUND - 'round': add an arc at the joint - */ - - (function (LINE_JOIN) { - LINE_JOIN["MITER"] = "miter"; - LINE_JOIN["BEVEL"] = "bevel"; - LINE_JOIN["ROUND"] = "round"; - })(exports.LINE_JOIN || (exports.LINE_JOIN = {})); - /** - * Support line caps in `PIXI.LineStyle` for graphics. - * - * @see PIXI.Graphics#lineStyle - * - * @name LINE_CAP - * @memberof PIXI - * @static - * @enum {string} - * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges) - * @property {string} ROUND - 'round': add semicircle at ends - * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end) - */ - - (function (LINE_CAP) { - LINE_CAP["BUTT"] = "butt"; - LINE_CAP["ROUND"] = "round"; - LINE_CAP["SQUARE"] = "square"; - })(exports.LINE_CAP || (exports.LINE_CAP = {})); - /** - * Graphics curves resolution settings. If `adaptive` flag is set to `true`, - * the resolution is calculated based on the curve's length to ensure better visual quality. - * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`. - * - * @static - * @constant - * @memberof PIXI - * @name GRAPHICS_CURVES - * @type {object} - * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive - * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored) - * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored) - * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored) - */ - var GRAPHICS_CURVES = { - adaptive: true, - maxLength: 10, - minSegments: 8, - maxSegments: 2048, - epsilon: 0.0001, - _segmentsCount: function (length, defaultSegments) { - if (defaultSegments === void 0) { defaultSegments = 20; } - if (!this.adaptive || !length || isNaN(length)) { - return defaultSegments; - } - var result = Math.ceil(length / this.maxLength); - if (result < this.minSegments) { - result = this.minSegments; - } - else if (result > this.maxSegments) { - result = this.maxSegments; - } - return result; - }, - }; - - /** - * Fill style object for Graphics. - * - * @class - * @memberof PIXI - */ - var FillStyle = /** @class */ (function () { - function FillStyle() { - /** - * The hex color value used when coloring the Graphics object. - * - * @member {number} - * @default 0xFFFFFF - */ - this.color = 0xFFFFFF; - /** - * The alpha value used when filling the Graphics object. - * - * @member {number} - * @default 1 - */ - this.alpha = 1.0; - /** - * The texture to be used for the fill. - * - * @member {PIXI.Texture} - * @default 0 - */ - this.texture = Texture.WHITE; - /** - * The transform aplpied to the texture. - * - * @member {PIXI.Matrix} - * @default null - */ - this.matrix = null; - /** - * If the current fill is visible. - * - * @member {boolean} - * @default false - */ - this.visible = false; - this.reset(); - } - /** - * Clones the object - * - * @return {PIXI.FillStyle} - */ - FillStyle.prototype.clone = function () { - var obj = new FillStyle(); - obj.color = this.color; - obj.alpha = this.alpha; - obj.texture = this.texture; - obj.matrix = this.matrix; - obj.visible = this.visible; - return obj; - }; - /** - * Reset - */ - FillStyle.prototype.reset = function () { - this.color = 0xFFFFFF; - this.alpha = 1; - this.texture = Texture.WHITE; - this.matrix = null; - this.visible = false; - }; - /** - * Destroy and don't use after this - */ - FillStyle.prototype.destroy = function () { - this.texture = null; - this.matrix = null; - }; - return FillStyle; - }()); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$5 = function(d, b) { - extendStatics$5 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$5(d, b); - }; - - function __extends$5(d, b) { - extendStatics$5(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Builds a polygon to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildPoly = { - build: function (graphicsData) { - graphicsData.points = graphicsData.shape.points.slice(); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var holes = graphicsData.holes; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - if (points.length >= 6) { - var holeArray = []; - // Process holes.. - for (var i = 0; i < holes.length; i++) { - var hole = holes[i]; - holeArray.push(points.length / 2); - points = points.concat(hole.points); - } - // sort color - var triangles = earcut_1(points, holeArray, 2); - if (!triangles) { - return; - } - var vertPos = verts.length / 2; - for (var i = 0; i < triangles.length; i += 3) { - indices.push(triangles[i] + vertPos); - indices.push(triangles[i + 1] + vertPos); - indices.push(triangles[i + 2] + vertPos); - } - for (var i = 0; i < points.length; i++) { - verts.push(points[i]); - } - } - }, - }; - - // for type only - /** - * Builds a circle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildCircle = { - build: function (graphicsData) { - // need to convert points to a nice regular data - var circleData = graphicsData.shape; - var points = graphicsData.points; - var x = circleData.x; - var y = circleData.y; - var width; - var height; - points.length = 0; - // TODO - bit hacky?? - if (graphicsData.type === exports.SHAPES.CIRC) { - width = circleData.radius; - height = circleData.radius; - } - else { - var ellipseData = graphicsData.shape; - width = ellipseData.width; - height = ellipseData.height; - } - if (width === 0 || height === 0) { - return; - } - var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius)) - || Math.floor(15 * Math.sqrt(width + height)); - totalSegs /= 2.3; - var seg = (Math.PI * 2) / totalSegs; - for (var i = 0; i < totalSegs - 0.5; i++) { - points.push(x + (Math.sin(-seg * i) * width), y + (Math.cos(-seg * i) * height)); - } - points.push(points[0], points[1]); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var vertPos = verts.length / 2; - var center = vertPos; - var circle = (graphicsData.shape); - var matrix = graphicsData.matrix; - var x = circle.x; - var y = circle.y; - // Push center (special point) - verts.push(graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x, graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y); - for (var i = 0; i < points.length; i += 2) { - verts.push(points[i], points[i + 1]); - // add some uvs - indices.push(vertPos++, center, vertPos); - } - }, - }; - - /** - * Builds a rectangle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildRectangle = { - build: function (graphicsData) { - // --- // - // need to convert points to a nice regular data - // - var rectData = graphicsData.shape; - var x = rectData.x; - var y = rectData.y; - var width = rectData.width; - var height = rectData.height; - var points = graphicsData.points; - points.length = 0; - points.push(x, y, x + width, y, x + width, y + height, x, y + height); - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var vertPos = verts.length / 2; - verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]); - graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3); - }, - }; - - /** - * Calculate a single point for a quadratic bezier curve. - * Utility function used by quadraticBezierCurve. - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} n1 - first number - * @param {number} n2 - second number - * @param {number} perc - percentage - * @return {number} the result - * - */ - function getPt(n1, n2, perc) { - var diff = n2 - n1; - return n1 + (diff * perc); - } - /** - * Calculate the points for a quadratic bezier curve. (helper function..) - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} fromX - Origin point x - * @param {number} fromY - Origin point x - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created. - * @return {number[]} an array of points - */ - function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) { - if (out === void 0) { out = []; } - var n = 20; - var points = out; - var xa = 0; - var ya = 0; - var xb = 0; - var yb = 0; - var x = 0; - var y = 0; - for (var i = 0, j = 0; i <= n; ++i) { - j = i / n; - // The Green Line - xa = getPt(fromX, cpX, j); - ya = getPt(fromY, cpY, j); - xb = getPt(cpX, toX, j); - yb = getPt(cpY, toY, j); - // The Black Dot - x = getPt(xa, xb, j); - y = getPt(ya, yb, j); - points.push(x, y); - } - return points; - } - /** - * Builds a rounded rectangle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildRoundedRectangle = { - build: function (graphicsData) { - var rrectData = graphicsData.shape; - var points = graphicsData.points; - var x = rrectData.x; - var y = rrectData.y; - var width = rrectData.width; - var height = rrectData.height; - // Don't allow negative radius or greater than half the smallest width - var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2)); - points.length = 0; - // No radius, do a simple rectangle - if (!radius) { - points.push(x, y, x + width, y, x + width, y + height, x, y + height); - } - else { - quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points); - quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points); - quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points); - quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points); - } - // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. - // TODO - fix this properly, this is not very elegant.. but it works for now. - }, - triangulate: function (graphicsData, graphicsGeometry) { - var points = graphicsData.points; - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var vecPos = verts.length / 2; - var triangles = earcut_1(points, null, 2); - for (var i = 0, j = triangles.length; i < j; i += 3) { - indices.push(triangles[i] + vecPos); - // indices.push(triangles[i] + vecPos); - indices.push(triangles[i + 1] + vecPos); - // indices.push(triangles[i + 2] + vecPos); - indices.push(triangles[i + 2] + vecPos); - } - for (var i = 0, j = points.length; i < j; i++) { - verts.push(points[i], points[++i]); - } - }, - }; - - /** - * Buffers vertices to draw a square cap. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} x - X-coord of end point - * @param {number} y - Y-coord of end point - * @param {number} nx - X-coord of line normal pointing inside - * @param {number} ny - Y-coord of line normal pointing inside - * @param {Array} verts - vertex buffer - * @returns {} - */ - function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) { - var ix = x - (nx * innerWeight); - var iy = y - (ny * innerWeight); - var ox = x + (nx * outerWeight); - var oy = y + (ny * outerWeight); - /* Rotate nx,ny for extension vector */ - var exx; - var eyy; - if (clockwise) { - exx = ny; - eyy = -nx; - } - else { - exx = -ny; - eyy = nx; - } - /* [i|0]x,y extended at cap */ - var eix = ix + exx; - var eiy = iy + eyy; - var eox = ox + exx; - var eoy = oy + eyy; - /* Square itself must be inserted clockwise*/ - verts.push(eix, eiy); - verts.push(eox, eoy); - return 2; - } - /** - * Buffers vertices to draw an arc at the line joint or cap. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {number} cx - X-coord of center - * @param {number} cy - Y-coord of center - * @param {number} sx - X-coord of arc start - * @param {number} sy - Y-coord of arc start - * @param {number} ex - X-coord of arc end - * @param {number} ey - Y-coord of arc end - * @param {Array} verts - buffer of vertices - * @param {boolean} clockwise - orientation of vertices - * @returns {number} - no. of vertices pushed - */ - function round(cx, cy, sx, sy, ex, ey, verts, clockwise) { - var cx2p0x = sx - cx; - var cy2p0y = sy - cy; - var angle0 = Math.atan2(cx2p0x, cy2p0y); - var angle1 = Math.atan2(ex - cx, ey - cy); - if (clockwise && angle0 < angle1) { - angle0 += Math.PI * 2; - } - else if (!clockwise && angle0 > angle1) { - angle1 += Math.PI * 2; - } - var startAngle = angle0; - var angleDiff = angle1 - angle0; - var absAngleDiff = Math.abs(angleDiff); - /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND) - { - const r1x = cx - nxtPx; - const r1y = cy - nxtPy; - - if (r1x === 0) - { - if (r1y > 0) - { - angleDiff = -angleDiff; - } - } - else if (r1x >= -GRAPHICS_CURVES.epsilon) - { - angleDiff = -angleDiff; - } - }*/ - var radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y)); - var segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1; - var angleInc = angleDiff / segCount; - startAngle += angleInc; - if (clockwise) { - verts.push(cx, cy); - verts.push(sx, sy); - for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { - verts.push(cx, cy); - verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); - } - verts.push(cx, cy); - verts.push(ex, ey); - } - else { - verts.push(sx, sy); - verts.push(cx, cy); - for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { - verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); - verts.push(cx, cy); - } - verts.push(ex, ey); - verts.push(cx, cy); - } - return segCount * 2; - } - /** - * Builds a line to draw using the polygon method. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildNonNativeLine(graphicsData, graphicsGeometry) { - var shape = graphicsData.shape; - var points = graphicsData.points || shape.points.slice(); - var eps = graphicsGeometry.closePointEps; - if (points.length === 0) { - return; - } - // if the line width is an odd number add 0.5 to align to a whole pixel - // commenting this out fixes #711 and #1620 - // if (graphicsData.lineWidth%2) - // { - // for (i = 0; i < points.length; i++) - // { - // points[i] += 0.5; - // } - // } - var style = graphicsData.lineStyle; - // get first and last point.. figure out the middle! - var firstPoint = new Point(points[0], points[1]); - var lastPoint = new Point(points[points.length - 2], points[points.length - 1]); - var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; - var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps - && Math.abs(firstPoint.y - lastPoint.y) < eps; - // if the first point is the last point - gonna have issues :) - if (closedShape) { - // need to clone as we are going to slightly modify the shape.. - points = points.slice(); - if (closedPath) { - points.pop(); - points.pop(); - lastPoint.set(points[points.length - 2], points[points.length - 1]); - } - var midPointX = (firstPoint.x + lastPoint.x) * 0.5; - var midPointY = (lastPoint.y + firstPoint.y) * 0.5; - points.unshift(midPointX, midPointY); - points.push(midPointX, midPointY); - } - var verts = graphicsGeometry.points; - var length = points.length / 2; - var indexCount = points.length; - var indexStart = verts.length / 2; - // Max. inner and outer width - var width = style.width / 2; - var widthSquared = width * width; - var miterLimitSquared = style.miterLimit * style.miterLimit; - /* Line segments of interest where (x1,y1) forms the corner. */ - var x0 = points[0]; - var y0 = points[1]; - var x1 = points[2]; - var y1 = points[3]; - var x2 = 0; - var y2 = 0; - /* perp[?](x|y) = the line normal with magnitude lineWidth. */ - var perpx = -(y0 - y1); - var perpy = x0 - x1; - var perp1x = 0; - var perp1y = 0; - var dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - var ratio = style.alignment; // 0.5; - var innerWeight = (1 - ratio) * 2; - var outerWeight = ratio * 2; - if (!closedShape) { - if (style.cap === exports.LINE_CAP.ROUND) { - indexCount += round(x0 - (perpx * (innerWeight - outerWeight) * 0.5), y0 - (perpy * (innerWeight - outerWeight) * 0.5), x0 - (perpx * innerWeight), y0 - (perpy * innerWeight), x0 + (perpx * outerWeight), y0 + (perpy * outerWeight), verts, true) + 2; - } - else if (style.cap === exports.LINE_CAP.SQUARE) { - indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts); - } - } - // Push first point (below & above vertices) - verts.push(x0 - (perpx * innerWeight), y0 - (perpy * innerWeight)); - verts.push(x0 + (perpx * outerWeight), y0 + (perpy * outerWeight)); - for (var i = 1; i < length - 1; ++i) { - x0 = points[(i - 1) * 2]; - y0 = points[((i - 1) * 2) + 1]; - x1 = points[i * 2]; - y1 = points[(i * 2) + 1]; - x2 = points[(i + 1) * 2]; - y2 = points[((i + 1) * 2) + 1]; - perpx = -(y0 - y1); - perpy = x0 - x1; - dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - perp1x = -(y1 - y2); - perp1y = x1 - x2; - dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y)); - perp1x /= dist; - perp1y /= dist; - perp1x *= width; - perp1y *= width; - /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */ - var dx0 = x1 - x0; - var dy0 = y0 - y1; - var dx1 = x1 - x2; - var dy1 = y2 - y1; - /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ - var cross = (dy0 * dx1) - (dy1 * dx0); - var clockwise = (cross < 0); - /* Going nearly straight? */ - if (Math.abs(cross) < 0.1) { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - continue; - } - /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */ - var c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0)); - var c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2)); - var px = ((dx0 * c2) - (dx1 * c1)) / cross; - var py = ((dy1 * c1) - (dy0 * c2)) / cross; - var pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1)); - /* Inner miter point */ - var imx = x1 + ((px - x1) * innerWeight); - var imy = y1 + ((py - y1) * innerWeight); - /* Outer miter point */ - var omx = x1 - ((px - x1) * outerWeight); - var omy = y1 - ((py - y1) * outerWeight); - /* Is the inside miter point too far away, creating a spike? */ - var smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1)); - var insideWeight = clockwise ? innerWeight : outerWeight; - var smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared); - var insideMiterOk = pdist <= smallerInsideDiagonalSq; - if (insideMiterOk) { - if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { - if (clockwise) /* rotating at inner angle */ { - verts.push(imx, imy); // inner miter point - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex - verts.push(imx, imy); // inner miter point - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex - } - else /* rotating at outer angle */ { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex - verts.push(omx, omy); // outer miter point - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's outer vertex - verts.push(omx, omy); // outer miter point - } - indexCount += 2; - } - else if (style.join === exports.LINE_JOIN.ROUND) { - if (clockwise) /* arc is outside */ { - verts.push(imx, imy); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 4; - verts.push(imx, imy); - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); - } - else /* arc is inside */ { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(omx, omy); - indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 4; - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); - verts.push(omx, omy); - } - } - else { - verts.push(imx, imy); - verts.push(omx, omy); - } - } - else // inside miter is NOT ok - { - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex - if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { ; } - else if (style.join === exports.LINE_JOIN.ROUND) { - if (clockwise) /* arc is outside */ { - indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 2; - } - else /* arc is inside */ { - indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 2; - } - } - else { - if (clockwise) { - verts.push(omx, omy); // inner miter point - verts.push(omx, omy); // inner miter point - } - else { - verts.push(imx, imy); // outer miter point - verts.push(imx, imy); // outer miter point - } - indexCount += 2; - } - verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex - verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex - indexCount += 2; - } - } - x0 = points[(length - 2) * 2]; - y0 = points[((length - 2) * 2) + 1]; - x1 = points[(length - 1) * 2]; - y1 = points[((length - 1) * 2) + 1]; - perpx = -(y0 - y1); - perpy = x0 - x1; - dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; - perpy /= dist; - perpx *= width; - perpy *= width; - verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); - verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); - if (!closedShape) { - if (style.cap === exports.LINE_CAP.ROUND) { - indexCount += round(x1 - (perpx * (innerWeight - outerWeight) * 0.5), y1 - (perpy * (innerWeight - outerWeight) * 0.5), x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), verts, false) + 2; - } - else if (style.cap === exports.LINE_CAP.SQUARE) { - indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts); - } - } - var indices = graphicsGeometry.indices; - var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon; - // indices.push(indexStart); - for (var i = indexStart; i < indexCount + indexStart - 2; ++i) { - x0 = verts[(i * 2)]; - y0 = verts[(i * 2) + 1]; - x1 = verts[(i + 1) * 2]; - y1 = verts[((i + 1) * 2) + 1]; - x2 = verts[(i + 2) * 2]; - y2 = verts[((i + 2) * 2) + 1]; - /* Skip zero area triangles */ - if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2) { - continue; - } - indices.push(i, i + 1, i + 2); - } - } - /** - * Builds a line to draw using the gl.drawArrays(gl.LINES) method - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildNativeLine(graphicsData, graphicsGeometry) { - var i = 0; - var shape = graphicsData.shape; - var points = graphicsData.points || shape.points; - var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; - if (points.length === 0) - { return; } - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - var length = points.length / 2; - var startIndex = verts.length / 2; - var currentIndex = startIndex; - verts.push(points[0], points[1]); - for (i = 1; i < length; i++) { - verts.push(points[i * 2], points[(i * 2) + 1]); - indices.push(currentIndex, currentIndex + 1); - currentIndex++; - } - if (closedShape) { - indices.push(currentIndex, startIndex); - } - } - /** - * Builds a line to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output - */ - function buildLine(graphicsData, graphicsGeometry) { - if (graphicsData.lineStyle.native) { - buildNativeLine(graphicsData, graphicsGeometry); - } - else { - buildNonNativeLine(graphicsData, graphicsGeometry); - } - } - - /** - * Draw a star shape with an arbitrary number of points. - * - * @class - * @extends PIXI.Polygon - * @memberof PIXI.graphicsUtils - * @param {number} x - Center X position of the star - * @param {number} y - Center Y position of the star - * @param {number} points - The number of points of the star, must be > 1 - * @param {number} radius - The outer radius of the star - * @param {number} [innerRadius] - The inner radius between points, default half `radius` - * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - var Star = /** @class */ (function (_super) { - __extends$5(Star, _super); - function Star(x, y, points, radius, innerRadius, rotation) { - if (rotation === void 0) { rotation = 0; } - var _this = this; - innerRadius = innerRadius || radius / 2; - var startAngle = (-1 * Math.PI / 2) + rotation; - var len = points * 2; - var delta = PI_2 / len; - var polygon = []; - for (var i = 0; i < len; i++) { - var r = i % 2 ? innerRadius : radius; - var angle = (i * delta) + startAngle; - polygon.push(x + (r * Math.cos(angle)), y + (r * Math.sin(angle))); - } - _this = _super.call(this, polygon) || this; - return _this; - } - return Star; - }(Polygon)); - - /** - * Utilities for arc curves - * @class - * @private - */ - var ArcUtils = /** @class */ (function () { - function ArcUtils() { - } - /** - * The arcTo() method creates an arc/curve between two tangents on the canvas. - * - * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! - * - * @private - * @param {number} x1 - The x-coordinate of the beginning of the arc - * @param {number} y1 - The y-coordinate of the beginning of the arc - * @param {number} x2 - The x-coordinate of the end of the arc - * @param {number} y2 - The y-coordinate of the end of the arc - * @param {number} radius - The radius of the arc - * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`. - */ - ArcUtils.curveTo = function (x1, y1, x2, y2, radius, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - var a1 = fromY - y1; - var b1 = fromX - x1; - var a2 = y2 - y1; - var b2 = x2 - x1; - var mm = Math.abs((a1 * b2) - (b1 * a2)); - if (mm < 1.0e-8 || radius === 0) { - if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) { - points.push(x1, y1); - } - return null; - } - var dd = (a1 * a1) + (b1 * b1); - var cc = (a2 * a2) + (b2 * b2); - var tt = (a1 * a2) + (b1 * b2); - var k1 = radius * Math.sqrt(dd) / mm; - var k2 = radius * Math.sqrt(cc) / mm; - var j1 = k1 * tt / dd; - var j2 = k2 * tt / cc; - var cx = (k1 * b2) + (k2 * b1); - var cy = (k1 * a2) + (k2 * a1); - var px = b1 * (k2 + j1); - var py = a1 * (k2 + j1); - var qx = b2 * (k1 + j2); - var qy = a2 * (k1 + j2); - var startAngle = Math.atan2(py - cy, px - cx); - var endAngle = Math.atan2(qy - cy, qx - cx); - return { - cx: (cx + x1), - cy: (cy + y1), - radius: radius, - startAngle: startAngle, - endAngle: endAngle, - anticlockwise: (b1 * a2 > b2 * a1), - }; - }; - /* eslint-disable max-len */ - /** - * The arc method creates an arc/curve (used to create circles, or parts of circles). - * - * @private - * @param {number} startX - Start x location of arc - * @param {number} startY - Start y location of arc - * @param {number} cx - The x-coordinate of the center of the circle - * @param {number} cy - The y-coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position - * of the arc's circle) - * @param {number} endAngle - The ending angle, in radians - * @param {boolean} anticlockwise - Specifies whether the drawing should be - * counter-clockwise or clockwise. False is default, and indicates clockwise, while true - * indicates counter-clockwise. - * @param {number[]} points - Collection of points to add to - */ - ArcUtils.arc = function (_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) { - var sweep = endAngle - startAngle; - var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / PI_2) * 40); - var theta = (sweep) / (n * 2); - var theta2 = theta * 2; - var cTheta = Math.cos(theta); - var sTheta = Math.sin(theta); - var segMinus = n - 1; - var remainder = (segMinus % 1) / segMinus; - for (var i = 0; i <= segMinus; ++i) { - var real = i + (remainder * i); - var angle = ((theta) + startAngle + (theta2 * real)); - var c = Math.cos(angle); - var s = -Math.sin(angle); - points.push((((cTheta * c) + (sTheta * s)) * radius) + cx, (((cTheta * -s) + (sTheta * c)) * radius) + cy); - } - }; - return ArcUtils; - }()); - - /** - * Utilities for bezier curves - * @class - * @private - */ - var BezierUtils = /** @class */ (function () { - function BezierUtils() { - } - /** - * Calculate length of bezier curve. - * Analytical solution is impossible, since it involves an integral that does not integrate in general. - * Therefore numerical solution is used. - * - * @private - * @param {number} fromX - Starting point x - * @param {number} fromY - Starting point y - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {number} Length of bezier curve - */ - BezierUtils.curveLength = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) { - var n = 10; - var result = 0.0; - var t = 0.0; - var t2 = 0.0; - var t3 = 0.0; - var nt = 0.0; - var nt2 = 0.0; - var nt3 = 0.0; - var x = 0.0; - var y = 0.0; - var dx = 0.0; - var dy = 0.0; - var prevX = fromX; - var prevY = fromY; - for (var i = 1; i <= n; ++i) { - t = i / n; - t2 = t * t; - t3 = t2 * t; - nt = (1.0 - t); - nt2 = nt * nt; - nt3 = nt2 * nt; - x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX); - y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY); - dx = prevX - x; - dy = prevY - y; - prevX = x; - prevY = y; - result += Math.sqrt((dx * dx) + (dy * dy)); - } - return result; - }; - /** - * Calculate the points for a bezier curve and then draws it. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Path array to push points into - */ - BezierUtils.curveTo = function (cpX, cpY, cpX2, cpY2, toX, toY, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - points.length -= 2; - var n = GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)); - var dt = 0; - var dt2 = 0; - var dt3 = 0; - var t2 = 0; - var t3 = 0; - points.push(fromX, fromY); - for (var i = 1, j = 0; i <= n; ++i) { - j = i / n; - dt = (1 - j); - dt2 = dt * dt; - dt3 = dt2 * dt; - t2 = j * j; - t3 = t2 * j; - points.push((dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)); - } - }; - return BezierUtils; - }()); - - /** - * Utilities for quadratic curves - * @class - * @private - */ - var QuadraticUtils = /** @class */ (function () { - function QuadraticUtils() { - } - /** - * Calculate length of quadratic curve - * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/} - * for the detailed explanation of math behind this. - * - * @private - * @param {number} fromX - x-coordinate of curve start point - * @param {number} fromY - y-coordinate of curve start point - * @param {number} cpX - x-coordinate of curve control point - * @param {number} cpY - y-coordinate of curve control point - * @param {number} toX - x-coordinate of curve end point - * @param {number} toY - y-coordinate of curve end point - * @return {number} Length of quadratic curve - */ - QuadraticUtils.curveLength = function (fromX, fromY, cpX, cpY, toX, toY) { - var ax = fromX - (2.0 * cpX) + toX; - var ay = fromY - (2.0 * cpY) + toY; - var bx = (2.0 * cpX) - (2.0 * fromX); - var by = (2.0 * cpY) - (2.0 * fromY); - var a = 4.0 * ((ax * ax) + (ay * ay)); - var b = 4.0 * ((ax * bx) + (ay * by)); - var c = (bx * bx) + (by * by); - var s = 2.0 * Math.sqrt(a + b + c); - var a2 = Math.sqrt(a); - var a32 = 2.0 * a * a2; - var c2 = 2.0 * Math.sqrt(c); - var ba = b / a2; - return ((a32 * s) - + (a2 * b * (s - c2)) - + (((4.0 * c * a) - (b * b)) - * Math.log(((2.0 * a2) + ba + s) / (ba + c2)))) / (4.0 * a32); - }; - /** - * Calculate the points for a quadratic bezier curve and then draws it. - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * @private - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Points to add segments to. - */ - QuadraticUtils.curveTo = function (cpX, cpY, toX, toY, points) { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)); - var xa = 0; - var ya = 0; - for (var i = 1; i <= n; ++i) { - var j = i / n; - xa = fromX + ((cpX - fromX) * j); - ya = fromY + ((cpY - fromY) * j); - points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), ya + (((cpY + ((toY - cpY) * j)) - ya) * j)); - } - }; - return QuadraticUtils; - }()); - - /** - * A structure to hold interim batch objects for Graphics. - * @class - * @memberof PIXI.graphicsUtils - */ - var BatchPart = /** @class */ (function () { - function BatchPart() { - this.reset(); - } - /** - * Begin batch part - * - * @param {PIXI.FillStyle | PIXI.LineStyle} style - * @param {number} startIndex - * @param {number} attribStart - */ - BatchPart.prototype.begin = function (style, startIndex, attribStart) { - this.reset(); - this.style = style; - this.start = startIndex; - this.attribStart = attribStart; - }; - /** - * End batch part - * - * @param {number} endIndex - * @param {number} endAttrib - */ - BatchPart.prototype.end = function (endIndex, endAttrib) { - this.attribSize = endAttrib - this.attribStart; - this.size = endIndex - this.start; - }; - BatchPart.prototype.reset = function () { - this.style = null; - this.size = 0; - this.start = 0; - this.attribStart = 0; - this.attribSize = 0; - }; - return BatchPart; - }()); - - /** - * Generalized convenience utilities for Graphics. - * - * @namespace graphicsUtils - * @memberof PIXI - */ - var _a; - /** - * Map of fill commands for each shape type. - * - * @memberof PIXI.graphicsUtils - * @member {Object} FILL_COMMANDS - */ - var FILL_COMMANDS = (_a = {}, - _a[exports.SHAPES.POLY] = buildPoly, - _a[exports.SHAPES.CIRC] = buildCircle, - _a[exports.SHAPES.ELIP] = buildCircle, - _a[exports.SHAPES.RECT] = buildRectangle, - _a[exports.SHAPES.RREC] = buildRoundedRectangle, - _a); - /** - * Batch pool, stores unused batches for preventing allocations. - * - * @memberof PIXI.graphicsUtils - * @member {Array} BATCH_POOL - */ - var BATCH_POOL = []; - /** - * Draw call pool, stores unused draw calls for preventing allocations. - * - * @memberof PIXI.graphicsUtils - * @member {Array} DRAW_CALL_POOL - */ - var DRAW_CALL_POOL = []; - - var index$2 = ({ - buildPoly: buildPoly, - buildCircle: buildCircle, - buildRectangle: buildRectangle, - buildRoundedRectangle: buildRoundedRectangle, - FILL_COMMANDS: FILL_COMMANDS, - BATCH_POOL: BATCH_POOL, - DRAW_CALL_POOL: DRAW_CALL_POOL, - buildLine: buildLine, - Star: Star, - ArcUtils: ArcUtils, - BezierUtils: BezierUtils, - QuadraticUtils: QuadraticUtils, - BatchPart: BatchPart - }); - - /** - * A class to contain data useful for Graphics objects - * - * @class - * @memberof PIXI - */ - var GraphicsData = /** @class */ (function () { - /** - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw - * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw - * @param {PIXI.Matrix} [matrix] - Transform matrix - */ - function GraphicsData(shape, fillStyle, lineStyle, matrix) { - if (fillStyle === void 0) { fillStyle = null; } - if (lineStyle === void 0) { lineStyle = null; } - if (matrix === void 0) { matrix = null; } - /** - * The shape object to draw. - * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} - */ - this.shape = shape; - /** - * The style of the line. - * @member {PIXI.LineStyle} - */ - this.lineStyle = lineStyle; - /** - * The style of the fill. - * @member {PIXI.FillStyle} - */ - this.fillStyle = fillStyle; - /** - * The transform matrix. - * @member {PIXI.Matrix} - */ - this.matrix = matrix; - /** - * The type of the shape, see the Const.Shapes file for all the existing types, - * @member {number} - */ - this.type = shape.type; - /** - * The collection of points. - * @member {number[]} - */ - this.points = []; - /** - * The collection of holes. - * @member {PIXI.GraphicsData[]} - */ - this.holes = []; - } - /** - * Creates a new GraphicsData object with the same values as this one. - * - * @return {PIXI.GraphicsData} Cloned GraphicsData object - */ - GraphicsData.prototype.clone = function () { - return new GraphicsData(this.shape, this.fillStyle, this.lineStyle, this.matrix); - }; - /** - * Destroys the Graphics data. - * - */ - GraphicsData.prototype.destroy = function () { - this.shape = null; - this.holes.length = 0; - this.holes = null; - this.points.length = 0; - this.points = null; - this.lineStyle = null; - this.fillStyle = null; - }; - return GraphicsData; - }()); - - var tmpPoint = new Point(); - var tmpBounds = new Bounds(); - /** - * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. - * - * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. - * - * @class - * @extends PIXI.BatchGeometry - * @memberof PIXI - */ - var GraphicsGeometry = /** @class */ (function (_super) { - __extends$5(GraphicsGeometry, _super); - function GraphicsGeometry() { - var _this = _super.call(this) || this; - _this.uvsFloat32 = null; - _this.indicesUint16 = null; - /** - * An array of points to draw, 2 numbers per point - * - * @member {number[]} - * @protected - */ - _this.points = []; - /** - * The collection of colors - * - * @member {number[]} - * @protected - */ - _this.colors = []; - /** - * The UVs collection - * - * @member {number[]} - * @protected - */ - _this.uvs = []; - /** - * The indices of the vertices - * - * @member {number[]} - * @protected - */ - _this.indices = []; - /** - * Reference to the texture IDs. - * - * @member {number[]} - * @protected - */ - _this.textureIds = []; - /** - * The collection of drawn shapes. - * - * @member {PIXI.GraphicsData[]} - * @protected - */ - _this.graphicsData = []; - /** - * Used to detect if the graphics object has changed. - * - * @member {number} - * @protected - */ - _this.dirty = 0; - /** - * Batches need to regenerated if the geometry is updated. - * - * @member {number} - * @protected - */ - _this.batchDirty = -1; - /** - * Used to check if the cache is dirty. - * - * @member {number} - * @protected - */ - _this.cacheDirty = -1; - /** - * Used to detect if we cleared the graphicsData. - * - * @member {number} - * @default 0 - * @protected - */ - _this.clearDirty = 0; - /** - * List of current draw calls drived from the batches. - * - * @member {object[]} - * @protected - */ - _this.drawCalls = []; - /** - * Intermediate abstract format sent to batch system. - * Can be converted to drawCalls or to batchable objects. - * - * @member {PIXI.graphicsUtils.BatchPart[]} - * @protected - */ - _this.batches = []; - /** - * Index of the last batched shape in the stack of calls. - * - * @member {number} - * @protected - */ - _this.shapeIndex = 0; - /** - * Cached bounds. - * - * @member {PIXI.Bounds} - * @protected - */ - _this._bounds = new Bounds(); - /** - * The bounds dirty flag. - * - * @member {number} - * @protected - */ - _this.boundsDirty = -1; - /** - * Padding to add to the bounds. - * - * @member {number} - * @default 0 - */ - _this.boundsPadding = 0; - _this.batchable = false; - _this.indicesUint16 = null; - _this.uvsFloat32 = null; - /** - * Minimal distance between points that are considered different. - * Affects line tesselation. - * - * @member {number} - */ - _this.closePointEps = 1e-4; - return _this; - } - Object.defineProperty(GraphicsGeometry.prototype, "bounds", { - /** - * Get the current bounds of the graphic geometry. - * - * @member {PIXI.Bounds} - * @readonly - */ - get: function () { - if (this.boundsDirty !== this.dirty) { - this.boundsDirty = this.dirty; - this.calculateBounds(); - } - return this._bounds; - }, - enumerable: false, - configurable: true - }); - /** - * Call if you changed graphicsData manually. - * Empties all batch buffers. - */ - GraphicsGeometry.prototype.invalidate = function () { - this.boundsDirty = -1; - this.dirty++; - this.batchDirty++; - this.shapeIndex = 0; - this.points.length = 0; - this.colors.length = 0; - this.uvs.length = 0; - this.indices.length = 0; - this.textureIds.length = 0; - for (var i = 0; i < this.drawCalls.length; i++) { - this.drawCalls[i].texArray.clear(); - DRAW_CALL_POOL.push(this.drawCalls[i]); - } - this.drawCalls.length = 0; - for (var i = 0; i < this.batches.length; i++) { - var batchPart = this.batches[i]; - batchPart.reset(); - BATCH_POOL.push(batchPart); - } - this.batches.length = 0; - }; - /** - * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. - * - * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls - */ - GraphicsGeometry.prototype.clear = function () { - if (this.graphicsData.length > 0) { - this.invalidate(); - this.clearDirty++; - this.graphicsData.length = 0; - } - return this; - }; - /** - * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. - * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. - * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. - */ - GraphicsGeometry.prototype.drawShape = function (shape, fillStyle, lineStyle, matrix) { - if (fillStyle === void 0) { fillStyle = null; } - if (lineStyle === void 0) { lineStyle = null; } - if (matrix === void 0) { matrix = null; } - var data = new GraphicsData(shape, fillStyle, lineStyle, matrix); - this.graphicsData.push(data); - this.dirty++; - return this; - }; - /** - * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. - * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. - * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. - */ - GraphicsGeometry.prototype.drawHole = function (shape, matrix) { - if (matrix === void 0) { matrix = null; } - if (!this.graphicsData.length) { - return null; - } - var data = new GraphicsData(shape, null, null, matrix); - var lastShape = this.graphicsData[this.graphicsData.length - 1]; - data.lineStyle = lastShape.lineStyle; - lastShape.holes.push(data); - this.dirty++; - return this; - }; - /** - * Destroys the GraphicsGeometry object. - * - */ - GraphicsGeometry.prototype.destroy = function () { - _super.prototype.destroy.call(this); - // destroy each of the GraphicsData objects - for (var i = 0; i < this.graphicsData.length; ++i) { - this.graphicsData[i].destroy(); - } - this.points.length = 0; - this.points = null; - this.colors.length = 0; - this.colors = null; - this.uvs.length = 0; - this.uvs = null; - this.indices.length = 0; - this.indices = null; - this.indexBuffer.destroy(); - this.indexBuffer = null; - this.graphicsData.length = 0; - this.graphicsData = null; - this.drawCalls.length = 0; - this.drawCalls = null; - this.batches.length = 0; - this.batches = null; - this._bounds = null; - }; - /** - * Check to see if a point is contained within this geometry. - * - * @param {PIXI.IPointData} point - Point to check if it's contained. - * @return {Boolean} `true` if the point is contained within geometry. - */ - GraphicsGeometry.prototype.containsPoint = function (point) { - var graphicsData = this.graphicsData; - for (var i = 0; i < graphicsData.length; ++i) { - var data = graphicsData[i]; - if (!data.fillStyle.visible) { - continue; - } - // only deal with fills.. - if (data.shape) { - if (data.matrix) { - data.matrix.applyInverse(point, tmpPoint); - } - else { - tmpPoint.copyFrom(point); - } - if (data.shape.contains(tmpPoint.x, tmpPoint.y)) { - var hitHole = false; - if (data.holes) { - for (var i_1 = 0; i_1 < data.holes.length; i_1++) { - var hole = data.holes[i_1]; - if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) { - hitHole = true; - break; - } - } - } - if (!hitHole) { - return true; - } - } - } - } - return false; - }; - /** - * Generates intermediate batch data. Either gets converted to drawCalls - * or used to convert to batch objects directly by the Graphics object. - * - * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices - */ - GraphicsGeometry.prototype.updateBatches = function (allow32Indices) { - if (!this.graphicsData.length) { - this.batchable = true; - return; - } - if (!this.validateBatching()) { - return; - } - this.cacheDirty = this.dirty; - var uvs = this.uvs; - var graphicsData = this.graphicsData; - var batchPart = null; - var currentStyle = null; - if (this.batches.length > 0) { - batchPart = this.batches[this.batches.length - 1]; - currentStyle = batchPart.style; - } - for (var i = this.shapeIndex; i < graphicsData.length; i++) { - this.shapeIndex++; - var data = graphicsData[i]; - var fillStyle = data.fillStyle; - var lineStyle = data.lineStyle; - var command = FILL_COMMANDS[data.type]; - // build out the shapes points.. - command.build(data); - if (data.matrix) { - this.transformPoints(data.points, data.matrix); - } - for (var j = 0; j < 2; j++) { - var style = (j === 0) ? fillStyle : lineStyle; - if (!style.visible) - { continue; } - var nextTexture = style.texture.baseTexture; - var index_1 = this.indices.length; - var attribIndex = this.points.length / 2; - nextTexture.wrapMode = exports.WRAP_MODES.REPEAT; - if (j === 0) { - this.processFill(data); - } - else { - this.processLine(data); - } - var size = (this.points.length / 2) - attribIndex; - if (size === 0) - { continue; } - // close batch if style is different - if (batchPart && !this._compareStyles(currentStyle, style)) { - batchPart.end(index_1, attribIndex); - batchPart = null; - } - // spawn new batch if its first batch or previous was closed - if (!batchPart) { - batchPart = BATCH_POOL.pop() || new BatchPart(); - batchPart.begin(style, index_1, attribIndex); - this.batches.push(batchPart); - currentStyle = style; - } - this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix); - } - } - var index = this.indices.length; - var attrib = this.points.length / 2; - if (batchPart) { - batchPart.end(index, attrib); - } - if (this.batches.length === 0) { - // there are no visible styles in GraphicsData - // its possible that someone wants Graphics just for the bounds - this.batchable = true; - return; - } - // prevent allocation when length is same as buffer - if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) { - this.indicesUint16.set(this.indices); - } - else { - var need32 = attrib > 0xffff && allow32Indices; - this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices); - } - // TODO make this a const.. - this.batchable = this.isBatchable(); - if (this.batchable) { - this.packBatches(); - } - else { - this.buildDrawCalls(); - } - }; - /** - * Affinity check - * - * @param {PIXI.FillStyle | PIXI.LineStyle} styleA - * @param {PIXI.FillStyle | PIXI.LineStyle} styleB - */ - GraphicsGeometry.prototype._compareStyles = function (styleA, styleB) { - if (!styleA || !styleB) { - return false; - } - if (styleA.texture.baseTexture !== styleB.texture.baseTexture) { - return false; - } - if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) { - return false; - } - if (!!styleA.native !== !!styleB.native) { - return false; - } - return true; - }; - /** - * Test geometry for batching process. - * - * @protected - */ - GraphicsGeometry.prototype.validateBatching = function () { - if (this.dirty === this.cacheDirty || !this.graphicsData.length) { - return false; - } - for (var i = 0, l = this.graphicsData.length; i < l; i++) { - var data = this.graphicsData[i]; - var fill = data.fillStyle; - var line = data.lineStyle; - if (fill && !fill.texture.baseTexture.valid) - { return false; } - if (line && !line.texture.baseTexture.valid) - { return false; } - } - return true; - }; - /** - * Offset the indices so that it works with the batcher. - * - * @protected - */ - GraphicsGeometry.prototype.packBatches = function () { - this.batchDirty++; - this.uvsFloat32 = new Float32Array(this.uvs); - var batches = this.batches; - for (var i = 0, l = batches.length; i < l; i++) { - var batch = batches[i]; - for (var j = 0; j < batch.size; j++) { - var index = batch.start + j; - this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart; - } - } - }; - /** - * Checks to see if this graphics geometry can be batched. - * Currently it needs to be small enough and not contain any native lines. - * - * @protected - */ - GraphicsGeometry.prototype.isBatchable = function () { - // prevent heavy mesh batching - if (this.points.length > 0xffff * 2) { - return false; - } - var batches = this.batches; - for (var i = 0; i < batches.length; i++) { - if (batches[i].style.native) { - return false; - } - } - return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2); - }; - /** - * Converts intermediate batches data to drawCalls. - * - * @protected - */ - GraphicsGeometry.prototype.buildDrawCalls = function () { - var TICK = ++BaseTexture._globalBatch; - for (var i = 0; i < this.drawCalls.length; i++) { - this.drawCalls[i].texArray.clear(); - DRAW_CALL_POOL.push(this.drawCalls[i]); - } - this.drawCalls.length = 0; - var colors = this.colors; - var textureIds = this.textureIds; - var currentGroup = DRAW_CALL_POOL.pop(); - if (!currentGroup) { - currentGroup = new BatchDrawCall(); - currentGroup.texArray = new BatchTextureArray(); - } - currentGroup.texArray.count = 0; - currentGroup.start = 0; - currentGroup.size = 0; - currentGroup.type = exports.DRAW_MODES.TRIANGLES; - var textureCount = 0; - var currentTexture = null; - var textureId = 0; - var native = false; - var drawMode = exports.DRAW_MODES.TRIANGLES; - var index = 0; - this.drawCalls.push(currentGroup); - // TODO - this can be simplified - for (var i = 0; i < this.batches.length; i++) { - var data = this.batches[i]; - // TODO add some full on MAX_TEXTURE CODE.. - var MAX_TEXTURES = 8; - // Forced cast for checking `native` without errors - var style = data.style; - var nextTexture = style.texture.baseTexture; - if (native !== !!style.native) { - native = !!style.native; - drawMode = native ? exports.DRAW_MODES.LINES : exports.DRAW_MODES.TRIANGLES; - // force the batch to break! - currentTexture = null; - textureCount = MAX_TEXTURES; - TICK++; - } - if (currentTexture !== nextTexture) { - currentTexture = nextTexture; - if (nextTexture._batchEnabled !== TICK) { - if (textureCount === MAX_TEXTURES) { - TICK++; - textureCount = 0; - if (currentGroup.size > 0) { - currentGroup = DRAW_CALL_POOL.pop(); - if (!currentGroup) { - currentGroup = new BatchDrawCall(); - currentGroup.texArray = new BatchTextureArray(); - } - this.drawCalls.push(currentGroup); - } - currentGroup.start = index; - currentGroup.size = 0; - currentGroup.texArray.count = 0; - currentGroup.type = drawMode; - } - // TODO add this to the render part.. - // Hack! Because texture has protected `touched` - nextTexture.touched = 1; // touch; - nextTexture._batchEnabled = TICK; - nextTexture._batchLocation = textureCount; - nextTexture.wrapMode = 10497; - currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture; - textureCount++; - } - } - currentGroup.size += data.size; - index += data.size; - textureId = nextTexture._batchLocation; - this.addColors(colors, style.color, style.alpha, data.attribSize); - this.addTextureIds(textureIds, textureId, data.attribSize); - } - BaseTexture._globalBatch = TICK; - // upload.. - // merge for now! - this.packAttributes(); - }; - /** - * Packs attributes to single buffer. - * - * @protected - */ - GraphicsGeometry.prototype.packAttributes = function () { - var verts = this.points; - var uvs = this.uvs; - var colors = this.colors; - var textureIds = this.textureIds; - // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes - var glPoints = new ArrayBuffer(verts.length * 3 * 4); - var f32 = new Float32Array(glPoints); - var u32 = new Uint32Array(glPoints); - var p = 0; - for (var i = 0; i < verts.length / 2; i++) { - f32[p++] = verts[i * 2]; - f32[p++] = verts[(i * 2) + 1]; - f32[p++] = uvs[i * 2]; - f32[p++] = uvs[(i * 2) + 1]; - u32[p++] = colors[i]; - f32[p++] = textureIds[i]; - } - this._buffer.update(glPoints); - this._indexBuffer.update(this.indicesUint16); - }; - /** - * Process fill part of Graphics. - * - * @param {PIXI.GraphicsData} data - * @protected - */ - GraphicsGeometry.prototype.processFill = function (data) { - if (data.holes.length) { - this.processHoles(data.holes); - buildPoly.triangulate(data, this); - } - else { - var command = FILL_COMMANDS[data.type]; - command.triangulate(data, this); - } - }; - /** - * Process line part of Graphics. - * - * @param {PIXI.GraphicsData} data - * @protected - */ - GraphicsGeometry.prototype.processLine = function (data) { - buildLine(data, this); - for (var i = 0; i < data.holes.length; i++) { - buildLine(data.holes[i], this); - } - }; - /** - * Process the holes data. - * - * @param {PIXI.GraphicsData[]} holes - Holes to render - * @protected - */ - GraphicsGeometry.prototype.processHoles = function (holes) { - for (var i = 0; i < holes.length; i++) { - var hole = holes[i]; - var command = FILL_COMMANDS[hole.type]; - command.build(hole); - if (hole.matrix) { - this.transformPoints(hole.points, hole.matrix); - } - } - }; - /** - * Update the local bounds of the object. Expensive to use performance-wise. - * - * @protected - */ - GraphicsGeometry.prototype.calculateBounds = function () { - var bounds = this._bounds; - var sequenceBounds = tmpBounds; - var curMatrix = Matrix.IDENTITY; - this._bounds.clear(); - sequenceBounds.clear(); - for (var i = 0; i < this.graphicsData.length; i++) { - var data = this.graphicsData[i]; - var shape = data.shape; - var type = data.type; - var lineStyle = data.lineStyle; - var nextMatrix = data.matrix || Matrix.IDENTITY; - var lineWidth = 0.0; - if (lineStyle && lineStyle.visible) { - var alignment = lineStyle.alignment; - lineWidth = lineStyle.width; - if (type === exports.SHAPES.POLY) { - lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment)); - } - else { - lineWidth = lineWidth * Math.max(0, alignment); - } - } - if (curMatrix !== nextMatrix) { - if (!sequenceBounds.isEmpty()) { - bounds.addBoundsMatrix(sequenceBounds, curMatrix); - sequenceBounds.clear(); - } - curMatrix = nextMatrix; - } - if (type === exports.SHAPES.RECT || type === exports.SHAPES.RREC) { - var rect = shape; - sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, lineWidth, lineWidth); - } - else if (type === exports.SHAPES.CIRC) { - var circle = shape; - sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y, circle.radius + lineWidth, circle.radius + lineWidth); - } - else if (type === exports.SHAPES.ELIP) { - var ellipse = shape; - sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y, ellipse.width + lineWidth, ellipse.height + lineWidth); - } - else { - var poly = shape; - // adding directly to the bounds - bounds.addVerticesMatrix(curMatrix, poly.points, 0, poly.points.length, lineWidth, lineWidth); - } - } - if (!sequenceBounds.isEmpty()) { - bounds.addBoundsMatrix(sequenceBounds, curMatrix); - } - bounds.pad(this.boundsPadding, this.boundsPadding); - }; - /** - * Transform points using matrix. - * - * @protected - * @param {number[]} points - Points to transform - * @param {PIXI.Matrix} matrix - Transform matrix - */ - GraphicsGeometry.prototype.transformPoints = function (points, matrix) { - for (var i = 0; i < points.length / 2; i++) { - var x = points[(i * 2)]; - var y = points[(i * 2) + 1]; - points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx; - points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty; - } - }; - /** - * Add colors. - * - * @protected - * @param {number[]} colors - List of colors to add to - * @param {number} color - Color to add - * @param {number} alpha - Alpha to use - * @param {number} size - Number of colors to add - */ - GraphicsGeometry.prototype.addColors = function (colors, color, alpha, size) { - // TODO use the premultiply bits Ivan added - var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16); - var rgba = premultiplyTint(rgb, alpha); - while (size-- > 0) { - colors.push(rgba); - } - }; - /** - * Add texture id that the shader/fragment wants to use. - * - * @protected - * @param {number[]} textureIds - * @param {number} id - * @param {number} size - */ - GraphicsGeometry.prototype.addTextureIds = function (textureIds, id, size) { - while (size-- > 0) { - textureIds.push(id); - } - }; - /** - * Generates the UVs for a shape. - * - * @protected - * @param {number[]} verts - Vertices - * @param {number[]} uvs - UVs - * @param {PIXI.Texture} texture - Reference to Texture - * @param {number} start - Index buffer start index. - * @param {number} size - The size/length for index buffer. - * @param {PIXI.Matrix} [matrix] - Optional transform for all points. - */ - GraphicsGeometry.prototype.addUvs = function (verts, uvs, texture, start, size, matrix) { - if (matrix === void 0) { matrix = null; } - var index = 0; - var uvsStart = uvs.length; - var frame = texture.frame; - while (index < size) { - var x = verts[(start + index) * 2]; - var y = verts[((start + index) * 2) + 1]; - if (matrix) { - var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx; - y = (matrix.b * x) + (matrix.d * y) + matrix.ty; - x = nx; - } - index++; - uvs.push(x / frame.width, y / frame.height); - } - var baseTexture = texture.baseTexture; - if (frame.width < baseTexture.width - || frame.height < baseTexture.height) { - this.adjustUvs(uvs, texture, uvsStart, size); - } - }; - /** - * Modify uvs array according to position of texture region - * Does not work with rotated or trimmed textures - * - * @param {number[]} uvs - array - * @param {PIXI.Texture} texture - region - * @param {number} start - starting index for uvs - * @param {number} size - how many points to adjust - */ - GraphicsGeometry.prototype.adjustUvs = function (uvs, texture, start, size) { - var baseTexture = texture.baseTexture; - var eps = 1e-6; - var finish = start + (size * 2); - var frame = texture.frame; - var scaleX = frame.width / baseTexture.width; - var scaleY = frame.height / baseTexture.height; - var offsetX = frame.x / frame.width; - var offsetY = frame.y / frame.height; - var minX = Math.floor(uvs[start] + eps); - var minY = Math.floor(uvs[start + 1] + eps); - for (var i = start + 2; i < finish; i += 2) { - minX = Math.min(minX, Math.floor(uvs[i] + eps)); - minY = Math.min(minY, Math.floor(uvs[i + 1] + eps)); - } - offsetX -= minX; - offsetY -= minY; - for (var i = start; i < finish; i += 2) { - uvs[i] = (uvs[i] + offsetX) * scaleX; - uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY; - } - }; - /** - * The maximum number of points to consider an object "batchable", - * able to be batched by the renderer's batch system. - * - * @memberof PIXI.GraphicsGeometry - * @static - * @member {number} BATCHABLE_SIZE - * @default 100 - */ - GraphicsGeometry.BATCHABLE_SIZE = 100; - return GraphicsGeometry; - }(BatchGeometry)); - - /** - * Represents the line style for Graphics. - * @memberof PIXI - * @class - * @extends PIXI.FillStyle - */ - var LineStyle = /** @class */ (function (_super) { - __extends$5(LineStyle, _super); - function LineStyle() { - var _this = _super !== null && _super.apply(this, arguments) || this; - /** - * The width (thickness) of any lines drawn. - * - * @member {number} - * @default 0 - */ - _this.width = 0; - /** - * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). - * - * @member {number} - * @default 0.5 - */ - _this.alignment = 0.5; - /** - * If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * - * @member {boolean} - * @default false - */ - _this.native = false; - /** - * Line cap style. - * - * @member {PIXI.LINE_CAP} - * @default PIXI.LINE_CAP.BUTT - */ - _this.cap = exports.LINE_CAP.BUTT; - /** - * Line join style. - * - * @member {PIXI.LINE_JOIN} - * @default PIXI.LINE_JOIN.MITER - */ - _this.join = exports.LINE_JOIN.MITER; - /** - * Miter limit. - * - * @member {number} - * @default 10 - */ - _this.miterLimit = 10; - return _this; - } - /** - * Clones the object - * - * @return {PIXI.LineStyle} - */ - LineStyle.prototype.clone = function () { - var obj = new LineStyle(); - obj.color = this.color; - obj.alpha = this.alpha; - obj.texture = this.texture; - obj.matrix = this.matrix; - obj.visible = this.visible; - obj.width = this.width; - obj.alignment = this.alignment; - obj.native = this.native; - obj.cap = this.cap; - obj.join = this.join; - obj.miterLimit = this.miterLimit; - return obj; - }; - /** - * Reset the line style to default. - */ - LineStyle.prototype.reset = function () { - _super.prototype.reset.call(this); - // Override default line style color - this.color = 0x0; - this.alignment = 0.5; - this.width = 0; - this.native = false; - }; - return LineStyle; - }(FillStyle)); - - var temp = new Float32Array(3); - // a default shaders map used by graphics.. - var DEFAULT_SHADERS = {}; - /** - * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. - * - * Note that because Graphics can share a GraphicsGeometry with other instances, - * it is necessary to call `destroy()` to properly dereference the underlying - * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same - * Graphics instance and call `clear()` between redraws. - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Graphics = /** @class */ (function (_super) { - __extends$5(Graphics, _super); - /** - * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted - * will create a new GraphicsGeometry instance. - */ - function Graphics(geometry) { - if (geometry === void 0) { geometry = null; } - var _this = _super.call(this) || this; - _this._geometry = geometry || new GraphicsGeometry(); - _this._geometry.refCount++; - /** - * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. - * Can be shared between multiple Graphics objects. - * - * @member {PIXI.Shader} - */ - _this.shader = null; - /** - * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., - * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. - * - * @member {PIXI.State} - */ - _this.state = State.for2d(); - /** - * Current fill style - * - * @member {PIXI.FillStyle} - * @protected - */ - _this._fillStyle = new FillStyle(); - /** - * Current line style - * - * @member {PIXI.LineStyle} - * @protected - */ - _this._lineStyle = new LineStyle(); - /** - * Current shape transform matrix. - * - * @member {PIXI.Matrix} - * @protected - */ - _this._matrix = null; - /** - * Current hole mode is enabled. - * - * @member {boolean} - * @default false - * @protected - */ - _this._holeMode = false; - /** - * Current path - * - * @member {PIXI.Polygon} - * @protected - */ - _this.currentPath = null; - /** - * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. - * This is useful if your graphics element does not change often, as it will speed up the rendering - * of the object in exchange for taking up texture memory. It is also useful if you need the graphics - * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if - * you are constantly redrawing the graphics element. - * - * @name cacheAsBitmap - * @member {boolean} - * @memberof PIXI.Graphics# - * @default false - */ - /** - * A collections of batches! These can be drawn by the renderer batch system. - * - * @protected - * @member {object[]} - */ - _this.batches = []; - /** - * Update dirty for limiting calculating tints for batches. - * - * @protected - * @member {number} - * @default -1 - */ - _this.batchTint = -1; - /** - * Update dirty for limiting calculating batches. - * - * @protected - * @member {number} - * @default -1 - */ - _this.batchDirty = -1; - /** - * Copy of the object vertex data. - * - * @protected - * @member {Float32Array} - */ - _this.vertexData = null; - /** - * Renderer plugin for batching - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = 'batch'; - _this._transformID = -1; - // Set default - _this.tint = 0xFFFFFF; - _this.blendMode = exports.BLEND_MODES.NORMAL; - return _this; - } - Object.defineProperty(Graphics.prototype, "geometry", { - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh or Graphics objects. - * - * @member {PIXI.GraphicsGeometry} - * @readonly - */ - get: function () { - return this._geometry; - }, - enumerable: false, - configurable: true - }); - /** - * Creates a new Graphics object with the same values as this one. - * Note that only the geometry of the object is cloned, not its transform (position,scale,etc) - * - * @return {PIXI.Graphics} A clone of the graphics object - */ - Graphics.prototype.clone = function () { - this.finishPoly(); - return new Graphics(this._geometry); - }; - Object.defineProperty(Graphics.prototype, "blendMode", { - get: function () { - return this.state.blendMode; - }, - /** - * The blend mode to be applied to the graphic shape. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "tint", { - /** - * The tint applied to the graphic shape. This is a hex value. A value of - * 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "fill", { - /** - * The current fill style. - * - * @member {PIXI.FillStyle} - * @readonly - */ - get: function () { - return this._fillStyle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Graphics.prototype, "line", { - /** - * The current line style. - * - * @member {PIXI.LineStyle} - * @readonly - */ - get: function () { - return this._lineStyle; - }, - enumerable: false, - configurable: true - }); - /** - * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() - * method or the drawCircle() method. - * - * @method PIXI.Graphics#lineStyle - * @param {number} [width=0] - width of the line to draw, will update the objects stored style - * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style - * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - /** - * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() - * method or the drawCircle() method. - * - * @param {object} [options] - Line style options - * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style - * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style - * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style - * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style - * @param {number}[options.miterLimit=10] - miter limit ratio - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineStyle = function (options) { - if (options === void 0) { options = null; } - // Support non-object params: (width, color, alpha, alignment, native) - if (typeof options === 'number') { - // eslint-disable-next-line - var args = arguments; - options = { - width: args[0] || 0, - color: args[1] || 0x0, - alpha: args[2] !== undefined ? args[2] : 1, - alignment: args[3] !== undefined ? args[3] : 0.5, - native: !!args[4], - }; - } - return this.lineTextureStyle(options); - }; - /** - * Like line style but support texture for line fill. - * - * @param {object} [options] - Collection of options for setting line style. - * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style - * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use - * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style. - * Default 0xFFFFFF if texture present. - * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture - * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style - * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style - * @param {number}[options.miterLimit=10] - miter limit ratio - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineTextureStyle = function (options) { - // backward compatibility with params: (width, texture, - // color, alpha, matrix, alignment, native) - if (typeof options === 'number') { - deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle'); - // eslint-disable-next-line - var _a = arguments, width = _a[0], texture = _a[1], color = _a[2], alpha = _a[3], matrix = _a[4], alignment = _a[5], native = _a[6]; - options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native }; - // Remove undefined keys - Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); - } - // Apply defaults - options = Object.assign({ - width: 0, - texture: Texture.WHITE, - color: (options && options.texture) ? 0xFFFFFF : 0x0, - alpha: 1, - matrix: null, - alignment: 0.5, - native: false, - cap: exports.LINE_CAP.BUTT, - join: exports.LINE_JOIN.MITER, - miterLimit: 10, - }, options); - if (this.currentPath) { - this.startPoly(); - } - var visible = options.width > 0 && options.alpha > 0; - if (!visible) { - this._lineStyle.reset(); - } - else { - if (options.matrix) { - options.matrix = options.matrix.clone(); - options.matrix.invert(); - } - Object.assign(this._lineStyle, { visible: visible }, options); - } - return this; - }; - /** - * Start a polygon object internally - * @protected - */ - Graphics.prototype.startPoly = function () { - if (this.currentPath) { - var points = this.currentPath.points; - var len = this.currentPath.points.length; - if (len > 2) { - this.drawShape(this.currentPath); - this.currentPath = new Polygon(); - this.currentPath.closeStroke = false; - this.currentPath.points.push(points[len - 2], points[len - 1]); - } - } - else { - this.currentPath = new Polygon(); - this.currentPath.closeStroke = false; - } - }; - /** - * Finish the polygon object. - * @protected - */ - Graphics.prototype.finishPoly = function () { - if (this.currentPath) { - if (this.currentPath.points.length > 2) { - this.drawShape(this.currentPath); - this.currentPath = null; - } - else { - this.currentPath.points.length = 0; - } - } - }; - /** - * Moves the current drawing position to x, y. - * - * @param {number} x - the X coordinate to move to - * @param {number} y - the Y coordinate to move to - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.moveTo = function (x, y) { - this.startPoly(); - this.currentPath.points[0] = x; - this.currentPath.points[1] = y; - return this; - }; - /** - * Draws a line using the current line style from the current drawing position to (x, y); - * The current drawing position is then set to (x, y). - * - * @param {number} x - the X coordinate to draw to - * @param {number} y - the Y coordinate to draw to - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.lineTo = function (x, y) { - if (!this.currentPath) { - this.moveTo(0, 0); - } - // remove duplicates.. - var points = this.currentPath.points; - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - if (fromX !== x || fromY !== y) { - points.push(x, y); - } - return this; - }; - /** - * Initialize the curve - * - * @protected - * @param {number} [x=0] - * @param {number} [y=0] - */ - Graphics.prototype._initCurve = function (x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (this.currentPath) { - if (this.currentPath.points.length === 0) { - this.currentPath.points = [x, y]; - } - } - else { - this.moveTo(x, y); - } - }; - /** - * Calculate the points for a quadratic bezier curve and then draws it. - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY) { - this._initCurve(); - var points = this.currentPath.points; - if (points.length === 0) { - this.moveTo(0, 0); - } - QuadraticUtils.curveTo(cpX, cpY, toX, toY, points); - return this; - }; - /** - * Calculate the points for a bezier curve and then draws it. - * - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY) { - this._initCurve(); - BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points); - return this; - }; - /** - * The arcTo() method creates an arc/curve between two tangents on the canvas. - * - * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! - * - * @param {number} x1 - The x-coordinate of the first tangent point of the arc - * @param {number} y1 - The y-coordinate of the first tangent point of the arc - * @param {number} x2 - The x-coordinate of the end of the arc - * @param {number} y2 - The y-coordinate of the end of the arc - * @param {number} radius - The radius of the arc - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.arcTo = function (x1, y1, x2, y2, radius) { - this._initCurve(x1, y1); - var points = this.currentPath.points; - var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points); - if (result) { - var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise; - this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise); - } - return this; - }; - /** - * The arc method creates an arc/curve (used to create circles, or parts of circles). - * - * @param {number} cx - The x-coordinate of the center of the circle - * @param {number} cy - The y-coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position - * of the arc's circle) - * @param {number} endAngle - The ending angle, in radians - * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be - * counter-clockwise or clockwise. False is default, and indicates clockwise, while true - * indicates counter-clockwise. - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.arc = function (cx, cy, radius, startAngle, endAngle, anticlockwise) { - if (anticlockwise === void 0) { anticlockwise = false; } - if (startAngle === endAngle) { - return this; - } - if (!anticlockwise && endAngle <= startAngle) { - endAngle += PI_2; - } - else if (anticlockwise && startAngle <= endAngle) { - startAngle += PI_2; - } - var sweep = endAngle - startAngle; - if (sweep === 0) { - return this; - } - var startX = cx + (Math.cos(startAngle) * radius); - var startY = cy + (Math.sin(startAngle) * radius); - var eps = this._geometry.closePointEps; - // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path. - var points = this.currentPath ? this.currentPath.points : null; - if (points) { - // TODO: make a better fix. - // We check how far our start is from the last existing point - var xDiff = Math.abs(points[points.length - 2] - startX); - var yDiff = Math.abs(points[points.length - 1] - startY); - if (xDiff < eps && yDiff < eps) { ; } - else { - points.push(startX, startY); - } - } - else { - this.moveTo(startX, startY); - points = this.currentPath.points; - } - ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points); - return this; - }; - /** - * Specifies a simple one-color fill that subsequent calls to other Graphics methods - * (such as lineTo() or drawCircle()) use when drawing. - * - * @param {number} [color=0] - the color of the fill - * @param {number} [alpha=1] - the alpha of the fill - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.beginFill = function (color, alpha) { - if (color === void 0) { color = 0; } - if (alpha === void 0) { alpha = 1; } - return this.beginTextureFill({ texture: Texture.WHITE, color: color, alpha: alpha }); - }; - /** - * Begin the texture fill - * - * @param {object} [options] - Object object. - * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill - * @param {number} [options.color=0xffffff] - Background to fill behind texture - * @param {number} [options.alpha=1] - Alpha of fill - * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.beginTextureFill = function (options) { - // backward compatibility with params: (texture, color, alpha, matrix) - if (options instanceof Texture) { - deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill'); - // eslint-disable-next-line - var _a = arguments, texture = _a[0], color = _a[1], alpha = _a[2], matrix = _a[3]; - options = { texture: texture, color: color, alpha: alpha, matrix: matrix }; - // Remove undefined keys - Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); - } - // Apply defaults - options = Object.assign({ - texture: Texture.WHITE, - color: 0xFFFFFF, - alpha: 1, - matrix: null, - }, options); - if (this.currentPath) { - this.startPoly(); - } - var visible = options.alpha > 0; - if (!visible) { - this._fillStyle.reset(); - } - else { - if (options.matrix) { - options.matrix = options.matrix.clone(); - options.matrix.invert(); - } - Object.assign(this._fillStyle, { visible: visible }, options); - } - return this; - }; - /** - * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. - * - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.endFill = function () { - this.finishPoly(); - this._fillStyle.reset(); - return this; - }; - /** - * Draws a rectangle shape. - * - * @param {number} x - The X coord of the top-left of the rectangle - * @param {number} y - The Y coord of the top-left of the rectangle - * @param {number} width - The width of the rectangle - * @param {number} height - The height of the rectangle - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawRect = function (x, y, width, height) { - return this.drawShape(new Rectangle(x, y, width, height)); - }; - /** - * Draw a rectangle shape with rounded/beveled corners. - * - * @param {number} x - The X coord of the top-left of the rectangle - * @param {number} y - The Y coord of the top-left of the rectangle - * @param {number} width - The width of the rectangle - * @param {number} height - The height of the rectangle - * @param {number} radius - Radius of the rectangle corners - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawRoundedRect = function (x, y, width, height, radius) { - return this.drawShape(new RoundedRectangle(x, y, width, height, radius)); - }; - /** - * Draws a circle. - * - * @param {number} x - The X coordinate of the center of the circle - * @param {number} y - The Y coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawCircle = function (x, y, radius) { - return this.drawShape(new Circle(x, y, radius)); - }; - /** - * Draws an ellipse. - * - * @param {number} x - The X coordinate of the center of the ellipse - * @param {number} y - The Y coordinate of the center of the ellipse - * @param {number} width - The half width of the ellipse - * @param {number} height - The half height of the ellipse - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawEllipse = function (x, y, width, height) { - return this.drawShape(new Ellipse(x, y, width, height)); - }; - /** - * Draws a polygon using the given path. - * - * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon. - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawPolygon = function () { - var arguments$1 = arguments; - - var path = []; - for (var _i = 0; _i < arguments.length; _i++) { - path[_i] = arguments$1[_i]; - } - var points; - var closeStroke = true; // !!this._fillStyle; - var poly = path[0]; - // check if data has points.. - if (poly.points) { - closeStroke = poly.closeStroke; - points = poly.points; - } - else if (Array.isArray(path[0])) { - points = path[0]; - } - else { - points = path; - } - var shape = new Polygon(points); - shape.closeStroke = closeStroke; - this.drawShape(shape); - return this; - }; - /** - * Draw any shape. - * - * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawShape = function (shape) { - if (!this._holeMode) { - this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix); - } - else { - this._geometry.drawHole(shape, this._matrix); - } - return this; - }; - /** - * Draw a star shape with an arbitrary number of points. - * - * @param {number} x - Center X position of the star - * @param {number} y - Center Y position of the star - * @param {number} points - The number of points of the star, must be > 1 - * @param {number} radius - The outer radius of the star - * @param {number} [innerRadius] - The inner radius between points, default half `radius` - * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.drawStar = function (x, y, points, radius, innerRadius, rotation) { - if (rotation === void 0) { rotation = 0; } - return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation)); - }; - /** - * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. - * - * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls - */ - Graphics.prototype.clear = function () { - this._geometry.clear(); - this._lineStyle.reset(); - this._fillStyle.reset(); - this._boundsID++; - this._matrix = null; - this._holeMode = false; - this.currentPath = null; - return this; - }; - /** - * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and - * masked with gl.scissor. - * - * @returns {boolean} True if only 1 rect. - */ - Graphics.prototype.isFastRect = function () { - var data = this._geometry.graphicsData; - return data.length === 1 - && data[0].shape.type === exports.SHAPES.RECT - && !(data[0].lineStyle.visible && data[0].lineStyle.width); - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._render = function (renderer) { - this.finishPoly(); - var geometry = this._geometry; - var hasuint32 = renderer.context.supports.uint32Indices; - // batch part.. - // batch it! - geometry.updateBatches(hasuint32); - if (geometry.batchable) { - if (this.batchDirty !== geometry.batchDirty) { - this._populateBatches(); - } - this._renderBatched(renderer); - } - else { - // no batching... - renderer.batch.flush(); - this._renderDirect(renderer); - } - }; - /** - * Populating batches for rendering - * - * @protected - */ - Graphics.prototype._populateBatches = function () { - var geometry = this._geometry; - var blendMode = this.blendMode; - var len = geometry.batches.length; - this.batchTint = -1; - this._transformID = -1; - this.batchDirty = geometry.batchDirty; - this.batches.length = len; - this.vertexData = new Float32Array(geometry.points); - for (var i = 0; i < len; i++) { - var gI = geometry.batches[i]; - var color = gI.style.color; - var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); - var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); - var indices = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size); - var batch = { - vertexData: vertexData, - blendMode: blendMode, - indices: indices, - uvs: uvs, - _batchRGB: hex2rgb(color), - _tintRGB: color, - _texture: gI.style.texture, - alpha: gI.style.alpha, - worldAlpha: 1 - }; - this.batches[i] = batch; - } - }; - /** - * Renders the batches using the BathedRenderer plugin - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._renderBatched = function (renderer) { - if (!this.batches.length) { - return; - } - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - this.calculateVertices(); - this.calculateTints(); - for (var i = 0, l = this.batches.length; i < l; i++) { - var batch = this.batches[i]; - batch.worldAlpha = this.worldAlpha * batch.alpha; - renderer.plugins[this.pluginName].render(batch); - } - }; - /** - * Renders the graphics direct - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._renderDirect = function (renderer) { - var shader = this._resolveDirectShader(renderer); - var geometry = this._geometry; - var tint = this.tint; - var worldAlpha = this.worldAlpha; - var uniforms = shader.uniforms; - var drawCalls = geometry.drawCalls; - // lets set the transfomr - uniforms.translationMatrix = this.transform.worldTransform; - // and then lets set the tint.. - uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha; - uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha; - uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha; - uniforms.tint[3] = worldAlpha; - // the first draw call, we can set the uniforms of the shader directly here. - // this means that we can tack advantage of the sync function of pixi! - // bind and sync uniforms.. - // there is a way to optimise this.. - renderer.shader.bind(shader); - renderer.geometry.bind(geometry, shader); - // set state.. - renderer.state.set(this.state); - // then render the rest of them... - for (var i = 0, l = drawCalls.length; i < l; i++) { - this._renderDrawCallDirect(renderer, geometry.drawCalls[i]); - } - }; - /** - * Renders specific DrawCall - * - * @param {PIXI.Renderer} renderer - * @param {PIXI.BatchDrawCall} drawCall - */ - Graphics.prototype._renderDrawCallDirect = function (renderer, drawCall) { - var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start; - var groupTextureCount = texArray.count; - for (var j = 0; j < groupTextureCount; j++) { - renderer.texture.bind(texArray.elements[j], j); - } - renderer.geometry.draw(type, size, start); - }; - /** - * Resolves shader for direct rendering - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Graphics.prototype._resolveDirectShader = function (renderer) { - var shader = this.shader; - var pluginName = this.pluginName; - if (!shader) { - // if there is no shader here, we can use the default shader. - // and that only gets created if we actually need it.. - // but may be more than one plugins for graphics - if (!DEFAULT_SHADERS[pluginName]) { - var MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES; - var sampleValues = new Int32Array(MAX_TEXTURES); - for (var i = 0; i < MAX_TEXTURES; i++) { - sampleValues[i] = i; - } - var uniforms = { - tint: new Float32Array([1, 1, 1, 1]), - translationMatrix: new Matrix(), - default: UniformGroup.from({ uSamplers: sampleValues }, true), - }; - var program = renderer.plugins[pluginName]._shader.program; - DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms); - } - shader = DEFAULT_SHADERS[pluginName]; - } - return shader; - }; - /** - * Retrieves the bounds of the graphic shape as a rectangle object - * - * @protected - */ - Graphics.prototype._calculateBounds = function () { - this.finishPoly(); - var geometry = this._geometry; - // skipping when graphics is empty, like a container - if (!geometry.graphicsData.length) { - return; - } - var _a = geometry.bounds, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); - }; - /** - * Tests if a point is inside this graphics object - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Graphics.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, Graphics._TEMP_POINT); - return this._geometry.containsPoint(Graphics._TEMP_POINT); - }; - /** - * Recalcuate the tint by applying tin to batches using Graphics tint. - * @protected - */ - Graphics.prototype.calculateTints = function () { - if (this.batchTint !== this.tint) { - this.batchTint = this.tint; - var tintRGB = hex2rgb(this.tint, temp); - for (var i = 0; i < this.batches.length; i++) { - var batch = this.batches[i]; - var batchTint = batch._batchRGB; - var r = (tintRGB[0] * batchTint[0]) * 255; - var g = (tintRGB[1] * batchTint[1]) * 255; - var b = (tintRGB[2] * batchTint[2]) * 255; - // TODO Ivan, can this be done in one go? - var color = (r << 16) + (g << 8) + (b | 0); - batch._tintRGB = (color >> 16) - + (color & 0xff00) - + ((color & 0xff) << 16); - } - } - }; - /** - * If there's a transform update or a change to the shape of the - * geometry, recaculate the vertices. - * @protected - */ - Graphics.prototype.calculateVertices = function () { - var wtID = this.transform._worldID; - if (this._transformID === wtID) { - return; - } - this._transformID = wtID; - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var data = this._geometry.points; // batch.vertexDataOriginal; - var vertexData = this.vertexData; - var count = 0; - for (var i = 0; i < data.length; i += 2) { - var x = data[i]; - var y = data[i + 1]; - vertexData[count++] = (a * x) + (c * y) + tx; - vertexData[count++] = (d * y) + (b * x) + ty; - } - }; - /** - * Closes the current path. - * - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.closePath = function () { - var currentPath = this.currentPath; - if (currentPath) { - // we don't need to add extra point in the end because buildLine will take care of that - currentPath.closeStroke = true; - } - return this; - }; - /** - * Apply a matrix to the positional data. - * - * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape. - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.setMatrix = function (matrix) { - this._matrix = matrix; - return this; - }; - /** - * Begin adding holes to the last draw shape - * IMPORTANT: holes must be fully inside a shape to work - * Also weirdness ensues if holes overlap! - * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer, - * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle. - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.beginHole = function () { - this.finishPoly(); - this._holeMode = true; - return this; - }; - /** - * End adding holes to the last draw shape - * @return {PIXI.Graphics} Returns itself. - */ - Graphics.prototype.endHole = function () { - this.finishPoly(); - this._holeMode = false; - return this; - }; - /** - * Destroys the Graphics object. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite - */ - Graphics.prototype.destroy = function (options) { - this._geometry.refCount--; - if (this._geometry.refCount === 0) { - this._geometry.dispose(); - } - this._matrix = null; - this.currentPath = null; - this._lineStyle.destroy(); - this._lineStyle = null; - this._fillStyle.destroy(); - this._fillStyle = null; - this._geometry = null; - this.shader = null; - this.vertexData = null; - this.batches.length = 0; - this.batches = null; - _super.prototype.destroy.call(this, options); - }; - /** - * Temporary point to use for containsPoint - * - * @static - * @private - * @member {PIXI.Point} - */ - Graphics._TEMP_POINT = new Point(); - return Graphics; - }(Container)); - - /*! - * @pixi/sprite - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$6 = function(d, b) { - extendStatics$6 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$6(d, b); - }; - - function __extends$6(d, b) { - extendStatics$6(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var tempPoint = new Point(); - var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); - /** - * The Sprite object is the base for all textured objects that are rendered to the screen - * - * A sprite can be created directly from an image like this: - * - * ```js - * let sprite = PIXI.Sprite.from('assets/image.png'); - * ``` - * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, - * as swapping base textures when rendering to the screen is inefficient. - * - * ```js - * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; - * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); - * ... - * } - * ``` - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Sprite = /** @class */ (function (_super) { - __extends$6(Sprite, _super); - /** - * @param {PIXI.Texture} [texture] - The texture for this sprite. - */ - function Sprite(texture) { - var _this = _super.call(this) || this; - /** - * The anchor point defines the normalized coordinates - * in the texture that map to the position of this - * sprite. - * - * By default, this is `(0,0)` (or `texture.defaultAnchor` - * if you have modified that), which means the position - * `(x,y)` of this `Sprite` will be the top-left corner. - * - * Note: Updating `texture.defaultAnchor` after - * constructing a `Sprite` does _not_ update its anchor. - * - * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html} - * - * @default `texture.defaultAnchor` - * @member {PIXI.ObservablePoint} - * @private - */ - _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); - /** - * The texture that the sprite is using - * - * @private - * @member {PIXI.Texture} - */ - _this._texture = null; - /** - * The width of the sprite (this is initially set by the texture) - * - * @protected - * @member {number} - */ - _this._width = 0; - /** - * The height of the sprite (this is initially set by the texture) - * - * @protected - * @member {number} - */ - _this._height = 0; - /** - * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 0xFFFFFF - */ - _this._tint = null; - /** - * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect. - * - * @private - * @member {number} - * @default 16777215 - */ - _this._tintRGB = null; - _this.tint = 0xFFFFFF; - /** - * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - _this.blendMode = exports.BLEND_MODES.NORMAL; - /** - * Cached tint value so we can tell when the tint is changed. - * Value is used for 2d CanvasRenderer. - * - * @protected - * @member {number} - * @default 0xFFFFFF - */ - _this._cachedTint = 0xFFFFFF; - /** - * this is used to store the uvs data of the sprite, assigned at the same time - * as the vertexData in calculateVertices() - * - * @private - * @member {Float32Array} - */ - _this.uvs = null; - // call texture setter - _this.texture = texture || Texture.EMPTY; - /** - * this is used to store the vertex data of the sprite (basically a quad) - * - * @private - * @member {Float32Array} - */ - _this.vertexData = new Float32Array(8); - /** - * This is used to calculate the bounds of the object IF it is a trimmed sprite - * - * @private - * @member {Float32Array} - */ - _this.vertexTrimmedData = null; - _this._transformID = -1; - _this._textureID = -1; - _this._transformTrimmedID = -1; - _this._textureTrimmedID = -1; - // Batchable stuff.. - // TODO could make this a mixin? - _this.indices = indices; - /** - * Plugin that is responsible for rendering this element. - * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods. - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = 'batch'; - /** - * used to fast check if a sprite is.. a sprite! - * @member {boolean} - */ - _this.isSprite = true; - /** - * Internal roundPixels field - * - * @member {boolean} - * @private - */ - _this._roundPixels = settings.ROUND_PIXELS; - return _this; - } - /** - * When the texture is updated, this event will fire to update the scale and frame - * - * @protected - */ - Sprite.prototype._onTextureUpdate = function () { - this._textureID = -1; - this._textureTrimmedID = -1; - this._cachedTint = 0xFFFFFF; - // so if _width is 0 then width was not set.. - if (this._width) { - this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width; - } - if (this._height) { - this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height; - } - }; - /** - * Called when the anchor position updates. - * - * @private - */ - Sprite.prototype._onAnchorUpdate = function () { - this._transformID = -1; - this._transformTrimmedID = -1; - }; - /** - * calculates worldTransform * vertices, store it in vertexData - */ - Sprite.prototype.calculateVertices = function () { - var texture = this._texture; - if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { - return; - } - // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` - if (this._textureID !== texture._updateID) { - this.uvs = this._texture._uvs.uvsFloat32; - } - this._transformID = this.transform._worldID; - this._textureID = texture._updateID; - // set the vertex data - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var vertexData = this.vertexData; - var trim = texture.trim; - var orig = texture.orig; - var anchor = this._anchor; - var w0 = 0; - var w1 = 0; - var h0 = 0; - var h1 = 0; - if (trim) { - // if the sprite is trimmed and is not a tilingsprite then we need to add the extra - // space before transforming the sprite coords. - w1 = trim.x - (anchor._x * orig.width); - w0 = w1 + trim.width; - h1 = trim.y - (anchor._y * orig.height); - h0 = h1 + trim.height; - } - else { - w1 = -anchor._x * orig.width; - w0 = w1 + orig.width; - h1 = -anchor._y * orig.height; - h0 = h1 + orig.height; - } - // xy - vertexData[0] = (a * w1) + (c * h1) + tx; - vertexData[1] = (d * h1) + (b * w1) + ty; - // xy - vertexData[2] = (a * w0) + (c * h1) + tx; - vertexData[3] = (d * h1) + (b * w0) + ty; - // xy - vertexData[4] = (a * w0) + (c * h0) + tx; - vertexData[5] = (d * h0) + (b * w0) + ty; - // xy - vertexData[6] = (a * w1) + (c * h0) + tx; - vertexData[7] = (d * h0) + (b * w1) + ty; - if (this._roundPixels) { - var resolution = settings.RESOLUTION; - for (var i = 0; i < vertexData.length; ++i) { - vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); - } - } - }; - /** - * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData - * This is used to ensure that the true width and height of a trimmed texture is respected - */ - Sprite.prototype.calculateTrimmedVertices = function () { - if (!this.vertexTrimmedData) { - this.vertexTrimmedData = new Float32Array(8); - } - else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { - return; - } - this._transformTrimmedID = this.transform._worldID; - this._textureTrimmedID = this._texture._updateID; - // lets do some special trim code! - var texture = this._texture; - var vertexData = this.vertexTrimmedData; - var orig = texture.orig; - var anchor = this._anchor; - // lets calculate the new untrimmed bounds.. - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var w1 = -anchor._x * orig.width; - var w0 = w1 + orig.width; - var h1 = -anchor._y * orig.height; - var h0 = h1 + orig.height; - // xy - vertexData[0] = (a * w1) + (c * h1) + tx; - vertexData[1] = (d * h1) + (b * w1) + ty; - // xy - vertexData[2] = (a * w0) + (c * h1) + tx; - vertexData[3] = (d * h1) + (b * w0) + ty; - // xy - vertexData[4] = (a * w0) + (c * h0) + tx; - vertexData[5] = (d * h0) + (b * w0) + ty; - // xy - vertexData[6] = (a * w1) + (c * h0) + tx; - vertexData[7] = (d * h0) + (b * w1) + ty; - }; - /** - * - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The webgl renderer to use. - */ - Sprite.prototype._render = function (renderer) { - this.calculateVertices(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - }; - /** - * Updates the bounds of the sprite. - * - * @protected - */ - Sprite.prototype._calculateBounds = function () { - var trim = this._texture.trim; - var orig = this._texture.orig; - // First lets check to see if the current texture has a trim.. - if (!trim || (trim.width === orig.width && trim.height === orig.height)) { - // no trim! lets use the usual calculations.. - this.calculateVertices(); - this._bounds.addQuad(this.vertexData); - } - else { - // lets calculate a special trimmed bounds... - this.calculateTrimmedVertices(); - this._bounds.addQuad(this.vertexTrimmedData); - } - }; - /** - * Gets the local bounds of the sprite object. - * - * @param {PIXI.Rectangle} [rect] - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - Sprite.prototype.getLocalBounds = function (rect) { - // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) { - this._bounds.minX = this._texture.orig.width * -this._anchor._x; - this._bounds.minY = this._texture.orig.height * -this._anchor._y; - this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x); - this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y); - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - return this._bounds.getRectangle(rect); - } - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * Tests if a point is inside this sprite - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Sprite.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, tempPoint); - var width = this._texture.orig.width; - var height = this._texture.orig.height; - var x1 = -width * this.anchor.x; - var y1 = 0; - if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { - y1 = -height * this.anchor.y; - if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { - return true; - } - } - return false; - }; - /** - * Destroys this sprite and optionally its texture and children - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well - */ - Sprite.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this._texture.off('update', this._onTextureUpdate, this); - this._anchor = null; - var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; - if (destroyTexture) { - var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; - this._texture.destroy(!!destroyBaseTexture); - } - this._texture = null; - }; - // some helper functions.. - /** - * Helper function that creates a new sprite based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from - * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.Sprite} The newly created sprite - */ - Sprite.from = function (source, options) { - var texture = (source instanceof Texture) - ? source - : Texture.from(source, options); - return new Sprite(texture); - }; - Object.defineProperty(Sprite.prototype, "roundPixels", { - get: function () { - return this._roundPixels; - }, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - set: function (value) { - if (this._roundPixels !== value) { - this._transformID = -1; - } - this._roundPixels = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "width", { - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return Math.abs(this.scale.x) * this._texture.orig.width; - }, - set: function (value) { - var s = sign$1(this.scale.x) || 1; - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "height", { - /** - * The height of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return Math.abs(this.scale.y) * this._texture.orig.height; - }, - set: function (value) { - var s = sign$1(this.scale.y) || 1; - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "anchor", { - /** - * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} - * and passed to the constructor. - * - * The default is `(0,0)`, this means the sprite's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. - * - * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this._anchor; - }, - set: function (value) { - this._anchor.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "tint", { - /** - * The tint applied to the sprite. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this._tint; - }, - set: function (value) { - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Sprite.prototype, "texture", { - /** - * The texture that the sprite is using - * - * @member {PIXI.Texture} - */ - get: function () { - return this._texture; - }, - set: function (value) { - if (this._texture === value) { - return; - } - if (this._texture) { - this._texture.off('update', this._onTextureUpdate, this); - } - this._texture = value || Texture.EMPTY; - this._cachedTint = 0xFFFFFF; - this._textureID = -1; - this._textureTrimmedID = -1; - if (value) { - // wait for the texture to load - if (value.baseTexture.valid) { - this._onTextureUpdate(); - } - else { - value.once('update', this._onTextureUpdate, this); - } - } - }, - enumerable: false, - configurable: true - }); - return Sprite; - }(Container)); - - /*! - * @pixi/text - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/text is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$7 = function(d, b) { - extendStatics$7 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$7(d, b); - }; - - function __extends$7(d, b) { - extendStatics$7(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Constants that define the type of gradient on text. - * - * @static - * @constant - * @name TEXT_GRADIENT - * @memberof PIXI - * @type {object} - * @property {number} LINEAR_VERTICAL Vertical gradient - * @property {number} LINEAR_HORIZONTAL Linear gradient - */ - - (function (TEXT_GRADIENT) { - TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_VERTICAL"] = 0] = "LINEAR_VERTICAL"; - TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_HORIZONTAL"] = 1] = "LINEAR_HORIZONTAL"; - })(exports.TEXT_GRADIENT || (exports.TEXT_GRADIENT = {})); - - // disabling eslint for now, going to rewrite this in v5 - var defaultStyle = { - align: 'left', - breakWords: false, - dropShadow: false, - dropShadowAlpha: 1, - dropShadowAngle: Math.PI / 6, - dropShadowBlur: 0, - dropShadowColor: 'black', - dropShadowDistance: 5, - fill: 'black', - fillGradientType: exports.TEXT_GRADIENT.LINEAR_VERTICAL, - fillGradientStops: [], - fontFamily: 'Arial', - fontSize: 26, - fontStyle: 'normal', - fontVariant: 'normal', - fontWeight: 'normal', - letterSpacing: 0, - lineHeight: 0, - lineJoin: 'miter', - miterLimit: 10, - padding: 0, - stroke: 'black', - strokeThickness: 0, - textBaseline: 'alphabetic', - trim: false, - whiteSpace: 'pre', - wordWrap: false, - wordWrapWidth: 100, - leading: 0, - }; - var genericFontFamilies = [ - 'serif', - 'sans-serif', - 'monospace', - 'cursive', - 'fantasy', - 'system-ui' ]; - /** - * A TextStyle Object contains information to decorate a Text objects. - * - * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. - * - * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). - * - * @class - * @memberof PIXI - */ - var TextStyle = /** @class */ (function () { - /** - * @param {object} [style] - The style parameters - * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), - * does not affect single line text - * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it - * needs wordWrap to be set to true - * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text - * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow - * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow - * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius - * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00' - * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow - * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas - * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient - * eg ['#000000','#FFFFFF'] - * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} - * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours - * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT} - * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set - * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. - * @param {string|string[]} [style.fontFamily='Arial'] - The font family - * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string, - * equivalents are '26px','20pt','160%' or '1.6em') - * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique') - * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps') - * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100', - * '200', '300', '400', '500', '600', '700', '800' or '900') - * @param {number} [style.leading=0] - The space between lines - * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0 - * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses - * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve - * spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" - * (creates a squared corner). - * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce - * or increase the spikiness of rendered text. - * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from - * happening by adding padding to all sides of the text. - * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke - * e.g 'blue', '#FCFF00' - * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. - * Default is 0 (no stroke) - * @param {boolean} [style.trim=false] - Trim transparent borders - * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered. - * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved "normal" - * (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true - * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used - * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true - */ - function TextStyle(style) { - this.styleID = 0; - this.reset(); - deepCopyProperties(this, style, style); - } - /** - * Creates a new TextStyle object with the same values as this one. - * Note that the only the properties of the object are cloned. - * - * @return {PIXI.TextStyle} New cloned TextStyle object - */ - TextStyle.prototype.clone = function () { - var clonedProperties = {}; - deepCopyProperties(clonedProperties, this, defaultStyle); - return new TextStyle(clonedProperties); - }; - /** - * Resets all properties to the defaults specified in TextStyle.prototype._default - */ - TextStyle.prototype.reset = function () { - deepCopyProperties(this, defaultStyle, defaultStyle); - }; - Object.defineProperty(TextStyle.prototype, "align", { - /** - * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text - * - * @member {string} - */ - get: function () { - return this._align; - }, - set: function (align) { - if (this._align !== align) { - this._align = align; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "breakWords", { - /** - * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true - * - * @member {boolean} - */ - get: function () { - return this._breakWords; - }, - set: function (breakWords) { - if (this._breakWords !== breakWords) { - this._breakWords = breakWords; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadow", { - /** - * Set a drop shadow for the text - * - * @member {boolean} - */ - get: function () { - return this._dropShadow; - }, - set: function (dropShadow) { - if (this._dropShadow !== dropShadow) { - this._dropShadow = dropShadow; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowAlpha", { - /** - * Set alpha for the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowAlpha; - }, - set: function (dropShadowAlpha) { - if (this._dropShadowAlpha !== dropShadowAlpha) { - this._dropShadowAlpha = dropShadowAlpha; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowAngle", { - /** - * Set a angle of the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowAngle; - }, - set: function (dropShadowAngle) { - if (this._dropShadowAngle !== dropShadowAngle) { - this._dropShadowAngle = dropShadowAngle; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowBlur", { - /** - * Set a shadow blur radius - * - * @member {number} - */ - get: function () { - return this._dropShadowBlur; - }, - set: function (dropShadowBlur) { - if (this._dropShadowBlur !== dropShadowBlur) { - this._dropShadowBlur = dropShadowBlur; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowColor", { - /** - * A fill style to be used on the dropshadow e.g 'red', '#00FF00' - * - * @member {string|number} - */ - get: function () { - return this._dropShadowColor; - }, - set: function (dropShadowColor) { - var outputColor = getColor(dropShadowColor); - if (this._dropShadowColor !== outputColor) { - this._dropShadowColor = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "dropShadowDistance", { - /** - * Set a distance of the drop shadow - * - * @member {number} - */ - get: function () { - return this._dropShadowDistance; - }, - set: function (dropShadowDistance) { - if (this._dropShadowDistance !== dropShadowDistance) { - this._dropShadowDistance = dropShadowDistance; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fill", { - /** - * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. - * Can be an array to create a gradient eg ['#000000','#FFFFFF'] - * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} - * - * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} - */ - get: function () { - return this._fill; - }, - set: function (fill) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in - // without casting here. - var outputColor = getColor(fill); - if (this._fill !== outputColor) { - this._fill = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fillGradientType", { - /** - * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. - * See {@link PIXI.TEXT_GRADIENT} - * - * @member {number} - */ - get: function () { - return this._fillGradientType; - }, - set: function (fillGradientType) { - if (this._fillGradientType !== fillGradientType) { - this._fillGradientType = fillGradientType; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fillGradientStops", { - /** - * If fill is an array of colours to create a gradient, this array can set the stop points - * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. - * - * @member {number[]} - */ - get: function () { - return this._fillGradientStops; - }, - set: function (fillGradientStops) { - if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) { - this._fillGradientStops = fillGradientStops; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontFamily", { - /** - * The font family - * - * @member {string|string[]} - */ - get: function () { - return this._fontFamily; - }, - set: function (fontFamily) { - if (this.fontFamily !== fontFamily) { - this._fontFamily = fontFamily; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontSize", { - /** - * The font size - * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') - * - * @member {number|string} - */ - get: function () { - return this._fontSize; - }, - set: function (fontSize) { - if (this._fontSize !== fontSize) { - this._fontSize = fontSize; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontStyle", { - /** - * The font style - * ('normal', 'italic' or 'oblique') - * - * @member {string} - */ - get: function () { - return this._fontStyle; - }, - set: function (fontStyle) { - if (this._fontStyle !== fontStyle) { - this._fontStyle = fontStyle; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontVariant", { - /** - * The font variant - * ('normal' or 'small-caps') - * - * @member {string} - */ - get: function () { - return this._fontVariant; - }, - set: function (fontVariant) { - if (this._fontVariant !== fontVariant) { - this._fontVariant = fontVariant; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "fontWeight", { - /** - * The font weight - * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') - * - * @member {string} - */ - get: function () { - return this._fontWeight; - }, - set: function (fontWeight) { - if (this._fontWeight !== fontWeight) { - this._fontWeight = fontWeight; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "letterSpacing", { - /** - * The amount of spacing between letters, default is 0 - * - * @member {number} - */ - get: function () { - return this._letterSpacing; - }, - set: function (letterSpacing) { - if (this._letterSpacing !== letterSpacing) { - this._letterSpacing = letterSpacing; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "lineHeight", { - /** - * The line height, a number that represents the vertical space that a letter uses - * - * @member {number} - */ - get: function () { - return this._lineHeight; - }, - set: function (lineHeight) { - if (this._lineHeight !== lineHeight) { - this._lineHeight = lineHeight; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "leading", { - /** - * The space between lines - * - * @member {number} - */ - get: function () { - return this._leading; - }, - set: function (leading) { - if (this._leading !== leading) { - this._leading = leading; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "lineJoin", { - /** - * The lineJoin property sets the type of corner created, it can resolve spiked text issues. - * Default is 'miter' (creates a sharp corner). - * - * @member {string} - */ - get: function () { - return this._lineJoin; - }, - set: function (lineJoin) { - if (this._lineJoin !== lineJoin) { - this._lineJoin = lineJoin; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "miterLimit", { - /** - * The miter limit to use when using the 'miter' lineJoin mode - * This can reduce or increase the spikiness of rendered text. - * - * @member {number} - */ - get: function () { - return this._miterLimit; - }, - set: function (miterLimit) { - if (this._miterLimit !== miterLimit) { - this._miterLimit = miterLimit; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "padding", { - /** - * Occasionally some fonts are cropped. Adding some padding will prevent this from happening - * by adding padding to all sides of the text. - * - * @member {number} - */ - get: function () { - return this._padding; - }, - set: function (padding) { - if (this._padding !== padding) { - this._padding = padding; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "stroke", { - /** - * A canvas fillstyle that will be used on the text stroke - * e.g 'blue', '#FCFF00' - * - * @member {string|number} - */ - get: function () { - return this._stroke; - }, - set: function (stroke) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var outputColor = getColor(stroke); - if (this._stroke !== outputColor) { - this._stroke = outputColor; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "strokeThickness", { - /** - * A number that represents the thickness of the stroke. - * Default is 0 (no stroke) - * - * @member {number} - */ - get: function () { - return this._strokeThickness; - }, - set: function (strokeThickness) { - if (this._strokeThickness !== strokeThickness) { - this._strokeThickness = strokeThickness; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "textBaseline", { - /** - * The baseline of the text that is rendered. - * - * @member {string} - */ - get: function () { - return this._textBaseline; - }, - set: function (textBaseline) { - if (this._textBaseline !== textBaseline) { - this._textBaseline = textBaseline; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "trim", { - /** - * Trim transparent borders - * - * @member {boolean} - */ - get: function () { - return this._trim; - }, - set: function (trim) { - if (this._trim !== trim) { - this._trim = trim; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "whiteSpace", { - /** - * How newlines and spaces should be handled. - * Default is 'pre' (preserve, preserve). - * - * value | New lines | Spaces - * --- | --- | --- - * 'normal' | Collapse | Collapse - * 'pre' | Preserve | Preserve - * 'pre-line' | Preserve | Collapse - * - * @member {string} - */ - get: function () { - return this._whiteSpace; - }, - set: function (whiteSpace) { - if (this._whiteSpace !== whiteSpace) { - this._whiteSpace = whiteSpace; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "wordWrap", { - /** - * Indicates if word wrap should be used - * - * @member {boolean} - */ - get: function () { - return this._wordWrap; - }, - set: function (wordWrap) { - if (this._wordWrap !== wordWrap) { - this._wordWrap = wordWrap; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextStyle.prototype, "wordWrapWidth", { - /** - * The width at which text will wrap, it needs wordWrap to be set to true - * - * @member {number} - */ - get: function () { - return this._wordWrapWidth; - }, - set: function (wordWrapWidth) { - if (this._wordWrapWidth !== wordWrapWidth) { - this._wordWrapWidth = wordWrapWidth; - this.styleID++; - } - }, - enumerable: false, - configurable: true - }); - /** - * Generates a font style string to use for `TextMetrics.measureFont()`. - * - * @return {string} Font style string, for passing to `TextMetrics.measureFont()` - */ - TextStyle.prototype.toFontString = function () { - // build canvas api font setting from individual components. Convert a numeric this.fontSize to px - var fontSizeString = (typeof this.fontSize === 'number') ? this.fontSize + "px" : this.fontSize; - // Clean-up fontFamily property by quoting each font name - // this will support font names with spaces - var fontFamilies = this.fontFamily; - if (!Array.isArray(this.fontFamily)) { - fontFamilies = this.fontFamily.split(','); - } - for (var i = fontFamilies.length - 1; i >= 0; i--) { - // Trim any extra white-space - var fontFamily = fontFamilies[i].trim(); - // Check if font already contains strings - if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) { - fontFamily = "\"" + fontFamily + "\""; - } - fontFamilies[i] = fontFamily; - } - return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + fontSizeString + " " + fontFamilies.join(','); - }; - return TextStyle; - }()); - /** - * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. - * @private - * @param {string|number} color - * @return {string} The color as a string. - */ - function getSingleColor(color) { - if (typeof color === 'number') { - return hex2string(color); - } - else if (typeof color === 'string') { - if (color.indexOf('0x') === 0) { - color = color.replace('0x', '#'); - } - } - return color; - } - function getColor(color) { - if (!Array.isArray(color)) { - return getSingleColor(color); - } - else { - for (var i = 0; i < color.length; ++i) { - color[i] = getSingleColor(color[i]); - } - return color; - } - } - /** - * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. - * This version can also convert array of colors - * @private - * @param {Array} array1 - First array to compare - * @param {Array} array2 - Second array to compare - * @return {boolean} Do the arrays contain the same values in the same order - */ - function areArraysEqual(array1, array2) { - if (!Array.isArray(array1) || !Array.isArray(array2)) { - return false; - } - if (array1.length !== array2.length) { - return false; - } - for (var i = 0; i < array1.length; ++i) { - if (array1[i] !== array2[i]) { - return false; - } - } - return true; - } - /** - * Utility function to ensure that object properties are copied by value, and not by reference - * @private - * @param {Object} target - Target object to copy properties into - * @param {Object} source - Source object for the properties to copy - * @param {string} propertyObj - Object containing properties names we want to loop over - */ - function deepCopyProperties(target, source, propertyObj) { - for (var prop in propertyObj) { - if (Array.isArray(source[prop])) { - target[prop] = source[prop].slice(); - } - else { - target[prop] = source[prop]; - } - } - } - - /** - * The TextMetrics object represents the measurement of a block of text with a specified style. - * - * ```js - * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}) - * let textMetrics = PIXI.TextMetrics.measureText('Your text', style) - * ``` - * - * @class - * @memberof PIXI - */ - var TextMetrics = /** @class */ (function () { - /** - * @param {string} text - the text that was measured - * @param {PIXI.TextStyle} style - the style that was measured - * @param {number} width - the measured width of the text - * @param {number} height - the measured height of the text - * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style - * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` - * @param {number} lineHeight - the measured line height for this style - * @param {number} maxLineWidth - the maximum line width for all measured lines - * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont - */ - function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) { - /** - * The text that was measured - * - * @member {string} - */ - this.text = text; - /** - * The style that was measured - * - * @member {PIXI.TextStyle} - */ - this.style = style; - /** - * The measured width of the text - * - * @member {number} - */ - this.width = width; - /** - * The measured height of the text - * - * @member {number} - */ - this.height = height; - /** - * An array of lines of the text broken by new lines and wrapping is specified in style - * - * @member {string[]} - */ - this.lines = lines; - /** - * An array of the line widths for each line matched to `lines` - * - * @member {number[]} - */ - this.lineWidths = lineWidths; - /** - * The measured line height for this style - * - * @member {number} - */ - this.lineHeight = lineHeight; - /** - * The maximum line width for all measured lines - * - * @member {number} - */ - this.maxLineWidth = maxLineWidth; - /** - * The font properties object from TextMetrics.measureFont - * - * @member {PIXI.IFontMetrics} - */ - this.fontProperties = fontProperties; - } - /** - * Measures the supplied string of text and returns a Rectangle. - * - * @param {string} text - the text to measure. - * @param {PIXI.TextStyle} style - the text style to use for measuring - * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {PIXI.TextMetrics} measured width and height of the text. - */ - TextMetrics.measureText = function (text, style, wordWrap, canvas) { - if (canvas === void 0) { canvas = TextMetrics._canvas; } - wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap; - var font = style.toFontString(); - var fontProperties = TextMetrics.measureFont(font); - // fallback in case UA disallow canvas data extraction - // (toDataURI, getImageData functions) - if (fontProperties.fontSize === 0) { - fontProperties.fontSize = style.fontSize; - fontProperties.ascent = style.fontSize; - } - var context = canvas.getContext('2d'); - context.font = font; - var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; - var lines = outputText.split(/(?:\r\n|\r|\n)/); - var lineWidths = new Array(lines.length); - var maxLineWidth = 0; - for (var i = 0; i < lines.length; i++) { - var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing); - lineWidths[i] = lineWidth; - maxLineWidth = Math.max(maxLineWidth, lineWidth); - } - var width = maxLineWidth + style.strokeThickness; - if (style.dropShadow) { - width += style.dropShadowDistance; - } - var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; - var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) - + ((lines.length - 1) * (lineHeight + style.leading)); - if (style.dropShadow) { - height += style.dropShadowDistance; - } - return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties); - }; - /** - * Applies newlines to a string to have it optimally fit into the horizontal - * bounds set by the Text object's wordWrapWidth property. - * - * @private - * @param {string} text - String to apply word wrapping to - * @param {PIXI.TextStyle} style - the style to use when wrapping - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {string} New string with new lines applied where required - */ - TextMetrics.wordWrap = function (text, style, canvas) { - if (canvas === void 0) { canvas = TextMetrics._canvas; } - var context = canvas.getContext('2d'); - var width = 0; - var line = ''; - var lines = ''; - var cache = Object.create(null); - var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace; - // How to handle whitespaces - var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); - var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); - // whether or not spaces may be added to the beginning of lines - var canPrependSpaces = !collapseSpaces; - // There is letterSpacing after every char except the last one - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! - // so for convenience the above needs to be compared to width + 1 extra letterSpace - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ - // ________________________________________________ - // And then the final space is simply no appended to each line - var wordWrapWidth = style.wordWrapWidth + letterSpacing; - // break text into words, spaces and newline chars - var tokens = TextMetrics.tokenize(text); - for (var i = 0; i < tokens.length; i++) { - // get the word, space or newlineChar - var token = tokens[i]; - // if word is a new line - if (TextMetrics.isNewline(token)) { - // keep the new line - if (!collapseNewlines) { - lines += TextMetrics.addLine(line); - canPrependSpaces = !collapseSpaces; - line = ''; - width = 0; - continue; - } - // if we should collapse new lines - // we simply convert it into a space - token = ' '; - } - // if we should collapse repeated whitespaces - if (collapseSpaces) { - // check both this and the last tokens for spaces - var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); - var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); - if (currIsBreakingSpace && lastIsBreakingSpace) { - continue; - } - } - // get word width from cache if possible - var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); - // word is longer than desired bounds - if (tokenWidth > wordWrapWidth) { - // if we are not already at the beginning of a line - if (line !== '') { - // start newlines for overflow words - lines += TextMetrics.addLine(line); - line = ''; - width = 0; - } - // break large word over multiple lines - if (TextMetrics.canBreakWords(token, style.breakWords)) { - // break word into characters - var characters = TextMetrics.wordWrapSplit(token); - // loop the characters - for (var j = 0; j < characters.length; j++) { - var char = characters[j]; - var k = 1; - // we are not at the end of the token - while (characters[j + k]) { - var nextChar = characters[j + k]; - var lastChar = char[char.length - 1]; - // should not split chars - if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) { - // combine chars & move forward one - char += nextChar; - } - else { - break; - } - k++; - } - j += char.length - 1; - var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); - if (characterWidth + width > wordWrapWidth) { - lines += TextMetrics.addLine(line); - canPrependSpaces = false; - line = ''; - width = 0; - } - line += char; - width += characterWidth; - } - } - // run word out of the bounds - else { - // if there are words in this line already - // finish that line and start a new one - if (line.length > 0) { - lines += TextMetrics.addLine(line); - line = ''; - width = 0; - } - var isLastToken = i === tokens.length - 1; - // give it its own line if it's not the end - lines += TextMetrics.addLine(token, !isLastToken); - canPrependSpaces = false; - line = ''; - width = 0; - } - } - // word could fit - else { - // word won't fit because of existing words - // start a new line - if (tokenWidth + width > wordWrapWidth) { - // if its a space we don't want it - canPrependSpaces = false; - // add a new line - lines += TextMetrics.addLine(line); - // start a new line - line = ''; - width = 0; - } - // don't add spaces to the beginning of lines - if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) { - // add the word to the current line - line += token; - // update width counter - width += tokenWidth; - } - } - } - lines += TextMetrics.addLine(line, false); - return lines; - }; - /** - * Convienience function for logging each line added during the wordWrap - * method - * - * @private - * @param {string} line - The line of text to add - * @param {boolean} newLine - Add new line character to end - * @return {string} A formatted line - */ - TextMetrics.addLine = function (line, newLine) { - if (newLine === void 0) { newLine = true; } - line = TextMetrics.trimRight(line); - line = (newLine) ? line + "\n" : line; - return line; - }; - /** - * Gets & sets the widths of calculated characters in a cache object - * - * @private - * @param {string} key - The key - * @param {number} letterSpacing - The letter spacing - * @param {object} cache - The cache - * @param {CanvasRenderingContext2D} context - The canvas context - * @return {number} The from cache. - */ - TextMetrics.getFromCache = function (key, letterSpacing, cache, context) { - var width = cache[key]; - if (typeof width !== 'number') { - var spacing = ((key.length) * letterSpacing); - width = context.measureText(key).width + spacing; - cache[key] = width; - } - return width; - }; - /** - * Determines whether we should collapse breaking spaces - * - * @private - * @param {string} whiteSpace - The TextStyle property whiteSpace - * @return {boolean} should collapse - */ - TextMetrics.collapseSpaces = function (whiteSpace) { - return (whiteSpace === 'normal' || whiteSpace === 'pre-line'); - }; - /** - * Determines whether we should collapse newLine chars - * - * @private - * @param {string} whiteSpace - The white space - * @return {boolean} should collapse - */ - TextMetrics.collapseNewlines = function (whiteSpace) { - return (whiteSpace === 'normal'); - }; - /** - * trims breaking whitespaces from string - * - * @private - * @param {string} text - The text - * @return {string} trimmed string - */ - TextMetrics.trimRight = function (text) { - if (typeof text !== 'string') { - return ''; - } - for (var i = text.length - 1; i >= 0; i--) { - var char = text[i]; - if (!TextMetrics.isBreakingSpace(char)) { - break; - } - text = text.slice(0, -1); - } - return text; - }; - /** - * Determines if char is a newline. - * - * @private - * @param {string} char - The character - * @return {boolean} True if newline, False otherwise. - */ - TextMetrics.isNewline = function (char) { - if (typeof char !== 'string') { - return false; - } - return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0); - }; - /** - * Determines if char is a breaking whitespace. - * - * @private - * @param {string} char - The character - * @return {boolean} True if whitespace, False otherwise. - */ - TextMetrics.isBreakingSpace = function (char) { - if (typeof char !== 'string') { - return false; - } - return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0); - }; - /** - * Splits a string into words, breaking-spaces and newLine characters - * - * @private - * @param {string} text - The text - * @return {string[]} A tokenized array - */ - TextMetrics.tokenize = function (text) { - var tokens = []; - var token = ''; - if (typeof text !== 'string') { - return tokens; - } - for (var i = 0; i < text.length; i++) { - var char = text[i]; - if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) { - if (token !== '') { - tokens.push(token); - token = ''; - } - tokens.push(char); - continue; - } - token += char; - } - if (token !== '') { - tokens.push(token); - } - return tokens; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to customise which words should break - * Examples are if the token is CJK or numbers. - * It must return a boolean. - * - * @param {string} token - The token - * @param {boolean} breakWords - The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakWords = function (_token, breakWords) { - return breakWords; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to determine whether a pair of characters - * should be broken by newlines - * For example certain characters in CJK langs or numbers. - * It must return a boolean. - * - * @param {string} char - The character - * @param {string} nextChar - The next character - * @param {string} token - The token/word the characters are from - * @param {number} index - The index in the token of the char - * @param {boolean} breakWords - The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakChars = function (_char, _nextChar, _token, _index, _breakWords) { - return true; - }; - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It is called when a token (usually a word) has to be split into separate pieces - * in order to determine the point to break a word. - * It must return an array of characters. - * - * @example - * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. - * TextMetrics.wordWrapSplit = (token) => [...token]; - * - * @param {string} token - The token to split - * @return {string[]} The characters of the token - */ - TextMetrics.wordWrapSplit = function (token) { - return token.split(''); - }; - /** - * Calculates the ascent, descent and fontSize of a given font-style - * - * @static - * @param {string} font - String representing the style of the font - * @return {PIXI.IFontMetrics} Font properties object - */ - TextMetrics.measureFont = function (font) { - // as this method is used for preparing assets, don't recalculate things if we don't need to - if (TextMetrics._fonts[font]) { - return TextMetrics._fonts[font]; - } - var properties = { - ascent: 0, - descent: 0, - fontSize: 0, - }; - var canvas = TextMetrics._canvas; - var context = TextMetrics._context; - context.font = font; - var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; - var width = Math.ceil(context.measureText(metricsString).width); - var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); - var height = 2 * baseline; - baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; - canvas.width = width; - canvas.height = height; - context.fillStyle = '#f00'; - context.fillRect(0, 0, width, height); - context.font = font; - context.textBaseline = 'alphabetic'; - context.fillStyle = '#000'; - context.fillText(metricsString, 0, baseline); - var imagedata = context.getImageData(0, 0, width, height).data; - var pixels = imagedata.length; - var line = width * 4; - var i = 0; - var idx = 0; - var stop = false; - // ascent. scan from top to bottom until we find a non red pixel - for (i = 0; i < baseline; ++i) { - for (var j = 0; j < line; j += 4) { - if (imagedata[idx + j] !== 255) { - stop = true; - break; - } - } - if (!stop) { - idx += line; - } - else { - break; - } - } - properties.ascent = baseline - i; - idx = pixels - line; - stop = false; - // descent. scan from bottom to top until we find a non red pixel - for (i = height; i > baseline; --i) { - for (var j = 0; j < line; j += 4) { - if (imagedata[idx + j] !== 255) { - stop = true; - break; - } - } - if (!stop) { - idx -= line; - } - else { - break; - } - } - properties.descent = i - baseline; - properties.fontSize = properties.ascent + properties.descent; - TextMetrics._fonts[font] = properties; - return properties; - }; - /** - * Clear font metrics in metrics cache. - * - * @static - * @param {string} [font] - font name. If font name not set then clear cache for all fonts. - */ - TextMetrics.clearMetrics = function (font) { - if (font === void 0) { font = ''; } - if (font) { - delete TextMetrics._fonts[font]; - } - else { - TextMetrics._fonts = {}; - } - }; - return TextMetrics; - }()); - /** - * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * - * @typedef {object} FontMetrics - * @property {number} ascent - The ascent distance - * @property {number} descent - The descent distance - * @property {number} fontSize - Font size from ascent to descent - * @memberof PIXI.TextMetrics - * @private - */ - var canvas = (function () { - try { - // OffscreenCanvas2D measureText can be up to 40% faster. - var c = new OffscreenCanvas(0, 0); - var context = c.getContext('2d'); - if (context && context.measureText) { - return c; - } - return document.createElement('canvas'); - } - catch (ex) { - return document.createElement('canvas'); - } - })(); - canvas.width = canvas.height = 10; - /** - * Cached canvas element for measuring text - * - * @memberof PIXI.TextMetrics - * @type {HTMLCanvasElement} - * @private - */ - TextMetrics._canvas = canvas; - /** - * Cache for context to use. - * - * @memberof PIXI.TextMetrics - * @type {CanvasRenderingContext2D} - * @private - */ - TextMetrics._context = canvas.getContext('2d'); - /** - * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. - * - * @memberof PIXI.TextMetrics - * @type {Object} - * @private - */ - TextMetrics._fonts = {}; - /** - * String used for calculate font metrics. - * These characters are all tall to help calculate the height required for text. - * - * @static - * @memberof PIXI.TextMetrics - * @name METRICS_STRING - * @type {string} - * @default |ÉqÅ - */ - TextMetrics.METRICS_STRING = '|ÉqÅ'; - /** - * Baseline symbol for calculate font metrics. - * - * @static - * @memberof PIXI.TextMetrics - * @name BASELINE_SYMBOL - * @type {string} - * @default M - */ - TextMetrics.BASELINE_SYMBOL = 'M'; - /** - * Baseline multiplier for calculate font metrics. - * - * @static - * @memberof PIXI.TextMetrics - * @name BASELINE_MULTIPLIER - * @type {number} - * @default 1.4 - */ - TextMetrics.BASELINE_MULTIPLIER = 1.4; - /** - * Cache of new line chars. - * - * @memberof PIXI.TextMetrics - * @type {number[]} - * @private - */ - TextMetrics._newlines = [ - 0x000A, - 0x000D ]; - /** - * Cache of breaking spaces. - * - * @memberof PIXI.TextMetrics - * @type {number[]} - * @private - */ - TextMetrics._breakingSpaces = [ - 0x0009, - 0x0020, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2008, - 0x2009, - 0x200A, - 0x205F, - 0x3000 ]; - /** - * A number, or a string containing a number. - * - * @memberof PIXI - * @typedef IFontMetrics - * @property {number} ascent - Font ascent - * @property {number} descent - Font descent - * @property {number} fontSize - Font size - */ - - var defaultDestroyOptions = { - texture: true, - children: false, - baseTexture: true, - }; - /** - * A Text Object will create a line or multiple lines of text. - * - * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). - * - * The primary advantage of this class over BitmapText is that you have great control over the style of the next, - * which you can change at runtime. - * - * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. - * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. - * - * To split a line you can use '\n' in your text string, or, on the `style` object, - * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. - * - * A Text can be created directly from a string and a style object, - * which can be generated [here](https://pixijs.io/pixi-text-style). - * - * ```js - * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}); - * ``` - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var Text = /** @class */ (function (_super) { - __extends$7(Text, _super); - /** - * @param {string} text - The string that you would like the text to display - * @param {object|PIXI.TextStyle} [style] - The style parameters - * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text - */ - function Text(text, style, canvas) { - var _this = this; - var ownCanvas = false; - if (!canvas) { - canvas = document.createElement('canvas'); - ownCanvas = true; - } - canvas.width = 3; - canvas.height = 3; - var texture = Texture.from(canvas); - texture.orig = new Rectangle(); - texture.trim = new Rectangle(); - _this = _super.call(this, texture) || this; - /** - * Keep track if this Text object created it's own canvas - * element (`true`) or uses the constructor argument (`false`). - * Used to workaround a GC issues with Safari < 13 when - * destroying Text. See `destroy` for more info. - * - * @member {boolean} - * @private - */ - _this._ownCanvas = ownCanvas; - /** - * The canvas element that everything is drawn to - * - * @member {HTMLCanvasElement} - */ - _this.canvas = canvas; - /** - * The canvas 2d context that everything is drawn with - * @member {CanvasRenderingContext2D} - */ - _this.context = _this.canvas.getContext('2d'); - /** - * The resolution / device pixel ratio of the canvas. - * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. - * @member {number} - * @default 1 - */ - _this._resolution = settings.RESOLUTION; - _this._autoResolution = true; - /** - * Private tracker for the current text. - * - * @member {string} - * @private - */ - _this._text = null; - /** - * Private tracker for the current style. - * - * @member {object} - * @private - */ - _this._style = null; - /** - * Private listener to track style changes. - * - * @member {Function} - * @private - */ - _this._styleListener = null; - /** - * Private tracker for the current font. - * - * @member {string} - * @private - */ - _this._font = ''; - _this.text = text; - _this.style = style; - _this.localStyleID = -1; - return _this; - } - /** - * Renders text to its canvas, and updates its texture. - * By default this is used internally to ensure the texture is correct before rendering, - * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text, - * and then shared across multiple Sprites. - * - * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called. - */ - Text.prototype.updateText = function (respectDirty) { - var style = this._style; - // check if style has changed.. - if (this.localStyleID !== style.styleID) { - this.dirty = true; - this.localStyleID = style.styleID; - } - if (!this.dirty && respectDirty) { - return; - } - this._font = this._style.toFontString(); - var context = this.context; - var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas); - var width = measured.width; - var height = measured.height; - var lines = measured.lines; - var lineHeight = measured.lineHeight; - var lineWidths = measured.lineWidths; - var maxLineWidth = measured.maxLineWidth; - var fontProperties = measured.fontProperties; - this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution); - this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution); - context.scale(this._resolution, this._resolution); - context.clearRect(0, 0, this.canvas.width, this.canvas.height); - context.font = this._font; - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - var linePositionX; - var linePositionY; - // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text - var passesCount = style.dropShadow ? 2 : 1; - // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex, - // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow. - // - // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more - // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill - // and the stroke; and fill drop shadows would appear over the top of the stroke. - // - // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal - // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the - // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow - // beneath the text, whilst also having the proper text shadow styling. - for (var i = 0; i < passesCount; ++i) { - var isShadowPass = style.dropShadow && i === 0; - // we only want the drop shadow, so put text way off-screen - var dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0; - var dsOffsetShadow = dsOffsetText * this._resolution; - if (isShadowPass) { - // On Safari, text with gradient and drop shadows together do not position correctly - // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689 - // Therefore we'll set the styles to be a plain black whilst generating this drop shadow - context.fillStyle = 'black'; - context.strokeStyle = 'black'; - var dropShadowColor = style.dropShadowColor; - var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); - context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; - context.shadowBlur = style.dropShadowBlur; - context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; - context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow; - } - else { - // set canvas text styles - context.fillStyle = this._generateFillStyle(style, lines, measured); - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - context.strokeStyle = style.stroke; - context.shadowColor = 'black'; - context.shadowBlur = 0; - context.shadowOffsetX = 0; - context.shadowOffsetY = 0; - } - // draw lines line by line - for (var i_1 = 0; i_1 < lines.length; i_1++) { - linePositionX = style.strokeThickness / 2; - linePositionY = ((style.strokeThickness / 2) + (i_1 * lineHeight)) + fontProperties.ascent; - if (style.align === 'right') { - linePositionX += maxLineWidth - lineWidths[i_1]; - } - else if (style.align === 'center') { - linePositionX += (maxLineWidth - lineWidths[i_1]) / 2; - } - if (style.stroke && style.strokeThickness) { - this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true); - } - if (style.fill) { - this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText); - } - } - } - this.updateTexture(); - }; - /** - * Render the text with letter-spacing. - * @param {string} text - The text to draw - * @param {number} x - Horizontal position to draw the text - * @param {number} y - Vertical position to draw the text - * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the - * text? If not, it's for the inside fill - * @private - */ - Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) { - if (isStroke === void 0) { isStroke = false; } - var style = this._style; - // letterSpacing of 0 means normal - var letterSpacing = style.letterSpacing; - if (letterSpacing === 0) { - if (isStroke) { - this.context.strokeText(text, x, y); - } - else { - this.context.fillText(text, x, y); - } - return; - } - var currentPosition = x; - // Using Array.from correctly splits characters whilst keeping emoji together. - // This is not supported on IE as it requires ES6, so regular text splitting occurs. - // This also doesn't account for emoji that are multiple emoji put together to make something else. - // Handling all of this would require a big library itself. - // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516 - // https://github.com/orling/grapheme-splitter - var stringArray = Array.from ? Array.from(text) : text.split(''); - var previousWidth = this.context.measureText(text).width; - var currentWidth = 0; - for (var i = 0; i < stringArray.length; ++i) { - var currentChar = stringArray[i]; - if (isStroke) { - this.context.strokeText(currentChar, currentPosition, y); - } - else { - this.context.fillText(currentChar, currentPosition, y); - } - currentWidth = this.context.measureText(text.substring(i + 1)).width; - currentPosition += previousWidth - currentWidth + letterSpacing; - previousWidth = currentWidth; - } - }; - /** - * Updates texture size based on canvas size - * - * @private - */ - Text.prototype.updateTexture = function () { - var canvas = this.canvas; - if (this._style.trim) { - var trimmed = trimCanvas(canvas); - if (trimmed.data) { - canvas.width = trimmed.width; - canvas.height = trimmed.height; - this.context.putImageData(trimmed.data, 0, 0); - } - } - var texture = this._texture; - var style = this._style; - var padding = style.trim ? 0 : style.padding; - var baseTexture = texture.baseTexture; - texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution); - texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution); - texture.trim.x = -padding; - texture.trim.y = -padding; - texture.orig.width = texture._frame.width - (padding * 2); - texture.orig.height = texture._frame.height - (padding * 2); - // call sprite onTextureUpdate to update scale if _width or _height were set - this._onTextureUpdate(); - baseTexture.setRealSize(canvas.width, canvas.height, this._resolution); - // Recursively updates transform of all objects from the root to this one - this._recursivePostUpdateTransform(); - this.dirty = false; - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - Text.prototype._render = function (renderer) { - if (this._autoResolution && this._resolution !== renderer.resolution) { - this._resolution = renderer.resolution; - this.dirty = true; - } - this.updateText(true); - _super.prototype._render.call(this, renderer); - }; - /** - * Gets the local bounds of the text object. - * - * @param {PIXI.Rectangle} rect - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - Text.prototype.getLocalBounds = function (rect) { - this.updateText(true); - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. - * @protected - */ - Text.prototype._calculateBounds = function () { - this.updateText(true); - this.calculateVertices(); - // if we have already done this on THIS frame. - this._bounds.addQuad(this.vertexData); - }; - /** - * Generates the fill style. Can automatically generate a gradient based on the fill style being an array - * - * @private - * @param {object} style - The style. - * @param {string[]} lines - The lines of text. - * @return {string|number|CanvasGradient} The fill style - */ - Text.prototype._generateFillStyle = function (style, lines, metrics) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var fillStyle = style.fill; - if (!Array.isArray(fillStyle)) { - return fillStyle; - } - else if (fillStyle.length === 1) { - return fillStyle[0]; - } - // the gradient will be evenly spaced out according to how large the array is. - // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 - var gradient; - // a dropshadow will enlarge the canvas and result in the gradient being - // generated with the incorrect dimensions - var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; - // should also take padding into account, padding can offset the gradient - var padding = style.padding || 0; - var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2); - var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2); - // make a copy of the style settings, so we can manipulate them later - var fill = fillStyle.slice(); - var fillGradientStops = style.fillGradientStops.slice(); - // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 - if (!fillGradientStops.length) { - var lengthPlus1 = fill.length + 1; - for (var i = 1; i < lengthPlus1; ++i) { - fillGradientStops.push(i / lengthPlus1); - } - } - // stop the bleeding of the last gradient on the line above to the top gradient of the this line - // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 - fill.unshift(fillStyle[0]); - fillGradientStops.unshift(0); - fill.push(fillStyle[fillStyle.length - 1]); - fillGradientStops.push(1); - if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { - // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas - gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding); - // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect - // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 - // There's potential for floating point precision issues at the seams between gradient repeats. - // The loop below generates the stops in order, so track the last generated one to prevent - // floating point precision from making us go the teeniest bit backwards, resulting in - // the first and last colors getting swapped. - var lastIterationStop = 0; - // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc - var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; - // textHeight, but as a 0-1 size in global gradient stop space - var gradStopLineHeight = textHeight / height; - for (var i = 0; i < lines.length; i++) { - var thisLineTop = metrics.lineHeight * i; - for (var j = 0; j < fill.length; j++) { - // 0-1 stop point for the current line, multiplied to global space afterwards - var lineStop = 0; - if (typeof fillGradientStops[j] === 'number') { - lineStop = fillGradientStops[j]; - } - else { - lineStop = j / fill.length; - } - var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); - // Prevent color stop generation going backwards from floating point imprecision - var clampedStop = Math.max(lastIterationStop, globalStop); - clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. - gradient.addColorStop(clampedStop, fill[j]); - lastIterationStop = clampedStop; - } - } - } - else { - // start the gradient at the center left of the canvas, and end at the center right of the canvas - gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2); - // can just evenly space out the gradients in this case, as multiple lines makes no difference - // to an even left to right gradient - var totalIterations = fill.length + 1; - var currentIteration = 1; - for (var i = 0; i < fill.length; i++) { - var stop = void 0; - if (typeof fillGradientStops[i] === 'number') { - stop = fillGradientStops[i]; - } - else { - stop = currentIteration / totalIterations; - } - gradient.addColorStop(stop, fill[i]); - currentIteration++; - } - } - return gradient; - }; - /** - * Destroys this text object. - * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as - * the majority of the time the texture will not be shared with any other Sprites. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their - * destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well - */ - Text.prototype.destroy = function (options) { - if (typeof options === 'boolean') { - options = { children: options }; - } - options = Object.assign({}, defaultDestroyOptions, options); - _super.prototype.destroy.call(this, options); - // set canvas width and height to 0 to workaround memory leak in Safari < 13 - // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12 - if (this._ownCanvas) { - this.canvas.height = this.canvas.width = 0; - } - // make sure to reset the the context and canvas.. dont want this hanging around in memory! - this.context = null; - this.canvas = null; - this._style = null; - }; - Object.defineProperty(Text.prototype, "width", { - /** - * The width of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - this.updateText(true); - return Math.abs(this.scale.x) * this._texture.orig.width; - }, - set: function (value) { - this.updateText(true); - var s = sign$1(this.scale.x) || 1; - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "height", { - /** - * The height of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - this.updateText(true); - return Math.abs(this.scale.y) * this._texture.orig.height; - }, - set: function (value) { - this.updateText(true); - var s = sign$1(this.scale.y) || 1; - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "style", { - /** - * Set the style of the text. Set up an event listener to listen for changes on the style - * object and mark the text as dirty. - * - * @member {object|PIXI.TextStyle} - */ - get: function () { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle - // since the setter creates the TextStyle. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - return this._style; - }, - set: function (style) { - style = style || {}; - if (style instanceof TextStyle) { - this._style = style; - } - else { - this._style = new TextStyle(style); - } - this.localStyleID = -1; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "text", { - /** - * Set the copy for the text object. To split a line you can use '\n'. - * - * @member {string} - */ - get: function () { - return this._text; - }, - set: function (text) { - text = String(text === null || text === undefined ? '' : text); - if (this._text === text) { - return; - } - this._text = text; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Text.prototype, "resolution", { - /** - * The resolution / device pixel ratio of the canvas. - * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. - * @member {number} - * @default 1 - */ - get: function () { - return this._resolution; - }, - set: function (value) { - this._autoResolution = false; - if (this._resolution === value) { - return; - } - this._resolution = value; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - return Text; - }(Sprite)); - - /*! - * @pixi/prepare - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/prepare is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Default number of uploads per frame using prepare plugin. - * - * @static - * @memberof PIXI.settings - * @name UPLOADS_PER_FRAME - * @type {number} - * @default 4 - */ - settings.UPLOADS_PER_FRAME = 4; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$8 = function(d, b) { - extendStatics$8 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$8(d, b); - }; - - function __extends$8(d, b) { - extendStatics$8(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified - * number of items per frame. - * - * @class - * @memberof PIXI - */ - var CountLimiter = /** @class */ (function () { - /** - * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame. - */ - function CountLimiter(maxItemsPerFrame) { - /** - * The maximum number of items that can be prepared each frame. - * @type {number} - * @private - */ - this.maxItemsPerFrame = maxItemsPerFrame; - /** - * The number of items that can be prepared in the current frame. - * @type {number} - * @private - */ - this.itemsLeft = 0; - } - /** - * Resets any counting properties to start fresh on a new frame. - */ - CountLimiter.prototype.beginFrame = function () { - this.itemsLeft = this.maxItemsPerFrame; - }; - /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. - */ - CountLimiter.prototype.allowedToUpload = function () { - return this.itemsLeft-- > 0; - }; - return CountLimiter; - }()); - - /** - * Built-in hook to find multiple textures from objects like AnimatedSprites. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findMultipleBaseTextures(item, queue) { - var result = false; - // Objects with multiple textures - if (item && item._textures && item._textures.length) { - for (var i = 0; i < item._textures.length; i++) { - if (item._textures[i] instanceof Texture) { - var baseTexture = item._textures[i].baseTexture; - if (queue.indexOf(baseTexture) === -1) { - queue.push(baseTexture); - result = true; - } - } - } - } - return result; - } - /** - * Built-in hook to find BaseTextures from Texture. - * - * @private - * @param {PIXI.Texture} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findBaseTexture(item, queue) { - if (item.baseTexture instanceof BaseTexture) { - var texture = item.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to find textures from objects. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findTexture(item, queue) { - if (item._texture && item._texture instanceof Texture) { - var texture = item._texture.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to draw PIXI.Text to its texture. - * - * @private - * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function drawText(_helper, item) { - if (item instanceof Text) { - // updating text will return early if it is not dirty - item.updateText(true); - return true; - } - return false; - } - /** - * Built-in hook to calculate a text style for a PIXI.Text object. - * - * @private - * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function calculateTextStyle(_helper, item) { - if (item instanceof TextStyle) { - var font = item.toFontString(); - TextMetrics.measureFont(font); - return true; - } - return false; - } - /** - * Built-in hook to find Text objects. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Text object was found. - */ - function findText(item, queue) { - if (item instanceof Text) { - // push the text style to prepare it - this can be really expensive - if (queue.indexOf(item.style) === -1) { - queue.push(item.style); - } - // also push the text object so that we can render it (to canvas/texture) if needed - if (queue.indexOf(item) === -1) { - queue.push(item); - } - // also push the Text's texture for upload to GPU - var texture = item._texture.baseTexture; - if (queue.indexOf(texture) === -1) { - queue.push(texture); - } - return true; - } - return false; - } - /** - * Built-in hook to find TextStyle objects. - * - * @private - * @param {PIXI.TextStyle} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.TextStyle object was found. - */ - function findTextStyle(item, queue) { - if (item instanceof TextStyle) { - if (queue.indexOf(item) === -1) { - queue.push(item); - } - return true; - } - return false; - } - /** - * The prepare manager provides functionality to upload content to the GPU. - * - * BasePrepare handles basic queuing functionality and is extended by - * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare} - * to provide preparation capabilities specific to their respective renderers. - * - * @example - * // Create a sprite - * const sprite = PIXI.Sprite.from('something.png'); - * - * // Load object into GPU - * app.renderer.plugins.prepare.upload(sprite, () => { - * - * //Texture(s) has been uploaded to GPU - * app.stage.addChild(sprite); - * - * }) - * - * @abstract - * @class - * @memberof PIXI - */ - var BasePrepare = /** @class */ (function () { - /** - * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer - */ - function BasePrepare(renderer) { - var _this = this; - /** - * The limiter to be used to control how quickly items are prepared. - * @type {PIXI.CountLimiter|PIXI.TimeLimiter} - */ - this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); - /** - * Reference to the renderer. - * @type {PIXI.AbstractRenderer} - * @protected - */ - this.renderer = renderer; - /** - * The only real difference between CanvasPrepare and Prepare is what they pass - * to upload hooks. That different parameter is stored here. - * @type {object} - * @protected - */ - this.uploadHookHelper = null; - /** - * Collection of items to uploads at once. - * @type {Array<*>} - * @private - */ - this.queue = []; - /** - * Collection of additional hooks for finding assets. - * @type {Array} - * @private - */ - this.addHooks = []; - /** - * Collection of additional hooks for processing assets. - * @type {Array} - * @private - */ - this.uploadHooks = []; - /** - * Callback to call after completed. - * @type {Array} - * @private - */ - this.completes = []; - /** - * If prepare is ticking (running). - * @type {boolean} - * @private - */ - this.ticking = false; - /** - * 'bound' call for prepareItems(). - * @type {Function} - * @private - */ - this.delayedTick = function () { - // unlikely, but in case we were destroyed between tick() and delayedTick() - if (!_this.queue) { - return; - } - _this.prepareItems(); - }; - // hooks to find the correct texture - this.registerFindHook(findText); - this.registerFindHook(findTextStyle); - this.registerFindHook(findMultipleBaseTextures); - this.registerFindHook(findBaseTexture); - this.registerFindHook(findTexture); - // upload hooks - this.registerUploadHook(drawText); - this.registerUploadHook(calculateTextStyle); - } - /** - * Upload all the textures and graphics to the GPU. - * - * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - - * Either the container or display object to search for items to upload, the items to upload themselves, - * or the callback function, if items have been added using `prepare.add`. - * @param {Function} [done] - Optional callback when all queued uploads have completed - */ - BasePrepare.prototype.upload = function (item, done) { - if (typeof item === 'function') { - done = item; - item = null; - } - // If a display object, search for items - // that we could upload - if (item) { - this.add(item); - } - // Get the items for upload from the display - if (this.queue.length) { - if (done) { - this.completes.push(done); - } - if (!this.ticking) { - this.ticking = true; - Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); - } - } - else if (done) { - done(); - } - }; - /** - * Handle tick update - * - * @private - */ - BasePrepare.prototype.tick = function () { - setTimeout(this.delayedTick, 0); - }; - /** - * Actually prepare items. This is handled outside of the tick because it will take a while - * and we do NOT want to block the current animation frame from rendering. - * - * @private - */ - BasePrepare.prototype.prepareItems = function () { - this.limiter.beginFrame(); - // Upload the graphics - while (this.queue.length && this.limiter.allowedToUpload()) { - var item = this.queue[0]; - var uploaded = false; - if (item && !item._destroyed) { - for (var i = 0, len = this.uploadHooks.length; i < len; i++) { - if (this.uploadHooks[i](this.uploadHookHelper, item)) { - this.queue.shift(); - uploaded = true; - break; - } - } - } - if (!uploaded) { - this.queue.shift(); - } - } - // We're finished - if (!this.queue.length) { - this.ticking = false; - var completes = this.completes.slice(0); - this.completes.length = 0; - for (var i = 0, len = completes.length; i < len; i++) { - completes[i](); - } - } - else { - // if we are not finished, on the next rAF do this again - Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); - } - }; - /** - * Adds hooks for finding items. - * - * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` - * function must return `true` if it was able to add item to the queue. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerFindHook = function (addHook) { - if (addHook) { - this.addHooks.push(addHook); - } - return this; - }; - /** - * Adds hooks for uploading items. - * - * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and - * function must return `true` if it was able to handle upload of item. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerUploadHook = function (uploadHook) { - if (uploadHook) { - this.uploadHooks.push(uploadHook); - } - return this; - }; - /** - * Manually add an item to the uploading queue. - * - * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to - * add to the queue - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.add = function (item) { - // Add additional hooks for finding elements on special - // types of objects that - for (var i = 0, len = this.addHooks.length; i < len; i++) { - if (this.addHooks[i](item, this.queue)) { - break; - } - } - // Get children recursively - if (item instanceof Container) { - for (var i = item.children.length - 1; i >= 0; i--) { - this.add(item.children[i]); - } - } - return this; - }; - /** - * Destroys the plugin, don't use after this. - * - */ - BasePrepare.prototype.destroy = function () { - if (this.ticking) { - Ticker.system.remove(this.tick, this); - } - this.ticking = false; - this.addHooks = null; - this.uploadHooks = null; - this.renderer = null; - this.completes = null; - this.queue = null; - this.limiter = null; - this.uploadHookHelper = null; - }; - return BasePrepare; - }()); - - /** - * Built-in hook to upload PIXI.Texture objects to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.BaseTexture} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadBaseTextures(renderer, item) { - if (item instanceof BaseTexture) { - // if the texture already has a GL texture, then the texture has been prepared or rendered - // before now. If the texture changed, then the changer should be calling texture.update() which - // reuploads the texture without need for preparing it again - if (!item._glTextures[renderer.CONTEXT_UID]) { - renderer.texture.bind(item); - } - return true; - } - return false; - } - /** - * Built-in hook to upload PIXI.Graphics to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadGraphics(renderer, item) { - if (!(item instanceof Graphics)) { - return false; - } - var geometry = item.geometry; - // update dirty graphics to get batches - item.finishPoly(); - geometry.updateBatches(); - var batches = geometry.batches; - // upload all textures found in styles - for (var i = 0; i < batches.length; i++) { - var texture = batches[i].style.texture; - if (texture) { - uploadBaseTextures(renderer, texture.baseTexture); - } - } - // if its not batchable - update vao for particular shader - if (!geometry.batchable) { - renderer.geometry.bind(geometry, item._resolveDirectShader(renderer)); - } - return true; - } - /** - * Built-in hook to find graphics. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Graphics object was found. - */ - function findGraphics(item, queue) { - if (item instanceof Graphics) { - queue.push(item); - return true; - } - return false; - } - /** - * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for - * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed. - * - * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. - * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. - * @example - * // Create a new application - * const app = new PIXI.Application(); - * document.body.appendChild(app.view); - * - * // Don't start rendering right away - * app.stop(); - * - * // create a display object - * const rect = new PIXI.Graphics() - * .beginFill(0x00ff00) - * .drawRect(40, 40, 200, 200); - * - * // Add to the stage - * app.stage.addChild(rect); - * - * // Don't start rendering until the graphic is uploaded to the GPU - * app.renderer.plugins.prepare.upload(app.stage, () => { - * app.start(); - * }); - * - * @class - * @extends PIXI.BasePrepare - * @memberof PIXI - */ - var Prepare = /** @class */ (function (_super) { - __extends$8(Prepare, _super); - /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer - */ - function Prepare(renderer) { - var _this = _super.call(this, renderer) || this; - _this.uploadHookHelper = _this.renderer; - // Add textures and graphics to upload - _this.registerFindHook(findGraphics); - _this.registerUploadHook(uploadBaseTextures); - _this.registerUploadHook(uploadGraphics); - return _this; - } - return Prepare; - }(BasePrepare)); - - /** - * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified - * number of milliseconds per frame. - * - * @class - * @memberof PIXI - */ - var TimeLimiter = /** @class */ (function () { - /** - * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. - */ - function TimeLimiter(maxMilliseconds) { - /** - * The maximum milliseconds that can be spent preparing items each frame. - * @type {number} - * @private - */ - this.maxMilliseconds = maxMilliseconds; - /** - * The start time of the current frame. - * @type {number} - * @private - */ - this.frameStart = 0; - } - /** - * Resets any counting properties to start fresh on a new frame. - */ - TimeLimiter.prototype.beginFrame = function () { - this.frameStart = Date.now(); - }; - /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. - */ - TimeLimiter.prototype.allowedToUpload = function () { - return Date.now() - this.frameStart < this.maxMilliseconds; - }; - return TimeLimiter; - }()); - - /*! - * @pixi/spritesheet - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/spritesheet is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Utility class for maintaining reference to a collection - * of Textures on a single Spritesheet. - * - * To access a sprite sheet from your code pass its JSON data file to Pixi's loader: - * - * ```js - * PIXI.Loader.shared.add("images/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["images/spritesheet.json"].spritesheet; - * ... - * } - * ``` - * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite. - * - * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker}, - * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}. - * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only - * supported by TexturePacker. - * - * @class - * @memberof PIXI - */ - var Spritesheet = /** @class */ (function () { - /** - * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object. - * @param {Object} data - Spritesheet image data. - * @param {string} [resolutionFilename] - The filename to consider when determining - * the resolution of the spritesheet. If not provided, the imageUrl will - * be used on the BaseTexture. - */ - function Spritesheet(texture, data, resolutionFilename) { - if (resolutionFilename === void 0) { resolutionFilename = null; } - /** - * Reference to original source image from the Loader. This reference is retained so we - * can destroy the Texture later on. It is never used internally. - * @type {PIXI.Texture} - * @private - */ - this._texture = texture instanceof Texture ? texture : null; - /** - * Reference to ths source texture. - * @type {PIXI.BaseTexture} - */ - this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture; - /** - * A map containing all textures of the sprite sheet. - * Can be used to create a {@link PIXI.Sprite|Sprite}: - * ```js - * new PIXI.Sprite(sheet.textures["image.png"]); - * ``` - * @member {Object} - */ - this.textures = {}; - /** - * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: - * ```js - * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) - * ``` - * @member {Object} - */ - this.animations = {}; - /** - * Reference to the original JSON data. - * @type {Object} - */ - this.data = data; - var resource = this.baseTexture.resource; - /** - * The resolution of the spritesheet. - * @type {number} - */ - this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)); - /** - * Map of spritesheet frames. - * @type {Object} - * @private - */ - this._frames = this.data.frames; - /** - * Collection of frame names. - * @type {string[]} - * @private - */ - this._frameKeys = Object.keys(this._frames); - /** - * Current batch index being processed. - * @type {number} - * @private - */ - this._batchIndex = 0; - /** - * Callback when parse is completed. - * @type {Function} - * @private - */ - this._callback = null; - } - /** - * Generate the resolution from the filename or fallback - * to the meta.scale field of the JSON data. - * - * @private - * @param {string} resolutionFilename - The filename to use for resolving - * the default resolution. - * @return {number} Resolution to use for spritesheet. - */ - Spritesheet.prototype._updateResolution = function (resolutionFilename) { - if (resolutionFilename === void 0) { resolutionFilename = null; } - var scale = this.data.meta.scale; - // Use a defaultValue of `null` to check if a url-based resolution is set - var resolution = getResolutionOfUrl(resolutionFilename, null); - // No resolution found via URL - if (resolution === null) { - // Use the scale value or default to 1 - resolution = scale !== undefined ? parseFloat(scale) : 1; - } - // For non-1 resolutions, update baseTexture - if (resolution !== 1) { - this.baseTexture.setResolution(resolution); - } - return resolution; - }; - /** - * Parser spritesheet from loaded data. This is done asynchronously - * to prevent creating too many Texture within a single process. - * - * @param {Function} callback - Callback when complete returns - * a map of the Textures for this spritesheet. - */ - Spritesheet.prototype.parse = function (callback) { - this._batchIndex = 0; - this._callback = callback; - if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) { - this._processFrames(0); - this._processAnimations(); - this._parseComplete(); - } - else { - this._nextBatch(); - } - }; - /** - * Process a batch of frames - * - * @private - * @param {number} initialFrameIndex - The index of frame to start. - */ - Spritesheet.prototype._processFrames = function (initialFrameIndex) { - var frameIndex = initialFrameIndex; - var maxFrames = Spritesheet.BATCH_SIZE; - while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) { - var i = this._frameKeys[frameIndex]; - var data = this._frames[i]; - var rect = data.frame; - if (rect) { - var frame = null; - var trim = null; - var sourceSize = data.trimmed !== false && data.sourceSize - ? data.sourceSize : data.frame; - var orig = new Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution); - if (data.rotated) { - frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution); - } - else { - frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); - } - // Check to see if the sprite is trimmed - if (data.trimmed !== false && data.spriteSourceSize) { - trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); - } - this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor); - // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions - Texture.addToCache(this.textures[i], i); - } - frameIndex++; - } - }; - /** - * Parse animations config - * - * @private - */ - Spritesheet.prototype._processAnimations = function () { - var animations = this.data.animations || {}; - for (var animName in animations) { - this.animations[animName] = []; - for (var i = 0; i < animations[animName].length; i++) { - var frameName = animations[animName][i]; - this.animations[animName].push(this.textures[frameName]); - } - } - }; - /** - * The parse has completed. - * - * @private - */ - Spritesheet.prototype._parseComplete = function () { - var callback = this._callback; - this._callback = null; - this._batchIndex = 0; - callback.call(this, this.textures); - }; - /** - * Begin the next batch of textures. - * - * @private - */ - Spritesheet.prototype._nextBatch = function () { - var _this = this; - this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); - this._batchIndex++; - setTimeout(function () { - if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) { - _this._nextBatch(); - } - else { - _this._processAnimations(); - _this._parseComplete(); - } - }, 0); - }; - /** - * Destroy Spritesheet and don't use after this. - * - * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well - */ - Spritesheet.prototype.destroy = function (destroyBase) { - var _a; - if (destroyBase === void 0) { destroyBase = false; } - for (var i in this.textures) { - this.textures[i].destroy(); - } - this._frames = null; - this._frameKeys = null; - this.data = null; - this.textures = null; - if (destroyBase) { - (_a = this._texture) === null || _a === void 0 ? void 0 : _a.destroy(); - this.baseTexture.destroy(); - } - this._texture = null; - this.baseTexture = null; - }; - /** - * The maximum number of Textures to build per process. - * - * @type {number} - * @default 1000 - */ - Spritesheet.BATCH_SIZE = 1000; - return Spritesheet; - }()); - - /** - * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with - * TexturePacker or similar JSON-based spritesheet. - * - * This middleware automatically generates Texture resources. - * - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var SpritesheetLoader = /** @class */ (function () { - function SpritesheetLoader() { - } - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - SpritesheetLoader.use = function (resource, next) { - // because this is middleware, it execute in loader context. `this` = loader - var loader = this; - var imageResourceName = resource.name + "_image"; - // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists - if (!resource.data - || resource.type !== LoaderResource.TYPE.JSON - || !resource.data.frames - || loader.resources[imageResourceName]) { - next(); - return; - } - var loadOptions = { - crossOrigin: resource.crossOrigin, - metadata: resource.metadata.imageMetadata, - parentResource: resource, - }; - var resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl); - // load the image for this sheet - loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) { - if (res.error) { - next(res.error); - return; - } - var spritesheet = new Spritesheet(res.texture, resource.data, resource.url); - spritesheet.parse(function () { - resource.spritesheet = spritesheet; - resource.textures = spritesheet.textures; - next(); - }); - }); - }; - /** - * Get the spritesheets root path - * @param {PIXI.LoaderResource} resource - Resource to check path - * @param {string} baseUrl - Base root url - */ - SpritesheetLoader.getResourcePath = function (resource, baseUrl) { - // Prepend url path unless the resource image is a data url - if (resource.isDataUrl) { - return resource.data.meta.image; - } - return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); - }; - return SpritesheetLoader; - }()); - - /*! - * @pixi/sprite-tiling - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite-tiling is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$9 = function(d, b) { - extendStatics$9 = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$9(d, b); - }; - - function __extends$9(d, b) { - extendStatics$9(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var tempPoint$1 = new Point(); - /** - * A tiling sprite is a fast way of rendering a tiling image - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var TilingSprite = /** @class */ (function (_super) { - __extends$9(TilingSprite, _super); - /** - * @param {PIXI.Texture} texture - the texture of the tiling sprite - * @param {number} [width=100] - the width of the tiling sprite - * @param {number} [height=100] - the height of the tiling sprite - */ - function TilingSprite(texture, width, height) { - if (width === void 0) { width = 100; } - if (height === void 0) { height = 100; } - var _this = _super.call(this, texture) || this; - /** - * Tile transform - * - * @member {PIXI.Transform} - */ - _this.tileTransform = new Transform(); - /** - * The with of the tiling sprite - * - * @member {number} - * @private - */ - _this._width = width; - /** - * The height of the tiling sprite - * - * @member {number} - * @private - */ - _this._height = height; - /** - * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space - * - * @member {PIXI.TextureMatrix} - */ - _this.uvMatrix = _this.texture.uvMatrix || new TextureMatrix(texture); - /** - * Plugin that is responsible for rendering this element. - * Allows to customize the rendering process without overriding '_render' method. - * - * @member {string} - * @default 'tilingSprite' - */ - _this.pluginName = 'tilingSprite'; - /** - * Whether or not anchor affects uvs - * - * @member {boolean} - * @default false - */ - _this.uvRespectAnchor = false; - return _this; - } - Object.defineProperty(TilingSprite.prototype, "clampMargin", { - /** - * Changes frame clamping in corresponding textureTransform, shortcut - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} - */ - get: function () { - return this.uvMatrix.clampMargin; - }, - set: function (value) { - this.uvMatrix.clampMargin = value; - this.uvMatrix.update(true); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "tileScale", { - /** - * The scaling of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.tileTransform.scale; - }, - set: function (value) { - this.tileTransform.scale.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "tilePosition", { - /** - * The offset of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - get: function () { - return this.tileTransform.position; - }, - set: function (value) { - this.tileTransform.position.copyFrom(value); - }, - enumerable: false, - configurable: true - }); - /** - * @protected - */ - TilingSprite.prototype._onTextureUpdate = function () { - if (this.uvMatrix) { - this.uvMatrix.texture = this._texture; - } - this._cachedTint = 0xFFFFFF; - }; - /** - * Renders the object using the WebGL renderer - * - * @protected - * @param {PIXI.Renderer} renderer - The renderer - */ - TilingSprite.prototype._render = function (renderer) { - // tweak our texture temporarily.. - var texture = this._texture; - if (!texture || !texture.valid) { - return; - } - this.tileTransform.updateLocalTransform(); - this.uvMatrix.update(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - renderer.plugins[this.pluginName].render(this); - }; - /** - * Updates the bounds of the tiling sprite. - * - * @protected - */ - TilingSprite.prototype._calculateBounds = function () { - var minX = this._width * -this._anchor._x; - var minY = this._height * -this._anchor._y; - var maxX = this._width * (1 - this._anchor._x); - var maxY = this._height * (1 - this._anchor._y); - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); - }; - /** - * Gets the local bounds of the sprite object. - * - * @param {PIXI.Rectangle} rect - The output rectangle. - * @return {PIXI.Rectangle} The bounds. - */ - TilingSprite.prototype.getLocalBounds = function (rect) { - // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) { - this._bounds.minX = this._width * -this._anchor._x; - this._bounds.minY = this._height * -this._anchor._y; - this._bounds.maxX = this._width * (1 - this._anchor._x); - this._bounds.maxY = this._height * (1 - this._anchor._y); - if (!rect) { - if (!this._localBoundsRect) { - this._localBoundsRect = new Rectangle(); - } - rect = this._localBoundsRect; - } - return this._bounds.getRectangle(rect); - } - return _super.prototype.getLocalBounds.call(this, rect); - }; - /** - * Checks if a point is inside this tiling sprite. - * - * @param {PIXI.IPointData} point - the point to check - * @return {boolean} Whether or not the sprite contains the point. - */ - TilingSprite.prototype.containsPoint = function (point) { - this.worldTransform.applyInverse(point, tempPoint$1); - var width = this._width; - var height = this._height; - var x1 = -width * this.anchor._x; - if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width) { - var y1 = -height * this.anchor._y; - if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height) { - return true; - } - } - return false; - }; - /** - * Destroys this sprite and optionally its texture and children - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well - */ - TilingSprite.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.tileTransform = null; - this.uvMatrix = null; - }; - /** - * Helper function that creates a new tiling sprite based on the source you provide. - * The source can be - frame id, image url, video url, canvas element, video element, base texture - * - * @static - * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from - * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options. - * @param {number} options.width - required width of the tiling sprite - * @param {number} options.height - required height of the tiling sprite - * @return {PIXI.TilingSprite} The newly created texture - */ - TilingSprite.from = function (source, options) { - // Deprecated - if (typeof options === 'number') { - deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args'); - // eslint-disable-next-line prefer-rest-params - options = { width: options, height: arguments[2] }; - } - return new TilingSprite(Texture.from(source, options), options.width, options.height); - }; - Object.defineProperty(TilingSprite.prototype, "width", { - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this._width; - }, - set: function (value) { - this._width = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TilingSprite.prototype, "height", { - /** - * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - get: function () { - return this._height; - }, - set: function (value) { - this._height = value; - }, - enumerable: false, - configurable: true - }); - return TilingSprite; - }(Sprite)); - - var vertex$2 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n"; - - var fragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture2D(uSampler, coord);\n gl_FragColor = texSample * uColor;\n}\n"; - - var fragmentSimple = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n"; - - var tempMat$1 = new Matrix(); - /** - * WebGL renderer plugin for tiling sprites - * - * @class - * @memberof PIXI - * @extends PIXI.ObjectRenderer - */ - var TilingSpriteRenderer = /** @class */ (function (_super) { - __extends$9(TilingSpriteRenderer, _super); - /** - * constructor for renderer - * - * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for. - */ - function TilingSpriteRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - var uniforms = { globals: _this.renderer.globalUniforms }; - _this.shader = Shader.from(vertex$2, fragment$2, uniforms); - _this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); - _this.quad = new QuadUv(); - /** - * The WebGL state in which this renderer will work. - * - * @member {PIXI.State} - * @readonly - */ - _this.state = State.for2d(); - return _this; - } - /** - * - * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered - */ - TilingSpriteRenderer.prototype.render = function (ts) { - var renderer = this.renderer; - var quad = this.quad; - var vertices = quad.vertices; - vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x; - vertices[1] = vertices[3] = ts._height * -ts.anchor.y; - vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x); - vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y); - if (ts.uvRespectAnchor) { - vertices = quad.uvs; - vertices[0] = vertices[6] = -ts.anchor.x; - vertices[1] = vertices[3] = -ts.anchor.y; - vertices[2] = vertices[4] = 1.0 - ts.anchor.x; - vertices[5] = vertices[7] = 1.0 - ts.anchor.y; - } - quad.invalidate(); - var tex = ts._texture; - var baseTex = tex.baseTexture; - var lt = ts.tileTransform.localTransform; - var uv = ts.uvMatrix; - var isSimple = baseTex.isPowerOfTwo - && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; - // auto, force repeat wrapMode for big tiling textures - if (isSimple) { - if (!baseTex._glTextures[renderer.CONTEXT_UID]) { - if (baseTex.wrapMode === exports.WRAP_MODES.CLAMP) { - baseTex.wrapMode = exports.WRAP_MODES.REPEAT; - } - } - else { - isSimple = baseTex.wrapMode !== exports.WRAP_MODES.CLAMP; - } - } - var shader = isSimple ? this.simpleShader : this.shader; - var w = tex.width; - var h = tex.height; - var W = ts._width; - var H = ts._height; - tempMat$1.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); - // that part is the same as above: - // tempMat.identity(); - // tempMat.scale(tex.width, tex.height); - // tempMat.prepend(lt); - // tempMat.scale(1.0 / ts._width, 1.0 / ts._height); - tempMat$1.invert(); - if (isSimple) { - tempMat$1.prepend(uv.mapCoord); - } - else { - shader.uniforms.uMapCoord = uv.mapCoord.toArray(true); - shader.uniforms.uClampFrame = uv.uClampFrame; - shader.uniforms.uClampOffset = uv.uClampOffset; - } - shader.uniforms.uTransform = tempMat$1.toArray(true); - shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.alphaMode); - shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true); - shader.uniforms.uSampler = tex; - renderer.shader.bind(shader); - renderer.geometry.bind(quad); - this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode); - renderer.state.set(this.state); - renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0); - }; - return TilingSpriteRenderer; - }(ObjectRenderer)); - - /*! - * @pixi/mesh - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mesh is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$a = function(d, b) { - extendStatics$a = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$a(d, b); - }; - - function __extends$a(d, b) { - extendStatics$a(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space. - * - * @class - * @memberof PIXI - */ - var MeshBatchUvs = /** @class */ (function () { - /** - * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's - * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix - */ - function MeshBatchUvs(uvBuffer, uvMatrix) { - /** - * Buffer with normalized UV's - * @member {PIXI.Buffer} - */ - this.uvBuffer = uvBuffer; - /** - * Material UV matrix - * @member {PIXI.TextureMatrix} - */ - this.uvMatrix = uvMatrix; - /** - * UV Buffer data - * @member {Float32Array} - * @readonly - */ - this.data = null; - this._bufferUpdateId = -1; - this._textureUpdateId = -1; - this._updateID = 0; - } - /** - * updates - * - * @param {boolean} [forceUpdate] - force the update - */ - MeshBatchUvs.prototype.update = function (forceUpdate) { - if (!forceUpdate - && this._bufferUpdateId === this.uvBuffer._updateID - && this._textureUpdateId === this.uvMatrix._updateID) { - return; - } - this._bufferUpdateId = this.uvBuffer._updateID; - this._textureUpdateId = this.uvMatrix._updateID; - var data = this.uvBuffer.data; - if (!this.data || this.data.length !== data.length) { - this.data = new Float32Array(data.length); - } - this.uvMatrix.multiplyUvs(data, this.data); - this._updateID++; - }; - return MeshBatchUvs; - }()); - - var tempPoint$2 = new Point(); - var tempPolygon = new Polygon(); - /** - * Base mesh class. - * - * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. - * This class assumes a certain level of WebGL knowledge. - * If you know a bit this should abstract enough away to make you life easier! - * - * Pretty much ALL WebGL can be broken down into the following: - * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) - * - State - This is the state of WebGL required to render the mesh. - * - * Through a combination of the above elements you can render anything you want, 2D or 3D! - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Mesh = /** @class */ (function (_super) { - __extends$a(Mesh, _super); - /** - * @param {PIXI.Geometry} geometry - the geometry the mesh will use - * @param {PIXI.MeshMaterial} shader - the shader the mesh will use - * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh - * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. - * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts - */ - function Mesh(geometry, shader, state, drawMode) { - if (drawMode === void 0) { drawMode = exports.DRAW_MODES.TRIANGLES; } - var _this = _super.call(this) || this; - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh objects. - * @member {PIXI.Geometry} - * @readonly - */ - _this.geometry = geometry; - geometry.refCount++; - /** - * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. - * Can be shared between multiple Mesh objects. - * @member {PIXI.Shader|PIXI.MeshMaterial} - */ - _this.shader = shader; - /** - * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., - * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. - * @member {PIXI.State} - */ - _this.state = state || State.for2d(); - /** - * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. - * - * @member {number} - * @see PIXI.DRAW_MODES - */ - _this.drawMode = drawMode; - /** - * Typically the index of the IndexBuffer where to start drawing. - * @member {number} - * @default 0 - */ - _this.start = 0; - /** - * How much of the geometry to draw, by default `0` renders everything. - * @member {number} - * @default 0 - */ - _this.size = 0; - /** - * thease are used as easy access for batching - * @member {Float32Array} - * @private - */ - _this.uvs = null; - /** - * thease are used as easy access for batching - * @member {Uint16Array} - * @private - */ - _this.indices = null; - /** - * this is the caching layer used by the batcher - * @member {Float32Array} - * @private - */ - _this.vertexData = new Float32Array(1); - /** - * If geometry is changed used to decide to re-transform - * the vertexData. - * @member {number} - * @private - */ - _this.vertexDirty = 0; - _this._transformID = -1; - /** - * Internal roundPixels field - * - * @member {boolean} - * @private - */ - _this._roundPixels = settings.ROUND_PIXELS; - /** - * Batched UV's are cached for atlas textures - * @member {PIXI.MeshBatchUvs} - * @private - */ - _this.batchUvs = null; - return _this; - } - Object.defineProperty(Mesh.prototype, "uvBuffer", { - /** - * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @member {PIXI.Buffer} - * @readonly - */ - get: function () { - return this.geometry.buffers[1]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "verticesBuffer", { - /** - * To change mesh vertices, change its uvBuffer data and increment its _updateID. - * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @member {PIXI.Buffer} - * @readonly - */ - get: function () { - return this.geometry.buffers[0]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "material", { - get: function () { - return this.shader; - }, - /** - * Alias for {@link PIXI.Mesh#shader}. - * @member {PIXI.MeshMaterial} - */ - set: function (value) { - this.shader = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "blendMode", { - get: function () { - return this.state.blendMode; - }, - /** - * The blend mode to be applied to the Mesh. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - set: function (value) { - this.state.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "roundPixels", { - get: function () { - return this._roundPixels; - }, - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - set: function (value) { - if (this._roundPixels !== value) { - this._transformID = -1; - } - this._roundPixels = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "tint", { - /** - * The multiply tint applied to the Mesh. This is a hex value. A value of - * `0xFFFFFF` will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - get: function () { - return this.shader.tint; - }, - set: function (value) { - this.shader.tint = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Mesh.prototype, "texture", { - /** - * The texture that the Mesh uses. - * - * @member {PIXI.Texture} - */ - get: function () { - return this.shader.texture; - }, - set: function (value) { - this.shader.texture = value; - }, - enumerable: false, - configurable: true - }); - /** - * Standard renderer draw. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._render = function (renderer) { - // set properties for batching.. - // TODO could use a different way to grab verts? - var vertices = this.geometry.buffers[0].data; - // TODO benchmark check for attribute size.. - if (this.shader.batchable - && this.drawMode === exports.DRAW_MODES.TRIANGLES - && vertices.length < Mesh.BATCHABLE_SIZE * 2) { - this._renderToBatch(renderer); - } - else { - this._renderDefault(renderer); - } - }; - /** - * Standard non-batching way of rendering. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderDefault = function (renderer) { - var shader = this.shader; - shader.alpha = this.worldAlpha; - if (shader.update) { - shader.update(); - } - renderer.batch.flush(); - if (shader.program.uniformData.translationMatrix) { - shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true); - } - // bind and sync uniforms.. - renderer.shader.bind(shader); - // set state.. - renderer.state.set(this.state); - // bind the geometry... - renderer.geometry.bind(this.geometry, shader); - // then render it - renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount); - }; - /** - * Rendering by using the Batch system. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderToBatch = function (renderer) { - var geometry = this.geometry; - if (this.shader.uvMatrix) { - this.shader.uvMatrix.update(); - this.calculateUvs(); - } - // set properties for batching.. - this.calculateVertices(); - this.indices = geometry.indexBuffer.data; - this._tintRGB = this.shader._tintRGB; - this._texture = this.shader.texture; - var pluginName = this.material.pluginName; - renderer.batch.setObjectRenderer(renderer.plugins[pluginName]); - renderer.plugins[pluginName].render(this); - }; - /** - * Updates vertexData field based on transform and vertices - */ - Mesh.prototype.calculateVertices = function () { - var geometry = this.geometry; - var vertices = geometry.buffers[0].data; - if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) { - return; - } - this._transformID = this.transform._worldID; - if (this.vertexData.length !== vertices.length) { - this.vertexData = new Float32Array(vertices.length); - } - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - var vertexData = this.vertexData; - for (var i = 0; i < vertexData.length / 2; i++) { - var x = vertices[(i * 2)]; - var y = vertices[(i * 2) + 1]; - vertexData[(i * 2)] = (a * x) + (c * y) + tx; - vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty; - } - if (this._roundPixels) { - var resolution = settings.RESOLUTION; - for (var i = 0; i < vertexData.length; ++i) { - vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); - } - } - this.vertexDirty = geometry.vertexDirtyId; - }; - /** - * Updates uv field based on from geometry uv's or batchUvs - */ - Mesh.prototype.calculateUvs = function () { - var geomUvs = this.geometry.buffers[1]; - if (!this.shader.uvMatrix.isSimple) { - if (!this.batchUvs) { - this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix); - } - this.batchUvs.update(); - this.uvs = this.batchUvs.data; - } - else { - this.uvs = geomUvs.data; - } - }; - /** - * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. - * - * @protected - */ - Mesh.prototype._calculateBounds = function () { - this.calculateVertices(); - this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length); - }; - /** - * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES. - * - * @param {PIXI.IPointData} point - the point to test - * @return {boolean} the result of the test - */ - Mesh.prototype.containsPoint = function (point) { - if (!this.getBounds().contains(point.x, point.y)) { - return false; - } - this.worldTransform.applyInverse(point, tempPoint$2); - var vertices = this.geometry.getBuffer('aVertexPosition').data; - var points = tempPolygon.points; - var indices = this.geometry.getIndex().data; - var len = indices.length; - var step = this.drawMode === 4 ? 3 : 1; - for (var i = 0; i + 2 < len; i += step) { - var ind0 = indices[i] * 2; - var ind1 = indices[i + 1] * 2; - var ind2 = indices[i + 2] * 2; - points[0] = vertices[ind0]; - points[1] = vertices[ind0 + 1]; - points[2] = vertices[ind1]; - points[3] = vertices[ind1 + 1]; - points[4] = vertices[ind2]; - points[5] = vertices[ind2 + 1]; - if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y)) { - return true; - } - } - return false; - }; - /** - * Destroys the Mesh object. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - */ - Mesh.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.geometry.refCount--; - if (this.geometry.refCount === 0) { - this.geometry.dispose(); - } - this.geometry = null; - this.shader = null; - this.state = null; - this.uvs = null; - this.indices = null; - this.vertexData = null; - }; - /** - * The maximum number of vertices to consider batchable. Generally, the complexity - * of the geometry. - * @memberof PIXI.Mesh - * @static - * @member {number} BATCHABLE_SIZE - */ - Mesh.BATCHABLE_SIZE = 100; - return Mesh; - }(Container)); - - var fragment$3 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"; - - var vertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"; - - /** - * Slightly opinionated default shader for PixiJS 2D objects. - * @class - * @memberof PIXI - * @extends PIXI.Shader - */ - var MeshMaterial = /** @class */ (function (_super) { - __extends$a(MeshMaterial, _super); - /** - * @param {PIXI.Texture} uSampler - Texture that material uses to render. - * @param {object} [options] - Additional options - * @param {number} [options.alpha=1] - Default alpha. - * @param {number} [options.tint=0xFFFFFF] - Default tint. - * @param {string} [options.pluginName='batch'] - Renderer plugin for batching. - * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program. - * @param {object} [options.uniforms] - Custom uniforms. - */ - function MeshMaterial(uSampler, options) { - var _this = this; - var uniforms = { - uSampler: uSampler, - alpha: 1, - uTextureMatrix: Matrix.IDENTITY, - uColor: new Float32Array([1, 1, 1, 1]), - }; - // Set defaults - options = Object.assign({ - tint: 0xFFFFFF, - alpha: 1, - pluginName: 'batch', - }, options); - if (options.uniforms) { - Object.assign(uniforms, options.uniforms); - } - _this = _super.call(this, options.program || Program.from(vertex$3, fragment$3), uniforms) || this; - /** - * Only do update if tint or alpha changes. - * @member {boolean} - * @private - * @default false - */ - _this._colorDirty = false; - /** - * TextureMatrix instance for this Mesh, used to track Texture changes - * - * @member {PIXI.TextureMatrix} - * @readonly - */ - _this.uvMatrix = new TextureMatrix(uSampler); - /** - * `true` if shader can be batch with the renderer's batch system. - * @member {boolean} - * @default true - */ - _this.batchable = options.program === undefined; - /** - * Renderer plugin for batching - * - * @member {string} - * @default 'batch' - */ - _this.pluginName = options.pluginName; - _this.tint = options.tint; - _this.alpha = options.alpha; - return _this; - } - Object.defineProperty(MeshMaterial.prototype, "texture", { - /** - * Reference to the texture being rendered. - * @member {PIXI.Texture} - */ - get: function () { - return this.uniforms.uSampler; - }, - set: function (value) { - if (this.uniforms.uSampler !== value) { - this.uniforms.uSampler = value; - this.uvMatrix.texture = value; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MeshMaterial.prototype, "alpha", { - get: function () { - return this._alpha; - }, - /** - * This gets automatically set by the object using this. - * - * @default 1 - * @member {number} - */ - set: function (value) { - if (value === this._alpha) - { return; } - this._alpha = value; - this._colorDirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MeshMaterial.prototype, "tint", { - get: function () { - return this._tint; - }, - /** - * Multiply tint for the material. - * @member {number} - * @default 0xFFFFFF - */ - set: function (value) { - if (value === this._tint) - { return; } - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - this._colorDirty = true; - }, - enumerable: false, - configurable: true - }); - /** - * Gets called automatically by the Mesh. Intended to be overridden for custom - * MeshMaterial objects. - */ - MeshMaterial.prototype.update = function () { - if (this._colorDirty) { - this._colorDirty = false; - var baseTexture = this.texture.baseTexture; - premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode); - } - if (this.uvMatrix.update()) { - this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord; - } - }; - return MeshMaterial; - }(Shader)); - - /** - * Standard 2D geometry used in PixiJS. - * - * Geometry can be defined without passing in a style or data if required. - * - * ```js - * const geometry = new PIXI.Geometry(); - * - * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); - * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2); - * geometry.addIndex([0,1,2,1,3,2]); - * - * ``` - * @class - * @memberof PIXI - * @extends PIXI.Geometry - */ - var MeshGeometry = /** @class */ (function (_super) { - __extends$a(MeshGeometry, _super); - /** - * @param {Float32Array|number[]} [vertices] - Positional data on geometry. - * @param {Float32Array|number[]} [uvs] - Texture UVs. - * @param {Uint16Array|number[]} [index] - IndexBuffer - */ - function MeshGeometry(vertices, uvs, index) { - var _this = _super.call(this) || this; - var verticesBuffer = new Buffer(vertices); - var uvsBuffer = new Buffer(uvs, true); - var indexBuffer = new Buffer(index, true, true); - _this.addAttribute('aVertexPosition', verticesBuffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', uvsBuffer, 2, false, exports.TYPES.FLOAT) - .addIndex(indexBuffer); - /** - * Dirty flag to limit update calls on Mesh. For example, - * limiting updates on a single Mesh instance with a shared Geometry - * within the render loop. - * @private - * @member {number} - * @default -1 - */ - _this._updateId = -1; - return _this; - } - Object.defineProperty(MeshGeometry.prototype, "vertexDirtyId", { - /** - * If the vertex position is updated. - * @member {number} - * @readonly - * @private - */ - get: function () { - return this.buffers[0]._updateID; - }, - enumerable: false, - configurable: true - }); - return MeshGeometry; - }(Geometry)); - - /*! - * @pixi/text-bitmap - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/text-bitmap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$b = function(d, b) { - extendStatics$b = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$b(d, b); - }; - - function __extends$b(d, b) { - extendStatics$b(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /* eslint-disable max-len */ - /** - * Normalized parsed data from .fnt files. - * - * @class - * @memberof PIXI - */ - var BitmapFontData = /** @class */ (function () { - function BitmapFontData() { - /** - * @member {PIXI.IBitmapFontDataInfo[]} - * @readOnly - */ - this.info = []; - /** - * @member {PIXI.IBitmapFontDataCommon[]} - * @readOnly - */ - this.common = []; - /** - * @member {PIXI.IBitmapFontDataPage[]} - * @readOnly - */ - this.page = []; - /** - * @member {PIXI.IBitmapFontDataChar[]} - * @readOnly - */ - this.char = []; - /** - * @member {PIXI.IBitmapFontDataKerning[]} - * @readOnly - */ - this.kerning = []; - } - return BitmapFontData; - }()); - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataInfo - * @property {string} face - * @property {number} size - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataCommon - * @property {number} lineHeight - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataPage - * @property {number} id - * @property {string} file - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataChar - * @property {string} id - * @property {number} page - * @property {number} x - * @property {number} y - * @property {number} width - * @property {number} height - * @property {number} xoffset - * @property {number} yoffset - * @property {number} xadvance - */ - /** - * @memberof PIXI - * @typedef {object} IBitmapFontDataKerning - * @property {number} first - * @property {number} second - * @property {number} amount - */ - - /** - * BitmapFont format that's Text-based. - * - * @class - * @private - */ - var TextFormat = /** @class */ (function () { - function TextFormat() { - } - /** - * Check if resource refers to txt font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - TextFormat.test = function (data) { - return typeof data === 'string' && data.indexOf('info face=') === 0; - }; - /** - * Convert text font data to a javascript object. - * - * @static - * @private - * @param {string} txt - Raw string data to be converted - * @return {PIXI.BitmapFontData} Parsed font data - */ - TextFormat.parse = function (txt) { - // Retrieve data item - var items = txt.match(/^[a-z]+\s+.+$/gm); - var rawData = { - info: [], - common: [], - page: [], - char: [], - chars: [], - kerning: [], - kernings: [], - }; - for (var i in items) { - // Extract item name - var name = items[i].match(/^[a-z]+/gm)[0]; - // Extract item attribute list as string ex.: "width=10" - var attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm); - // Convert attribute list into an object - var itemData = {}; - for (var i_1 in attributeList) { - // Split key-value pairs - var split = attributeList[i_1].split('='); - var key = split[0]; - // Remove eventual quotes from value - var strValue = split[1].replace(/"/gm, ''); - // Try to convert value into float - var floatValue = parseFloat(strValue); - // Use string value case float value is NaN - var value = isNaN(floatValue) ? strValue : floatValue; - itemData[key] = value; - } - // Push current item to the resulting data - rawData[name].push(itemData); - } - var font = new BitmapFontData(); - rawData.info.forEach(function (info) { return font.info.push({ - face: info.face, - size: parseInt(info.size, 10), - }); }); - rawData.common.forEach(function (common) { return font.common.push({ - lineHeight: parseInt(common.lineHeight, 10), - }); }); - rawData.page.forEach(function (page) { return font.page.push({ - id: parseInt(page.id, 10), - file: page.file, - }); }); - rawData.char.forEach(function (char) { return font.char.push({ - id: parseInt(char.id, 10), - page: parseInt(char.page, 10), - x: parseInt(char.x, 10), - y: parseInt(char.y, 10), - width: parseInt(char.width, 10), - height: parseInt(char.height, 10), - xoffset: parseInt(char.xoffset, 10), - yoffset: parseInt(char.yoffset, 10), - xadvance: parseInt(char.xadvance, 10), - }); }); - rawData.kerning.forEach(function (kerning) { return font.kerning.push({ - first: parseInt(kerning.first, 10), - second: parseInt(kerning.second, 10), - amount: parseInt(kerning.amount, 10), - }); }); - return font; - }; - return TextFormat; - }()); - - /** - * BitmapFont format that's XML-based. - * - * @class - * @private - */ - var XMLFormat = /** @class */ (function () { - function XMLFormat() { - } - /** - * Check if resource refers to xml font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - XMLFormat.test = function (data) { - return data instanceof XMLDocument - && data.getElementsByTagName('page').length - && data.getElementsByTagName('info')[0].getAttribute('face') !== null; - }; - /** - * Convert the XML into BitmapFontData that we can use. - * - * @static - * @private - * @param {XMLDocument} xml - * @return {BitmapFontData} Data to use for BitmapFont - */ - XMLFormat.parse = function (xml) { - var data = new BitmapFontData(); - var info = xml.getElementsByTagName('info'); - var common = xml.getElementsByTagName('common'); - var page = xml.getElementsByTagName('page'); - var char = xml.getElementsByTagName('char'); - var kerning = xml.getElementsByTagName('kerning'); - for (var i = 0; i < info.length; i++) { - data.info.push({ - face: info[i].getAttribute('face'), - size: parseInt(info[i].getAttribute('size'), 10), - }); - } - for (var i = 0; i < common.length; i++) { - data.common.push({ - lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10), - }); - } - for (var i = 0; i < page.length; i++) { - data.page.push({ - id: parseInt(page[i].getAttribute('id'), 10) || 0, - file: page[i].getAttribute('file'), - }); - } - for (var i = 0; i < char.length; i++) { - var letter = char[i]; - data.char.push({ - id: parseInt(letter.getAttribute('id'), 10), - page: parseInt(letter.getAttribute('page'), 10) || 0, - x: parseInt(letter.getAttribute('x'), 10), - y: parseInt(letter.getAttribute('y'), 10), - width: parseInt(letter.getAttribute('width'), 10), - height: parseInt(letter.getAttribute('height'), 10), - xoffset: parseInt(letter.getAttribute('xoffset'), 10), - yoffset: parseInt(letter.getAttribute('yoffset'), 10), - xadvance: parseInt(letter.getAttribute('xadvance'), 10), - }); - } - for (var i = 0; i < kerning.length; i++) { - data.kerning.push({ - first: parseInt(kerning[i].getAttribute('first'), 10), - second: parseInt(kerning[i].getAttribute('second'), 10), - amount: parseInt(kerning[i].getAttribute('amount'), 10), - }); - } - return data; - }; - return XMLFormat; - }()); - - /** - * BitmapFont format that's XML-based. - * - * @class - * @private - */ - var XMLStringFormat = /** @class */ (function () { - function XMLStringFormat() { - } - /** - * Check if resource refers to text xml font data. - * - * @static - * @private - * @param {any} data - * @return {boolean} True if resource could be treated as font data, false otherwise. - */ - XMLStringFormat.test = function (data) { - if (typeof data === 'string' && data.indexOf('') > -1) { - var xml = new self.DOMParser().parseFromString(data, 'text/xml'); - return XMLFormat.test(xml); - } - return false; - }; - /** - * Convert the text XML into BitmapFontData that we can use. - * - * @static - * @private - * @param {string} xmlTxt - * @return {BitmapFontData} Data to use for BitmapFont - */ - XMLStringFormat.parse = function (xmlTxt) { - var xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml'); - return XMLFormat.parse(xml); - }; - return XMLStringFormat; - }()); - - // Registered formats, maybe make this extensible in the future? - var formats = [ - TextFormat, - XMLFormat, - XMLStringFormat ]; - /** - * Auto-detect BitmapFont parsing format based on data. - * @private - * @param {any} data - Data to detect format - * @return {any} Format or null - */ - function autoDetectFormat(data) { - for (var i = 0; i < formats.length; i++) { - if (formats[i].test(data)) { - return formats[i]; - } - } - return null; - } - - // TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle - /** - * Generates the fill style. Can automatically generate a gradient based on the fill style being an array - * - * @private - * @param {object} style - The style. - * @param {string[]} lines - The lines of text. - * @return {string|number|CanvasGradient} The fill style - */ - function generateFillStyle(canvas, context, style, resolution, lines, metrics) { - // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as - // the setter converts to string. See this thread for more details: - // https://github.com/microsoft/TypeScript/issues/2521 - var fillStyle = style.fill; - if (!Array.isArray(fillStyle)) { - return fillStyle; - } - else if (fillStyle.length === 1) { - return fillStyle[0]; - } - // the gradient will be evenly spaced out according to how large the array is. - // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 - var gradient; - // a dropshadow will enlarge the canvas and result in the gradient being - // generated with the incorrect dimensions - var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; - // should also take padding into account, padding can offset the gradient - var padding = style.padding || 0; - var width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2); - var height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2); - // make a copy of the style settings, so we can manipulate them later - var fill = fillStyle.slice(); - var fillGradientStops = style.fillGradientStops.slice(); - // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 - if (!fillGradientStops.length) { - var lengthPlus1 = fill.length + 1; - for (var i = 1; i < lengthPlus1; ++i) { - fillGradientStops.push(i / lengthPlus1); - } - } - // stop the bleeding of the last gradient on the line above to the top gradient of the this line - // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 - fill.unshift(fillStyle[0]); - fillGradientStops.unshift(0); - fill.push(fillStyle[fillStyle.length - 1]); - fillGradientStops.push(1); - if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { - // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas - gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding); - // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect - // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 - // There's potential for floating point precision issues at the seams between gradient repeats. - // The loop below generates the stops in order, so track the last generated one to prevent - // floating point precision from making us go the teeniest bit backwards, resulting in - // the first and last colors getting swapped. - var lastIterationStop = 0; - // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc - var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; - // textHeight, but as a 0-1 size in global gradient stop space - var gradStopLineHeight = textHeight / height; - for (var i = 0; i < lines.length; i++) { - var thisLineTop = metrics.lineHeight * i; - for (var j = 0; j < fill.length; j++) { - // 0-1 stop point for the current line, multiplied to global space afterwards - var lineStop = 0; - if (typeof fillGradientStops[j] === 'number') { - lineStop = fillGradientStops[j]; - } - else { - lineStop = j / fill.length; - } - var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); - // Prevent color stop generation going backwards from floating point imprecision - var clampedStop = Math.max(lastIterationStop, globalStop); - clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. - gradient.addColorStop(clampedStop, fill[j]); - lastIterationStop = clampedStop; - } - } - } - else { - // start the gradient at the center left of the canvas, and end at the center right of the canvas - gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2); - // can just evenly space out the gradients in this case, as multiple lines makes no difference - // to an even left to right gradient - var totalIterations = fill.length + 1; - var currentIteration = 1; - for (var i = 0; i < fill.length; i++) { - var stop = void 0; - if (typeof fillGradientStops[i] === 'number') { - stop = fillGradientStops[i]; - } - else { - stop = currentIteration / totalIterations; - } - gradient.addColorStop(stop, fill[i]); - currentIteration++; - } - } - return gradient; - } - - // TODO: Prevent code duplication b/w drawGlyph & Text#updateText - /** - * Draws the glyph `metrics.text` on the given canvas. - * - * Ignored because not directly exposed. - * - * @ignore - * @param {HTMLCanvasElement} canvas - * @param {CanvasRenderingContext2D} context - * @param {TextMetrics} metrics - * @param {number} x - * @param {number} y - * @param {number} resolution - * @param {TextStyle} style - */ - function drawGlyph(canvas, context, metrics, x, y, resolution, style) { - var char = metrics.text; - var fontProperties = metrics.fontProperties; - context.translate(x, y); - context.scale(resolution, resolution); - var tx = style.strokeThickness / 2; - var ty = -(style.strokeThickness / 2); - context.font = style.toFontString(); - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - // set canvas text styles - context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); - context.strokeStyle = style.stroke; - context.font = style.toFontString(); - context.lineWidth = style.strokeThickness; - context.textBaseline = style.textBaseline; - context.lineJoin = style.lineJoin; - context.miterLimit = style.miterLimit; - // set canvas text styles - context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); - context.strokeStyle = style.stroke; - var dropShadowColor = style.dropShadowColor; - var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); - if (style.dropShadow) { - context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; - context.shadowBlur = style.dropShadowBlur; - context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; - context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance; - } - else { - context.shadowColor = 'black'; - context.shadowBlur = 0; - context.shadowOffsetX = 0; - context.shadowOffsetY = 0; - } - if (style.stroke && style.strokeThickness) { - context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent); - } - if (style.fill) { - context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent); - } - context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29) - context.fillStyle = 'rgba(0, 0, 0, 0)'; - } - - /** - * Processes the passed character set data and returns a flattened array of all the characters. - * - * Ignored because not directly exposed. - * - * @ignore - * @param {string | string[] | string[][] } chars - * @returns {string[]} - */ - function resolveCharacters(chars) { - // Split the chars string into individual characters - if (typeof chars === 'string') { - chars = [chars]; - } - // Handle an array of characters+ranges - var result = []; - for (var i = 0, j = chars.length; i < j; i++) { - var item = chars[i]; - // Handle range delimited by start/end chars - if (Array.isArray(item)) { - if (item.length !== 2) { - throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + item.length + "."); - } - var startCode = item[0].charCodeAt(0); - var endCode = item[1].charCodeAt(0); - if (endCode < startCode) { - throw new Error('[BitmapFont]: Invalid character range.'); - } - for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) { - result.push(String.fromCharCode(i_1)); - } - } - // Handle a character set string - else { - result.push.apply(result, item.split('')); - } - } - if (result.length === 0) { - throw new Error('[BitmapFont]: Empty set when resolving characters.'); - } - return result; - } - - /** - * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install` - * method for adding a font to be used. - * - * @class - * @memberof PIXI - */ - var BitmapFont = /** @class */ (function () { - /** - * @param {PIXI.BitmapFontData} data - * @param {PIXI.Texture[]|Object.} textures - */ - function BitmapFont(data, textures) { - var info = data.info[0]; - var common = data.common[0]; - var page = data.page[0]; - var res = getResolutionOfUrl(page.file); - var pageTextures = {}; - /** - * The name of the font face. - * - * @member {string} - * @readonly - */ - this.font = info.face; - /** - * The size of the font face in pixels. - * - * @member {number} - * @readonly - */ - this.size = info.size; - /** - * The line-height of the font face in pixels. - * - * @member {number} - * @readonly - */ - this.lineHeight = common.lineHeight / res; - /** - * The map of characters by character code. - * - * @member {object} - * @readonly - */ - this.chars = {}; - /** - * The map of base page textures (i.e., sheets of glyphs). - * - * @member {object} - * @readonly - * @private - */ - this.pageTextures = pageTextures; - // Convert the input Texture, Textures or object - // into a page Texture lookup by "id" - for (var i = 0; i < data.page.length; i++) { - var _a = data.page[i], id = _a.id, file = _a.file; - pageTextures[id] = textures instanceof Array - ? textures[i] : textures[file]; - } - // parse letters - for (var i = 0; i < data.char.length; i++) { - var _b = data.char[i], id = _b.id, page_1 = _b.page; - var _c = data.char[i], x = _c.x, y = _c.y, width = _c.width, height = _c.height, xoffset = _c.xoffset, yoffset = _c.yoffset, xadvance = _c.xadvance; - x /= res; - y /= res; - width /= res; - height /= res; - xoffset /= res; - yoffset /= res; - xadvance /= res; - var rect = new Rectangle(x + (pageTextures[page_1].frame.x / res), y + (pageTextures[page_1].frame.y / res), width, height); - this.chars[id] = { - xOffset: xoffset, - yOffset: yoffset, - xAdvance: xadvance, - kerning: {}, - texture: new Texture(pageTextures[page_1].baseTexture, rect), - page: page_1, - }; - } - // parse kernings - for (var i = 0; i < data.kerning.length; i++) { - var _d = data.kerning[i], first = _d.first, second = _d.second, amount = _d.amount; - first /= res; - second /= res; - amount /= res; - if (this.chars[second]) { - this.chars[second].kerning[first] = amount; - } - } - } - /** - * Remove references to created glyph textures. - */ - BitmapFont.prototype.destroy = function () { - for (var id in this.chars) { - this.chars[id].texture.destroy(); - this.chars[id].texture = null; - } - for (var id in this.pageTextures) { - this.pageTextures[id].destroy(true); - this.pageTextures[id] = null; - } - // Set readonly null. - this.chars = null; - this.pageTextures = null; - }; - /** - * Register a new bitmap font. - * - * @static - * @param {XMLDocument|string|PIXI.BitmapFontData} data - The - * characters map that could be provided as xml or raw string. - * @param {Object.|PIXI.Texture|PIXI.Texture[]} - * textures - List of textures for each page. - * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight - * and char fields. - */ - BitmapFont.install = function (data, textures) { - var fontData; - if (data instanceof BitmapFontData) { - fontData = data; - } - else { - var format = autoDetectFormat(data); - if (!format) { - throw new Error('Unrecognized data format for font.'); - } - fontData = format.parse(data); - } - // Single texture, convert to list - if (textures instanceof Texture) { - textures = [textures]; - } - var font = new BitmapFont(fontData, textures); - BitmapFont.available[font.font] = font; - return font; - }; - /** - * Remove bitmap font by name. - * - * @static - * @param {string} name - */ - BitmapFont.uninstall = function (name) { - var font = BitmapFont.available[name]; - if (!font) { - throw new Error("No font found named '" + name + "'"); - } - font.destroy(); - delete BitmapFont.available[name]; - }; - /** - * Generates a bitmap-font for the given style and character set. This does not support - * kernings yet. With `style` properties, only the following non-layout properties are used: - * - * - {@link PIXI.TextStyle#dropShadow|dropShadow} - * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance} - * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor} - * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur} - * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle} - * - {@link PIXI.TextStyle#fill|fill} - * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops} - * - {@link PIXI.TextStyle#fillGradientType|fillGradientType} - * - {@link PIXI.TextStyle#fontFamily|fontFamily} - * - {@link PIXI.TextStyle#fontSize|fontSize} - * - {@link PIXI.TextStyle#fontVariant|fontVariant} - * - {@link PIXI.TextStyle#fontWeight|fontWeight} - * - {@link PIXI.TextStyle#lineJoin|lineJoin} - * - {@link PIXI.TextStyle#miterLimit|miterLimit} - * - {@link PIXI.TextStyle#stroke|stroke} - * - {@link PIXI.TextStyle#strokeThickness|strokeThickness} - * - {@link PIXI.TextStyle#textBaseline|textBaseline} - * - * @param {string} name - The name of the custom font to use with BitmapText. - * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont. - * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font. - * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included - * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], "!@#$%^&*()~{}[] "]`. - * Don't forget to include spaces ' ' in your character set! - * @param {number} [options.resolution=1] - Render resolution for glyphs. - * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory. - * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory. - * @param {number} [options.padding=4] - Padding between glyphs on texture atlas. - * @return {PIXI.BitmapFont} Font generated by style options. - * @static - * @example - * PIXI.BitmapFont.from("TitleFont", { - * fontFamily: "Arial", - * fontSize: 12, - * strokeThickness: 2, - * fill: "purple" - * }); - * - * const title = new PIXI.BitmapText("This is the title", { fontName: "TitleFont" }); - */ - BitmapFont.from = function (name, textStyle, options) { - if (!name) { - throw new Error('[BitmapFont] Property `name` is required.'); - } - var _a = Object.assign({}, BitmapFont.defaultOptions, options), chars = _a.chars, padding = _a.padding, resolution = _a.resolution, textureWidth = _a.textureWidth, textureHeight = _a.textureHeight; - var charsList = resolveCharacters(chars); - var style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle); - var lineWidth = textureWidth; - var fontData = new BitmapFontData(); - fontData.info[0] = { - face: style.fontFamily, - size: style.fontSize, - }; - fontData.common[0] = { - lineHeight: style.fontSize, - }; - var positionX = 0; - var positionY = 0; - var canvas; - var context; - var baseTexture; - var maxCharHeight = 0; - var textures = []; - for (var i = 0; i < charsList.length; i++) { - if (!canvas) { - canvas = document.createElement('canvas'); - canvas.width = textureWidth; - canvas.height = textureHeight; - context = canvas.getContext('2d'); - baseTexture = new BaseTexture(canvas, { resolution: resolution }); - textures.push(new Texture(baseTexture)); - fontData.page.push({ - id: textures.length - 1, - file: '', - }); - } - // Measure glyph dimensions - var metrics = TextMetrics.measureText(charsList[i], style, false, canvas); - var width = metrics.width; - var height = Math.ceil(metrics.height); - // This is ugly - but italics are given more space so they don't overlap - var textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width); - // Can't fit char anymore: next canvas please! - if (positionY >= textureHeight - (height * resolution)) { - if (positionY === 0) { - // We don't want user debugging an infinite loop (or do we? :) - throw new Error("[BitmapFont] textureHeight " + textureHeight + "px is " - + ("too small for " + style.fontSize + "px fonts")); - } - --i; - // Create new atlas once current has filled up - canvas = null; - context = null; - baseTexture = null; - positionY = 0; - positionX = 0; - maxCharHeight = 0; - continue; - } - maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight); - // Wrap line once full row has been rendered - if ((textureGlyphWidth * resolution) + positionX >= lineWidth) { - --i; - positionY += maxCharHeight * resolution; - positionY = Math.ceil(positionY); - positionX = 0; - maxCharHeight = 0; - continue; - } - drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style); - // Unique (numeric) ID mapping to this glyph - var id = metrics.text.charCodeAt(0); - // Create a texture holding just the glyph - fontData.char.push({ - id: id, - page: textures.length - 1, - x: positionX / resolution, - y: positionY / resolution, - width: textureGlyphWidth, - height: height, - xoffset: 0, - yoffset: 0, - xadvance: Math.ceil(width - - (style.dropShadow ? style.dropShadowDistance : 0) - - (style.stroke ? style.strokeThickness : 0)), - }); - positionX += (textureGlyphWidth + (2 * padding)) * resolution; - positionX = Math.ceil(positionX); - } - var font = new BitmapFont(fontData, textures); - // Make it easier to replace a font - if (BitmapFont.available[name] !== undefined) { - BitmapFont.uninstall(name); - } - BitmapFont.available[name] = font; - return font; - }; - /** - * This character set includes all the letters in the alphabet (both lower- and upper- case). - * @readonly - * @static - * @member {string[][]} - * @example - * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.ALPHA }) - */ - BitmapFont.ALPHA = [['a', 'z'], ['A', 'Z'], ' ']; - /** - * This character set includes all decimal digits (from 0 to 9). - * @readonly - * @static - * @member {string[][]} - * @example - * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.NUMERIC }) - */ - BitmapFont.NUMERIC = [['0', '9']]; - /** - * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`. - * @readonly - * @static - * @member {string[][]} - */ - BitmapFont.ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' ']; - /** - * This character set consists of all the ASCII table. - * @readonly - * @static - * @member {string[][]} - * @see http://www.asciitable.com/ - */ - BitmapFont.ASCII = [[' ', '~']]; - /** - * Collection of default options when using `BitmapFont.from`. - * - * @readonly - * @static - * @member {PIXI.IBitmapFontOptions} - * @property {number} resolution=1 - * @property {number} textureWidth=512 - * @property {number} textureHeight=512 - * @property {number} padding=4 - * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC - */ - BitmapFont.defaultOptions = { - resolution: 1, - textureWidth: 512, - textureHeight: 512, - padding: 4, - chars: BitmapFont.ALPHANUMERIC, - }; - /** - * Collection of available/installed fonts. - * - * @readonly - * @static - * @member {Object.} - */ - BitmapFont.available = {}; - return BitmapFont; - }()); - /** - * @memberof PIXI - * @interface IBitmapFontOptions - * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate - * @property {number} [resolution=1] - the resolution for rendering - * @property {number} [padding=4] - the padding between glyphs in the atlas - * @property {number} [textureWidth=512] - the width of the texture atlas - * @property {number} [textureHeight=512] - the height of the texture atlas - */ - - var pageMeshDataPool = []; - var charRenderDataPool = []; - /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. - * - * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, - * meaning that rendering is fast, and changing text has no performance implications. - * - * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. - * - * To split a line you can use '\n', '\r' or '\r\n' in your string. - * - * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by: - * http://www.angelcode.com/products/bmfont/ for Windows or - * http://www.bmglyph.com/ for Mac. - * - * A BitmapText can only be created when the font is loaded. - * - * ```js - * // in this case the font is in a file called 'desyrel.fnt' - * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); - * ``` - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var BitmapText = /** @class */ (function (_super) { - __extends$b(BitmapText, _super); - /** - * @param {string} text - A string that you would like the text to display. - * @param {object} style - The style parameters. - * @param {string} style.fontName - The installed BitmapFont name. - * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined, - *. this will default to the BitmapFont size. - * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), - * does not affect single line text. - * @param {number} [style.tint=0xFFFFFF] - The tint color. - * @param {number} [style.letterSpacing=0] - The amount of spacing between letters. - * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping. - */ - function BitmapText(text, style) { - if (style === void 0) { style = {}; } - var _this = _super.call(this) || this; - _this._tint = 0xFFFFFF; - if (style.font) { - deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.'); - _this._upgradeStyle(style); - } - // Apply the defaults - var _a = Object.assign({}, BitmapText.styleDefaults, style), align = _a.align, tint = _a.tint, maxWidth = _a.maxWidth, letterSpacing = _a.letterSpacing, fontName = _a.fontName, fontSize = _a.fontSize; - if (!BitmapFont.available[fontName]) { - throw new Error("Missing BitmapFont \"" + fontName + "\""); - } - /** - * Collection of page mesh data. - * - * @member {object} - * @private - */ - _this._activePagesMeshData = []; - /** - * Private tracker for the width of the overall text - * - * @member {number} - * @private - */ - _this._textWidth = 0; - /** - * Private tracker for the height of the overall text - * - * @member {number} - * @private - */ - _this._textHeight = 0; - /** - * Private tracker for the current text align. - * - * @member {string} - * @private - */ - _this._align = align; - /** - * Private tracker for the current tint. - * - * @member {number} - * @private - */ - _this._tint = tint; - /** - * Private tracker for the current font name. - * - * @member {string} - * @private - */ - _this._fontName = fontName; - /** - * Private tracker for the current font size. - * - * @member {number} - * @private - */ - _this._fontSize = fontSize || BitmapFont.available[fontName].size; - /** - * Private tracker for the current text. - * - * @member {string} - * @private - */ - _this._text = text; - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the - * value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting value to 0 - * - * @member {number} - * @private - */ - _this._maxWidth = maxWidth; - /** - * The max line height. This is useful when trying to use the total height of the Text, - * ie: when trying to vertically align. (Internally used) - * - * @member {number} - * @private - */ - _this._maxLineHeight = 0; - /** - * Letter spacing. This is useful for setting the space between characters. - * @member {number} - * @private - */ - _this._letterSpacing = letterSpacing; - /** - * Text anchor. read-only - * - * @member {PIXI.ObservablePoint} - * @private - */ - _this._anchor = new ObservablePoint(function () { _this.dirty = true; }, _this, 0, 0); - /** - * If true PixiJS will Math.floor() x/y values when rendering - * - * @member {boolean} - * @default PIXI.settings.ROUND_PIXELS - */ - _this._roundPixels = settings.ROUND_PIXELS; - /** - * Set to `true` if the BitmapText needs to be redrawn. - * - * @member {boolean} - */ - _this.dirty = true; - /** - * Cached char texture is destroyed when BitmapText is destroyed - * @member {Record} - * @private - */ - _this._textureCache = {}; - return _this; - } - /** - * Renders text and updates it when needed. This should only be called - * if the BitmapFont is regenerated. - */ - BitmapText.prototype.updateText = function () { - var _a; - var data = BitmapFont.available[this._fontName]; - var scale = this._fontSize / data.size; - var pos = new Point(); - var chars = []; - var lineWidths = []; - var text = this._text.replace(/(?:\r\n|\r)/g, '\n') || ' '; - var textLength = text.length; - var maxWidth = this._maxWidth * data.size / this._fontSize; - var prevCharCode = null; - var lastLineWidth = 0; - var maxLineWidth = 0; - var line = 0; - var lastBreakPos = -1; - var lastBreakWidth = 0; - var spacesRemoved = 0; - var maxLineHeight = 0; - for (var i = 0; i < textLength; i++) { - var charCode = text.charCodeAt(i); - var char = text.charAt(i); - if ((/(?:\s)/).test(char)) { - lastBreakPos = i; - lastBreakWidth = lastLineWidth; - } - if (char === '\r' || char === '\n') { - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - ++line; - ++spacesRemoved; - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - continue; - } - var charData = data.chars[charCode]; - if (!charData) { - continue; - } - if (prevCharCode && charData.kerning[prevCharCode]) { - pos.x += charData.kerning[prevCharCode]; - } - var charRenderData = charRenderDataPool.pop() || { - texture: Texture.EMPTY, - line: 0, - charCode: 0, - position: new Point(), - }; - charRenderData.texture = charData.texture; - charRenderData.line = line; - charRenderData.charCode = charCode; - charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2); - charRenderData.position.y = pos.y + charData.yOffset; - chars.push(charRenderData); - pos.x += charData.xAdvance + this._letterSpacing; - lastLineWidth = pos.x; - maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height)); - prevCharCode = charCode; - if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) { - ++spacesRemoved; - removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos); - i = lastBreakPos; - lastBreakPos = -1; - lineWidths.push(lastBreakWidth); - maxLineWidth = Math.max(maxLineWidth, lastBreakWidth); - line++; - pos.x = 0; - pos.y += data.lineHeight; - prevCharCode = null; - } - } - var lastChar = text.charAt(text.length - 1); - if (lastChar !== '\r' && lastChar !== '\n') { - if ((/(?:\s)/).test(lastChar)) { - lastLineWidth = lastBreakWidth; - } - lineWidths.push(lastLineWidth); - maxLineWidth = Math.max(maxLineWidth, lastLineWidth); - } - var lineAlignOffsets = []; - for (var i = 0; i <= line; i++) { - var alignOffset = 0; - if (this._align === 'right') { - alignOffset = maxLineWidth - lineWidths[i]; - } - else if (this._align === 'center') { - alignOffset = (maxLineWidth - lineWidths[i]) / 2; - } - lineAlignOffsets.push(alignOffset); - } - var lenChars = chars.length; - var pagesMeshData = {}; - var newPagesMeshData = []; - var activePagesMeshData = this._activePagesMeshData; - for (var i = 0; i < activePagesMeshData.length; i++) { - pageMeshDataPool.push(activePagesMeshData[i]); - } - for (var i = 0; i < lenChars; i++) { - var texture = chars[i].texture; - var baseTextureUid = texture.baseTexture.uid; - if (!pagesMeshData[baseTextureUid]) { - var pageMeshData = pageMeshDataPool.pop(); - if (!pageMeshData) { - var geometry = new MeshGeometry(); - var material = new MeshMaterial(Texture.EMPTY); - var mesh = new Mesh(geometry, material); - pageMeshData = { - index: 0, - indexCount: 0, - vertexCount: 0, - uvsCount: 0, - total: 0, - mesh: mesh, - vertices: null, - uvs: null, - indices: null, - }; - } - // reset data.. - pageMeshData.index = 0; - pageMeshData.indexCount = 0; - pageMeshData.vertexCount = 0; - pageMeshData.uvsCount = 0; - pageMeshData.total = 0; - // TODO need to get page texture here somehow.. - var _textureCache = this._textureCache; - _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture); - pageMeshData.mesh.texture = _textureCache[baseTextureUid]; - pageMeshData.mesh.tint = this._tint; - newPagesMeshData.push(pageMeshData); - pagesMeshData[baseTextureUid] = pageMeshData; - } - pagesMeshData[baseTextureUid].total++; - } - // lets find any previously active pageMeshDatas that are no longer required for - // the updated text (if any), removed and return them to the pool. - for (var i = 0; i < activePagesMeshData.length; i++) { - if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) { - this.removeChild(activePagesMeshData[i].mesh); - } - } - // next lets add any new meshes, that have not yet been added to this BitmapText - // we only add if its not already a child of this BitmapObject - for (var i = 0; i < newPagesMeshData.length; i++) { - if (newPagesMeshData[i].mesh.parent !== this) { - this.addChild(newPagesMeshData[i].mesh); - } - } - // active page mesh datas are set to be the new pages added. - this._activePagesMeshData = newPagesMeshData; - for (var i in pagesMeshData) { - var pageMeshData = pagesMeshData[i]; - var total = pageMeshData.total; - // lets only allocate new buffers if we can fit the new text in the current ones.. - // unless that is, we will be batching. Currently batching dose not respect the size property of mesh - if (!(((_a = pageMeshData.indices) === null || _a === void 0 ? void 0 : _a.length) > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2) { - pageMeshData.vertices = new Float32Array(4 * 2 * total); - pageMeshData.uvs = new Float32Array(4 * 2 * total); - pageMeshData.indices = new Uint16Array(6 * total); - } - else { - var total_1 = pageMeshData.total; - var vertices = pageMeshData.vertices; - // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation. - for (var i_1 = total_1 * 4 * 2; i_1 < vertices.length; i_1++) { - vertices[i_1] = 0; - } - } - // as a buffer maybe bigger than the current word, we set the size of the meshMaterial - // to match the number of letters needed - pageMeshData.mesh.size = 6 * total; - } - for (var i = 0; i < lenChars; i++) { - var char = chars[i]; - var offset = char.position.x + lineAlignOffsets[char.line]; - if (this._roundPixels) { - offset = Math.round(offset); - } - var xPos = offset * scale; - var yPos = char.position.y * scale; - var texture = char.texture; - var pageMesh = pagesMeshData[texture.baseTexture.uid]; - var textureFrame = texture.frame; - var textureUvs = texture._uvs; - var index = pageMesh.index++; - pageMesh.indices[(index * 6) + 0] = 0 + (index * 4); - pageMesh.indices[(index * 6) + 1] = 1 + (index * 4); - pageMesh.indices[(index * 6) + 2] = 2 + (index * 4); - pageMesh.indices[(index * 6) + 3] = 0 + (index * 4); - pageMesh.indices[(index * 6) + 4] = 2 + (index * 4); - pageMesh.indices[(index * 6) + 5] = 3 + (index * 4); - pageMesh.vertices[(index * 8) + 0] = xPos; - pageMesh.vertices[(index * 8) + 1] = yPos; - pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale); - pageMesh.vertices[(index * 8) + 3] = yPos; - pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale); - pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale); - pageMesh.vertices[(index * 8) + 6] = xPos; - pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale); - pageMesh.uvs[(index * 8) + 0] = textureUvs.x0; - pageMesh.uvs[(index * 8) + 1] = textureUvs.y0; - pageMesh.uvs[(index * 8) + 2] = textureUvs.x1; - pageMesh.uvs[(index * 8) + 3] = textureUvs.y1; - pageMesh.uvs[(index * 8) + 4] = textureUvs.x2; - pageMesh.uvs[(index * 8) + 5] = textureUvs.y2; - pageMesh.uvs[(index * 8) + 6] = textureUvs.x3; - pageMesh.uvs[(index * 8) + 7] = textureUvs.y3; - } - this._textWidth = maxLineWidth * scale; - this._textHeight = (pos.y + data.lineHeight) * scale; - for (var i in pagesMeshData) { - var pageMeshData = pagesMeshData[i]; - // apply anchor - if (this.anchor.x !== 0 || this.anchor.y !== 0) { - var vertexCount = 0; - var anchorOffsetX = this._textWidth * this.anchor.x; - var anchorOffsetY = this._textHeight * this.anchor.y; - for (var i_2 = 0; i_2 < pageMeshData.total; i_2++) { - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - pageMeshData.vertices[vertexCount++] -= anchorOffsetX; - pageMeshData.vertices[vertexCount++] -= anchorOffsetY; - } - } - this._maxLineHeight = maxLineHeight * scale; - var vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition'); - var textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord'); - var indexBuffer = pageMeshData.mesh.geometry.getIndex(); - vertexBuffer.data = pageMeshData.vertices; - textureBuffer.data = pageMeshData.uvs; - indexBuffer.data = pageMeshData.indices; - vertexBuffer.update(); - textureBuffer.update(); - indexBuffer.update(); - } - for (var i = 0; i < chars.length; i++) { - charRenderDataPool.push(chars[i]); - } - }; - /** - * Updates the transform of this object - * - * @private - */ - BitmapText.prototype.updateTransform = function () { - this.validate(); - this.containerUpdateTransform(); - }; - /** - * Validates text before calling parent's getLocalBounds - * - * @return {PIXI.Rectangle} The rectangular bounding area - */ - BitmapText.prototype.getLocalBounds = function () { - this.validate(); - return _super.prototype.getLocalBounds.call(this); - }; - /** - * Updates text when needed - * - * @private - */ - BitmapText.prototype.validate = function () { - if (this.dirty) { - this.updateText(); - this.dirty = false; - } - }; - Object.defineProperty(BitmapText.prototype, "tint", { - /** - * The tint of the BitmapText object. - * - * @member {number} - * @default 0xffffff - */ - get: function () { - return this._tint; - }, - set: function (value) { - if (this._tint === value) - { return; } - this._tint = value; - for (var i = 0; i < this._activePagesMeshData.length; i++) { - this._activePagesMeshData[i].mesh.tint = value; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "align", { - /** - * The alignment of the BitmapText object. - * - * @member {string} - * @default 'left' - */ - get: function () { - return this._align; - }, - set: function (value) { - if (this._align !== value) { - this._align = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "fontName", { - /** - * The name of the BitmapFont. - * - * @member {string} - */ - get: function () { - return this._fontName; - }, - set: function (value) { - if (!BitmapFont.available[value]) { - throw new Error("Missing BitmapFont \"" + value + "\""); - } - if (this._fontName !== value) { - this._fontName = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "fontSize", { - /** - * The size of the font to display. - * - * @member {number} - */ - get: function () { - return this._fontSize; - }, - set: function (value) { - if (this._fontSize !== value) { - this._fontSize = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "anchor", { - /** - * The anchor sets the origin point of the text. - * - * The default is `(0,0)`, this means the text's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. - * - * @member {PIXI.Point | number} - */ - get: function () { - return this._anchor; - }, - set: function (value) { - if (typeof value === 'number') { - this._anchor.set(value); - } - else { - this._anchor.copyFrom(value); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "text", { - /** - * The text of the BitmapText object. - * - * @member {string} - */ - get: function () { - return this._text; - }, - set: function (text) { - text = String(text === null || text === undefined ? '' : text); - if (this._text === text) { - return; - } - this._text = text; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "maxWidth", { - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the - * value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting the value to 0. - * - * @member {number} - */ - get: function () { - return this._maxWidth; - }, - set: function (value) { - if (this._maxWidth === value) { - return; - } - this._maxWidth = value; - this.dirty = true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "maxLineHeight", { - /** - * The max line height. This is useful when trying to use the total height of the Text, - * i.e. when trying to vertically align. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._maxLineHeight; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "textWidth", { - /** - * The width of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._textWidth; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "letterSpacing", { - /** - * Additional space between characters. - * - * @member {number} - */ - get: function () { - return this._letterSpacing; - }, - set: function (value) { - if (this._letterSpacing !== value) { - this._letterSpacing = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "roundPixels", { - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default PIXI.settings.ROUND_PIXELS - */ - get: function () { - return this._roundPixels; - }, - set: function (value) { - if (value !== this._roundPixels) { - this._roundPixels = value; - this.dirty = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BitmapText.prototype, "textHeight", { - /** - * The height of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - get: function () { - this.validate(); - return this._textHeight; - }, - enumerable: false, - configurable: true - }); - /** - * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties. - * - * @private - * @deprecated since 5.3.0 - */ - BitmapText.prototype._upgradeStyle = function (style) { - if (typeof style.font === 'string') { - var valueSplit = style.font.split(' '); - style.fontName = valueSplit.length === 1 - ? valueSplit[0] - : valueSplit.slice(1).join(' '); - if (valueSplit.length >= 2) { - style.fontSize = parseInt(valueSplit[0], 10); - } - } - else { - style.fontName = style.font.name; - style.fontSize = typeof style.font.size === 'number' - ? style.font.size - : parseInt(style.font.size, 10); - } - }; - BitmapText.prototype.destroy = function (options) { - var _textureCache = this._textureCache; - for (var id in _textureCache) { - var texture = _textureCache[id]; - texture.destroy(); - delete _textureCache[id]; - } - this._textureCache = null; - _super.prototype.destroy.call(this, options); - }; - /** - * Register a bitmap font with data and a texture. - * - * @deprecated since 5.3.0 - * @see PIXI.BitmapFont.install - * @static - */ - BitmapText.registerFont = function (data, textures) { - deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install'); - return BitmapFont.install(data, textures); - }; - Object.defineProperty(BitmapText, "fonts", { - /** - * Get the list of installed fonts. - * - * @see PIXI.BitmapFont.available - * @deprecated since 5.3.0 - * @static - * @readonly - * @member {Object.} - */ - get: function () { - deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available'); - return BitmapFont.available; - }, - enumerable: false, - configurable: true - }); - BitmapText.styleDefaults = { - align: 'left', - tint: 0xFFFFFF, - maxWidth: 0, - letterSpacing: 0, - }; - return BitmapText; - }(Container)); - - /** - * {@link PIXI.Loader Loader} middleware for loading - * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. - * @class - * @memberof PIXI - * @implements PIXI.ILoaderPlugin - */ - var BitmapFontLoader = /** @class */ (function () { - function BitmapFontLoader() { - } - /** - * Called when the plugin is installed. - * - * @see PIXI.Loader.registerPlugin - */ - BitmapFontLoader.add = function () { - LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT); - }; - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - BitmapFontLoader.use = function (resource, next) { - var format = autoDetectFormat(resource.data); - // Resource was not recognised as any of the expected font data format - if (!format) { - next(); - return; - } - var baseUrl = BitmapFontLoader.getBaseUrl(this, resource); - var data = format.parse(resource.data); - var textures = {}; - // Handle completed, when the number of textures - // load is the same number as references in the fnt file - var completed = function (page) { - textures[page.metadata.pageFile] = page.texture; - if (Object.keys(textures).length === data.page.length) { - resource.bitmapFont = BitmapFont.install(data, textures); - next(); - } - }; - for (var i = 0; i < data.page.length; ++i) { - var pageFile = data.page[i].file; - var url = baseUrl + pageFile; - var exists = false; - // incase the image is loaded outside - // using the same loader, resource will be available - for (var name in this.resources) { - var bitmapResource = this.resources[name]; - if (bitmapResource.url === url) { - bitmapResource.metadata.pageFile = pageFile; - if (bitmapResource.texture) { - completed(bitmapResource); - } - else { - bitmapResource.onAfterMiddleware.add(completed); - } - exists = true; - break; - } - } - // texture is not loaded, we'll attempt to add - // it to the load and add the texture to the list - if (!exists) { - // Standard loading options for images - var options = { - crossOrigin: resource.crossOrigin, - loadType: LoaderResource.LOAD_TYPE.IMAGE, - metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata), - parentResource: resource, - }; - this.add(url, options, completed); - } - } - }; - /** - * Get folder path from a resource - * @private - * @param {PIXI.Loader} loader - * @param {PIXI.LoaderResource} resource - * @return {string} - */ - BitmapFontLoader.getBaseUrl = function (loader, resource) { - var resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : ''; - if (resource.isDataUrl) { - if (resUrl === '.') { - resUrl = ''; - } - if (loader.baseUrl && resUrl) { - // if baseurl has a trailing slash then add one to resUrl so the replace works below - if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/') { - resUrl += '/'; - } - } - } - // remove baseUrl from resUrl - resUrl = resUrl.replace(loader.baseUrl, ''); - // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. - if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/') { - resUrl += '/'; - } - return resUrl; - }; - /** - * Replacement for NodeJS's path.dirname - * @private - * @param {string} url - Path to get directory for - */ - BitmapFontLoader.dirname = function (url) { - var dir = url - .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character - .replace(/\/$/, '') // replace trailing slash - .replace(/\/[^\/]*$/, ''); // remove everything after the last - // File request is relative, use current directory - if (dir === url) { - return '.'; - } - // Started with a slash - else if (dir === '') { - return '/'; - } - return dir; - }; - return BitmapFontLoader; - }()); - - /*! - * @pixi/filter-alpha - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-alpha is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$c = function(d, b) { - extendStatics$c = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$c(d, b); - }; - - function __extends$c(d, b) { - extendStatics$c(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$4 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n"; - - /** - * Simplest filter - applies alpha. - * - * Use this instead of Container's alpha property to avoid visual layering of individual elements. - * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. - * If elements are not opaque, they will blend with each other anyway. - * - * Very handy if you want to use common features of all filters: - * - * 1. Assign a blendMode to this filter, blend all elements inside display object with background. - * - * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var AlphaFilter = /** @class */ (function (_super) { - __extends$c(AlphaFilter, _super); - /** - * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent - */ - function AlphaFilter(alpha) { - if (alpha === void 0) { alpha = 1.0; } - var _this = _super.call(this, _default, fragment$4, { uAlpha: 1 }) || this; - _this.alpha = alpha; - return _this; - } - Object.defineProperty(AlphaFilter.prototype, "alpha", { - /** - * Coefficient for alpha multiplication - * - * @member {number} - * @default 1 - */ - get: function () { - return this.uniforms.uAlpha; - }, - set: function (value) { - this.uniforms.uAlpha = value; - }, - enumerable: false, - configurable: true - }); - return AlphaFilter; - }(Filter)); - - /*! - * @pixi/filter-blur - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$d = function(d, b) { - extendStatics$d = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$d(d, b); - }; - - function __extends$d(d, b) { - extendStatics$d(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var vertTemplate = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }"; - function generateBlurVertSource(kernelSize, x) { - var halfLength = Math.ceil(kernelSize / 2); - var vertSource = vertTemplate; - var blurLoop = ''; - var template; - if (x) { - template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);'; - } - else { - template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);'; - } - for (var i = 0; i < kernelSize; i++) { - var blur = template.replace('%index%', i.toString()); - blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + ".0"); - blurLoop += blur; - blurLoop += '\n'; - } - vertSource = vertSource.replace('%blur%', blurLoop); - vertSource = vertSource.replace('%size%', kernelSize.toString()); - return vertSource; - } - - var GAUSSIAN_VALUES = { - 5: [0.153388, 0.221461, 0.250301], - 7: [0.071303, 0.131514, 0.189879, 0.214607], - 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236], - 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596], - 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641], - 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448], - }; - var fragTemplate$1 = [ - 'varying vec2 vBlurTexCoords[%size%];', - 'uniform sampler2D uSampler;', - 'void main(void)', - '{', - ' gl_FragColor = vec4(0.0);', - ' %blur%', - '}' ].join('\n'); - function generateBlurFragSource(kernelSize) { - var kernel = GAUSSIAN_VALUES[kernelSize]; - var halfLength = kernel.length; - var fragSource = fragTemplate$1; - var blurLoop = ''; - var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;'; - var value; - for (var i = 0; i < kernelSize; i++) { - var blur = template.replace('%index%', i.toString()); - value = i; - if (i >= halfLength) { - value = kernelSize - i - 1; - } - blur = blur.replace('%value%', kernel[value].toString()); - blurLoop += blur; - blurLoop += '\n'; - } - fragSource = fragSource.replace('%blur%', blurLoop); - fragSource = fragSource.replace('%size%', kernelSize.toString()); - return fragSource; - } - - /** - * Different types of environments for WebGL. - * - * @static - * @memberof PIXI - * @name ENV - * @enum {number} - * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experience unexplained flickering prefer this environment. - * @property {number} WEBGL - Version 1 of WebGL - * @property {number} WEBGL2 - Version 2 of WebGL - */ - var ENV; - (function (ENV) { - ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; - ENV[ENV["WEBGL"] = 1] = "WEBGL"; - ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; - })(ENV || (ENV = {})); - /** - * Constant to identify the Renderer Type. - * - * @static - * @memberof PIXI - * @name RENDERER_TYPE - * @enum {number} - * @property {number} UNKNOWN - Unknown render type. - * @property {number} WEBGL - WebGL render type. - * @property {number} CANVAS - Canvas render type. - */ - var RENDERER_TYPE; - (function (RENDERER_TYPE) { - RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; - RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; - RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; - })(RENDERER_TYPE || (RENDERER_TYPE = {})); - /** - * Bitwise OR of masks that indicate the buffers to be cleared. - * - * @static - * @memberof PIXI - * @name BUFFER_BITS - * @enum {number} - * @property {number} COLOR - Indicates the buffers currently enabled for color writing. - * @property {number} DEPTH - Indicates the depth buffer. - * @property {number} STENCIL - Indicates the stencil buffer. - */ - var BUFFER_BITS; - (function (BUFFER_BITS) { - BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; - BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; - BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; - })(BUFFER_BITS || (BUFFER_BITS = {})); - /** - * Various blend modes supported by PIXI. - * - * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. - * Anything else will silently act like NORMAL. - * - * @memberof PIXI - * @name BLEND_MODES - * @enum {number} - * @property {number} NORMAL - * @property {number} ADD - * @property {number} MULTIPLY - * @property {number} SCREEN - * @property {number} OVERLAY - * @property {number} DARKEN - * @property {number} LIGHTEN - * @property {number} COLOR_DODGE - * @property {number} COLOR_BURN - * @property {number} HARD_LIGHT - * @property {number} SOFT_LIGHT - * @property {number} DIFFERENCE - * @property {number} EXCLUSION - * @property {number} HUE - * @property {number} SATURATION - * @property {number} COLOR - * @property {number} LUMINOSITY - * @property {number} NORMAL_NPM - * @property {number} ADD_NPM - * @property {number} SCREEN_NPM - * @property {number} NONE - * @property {number} SRC_IN - * @property {number} SRC_OUT - * @property {number} SRC_ATOP - * @property {number} DST_OVER - * @property {number} DST_IN - * @property {number} DST_OUT - * @property {number} DST_ATOP - * @property {number} SUBTRACT - * @property {number} SRC_OVER - * @property {number} ERASE - * @property {number} XOR - */ - var BLEND_MODES; - (function (BLEND_MODES) { - BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; - BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; - BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; - BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; - BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; - BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; - BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; - BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; - BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; - BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; - BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; - BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; - BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; - BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; - BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; - BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; - BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; - BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; - BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; - BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; - BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; - BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; - BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; - BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; - BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; - BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; - BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; - BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; - BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; - BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; - BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; - BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; - })(BLEND_MODES || (BLEND_MODES = {})); - /** - * Various webgl draw modes. These can be used to specify which GL drawMode to use - * under certain situations and renderers. - * - * @memberof PIXI - * @static - * @name DRAW_MODES - * @enum {number} - * @property {number} POINTS - * @property {number} LINES - * @property {number} LINE_LOOP - * @property {number} LINE_STRIP - * @property {number} TRIANGLES - * @property {number} TRIANGLE_STRIP - * @property {number} TRIANGLE_FAN - */ - var DRAW_MODES; - (function (DRAW_MODES) { - DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; - DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; - DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; - DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; - DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; - DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; - })(DRAW_MODES || (DRAW_MODES = {})); - /** - * Various GL texture/resources formats. - * - * @memberof PIXI - * @static - * @name FORMATS - * @enum {number} - * @property {number} RGBA=6408 - * @property {number} RGB=6407 - * @property {number} ALPHA=6406 - * @property {number} LUMINANCE=6409 - * @property {number} LUMINANCE_ALPHA=6410 - * @property {number} DEPTH_COMPONENT=6402 - * @property {number} DEPTH_STENCIL=34041 - */ - var FORMATS; - (function (FORMATS) { - FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; - FORMATS[FORMATS["RGB"] = 6407] = "RGB"; - FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; - FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; - FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; - FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; - FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; - })(FORMATS || (FORMATS = {})); - /** - * Various GL target types. - * - * @memberof PIXI - * @static - * @name TARGETS - * @enum {number} - * @property {number} TEXTURE_2D=3553 - * @property {number} TEXTURE_CUBE_MAP=34067 - * @property {number} TEXTURE_2D_ARRAY=35866 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 - * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 - * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 - */ - var TARGETS; - (function (TARGETS) { - TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; - TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; - TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; - })(TARGETS || (TARGETS = {})); - /** - * Various GL data format types. - * - * @memberof PIXI - * @static - * @name TYPES - * @enum {number} - * @property {number} UNSIGNED_BYTE=5121 - * @property {number} UNSIGNED_SHORT=5123 - * @property {number} UNSIGNED_SHORT_5_6_5=33635 - * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 - * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 - * @property {number} FLOAT=5126 - * @property {number} HALF_FLOAT=36193 - */ - var TYPES; - (function (TYPES) { - TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; - TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; - TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; - TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; - TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; - TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; - TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; - })(TYPES || (TYPES = {})); - /** - * The scale modes that are supported by pixi. - * - * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. - * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. - * - * @memberof PIXI - * @static - * @name SCALE_MODES - * @enum {number} - * @property {number} LINEAR Smooth scaling - * @property {number} NEAREST Pixelating scaling - */ - var SCALE_MODES; - (function (SCALE_MODES) { - SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; - SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; - })(SCALE_MODES || (SCALE_MODES = {})); - /** - * The wrap modes that are supported by pixi. - * - * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. - * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as WebGL can - * only use REPEAT if the texture is po2. - * - * This property only affects WebGL. - * - * @name WRAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} CLAMP - The textures uvs are clamped - * @property {number} REPEAT - The texture uvs tile and repeat - * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring - */ - var WRAP_MODES; - (function (WRAP_MODES) { - WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; - WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; - WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; - })(WRAP_MODES || (WRAP_MODES = {})); - /** - * Mipmap filtering modes that are supported by pixi. - * - * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. - * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, - * or its `POW2` and texture dimensions are powers of 2. - * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. - * - * This property only affects WebGL. - * - * @name MIPMAP_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} OFF - No mipmaps - * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 - * @property {number} ON - Always generate mipmaps - */ - var MIPMAP_MODES; - (function (MIPMAP_MODES) { - MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; - MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; - MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; - })(MIPMAP_MODES || (MIPMAP_MODES = {})); - /** - * How to treat textures with premultiplied alpha - * - * @name ALPHA_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. - * Option for compressed and data textures that are created from typed arrays. - * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. - * Default option, used for all loaded images. - * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied - * Example: spine atlases with `_pma` suffix. - * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. - * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. - * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. - */ - var ALPHA_MODES; - (function (ALPHA_MODES) { - ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; - ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; - ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; - ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; - ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; - })(ALPHA_MODES || (ALPHA_MODES = {})); - /** - * How to clear renderTextures in filter - * - * @name CLEAR_MODES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} BLEND - Preserve the information in the texture, blend above - * @property {number} CLEAR - Must use `gl.clear` operation - * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia - * @property {number} NO - Alias for BLEND, same as `false` in earlier versions - * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions - * @property {number} AUTO - Alias for BLIT - */ - var CLEAR_MODES; - (function (CLEAR_MODES) { - CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; - CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; - CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; - CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; - CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; - CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; - })(CLEAR_MODES || (CLEAR_MODES = {})); - /** - * The gc modes that are supported by pixi. - * - * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO - * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not - * used for a specified period of time they will be removed from the GPU. They will of course - * be uploaded again when they are required. This is a silent behind the scenes process that - * should ensure that the GPU does not get filled up. - * - * Handy for mobile devices! - * This property only affects WebGL. - * - * @name GC_MODES - * @enum {number} - * @static - * @memberof PIXI - * @property {number} AUTO - Garbage collection will happen periodically automatically - * @property {number} MANUAL - Garbage collection will need to be called manually - */ - var GC_MODES; - (function (GC_MODES) { - GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; - GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; - })(GC_MODES || (GC_MODES = {})); - /** - * Constants that specify float precision in shaders. - * - * @name PRECISION - * @memberof PIXI - * @constant - * @static - * @enum {string} - * @property {string} LOW='lowp' - * @property {string} MEDIUM='mediump' - * @property {string} HIGH='highp' - */ - var PRECISION; - (function (PRECISION) { - PRECISION["LOW"] = "lowp"; - PRECISION["MEDIUM"] = "mediump"; - PRECISION["HIGH"] = "highp"; - })(PRECISION || (PRECISION = {})); - /** - * Constants for mask implementations. - * We use `type` suffix because it leads to very different behaviours - * - * @name MASK_TYPES - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - Mask is ignored - * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap - * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil - * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture - */ - var MASK_TYPES; - (function (MASK_TYPES) { - MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; - MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; - MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; - MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; - })(MASK_TYPES || (MASK_TYPES = {})); - /** - * Constants for multi-sampling antialiasing. - * - * @see PIXI.Framebuffer#multisample - * - * @name MSAA_QUALITY - * @memberof PIXI - * @static - * @enum {number} - * @property {number} NONE - No multisampling for this renderTexture - * @property {number} LOW - Try 2 samples - * @property {number} MEDIUM - Try 4 samples - * @property {number} HIGH - Try 8 samples - */ - var MSAA_QUALITY; - (function (MSAA_QUALITY) { - MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; - MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; - MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; - MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; - })(MSAA_QUALITY || (MSAA_QUALITY = {})); - - /** - * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var BlurFilterPass = /** @class */ (function (_super) { - __extends$d(BlurFilterPass, _super); - /** - * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`). - * @param {number} [strength=8] - The strength of the blur filter. - * @param {number} [quality=4] - The quality of the blur filter. - * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. - * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. - */ - function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) { - if (strength === void 0) { strength = 8; } - if (quality === void 0) { quality = 4; } - if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } - if (kernelSize === void 0) { kernelSize = 5; } - var _this = this; - var vertSrc = generateBlurVertSource(kernelSize, horizontal); - var fragSrc = generateBlurFragSource(kernelSize); - _this = _super.call(this, - // vertex shader - vertSrc, - // fragment shader - fragSrc) || this; - _this.horizontal = horizontal; - _this.resolution = resolution; - _this._quality = 0; - _this.quality = quality; - _this.blur = strength; - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - How to clear - */ - BlurFilterPass.prototype.apply = function (filterManager, input, output, clearMode) { - if (output) { - if (this.horizontal) { - this.uniforms.strength = (1 / output.width) * (output.width / input.width); - } - else { - this.uniforms.strength = (1 / output.height) * (output.height / input.height); - } - } - else { - if (this.horizontal) // eslint-disable-line - { - this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width); - } - else { - this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line - } - } - // screen space! - this.uniforms.strength *= this.strength; - this.uniforms.strength /= this.passes; - if (this.passes === 1) { - filterManager.applyFilter(this, input, output, clearMode); - } - else { - var renderTarget = filterManager.getFilterTexture(); - var renderer = filterManager.renderer; - var flip = input; - var flop = renderTarget; - this.state.blend = false; - filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR); - for (var i = 1; i < this.passes - 1; i++) { - filterManager.bindAndClear(flip, CLEAR_MODES.BLIT); - this.uniforms.uSampler = flop; - var temp = flop; - flop = flip; - flip = temp; - renderer.shader.bind(this); - renderer.geometry.draw(5); - } - this.state.blend = true; - filterManager.applyFilter(this, flop, output, clearMode); - filterManager.returnFilterTexture(renderTarget); - } - }; - Object.defineProperty(BlurFilterPass.prototype, "blur", { - /** - * Sets the strength of both the blur. - * - * @member {number} - * @default 16 - */ - get: function () { - return this.strength; - }, - set: function (value) { - this.padding = 1 + (Math.abs(value) * 2); - this.strength = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilterPass.prototype, "quality", { - /** - * Sets the quality of the blur by modifying the number of passes. More passes means higher - * quaility bluring but the lower the performance. - * - * @member {number} - * @default 4 - */ - get: function () { - return this._quality; - }, - set: function (value) { - this._quality = value; - this.passes = value; - }, - enumerable: false, - configurable: true - }); - return BlurFilterPass; - }(Filter)); - - /** - * The BlurFilter applies a Gaussian blur to an object. - * - * The strength of the blur can be set for the x-axis and y-axis separately. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var BlurFilter = /** @class */ (function (_super) { - __extends$d(BlurFilter, _super); - /** - * @param {number} [strength=8] - The strength of the blur filter. - * @param {number} [quality=4] - The quality of the blur filter. - * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. - * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. - */ - function BlurFilter(strength, quality, resolution, kernelSize) { - if (strength === void 0) { strength = 8; } - if (quality === void 0) { quality = 4; } - if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } - if (kernelSize === void 0) { kernelSize = 5; } - var _this = _super.call(this) || this; - _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize); - _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize); - _this.resolution = resolution; - _this.quality = quality; - _this.blur = strength; - _this.repeatEdgePixels = false; - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - How to clear - */ - BlurFilter.prototype.apply = function (filterManager, input, output, clearMode) { - var xStrength = Math.abs(this.blurXFilter.strength); - var yStrength = Math.abs(this.blurYFilter.strength); - if (xStrength && yStrength) { - var renderTarget = filterManager.getFilterTexture(); - this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR); - this.blurYFilter.apply(filterManager, renderTarget, output, clearMode); - filterManager.returnFilterTexture(renderTarget); - } - else if (yStrength) { - this.blurYFilter.apply(filterManager, input, output, clearMode); - } - else { - this.blurXFilter.apply(filterManager, input, output, clearMode); - } - }; - BlurFilter.prototype.updatePadding = function () { - if (this._repeatEdgePixels) { - this.padding = 0; - } - else { - this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; - } - }; - Object.defineProperty(BlurFilter.prototype, "blur", { - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurXFilter.blur; - }, - set: function (value) { - this.blurXFilter.blur = this.blurYFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "quality", { - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @default 1 - */ - get: function () { - return this.blurXFilter.quality; - }, - set: function (value) { - this.blurXFilter.quality = this.blurYFilter.quality = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blurX", { - /** - * Sets the strength of the blurX property - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurXFilter.blur; - }, - set: function (value) { - this.blurXFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blurY", { - /** - * Sets the strength of the blurY property - * - * @member {number} - * @default 2 - */ - get: function () { - return this.blurYFilter.blur; - }, - set: function (value) { - this.blurYFilter.blur = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "blendMode", { - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - get: function () { - return this.blurYFilter.blendMode; - }, - set: function (value) { - this.blurYFilter.blendMode = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BlurFilter.prototype, "repeatEdgePixels", { - /** - * If set to true the edge of the target will be clamped - * - * @member {boolean} - * @default false - */ - get: function () { - return this._repeatEdgePixels; - }, - set: function (value) { - this._repeatEdgePixels = value; - this.updatePadding(); - }, - enumerable: false, - configurable: true - }); - return BlurFilter; - }(Filter)); - - /*! - * @pixi/filter-color-matrix - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-color-matrix is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$e = function(d, b) { - extendStatics$e = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$e(d, b); - }; - - function __extends$e(d, b) { - extendStatics$e(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$5 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n"; - - /** - * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA - * color and alpha values of every pixel on your displayObject to produce a result - * with a new set of RGBA color and alpha values. It's pretty powerful! - * - * ```js - * let colorMatrix = new PIXI.filters.ColorMatrixFilter(); - * container.filters = [colorMatrix]; - * colorMatrix.contrast(2); - * ``` - * @author Clément Chenebault - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var ColorMatrixFilter = /** @class */ (function (_super) { - __extends$e(ColorMatrixFilter, _super); - function ColorMatrixFilter() { - var _this = this; - var uniforms = { - m: new Float32Array([1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0]), - uAlpha: 1, - }; - _this = _super.call(this, defaultFilter, fragment$5, uniforms) || this; - _this.alpha = 1; - return _this; - } - /** - * Transforms current matrix and set the new one - * - * @param {number[]} matrix - 5x4 matrix - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) { - if (multiply === void 0) { multiply = false; } - var newMatrix = matrix; - if (multiply) { - this._multiply(newMatrix, this.uniforms.m, matrix); - newMatrix = this._colorMatrix(newMatrix); - } - // set the new matrix - this.uniforms.m = newMatrix; - }; - /** - * Multiplies two mat5's - * - * @private - * @param {number[]} out - 5x4 matrix the receiving matrix - * @param {number[]} a - 5x4 matrix the first operand - * @param {number[]} b - 5x4 matrix the second operand - * @returns {number[]} 5x4 matrix - */ - ColorMatrixFilter.prototype._multiply = function (out, a, b) { - // Red Channel - out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); - out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); - out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); - out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); - out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4]; - // Green Channel - out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); - out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); - out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); - out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); - out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9]; - // Blue Channel - out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); - out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); - out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); - out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); - out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14]; - // Alpha Channel - out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); - out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); - out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); - out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); - out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19]; - return out; - }; - /** - * Create a Float32 Array and normalize the offset component to 0-1 - * - * @private - * @param {number[]} matrix - 5x4 matrix - * @return {number[]} 5x4 matrix with all values between 0-1 - */ - ColorMatrixFilter.prototype._colorMatrix = function (matrix) { - // Create a Float32 Array and normalize the offset component to 0-1 - var m = new Float32Array(matrix); - m[4] /= 255; - m[9] /= 255; - m[14] /= 255; - m[19] /= 255; - return m; - }; - /** - * Adjusts brightness - * - * @param {number} b - value of the brigthness (0-1, where 0 is black) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.brightness = function (b, multiply) { - var matrix = [ - b, 0, 0, 0, 0, - 0, b, 0, 0, 0, - 0, 0, b, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the matrices in grey scales - * - * @param {number} scale - value of the grey (0-1, where 0 is black) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.greyscale = function (scale, multiply) { - var matrix = [ - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - scale, scale, scale, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the black and white matrice. - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.blackAndWhite = function (multiply) { - var matrix = [ - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0.3, 0.6, 0.1, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the hue property of the color - * - * @param {number} rotation - in degrees - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.hue = function (rotation, multiply) { - rotation = (rotation || 0) / 180 * Math.PI; - var cosR = Math.cos(rotation); - var sinR = Math.sin(rotation); - var sqrt = Math.sqrt; - /* a good approximation for hue rotation - This matrix is far better than the versions with magic luminance constants - formerly used here, but also used in the starling framework (flash) and known from this - old part of the internet: quasimondo.com/archives/000565.php - - This new matrix is based on rgb cube rotation in space. Look here for a more descriptive - implementation as a shader not a general matrix: - https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js - - This is the source for the code: - see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751 - */ - var w = 1 / 3; - var sqrW = sqrt(w); // weight is - var a00 = cosR + ((1.0 - cosR) * w); - var a01 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a02 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a10 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a11 = cosR + (w * (1.0 - cosR)); - var a12 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a20 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a21 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a22 = cosR + (w * (1.0 - cosR)); - var matrix = [ - a00, a01, a02, 0, 0, - a10, a11, a12, 0, 0, - a20, a21, a22, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the contrast matrix, increase the separation between dark and bright - * Increase contrast : shadows darker and highlights brighter - * Decrease contrast : bring the shadows up and the highlights down - * - * @param {number} amount - value of the contrast (0-1) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.contrast = function (amount, multiply) { - var v = (amount || 0) + 1; - var o = -0.5 * (v - 1); - var matrix = [ - v, 0, 0, 0, o, - 0, v, 0, 0, o, - 0, 0, v, 0, o, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Set the saturation matrix, increase the separation between colors - * Increase saturation : increase contrast, brightness, and sharpness - * - * @param {number} amount - The saturation amount (0-1) - * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.saturate = function (amount, multiply) { - if (amount === void 0) { amount = 0; } - var x = (amount * 2 / 3) + 1; - var y = ((x - 1) * -0.5); - var matrix = [ - x, y, y, 0, 0, - y, x, y, 0, 0, - y, y, x, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Desaturate image (remove color) - * - * Call the saturate function - * - */ - ColorMatrixFilter.prototype.desaturate = function () { - this.saturate(-1); - }; - /** - * Negative image (inverse of classic rgb matrix) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.negative = function (multiply) { - var matrix = [ - -1, 0, 0, 1, 0, - 0, -1, 0, 1, 0, - 0, 0, -1, 1, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Sepia image - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.sepia = function (multiply) { - var matrix = [ - 0.393, 0.7689999, 0.18899999, 0, 0, - 0.349, 0.6859999, 0.16799999, 0, 0, - 0.272, 0.5339999, 0.13099999, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Color motion picture process invented in 1916 (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.technicolor = function (multiply) { - var matrix = [ - 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, - -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, - -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Polaroid filter - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.polaroid = function (multiply) { - var matrix = [ - 1.438, -0.062, -0.062, 0, 0, - -0.122, 1.378, -0.122, 0, 0, - -0.016, -0.016, 1.483, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Filter who transforms : Red -> Blue and Blue -> Red - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.toBGR = function (multiply) { - var matrix = [ - 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.kodachrome = function (multiply) { - var matrix = [ - 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, - -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, - -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Brown delicious browni filter (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.browni = function (multiply) { - var matrix = [ - 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, - -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, - 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Vintage filter (thanks Dominic Szablewski) - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.vintage = function (multiply) { - var matrix = [ - 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, - 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, - 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * We don't know exactly what it does, kind of gradient map, but funny to play with! - * - * @param {number} desaturation - Tone values. - * @param {number} toned - Tone values. - * @param {number} lightColor - Tone values, example: `0xFFE580` - * @param {number} darkColor - Tone values, example: `0xFFE580` - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) { - desaturation = desaturation || 0.2; - toned = toned || 0.15; - lightColor = lightColor || 0xFFE580; - darkColor = darkColor || 0x338000; - var lR = ((lightColor >> 16) & 0xFF) / 255; - var lG = ((lightColor >> 8) & 0xFF) / 255; - var lB = (lightColor & 0xFF) / 255; - var dR = ((darkColor >> 16) & 0xFF) / 255; - var dG = ((darkColor >> 8) & 0xFF) / 255; - var dB = (darkColor & 0xFF) / 255; - var matrix = [ - 0.3, 0.59, 0.11, 0, 0, - lR, lG, lB, desaturation, 0, - dR, dG, dB, toned, 0, - lR - dR, lG - dG, lB - dB, 0, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Night effect - * - * @param {number} intensity - The intensity of the night effect. - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.night = function (intensity, multiply) { - intensity = intensity || 0.1; - var matrix = [ - intensity * (-2.0), -intensity, 0, 0, 0, - -intensity, 0, intensity, 0, 0, - 0, intensity, intensity * 2.0, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Predator effect - * - * Erase the current matrix by setting a new indepent one - * - * @param {number} amount - how much the predator feels his future victim - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.predator = function (amount, multiply) { - var matrix = [ - // row 1 - 11.224130630493164 * amount, - -4.794486999511719 * amount, - -2.8746118545532227 * amount, - 0 * amount, - 0.40342438220977783 * amount, - // row 2 - -3.6330697536468506 * amount, - 9.193157196044922 * amount, - -2.951810836791992 * amount, - 0 * amount, - -1.316135048866272 * amount, - // row 3 - -3.2184197902679443 * amount, - -4.2375030517578125 * amount, - 7.476448059082031 * amount, - 0 * amount, - 0.8044459223747253 * amount, - // row 4 - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * LSD effect - * - * Multiply the current matrix - * - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, - * just set the current matrix with @param matrix - */ - ColorMatrixFilter.prototype.lsd = function (multiply) { - var matrix = [ - 2, -0.4, 0.5, 0, 0, - -0.5, 2, -0.4, 0, 0, - -0.4, -0.5, 3, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); - }; - /** - * Erase the current matrix by setting the default one - * - */ - ColorMatrixFilter.prototype.reset = function () { - var matrix = [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, false); - }; - Object.defineProperty(ColorMatrixFilter.prototype, "matrix", { - /** - * The matrix of the color matrix filter - * - * @member {number[]} - * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] - */ - get: function () { - return this.uniforms.m; - }, - set: function (value) { - this.uniforms.m = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ColorMatrixFilter.prototype, "alpha", { - /** - * The opacity value to use when mixing the original and resultant colors. - * - * When the value is 0, the original color is used without modification. - * When the value is 1, the result color is used. - * When in the range (0, 1) the color is interpolated between the original and result by this amount. - * - * @member {number} - * @default 1 - */ - get: function () { - return this.uniforms.uAlpha; - }, - set: function (value) { - this.uniforms.uAlpha = value; - }, - enumerable: false, - configurable: true - }); - return ColorMatrixFilter; - }(Filter)); - // Americanized alias - ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; - - /*! - * @pixi/filter-displacement - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-displacement is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$f = function(d, b) { - extendStatics$f = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$f(d, b); - }; - - function __extends$f(d, b) { - extendStatics$f(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$6 = "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n"; - - var vertex$4 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n"; - - /** - * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. - * - * You can use this filter to apply all manor of crazy warping effects. - * Currently the `r` property of the texture is used to offset the `x` - * and the `g` property of the texture is used to offset the `y`. - * - * The way it works is it uses the values of the displacement map to look up the - * correct pixels to output. This means it's not technically moving the original. - * Instead, it's starting at the output and asking "which pixel from the original goes here". - * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`, - * this filter will output the pixel approximately 20 pixels to the right of the original. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var DisplacementFilter = /** @class */ (function (_super) { - __extends$f(DisplacementFilter, _super); - /** - * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) - * @param {number} [scale] - The scale of the displacement - */ - function DisplacementFilter(sprite, scale) { - var _this = this; - var maskMatrix = new Matrix(); - sprite.renderable = false; - _this = _super.call(this, vertex$4, fragment$6, { - mapSampler: sprite._texture, - filterMatrix: maskMatrix, - scale: { x: 1, y: 1 }, - rotation: new Float32Array([1, 0, 0, 1]), - }) || this; - _this.maskSprite = sprite; - _this.maskMatrix = maskMatrix; - if (scale === null || scale === undefined) { - scale = 20; - } - /** - * scaleX, scaleY for displacements - * @member {PIXI.Point} - */ - _this.scale = new Point(scale, scale); - return _this; - } - /** - * Applies the filter. - * - * @param {PIXI.systems.FilterSystem} filterManager - The manager. - * @param {PIXI.RenderTexture} input - The input target. - * @param {PIXI.RenderTexture} output - The output target. - * @param {PIXI.CLEAR_MODES} clearMode - clearMode. - */ - DisplacementFilter.prototype.apply = function (filterManager, input, output, clearMode) { - // fill maskMatrix with _normalized sprite texture coords_ - this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); - this.uniforms.scale.x = this.scale.x; - this.uniforms.scale.y = this.scale.y; - // Extract rotation from world transform - var wt = this.maskSprite.worldTransform; - var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b)); - var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d)); - if (lenX !== 0 && lenY !== 0) { - this.uniforms.rotation[0] = wt.a / lenX; - this.uniforms.rotation[1] = wt.b / lenX; - this.uniforms.rotation[2] = wt.c / lenY; - this.uniforms.rotation[3] = wt.d / lenY; - } - // draw the filter... - filterManager.applyFilter(this, input, output, clearMode); - }; - Object.defineProperty(DisplacementFilter.prototype, "map", { - /** - * The texture used for the displacement map. Must be power of 2 sized texture. - * - * @member {PIXI.Texture} - */ - get: function () { - return this.uniforms.mapSampler; - }, - set: function (value) { - this.uniforms.mapSampler = value; - }, - enumerable: false, - configurable: true - }); - return DisplacementFilter; - }(Filter)); - - /*! - * @pixi/filter-fxaa - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-fxaa is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$g = function(d, b) { - extendStatics$g = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$g(d, b); - }; - - function __extends$g(d, b) { - extendStatics$g(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var vertex$5 = "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n"; - - var fragment$7 = "varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it's\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n"; - - /** - * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com - * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. - * - * @see https://github.com/mitsuhiko/webgl-meincraft - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - * - */ - var FXAAFilter = /** @class */ (function (_super) { - __extends$g(FXAAFilter, _super); - function FXAAFilter() { - // TODO - needs work - return _super.call(this, vertex$5, fragment$7) || this; - } - return FXAAFilter; - }(Filter)); - - /*! - * @pixi/filter-noise - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/filter-noise is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$h = function(d, b) { - extendStatics$h = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$h(d, b); - }; - - function __extends$h(d, b) { - extendStatics$h(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var fragment$8 = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"; - - /** - * @author Vico @vicocotea - * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js - */ - /** - * A Noise effect filter. - * - * @class - * @extends PIXI.Filter - * @memberof PIXI.filters - */ - var NoiseFilter = /** @class */ (function (_super) { - __extends$h(NoiseFilter, _super); - /** - * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. - * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. - */ - function NoiseFilter(noise, seed) { - if (noise === void 0) { noise = 0.5; } - if (seed === void 0) { seed = Math.random(); } - var _this = _super.call(this, defaultFilter, fragment$8, { - uNoise: 0, - uSeed: 0, - }) || this; - _this.noise = noise; - _this.seed = seed; - return _this; - } - Object.defineProperty(NoiseFilter.prototype, "noise", { - /** - * The amount of noise to apply, this value should be in the range (0, 1]. - * - * @member {number} - * @default 0.5 - */ - get: function () { - return this.uniforms.uNoise; - }, - set: function (value) { - this.uniforms.uNoise = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NoiseFilter.prototype, "seed", { - /** - * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. - * - * @member {number} - */ - get: function () { - return this.uniforms.uSeed; - }, - set: function (value) { - this.uniforms.uSeed = value; - }, - enumerable: false, - configurable: true - }); - return NoiseFilter; - }(Filter)); - - /*! - * @pixi/mixin-cache-as-bitmap - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-cache-as-bitmap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - var _tempMatrix = new Matrix(); - DisplayObject.prototype._cacheAsBitmap = false; - DisplayObject.prototype._cacheData = null; - // figured there's no point adding ALL the extra variables to prototype. - // this model can hold the information needed. This can also be generated on demand as - // most objects are not cached as bitmaps. - /** - * @class - * @ignore - */ - var CacheData = /** @class */ (function () { - function CacheData() { - this.textureCacheId = null; - this.originalRender = null; - this.originalRenderCanvas = null; - this.originalCalculateBounds = null; - this.originalGetLocalBounds = null; - this.originalUpdateTransform = null; - this.originalDestroy = null; - this.originalMask = null; - this.originalFilterArea = null; - this.originalContainsPoint = null; - this.sprite = null; - } - return CacheData; - }()); - Object.defineProperties(DisplayObject.prototype, { - /** - * Set this to true if you want this display object to be cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can - * provide a performance benefit for complex static displayObjects. - * To remove simply set this property to `false` - * - * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true - * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear. - * - * @member {boolean} - * @memberof PIXI.DisplayObject# - */ - cacheAsBitmap: { - get: function () { - return this._cacheAsBitmap; - }, - set: function (value) { - if (this._cacheAsBitmap === value) { - return; - } - this._cacheAsBitmap = value; - var data; - if (value) { - if (!this._cacheData) { - this._cacheData = new CacheData(); - } - data = this._cacheData; - data.originalRender = this.render; - data.originalRenderCanvas = this.renderCanvas; - data.originalUpdateTransform = this.updateTransform; - data.originalCalculateBounds = this.calculateBounds; - data.originalGetLocalBounds = this.getLocalBounds; - data.originalDestroy = this.destroy; - data.originalContainsPoint = this.containsPoint; - data.originalMask = this._mask; - data.originalFilterArea = this.filterArea; - this.render = this._renderCached; - this.renderCanvas = this._renderCachedCanvas; - this.destroy = this._cacheAsBitmapDestroy; - } - else { - data = this._cacheData; - if (data.sprite) { - this._destroyCachedDisplayObject(); - } - this.render = data.originalRender; - this.renderCanvas = data.originalRenderCanvas; - this.calculateBounds = data.originalCalculateBounds; - this.getLocalBounds = data.originalGetLocalBounds; - this.destroy = data.originalDestroy; - this.updateTransform = data.originalUpdateTransform; - this.containsPoint = data.originalContainsPoint; - this._mask = data.originalMask; - this.filterArea = data.originalFilterArea; - } - }, - }, - }); - /** - * Renders a cached version of the sprite with WebGL - * - * @private - * @function _renderCached - * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer - */ - DisplayObject.prototype._renderCached = function _renderCached(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - this._initCachedDisplayObject(renderer); - this._cacheData.sprite.transform._worldID = this.transform._worldID; - this._cacheData.sprite.worldAlpha = this.worldAlpha; - this._cacheData.sprite._render(renderer); - }; - /** - * Prepares the WebGL renderer to cache the sprite - * - * @private - * @function _initCachedDisplayObject - * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer - */ - DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) { - if (this._cacheData && this._cacheData.sprite) { - return; - } - // make sure alpha is set to 1 otherwise it will get rendered as invisible! - var cacheAlpha = this.alpha; - this.alpha = 1; - // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) - renderer.batch.flush(); - // this.filters= []; - // next we find the dimensions of the untransformed object - // this function also calls updatetransform on all its children as part of the measuring. - // This means we don't need to update the transform again in this function - // TODO pass an object to clone too? saves having to create a new one each time! - var bounds = this.getLocalBounds(null, true).clone(); - // add some padding! - if (this.filters) { - var padding = this.filters[0].padding; - bounds.pad(padding); - } - bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the WebGL renderer is currently using. - // this could be more elegant.. - var cachedRenderTexture = renderer.renderTexture.current; - var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone(); - var cachedProjectionTransform = renderer.projection.transform; - // We also store the filter stack - I will definitely look to change how this works a little later down the line. - // const stack = renderer.filterManager.filterStack; - // this renderTexture will be used to store the cached DisplayObject - var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); - var textureCacheId = "cacheAsBitmap_" + uid(); - this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); - Texture.addToCache(renderTexture, textureCacheId); - // need to set // - var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y); - // set all properties to there original so we can render to a texture - this.render = this._cacheData.originalRender; - renderer.render(this, renderTexture, true, m, false); - // now restore the state be setting the new properties - renderer.projection.transform = cachedProjectionTransform; - renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame); - // renderer.filterManager.filterStack = stack; - this.render = this._renderCached; - // the rest is the same as for Canvas - this.updateTransform = this.displayObjectUpdateTransform; - this.calculateBounds = this._calculateCachedBounds; - this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; - this.filterArea = null; - // create our cached sprite - var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; - cachedSprite.anchor.x = -(bounds.x / bounds.width); - cachedSprite.anchor.y = -(bounds.y / bounds.height); - cachedSprite.alpha = cacheAlpha; - cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; - // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) { - this.enableTempParent(); - this.updateTransform(); - this.disableTempParent(null); - } - else { - this.updateTransform(); - } - // map the hit test.. - this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); - }; - /** - * Renders a cached version of the sprite with canvas - * - * @private - * @function _renderCachedCanvas - * @memberof PIXI.DisplayObject# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer - */ - DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - this._initCachedDisplayObjectCanvas(renderer); - this._cacheData.sprite.worldAlpha = this.worldAlpha; - this._cacheData.sprite._renderCanvas(renderer); - }; - // TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. - /** - * Prepares the Canvas renderer to cache the sprite - * - * @private - * @function _initCachedDisplayObjectCanvas - * @memberof PIXI.DisplayObject# - * @param {PIXI.CanvasRenderer} renderer - The canvas renderer - */ - DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) { - if (this._cacheData && this._cacheData.sprite) { - return; - } - // get bounds actually transforms the object for us already! - var bounds = this.getLocalBounds(null, true); - var cacheAlpha = this.alpha; - this.alpha = 1; - var cachedRenderTarget = renderer.context; - var cachedProjectionTransform = renderer._projTransform; - bounds.ceil(settings.RESOLUTION); - var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); - var textureCacheId = "cacheAsBitmap_" + uid(); - this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); - Texture.addToCache(renderTexture, textureCacheId); - // need to set // - var m = _tempMatrix; - this.transform.localTransform.copyTo(m); - m.invert(); - m.tx -= bounds.x; - m.ty -= bounds.y; - // m.append(this.transform.worldTransform.) - // set all properties to there original so we can render to a texture - this.renderCanvas = this._cacheData.originalRenderCanvas; - renderer.render(this, renderTexture, true, m, false); - // now restore the state be setting the new properties - renderer.context = cachedRenderTarget; - renderer._projTransform = cachedProjectionTransform; - this.renderCanvas = this._renderCachedCanvas; - // the rest is the same as for WebGL - this.updateTransform = this.displayObjectUpdateTransform; - this.calculateBounds = this._calculateCachedBounds; - this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; - this.filterArea = null; - // create our cached sprite - var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; - cachedSprite.anchor.x = -(bounds.x / bounds.width); - cachedSprite.anchor.y = -(bounds.y / bounds.height); - cachedSprite.alpha = cacheAlpha; - cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; - // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) { - this.parent = renderer._tempDisplayObjectParent; - this.updateTransform(); - this.parent = null; - } - else { - this.updateTransform(); - } - // map the hit test.. - this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); - }; - /** - * Calculates the bounds of the cached sprite - * - * @private - */ - DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() { - this._bounds.clear(); - this._cacheData.sprite.transform._worldID = this.transform._worldID; - this._cacheData.sprite._calculateBounds(); - this._bounds.updateID = this._boundsID; - }; - /** - * Gets the bounds of the cached sprite. - * - * @private - * @return {Rectangle} The local bounds. - */ - DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() { - return this._cacheData.sprite.getLocalBounds(null); - }; - /** - * Destroys the cached sprite. - * - * @private - */ - DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() { - this._cacheData.sprite._texture.destroy(true); - this._cacheData.sprite = null; - BaseTexture.removeFromCache(this._cacheData.textureCacheId); - Texture.removeFromCache(this._cacheData.textureCacheId); - this._cacheData.textureCacheId = null; - }; - /** - * Destroys the cached object. - * - * @private - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value. - * Used when destroying containers, see the Container.destroy method. - */ - DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) { - this.cacheAsBitmap = false; - this.destroy(options); - }; - - /*! - * @pixi/mixin-get-child-by-name - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-get-child-by-name is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * The instance name of the object. - * - * @memberof PIXI.DisplayObject# - * @member {string} name - */ - DisplayObject.prototype.name = null; - /** - * Returns the display object in the container. - * - * Recursive searches are done in a preorder traversal. - * - * @method getChildByName - * @memberof PIXI.Container# - * @param {string} name - Instance name. - * @param {boolean}[deep=false] - Whether to search recursively - * @return {PIXI.DisplayObject} The child with the specified name. - */ - Container.prototype.getChildByName = function getChildByName(name, deep) { - for (var i = 0, j = this.children.length; i < j; i++) { - if (this.children[i].name === name) { - return this.children[i]; - } - } - if (deep) { - for (var i = 0, j = this.children.length; i < j; i++) { - var child = this.children[i]; - if (!child.getChildByName) { - continue; - } - var target = this.children[i].getChildByName(name, true); - if (target) { - return target; - } - } - } - return null; - }; - - /*! - * @pixi/mixin-get-global-position - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mixin-get-global-position is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot. - * - * @method getGlobalPosition - * @memberof PIXI.DisplayObject# - * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to. - * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from - * being updated. This means the calculation returned MAY be out of date BUT will give you a - * nice performance boost. - * @return {PIXI.Point} The updated point. - */ - DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) { - if (point === void 0) { point = new Point(); } - if (skipUpdate === void 0) { skipUpdate = false; } - if (this.parent) { - this.parent.toGlobal(this.position, point, skipUpdate); - } - else { - point.x = this.position.x; - point.y = this.position.y; - } - return point; - }; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$i = function(d, b) { - extendStatics$i = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$i(d, b); - }; - - function __extends$i(d, b) { - extendStatics$i(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - var arguments$1 = arguments; - - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments$1[i]; - for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __rest(s, e) { - var t = {}; - for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - { t[p] = s[p]; } } - if (s != null && typeof Object.getOwnPropertySymbols === "function") - { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) - { t[p[i]] = s[p[i]]; } } } - return t; - } - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); } - else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } } - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - } - - function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } - } - - function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) { throw new TypeError("Generator is already executing."); } - while (_) { try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } - if (y = 0, t) { op = [op[0] & 2, t.value]; } - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) { _.ops.pop(); } - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } - if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - function __exportStar(m, exports) { - for (var p in m) { if (!exports.hasOwnProperty(p)) { exports[p] = m[p]; } } - } - - function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) { return m.call(o); } - return { - next: function () { - if (o && i >= o.length) { o = void 0; } - return { value: o && o[i++], done: !o }; - } - }; - } - - function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) { return o; } - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) { m.call(i); } - } - finally { if (e) { throw e.error; } } - } - return ar; - } - - function __spread() { - var arguments$1 = arguments; - - for (var ar = [], i = 0; i < arguments.length; i++) - { ar = ar.concat(__read(arguments$1[i])); } - return ar; - } - - function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - } - - function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } - } - - function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - } - - function __asyncValues(o) { - if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - } - - function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - function __importStar(mod) { - if (mod && mod.__esModule) { return mod; } - var result = {}; - if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } - result.default = mod; - return result; - } - - function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; - } - - var v5 = '5.0.0'; - /** - * Deprecations (backward compatibilities) are automatically applied for browser bundles - * in the UMD module format. If using Webpack or Rollup, you'll need to apply these - * deprecations manually by doing something like this: - * @example - * import * as PIXI from 'pixi.js'; - * PIXI.useDeprecated(); // MUST be bound to namespace - * @memberof PIXI - * @function useDeprecated - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - function useDeprecated() { - // eslint-disable-next-line @typescript-eslint/no-this-alias - var PIXI = this; - Object.defineProperties(PIXI, { - /** - * @constant {RegExp|string} SVG_SIZE - * @memberof PIXI - * @see PIXI.resources.SVGResource.SVG_SIZE - * @deprecated since 5.0.0 - */ - SVG_SIZE: { - get: function () { - deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE'); - return PIXI.SVGResource.SVG_SIZE; - }, - }, - /** - * @class PIXI.TransformStatic - * @deprecated since 5.0.0 - * @see PIXI.Transform - */ - TransformStatic: { - get: function () { - deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform'); - return PIXI.Transform; - }, - }, - /** - * @class PIXI.TransformBase - * @deprecated since 5.0.0 - * @see PIXI.Transform - */ - TransformBase: { - get: function () { - deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform'); - return PIXI.Transform; - }, - }, - /** - * Constants that specify the transform type. - * - * @static - * @constant - * @name TRANSFORM_MODE - * @memberof PIXI - * @enum {number} - * @deprecated since 5.0.0 - * @property {number} STATIC - * @property {number} DYNAMIC - */ - TRANSFORM_MODE: { - get: function () { - deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed'); - return { STATIC: 0, DYNAMIC: 1 }; - }, - }, - /** - * @class PIXI.WebGLRenderer - * @see PIXI.Renderer - * @deprecated since 5.0.0 - */ - WebGLRenderer: { - get: function () { - deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer'); - return PIXI.Renderer; - }, - }, - /** - * @class PIXI.CanvasRenderTarget - * @see PIXI.utils.CanvasRenderTarget - * @deprecated since 5.0.0 - */ - CanvasRenderTarget: { - get: function () { - deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget'); - return PIXI.utils.CanvasRenderTarget; - }, - }, - /** - * @memberof PIXI - * @name loader - * @type {PIXI.Loader} - * @see PIXI.Loader.shared - * @deprecated since 5.0.0 - */ - loader: { - get: function () { - deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared'); - return PIXI.Loader.shared; - }, - }, - /** - * @class PIXI.FilterManager - * @see PIXI.systems.FilterSystem - * @deprecated since 5.0.0 - */ - FilterManager: { - get: function () { - deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem'); - return PIXI.systems.FilterSystem; - }, - }, - /** - * @namespace PIXI.CanvasTinter - * @see PIXI.canvasUtils - * @deprecated since 5.2.0 - */ - CanvasTinter: { - get: function () { - deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils'); - return PIXI.canvasUtils; - }, - }, - /** - * @namespace PIXI.GroupD8 - * @see PIXI.groupD8 - * @deprecated since 5.2.0 - */ - GroupD8: { - get: function () { - deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8'); - return PIXI.groupD8; - }, - }, - }); - /** - * @namespace PIXI.accessibility - * @see PIXI - * @deprecated since 5.3.0 - */ - PIXI.accessibility = {}; - Object.defineProperties(PIXI.accessibility, { - /** - * @class PIXI.accessibility.AccessibilityManager - * @deprecated since 5.3.0 - * @see PIXI.AccessibilityManager - */ - AccessibilityManager: { - get: function () { - deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager'); - return PIXI.AccessibilityManager; - }, - }, - }); - /** - * @namespace PIXI.interaction - * @see PIXI - * @deprecated since 5.3.0 - */ - PIXI.interaction = {}; - Object.defineProperties(PIXI.interaction, { - /** - * @class PIXI.interaction.InteractionManager - * @deprecated since 5.3.0 - * @see PIXI.InteractionManager - */ - InteractionManager: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager'); - return PIXI.InteractionManager; - }, - }, - /** - * @class PIXI.interaction.InteractionData - * @deprecated since 5.3.0 - * @see PIXI.InteractionData - */ - InteractionData: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData'); - return PIXI.InteractionData; - }, - }, - /** - * @class PIXI.interaction.InteractionEvent - * @deprecated since 5.3.0 - * @see PIXI.InteractionEvent - */ - InteractionEvent: { - get: function () { - deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent'); - return PIXI.InteractionEvent; - }, - }, - }); - /** - * @namespace PIXI.prepare - * @see PIXI - * @deprecated since 5.2.1 - */ - PIXI.prepare = {}; - Object.defineProperties(PIXI.prepare, { - /** - * @class PIXI.prepare.BasePrepare - * @deprecated since 5.2.1 - * @see PIXI.BasePrepare - */ - BasePrepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare'); - return PIXI.BasePrepare; - }, - }, - /** - * @class PIXI.prepare.Prepare - * @deprecated since 5.2.1 - * @see PIXI.Prepare - */ - Prepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare'); - return PIXI.Prepare; - }, - }, - /** - * @class PIXI.prepare.CanvasPrepare - * @deprecated since 5.2.1 - * @see PIXI.CanvasPrepare - */ - CanvasPrepare: { - get: function () { - deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare'); - return PIXI.CanvasPrepare; - }, - }, - }); - /** - * @namespace PIXI.extract - * @see PIXI - * @deprecated since 5.2.1 - */ - PIXI.extract = {}; - Object.defineProperties(PIXI.extract, { - /** - * @class PIXI.extract.Extract - * @deprecated since 5.2.1 - * @see PIXI.Extract - */ - Extract: { - get: function () { - deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract'); - return PIXI.Extract; - }, - }, - /** - * @class PIXI.extract.CanvasExtract - * @deprecated since 5.2.1 - * @see PIXI.CanvasExtract - */ - CanvasExtract: { - get: function () { - deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract'); - return PIXI.CanvasExtract; - }, - }, - }); - /** - * This namespace has been removed. All classes previous nested - * under this namespace have been moved to the top-level `PIXI` object. - * @namespace PIXI.extras - * @deprecated since 5.0.0 - */ - PIXI.extras = {}; - Object.defineProperties(PIXI.extras, { - /** - * @class PIXI.extras.TilingSprite - * @see PIXI.TilingSprite - * @deprecated since 5.0.0 - */ - TilingSprite: { - get: function () { - deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite'); - return PIXI.TilingSprite; - }, - }, - /** - * @class PIXI.extras.TilingSpriteRenderer - * @see PIXI.TilingSpriteRenderer - * @deprecated since 5.0.0 - */ - TilingSpriteRenderer: { - get: function () { - deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer'); - return PIXI.TilingSpriteRenderer; - }, - }, - /** - * @class PIXI.extras.AnimatedSprite - * @see PIXI.AnimatedSprite - * @deprecated since 5.0.0 - */ - AnimatedSprite: { - get: function () { - deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite'); - return PIXI.AnimatedSprite; - }, - }, - /** - * @class PIXI.extras.BitmapText - * @see PIXI.BitmapText - * @deprecated since 5.0.0 - */ - BitmapText: { - get: function () { - deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText'); - return PIXI.BitmapText; - }, - }, - }); - /** - * @static - * @method PIXI.TilingSprite.fromFrame - * @deprecated since 5.3.0 - * @see PIXI.TilingSprite.from - */ - PIXI.TilingSprite.fromFrame = function fromFrame(frameId, width, height) { - deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from'); - return PIXI.TilingSprite.from(frameId, { width: width, height: height }); - }; - /** - * @static - * @method PIXI.TilingSprite.fromImage - * @deprecated since 5.3.0 - * @see PIXI.TilingSprite.from - */ - PIXI.TilingSprite.fromImage = function fromImage(imageId, width, height, options) { - if (options === void 0) { options = {}; } - deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from'); - // Fallback support for crossorigin, scaleMode parameters - if (options && typeof options !== 'object') { - options = { - // eslint-disable-next-line prefer-rest-params - scaleMode: arguments[4], - resourceOptions: { - // eslint-disable-next-line prefer-rest-params - crossorigin: arguments[3], - }, - }; - } - options.width = width; - options.height = height; - return PIXI.TilingSprite.from(imageId, options); - }; - Object.defineProperties(PIXI.utils, { - /** - * @function PIXI.utils.getSvgSize - * @see PIXI.resources.SVGResource.getSize - * @deprecated since 5.0.0 - */ - getSvgSize: { - get: function () { - deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize'); - return PIXI.resources.SVGResource.getSize; - }, - }, - }); - /** - * All classes on this namespace have moved to the high-level `PIXI` object. - * @namespace PIXI.mesh - * @deprecated since 5.0.0 - */ - PIXI.mesh = {}; - Object.defineProperties(PIXI.mesh, { - /** - * @class PIXI.mesh.Mesh - * @see PIXI.SimpleMesh - * @deprecated since 5.0.0 - */ - Mesh: { - get: function () { - deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh'); - return PIXI.SimpleMesh; - }, - }, - /** - * @class PIXI.mesh.NineSlicePlane - * @see PIXI.NineSlicePlane - * @deprecated since 5.0.0 - */ - NineSlicePlane: { - get: function () { - deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane'); - return PIXI.NineSlicePlane; - }, - }, - /** - * @class PIXI.mesh.Plane - * @see PIXI.SimplePlane - * @deprecated since 5.0.0 - */ - Plane: { - get: function () { - deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane'); - return PIXI.SimplePlane; - }, - }, - /** - * @class PIXI.mesh.Rope - * @see PIXI.SimpleRope - * @deprecated since 5.0.0 - */ - Rope: { - get: function () { - deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope'); - return PIXI.SimpleRope; - }, - }, - /** - * @class PIXI.mesh.RawMesh - * @see PIXI.Mesh - * @deprecated since 5.0.0 - */ - RawMesh: { - get: function () { - deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh'); - return PIXI.Mesh; - }, - }, - /** - * @class PIXI.mesh.CanvasMeshRenderer - * @see PIXI.CanvasMeshRenderer - * @deprecated since 5.0.0 - */ - CanvasMeshRenderer: { - get: function () { - deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer'); - return PIXI.CanvasMeshRenderer; - }, - }, - /** - * @class PIXI.mesh.MeshRenderer - * @see PIXI.MeshRenderer - * @deprecated since 5.0.0 - */ - MeshRenderer: { - get: function () { - deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer'); - return PIXI.MeshRenderer; - }, - }, - }); - /** - * This namespace has been removed and items have been moved to - * the top-level `PIXI` object. - * @namespace PIXI.particles - * @deprecated since 5.0.0 - */ - PIXI.particles = {}; - Object.defineProperties(PIXI.particles, { - /** - * @class PIXI.particles.ParticleContainer - * @deprecated since 5.0.0 - * @see PIXI.ParticleContainer - */ - ParticleContainer: { - get: function () { - deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer'); - return PIXI.ParticleContainer; - }, - }, - /** - * @class PIXI.particles.ParticleRenderer - * @deprecated since 5.0.0 - * @see PIXI.ParticleRenderer - */ - ParticleRenderer: { - get: function () { - deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer'); - return PIXI.ParticleRenderer; - }, - }, - }); - /** - * This namespace has been removed and items have been moved to - * the top-level `PIXI` object. - * @namespace PIXI.ticker - * @deprecated since 5.0.0 - */ - PIXI.ticker = {}; - Object.defineProperties(PIXI.ticker, { - /** - * @class PIXI.ticker.Ticker - * @deprecated since 5.0.0 - * @see PIXI.Ticker - */ - Ticker: { - get: function () { - deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker'); - return PIXI.Ticker; - }, - }, - /** - * @name PIXI.ticker.shared - * @type {PIXI.Ticker} - * @deprecated since 5.0.0 - * @see PIXI.Ticker.shared - */ - shared: { - get: function () { - deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared'); - return PIXI.Ticker.shared; - }, - }, - }); - /** - * All classes on this namespace have moved to the high-level `PIXI` object. - * @namespace PIXI.loaders - * @deprecated since 5.0.0 - */ - PIXI.loaders = {}; - Object.defineProperties(PIXI.loaders, { - /** - * @class PIXI.loaders.Loader - * @see PIXI.Loader - * @deprecated since 5.0.0 - */ - Loader: { - get: function () { - deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader'); - return PIXI.Loader; - }, - }, - /** - * @class PIXI.loaders.Resource - * @see PIXI.LoaderResource - * @deprecated since 5.0.0 - */ - Resource: { - get: function () { - deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource'); - return PIXI.LoaderResource; - }, - }, - /** - * @function PIXI.loaders.bitmapFontParser - * @see PIXI.BitmapFontLoader.use - * @deprecated since 5.0.0 - */ - bitmapFontParser: { - get: function () { - deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use'); - return PIXI.BitmapFontLoader.use; - }, - }, - /** - * @function PIXI.loaders.parseBitmapFontData - * @deprecated since 5.0.0 - */ - parseBitmapFontData: { - get: function () { - deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed'); - }, - }, - /** - * @function PIXI.loaders.spritesheetParser - * @see PIXI.SpritesheetLoader.use - * @deprecated since 5.0.0 - */ - spritesheetParser: { - get: function () { - deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use'); - return PIXI.SpritesheetLoader.use; - }, - }, - /** - * @function PIXI.loaders.getResourcePath - * @see PIXI.SpritesheetLoader.getResourcePath - * @deprecated since 5.0.0 - */ - getResourcePath: { - get: function () { - deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath'); - return PIXI.SpritesheetLoader.getResourcePath; - }, - }, - }); - /** - * @function PIXI.loaders.Loader.addPixiMiddleware - * @see PIXI.Loader.registerPlugin - * @deprecated since 5.0.0 - * @param {function} middleware - */ - PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) { - deprecation(v5, 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'); - return PIXI.loaders.Loader.registerPlugin({ use: middleware() }); - }; - // convenience for converting event name to signal name - var eventToSignal = function (event) { - return "on" + event.charAt(0).toUpperCase() + event.slice(1); - }; - Object.assign(PIXI.Loader.prototype, { - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#on - * @deprecated since 5.0.0 - */ - on: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#on is completely deprecated, use PIXI.Loader#" + signal + ".add"); - }, - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#once - * @deprecated since 5.0.0 - */ - once: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#once is completely deprecated, use PIXI.Loader#" + signal + ".once"); - }, - /** - * Use the corresponding signal, e.g., event `start`` is signal `onStart`. - * @method PIXI.Loader#off - * @deprecated since 5.0.0 - */ - off: function (event) { - var signal = eventToSignal(event); - deprecation(v5, "PIXI.Loader#off is completely deprecated, use PIXI.Loader#" + signal + ".detach"); - }, - }); - /** - * @class PIXI.extract.WebGLExtract - * @deprecated since 5.0.0 - * @see PIXI.Extract - */ - Object.defineProperty(PIXI.extract, 'WebGLExtract', { - get: function () { - deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract'); - return PIXI.Extract; - }, - }); - /** - * @class PIXI.prepare.WebGLPrepare - * @deprecated since 5.0.0 - * @see PIXI.Prepare - */ - Object.defineProperty(PIXI.prepare, 'WebGLPrepare', { - get: function () { - deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare'); - return PIXI.Prepare; - }, - }); - /** - * @method PIXI.Container#_renderWebGL - * @private - * @deprecated since 5.0.0 - * @see PIXI.Container#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) { - deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render'); - this._render(renderer); - }; - /** - * @method PIXI.Container#renderWebGL - * @deprecated since 5.0.0 - * @see PIXI.Container#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) { - deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render'); - this.render(renderer); - }; - /** - * @method PIXI.DisplayObject#renderWebGL - * @deprecated since 5.0.0 - * @see PIXI.DisplayObject#render - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) { - deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render'); - this.render(renderer); - }; - /** - * @method PIXI.Container#renderAdvancedWebGL - * @deprecated since 5.0.0 - * @see PIXI.Container#renderAdvanced - * @param {PIXI.Renderer} renderer Instance of renderer - */ - PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) { - deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced'); - this.renderAdvanced(renderer); - }; - Object.defineProperties(PIXI.settings, { - /** - * Default transform type. - * - * @static - * @deprecated since 5.0.0 - * @memberof PIXI.settings - * @type {PIXI.TRANSFORM_MODE} - * @default PIXI.TRANSFORM_MODE.STATIC - */ - TRANSFORM_MODE: { - get: function () { - deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); - return 0; - }, - set: function () { - deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); - }, - }, - }); - var BaseTextureAny = PIXI.BaseTexture; - /** - * @method loadSource - * @memberof PIXI.BaseTexture# - * @deprecated since 5.0.0 - */ - BaseTextureAny.prototype.loadSource = function loadSource(image) { - deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated'); - var resource = PIXI.resources.autoDetectResource(image); - resource.internal = true; - this.setResource(resource); - this.update(); - }; - var baseTextureIdDeprecation = false; - Object.defineProperties(BaseTextureAny.prototype, { - /** - * @name PIXI.BaseTexture#hasLoaded - * @type {boolean} - * @deprecated since 5.0.0 - * @readonly - * @see PIXI.BaseTexture#valid - */ - hasLoaded: { - get: function () { - deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid'); - return this.valid; - }, - }, - /** - * @name PIXI.BaseTexture#imageUrl - * @type {string} - * @deprecated since 5.0.0 - * @see PIXI.resources.ImageResource#url - */ - imageUrl: { - get: function () { - var _a; - deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - return (_a = this.resource) === null || _a === void 0 ? void 0 : _a.url; - }, - set: function (imageUrl) { - deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - if (this.resource) { - this.resource.url = imageUrl; - } - }, - }, - /** - * @name PIXI.BaseTexture#source - * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} - * @deprecated since 5.0.0 - * @readonly - * @see PIXI.resources.BaseImageResource#source - */ - source: { - get: function () { - deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`'); - return this.resource.source; - }, - set: function (source) { - deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` ' - + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.'); - if (this.resource) { - this.resource.source = source; - } - }, - }, - /** - * @name PIXI.BaseTexture#premultiplyAlpha - * @type {boolean} - * @deprecated since 5.2.0 - * @readonly - * @see PIXI.BaseTexture#alphaMode - */ - premultiplyAlpha: { - get: function () { - deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' - + ', see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; - }, - set: function (value) { - deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' - + ', see `PIXI.ALPHA_MODES`'); - this.alphaMode = Number(value); - }, - }, - /** - * Batch local field, stores current texture location - * - * @name PIXI.BaseTexture#_id - * @deprecated since 5.2.0 - * @type {number} - * @see PIXI.BaseTexture#_batchLocation - */ - _id: { - get: function () { - if (!baseTextureIdDeprecation) { - // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible - deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`'); - baseTextureIdDeprecation = true; - } - return this._batchLocation; - }, - set: function (value) { - this._batchLocation = value; - }, - }, - }); - /** - * @method fromImage - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) { - deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); - }; - /** - * @method fromCanvas - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromCanvas = function fromCanvas(canvas, scaleMode) { - deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from'); - return BaseTextureAny.from(canvas, { scaleMode: scaleMode }); - }; - /** - * @method fromSVG - * @static - * @memberof PIXI.BaseTexture - * @deprecated since 5.0.0 - * @see PIXI.BaseTexture.from - */ - BaseTextureAny.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) { - deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); - }; - Object.defineProperties(PIXI.resources.ImageResource.prototype, { - /** - * @name PIXI.resources.ImageResource#premultiplyAlpha - * @type {boolean} - * @deprecated since 5.2.0 - * @readonly - * @see PIXI.resources.ImageResource#alphaMode - */ - premultiplyAlpha: { - get: function () { - deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' - + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; - }, - set: function (value) { - deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' - + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); - this.alphaMode = Number(value); - }, - }, - }); - /** - * @method PIXI.Point#copy - * @deprecated since 5.0.0 - * @see PIXI.Point#copyFrom - */ - PIXI.Point.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.ObservablePoint#copy - * @deprecated since 5.0.0 - * @see PIXI.ObservablePoint#copyFrom - */ - PIXI.ObservablePoint.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.Rectangle#copy - * @deprecated since 5.0.0 - * @see PIXI.Rectangle#copyFrom - */ - PIXI.Rectangle.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom'); - return this.copyFrom(p); - }; - /** - * @method PIXI.Matrix#copy - * @deprecated since 5.0.0 - * @see PIXI.Matrix#copyTo - */ - PIXI.Matrix.prototype.copy = function copy(p) { - deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo'); - return this.copyTo(p); - }; - /** - * @method PIXI.systems.StateSystem#setState - * @deprecated since 5.1.0 - * @see PIXI.systems.StateSystem#set - */ - PIXI.systems.StateSystem.prototype.setState = function setState(s) { - deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set'); - return this.set(s); - }; - Object.assign(PIXI.systems.FilterSystem.prototype, { - /** - * @method PIXI.FilterManager#getRenderTarget - * @deprecated since 5.0.0 - * @see PIXI.systems.FilterSystem#getFilterTexture - */ - getRenderTarget: function (_clear, resolution) { - deprecation(v5, 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'); - return this.getFilterTexture(null, resolution); - }, - /** - * @method PIXI.FilterManager#returnRenderTarget - * @deprecated since 5.0.0 - * @see PIXI.systems.FilterSystem#returnFilterTexture - */ - returnRenderTarget: function (renderTexture) { - deprecation(v5, 'PIXI.FilterManager.returnRenderTarget method has been replaced with ' - + 'PIXI.systems.FilterSystem.returnFilterTexture'); - this.returnFilterTexture(renderTexture); - }, - /** - * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix - * @deprecated since 5.0.0 - * @param {PIXI.Matrix} outputMatrix - the matrix to output to. - * @return {PIXI.Matrix} The mapped matrix. - */ - calculateScreenSpaceMatrix: function (outputMatrix) { - deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, ' - + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead'); - var mappedMatrix = outputMatrix.identity(); - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); - mappedMatrix.scale(destinationFrame.width, destinationFrame.height); - return mappedMatrix; - }, - /** - * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix - * @deprecated since 5.0.0 - * @param {PIXI.Matrix} outputMatrix - The matrix to output to. - * @return {PIXI.Matrix} The mapped matrix. - */ - calculateNormalizedScreenSpaceMatrix: function (outputMatrix) { - deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, ' - + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.'); - var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; - var mappedMatrix = outputMatrix.identity(); - mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); - var translateScaleX = (destinationFrame.width / sourceFrame.width); - var translateScaleY = (destinationFrame.height / sourceFrame.height); - mappedMatrix.scale(translateScaleX, translateScaleY); - return mappedMatrix; - }, - }); - Object.defineProperties(PIXI.RenderTexture.prototype, { - /** - * @name PIXI.RenderTexture#sourceFrame - * @type {PIXI.Rectangle} - * @deprecated since 5.0.0 - * @readonly - */ - sourceFrame: { - get: function () { - deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed'); - return this.filterFrame; - }, - }, - /** - * @name PIXI.RenderTexture#size - * @type {PIXI.Rectangle} - * @deprecated since 5.0.0 - * @readonly - */ - size: { - get: function () { - deprecation(v5, 'PIXI.RenderTexture.size property has been removed'); - return this._frame; - }, - }, - }); - /** - * @class BlurXFilter - * @memberof PIXI.filters - * @deprecated since 5.0.0 - * @see PIXI.filters.BlurFilterPass - */ - var BlurXFilter = /** @class */ (function (_super) { - __extends$i(BlurXFilter, _super); - function BlurXFilter(strength, quality, resolution, kernelSize) { - var _this = this; - deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - _this = _super.call(this, true, strength, quality, resolution, kernelSize) || this; - return _this; - } - return BlurXFilter; - }(PIXI.filters.BlurFilterPass)); - /** - * @class BlurYFilter - * @memberof PIXI.filters - * @deprecated since 5.0.0 - * @see PIXI.filters.BlurFilterPass - */ - var BlurYFilter = /** @class */ (function (_super) { - __extends$i(BlurYFilter, _super); - function BlurYFilter(strength, quality, resolution, kernelSize) { - var _this = this; - deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - _this = _super.call(this, false, strength, quality, resolution, kernelSize) || this; - return _this; - } - return BlurYFilter; - }(PIXI.filters.BlurFilterPass)); - Object.assign(PIXI.filters, { - BlurXFilter: BlurXFilter, - BlurYFilter: BlurYFilter, - }); - var SpriteAny = PIXI.Sprite, TextureAny = PIXI.Texture, GraphicsAny = PIXI.Graphics; - // Support for pixi.js-legacy bifurcation - // give users a friendly assist to use legacy - if (!GraphicsAny.prototype.generateCanvasTexture) { - GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture() { - deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in "pixi.js-legacy"'); - }; - } - /** - * @deprecated since 5.0.0 - * @member {PIXI.Graphics} PIXI.Graphics#graphicsData - * @see PIXI.Graphics#geometry - * @readonly - */ - Object.defineProperty(GraphicsAny.prototype, 'graphicsData', { - get: function () { - deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData'); - return this.geometry.graphicsData; - }, - }); - // Use these to deprecate all the Sprite from* methods - function spriteFrom(name, source, crossorigin, scaleMode) { - deprecation(v5, "PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from"); - return SpriteAny.from(source, { - resourceOptions: { - scale: scaleMode, - crossorigin: crossorigin, - }, - }); - } - /** - * @deprecated since 5.0.0 - * @see PIXI.Sprite.from - * @method PIXI.Sprite.fromImage - * @return {PIXI.Sprite} - */ - SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromSVG - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromCanvas - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromVideo - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Sprite.fromFrame - * @see PIXI.Sprite.from - * @return {PIXI.Sprite} - */ - SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame'); - // Use these to deprecate all the Texture from* methods - function textureFrom(name, source, crossorigin, scaleMode) { - deprecation(v5, "PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from"); - return TextureAny.from(source, { - resourceOptions: { - scale: scaleMode, - crossorigin: crossorigin, - }, - }); - } - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromImage - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromImage = textureFrom.bind(null, 'fromImage'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromSVG - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromCanvas - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromVideo - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo'); - /** - * @deprecated since 5.0.0 - * @method PIXI.Texture.fromFrame - * @see PIXI.Texture.from - * @return {PIXI.Texture} - */ - TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame'); - /** - * @deprecated since 5.0.0 - * @member {boolean} PIXI.AbstractRenderer#autoResize - * @see PIXI.AbstractRenderer#autoDensity - */ - Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', { - get: function () { - deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' - + 'use PIXI.AbstractRenderer.autoDensity'); - return this.autoDensity; - }, - set: function (value) { - deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' - + 'use PIXI.AbstractRenderer.autoDensity'); - this.autoDensity = value; - }, - }); - /** - * @deprecated since 5.0.0 - * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager - * @see PIXI.Renderer#texture - */ - Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', { - get: function () { - deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture'); - return this.texture; - }, - }); - /** - * @namespace PIXI.utils.mixins - * @deprecated since 5.0.0 - */ - PIXI.utils.mixins = { - /** - * @memberof PIXI.utils.mixins - * @function mixin - * @deprecated since 5.0.0 - */ - mixin: function () { - deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available'); - }, - /** - * @memberof PIXI.utils.mixins - * @function delayMixin - * @deprecated since 5.0.0 - */ - delayMixin: function () { - deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available'); - }, - /** - * @memberof PIXI.utils.mixins - * @function performMixins - * @deprecated since 5.0.0 - */ - performMixins: function () { - deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available'); - }, - }; - /** - * @memberof PIXI.BitmapText - * @member {object} font - * @deprecated since 5.3.0 - */ - Object.defineProperty(PIXI.BitmapText.prototype, 'font', { - get: function () { - deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' - + 'use fontName, fontSize, tint or align properties'); - return { - name: this._fontName, - size: this._fontSize, - tint: this._tint, - align: this._align, - }; - }, - set: function (value) { - deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' - + 'use fontName, fontSize, tint or align properties'); - if (!value) { - return; - } - var style = { font: value }; - this._upgradeStyle(style); - style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size; - this._fontName = style.fontName; - this._fontSize = style.fontSize; - this.dirty = true; - }, - }); - } - - /*! - * @pixi/mesh-extras - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/mesh-extras is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$j = function(d, b) { - extendStatics$j = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$j(d, b); - }; - - function __extends$j(d, b) { - extendStatics$j(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var PlaneGeometry = /** @class */ (function (_super) { - __extends$j(PlaneGeometry, _super); - function PlaneGeometry(width, height, segWidth, segHeight) { - if (width === void 0) { width = 100; } - if (height === void 0) { height = 100; } - if (segWidth === void 0) { segWidth = 10; } - if (segHeight === void 0) { segHeight = 10; } - var _this = _super.call(this) || this; - _this.segWidth = segWidth; - _this.segHeight = segHeight; - _this.width = width; - _this.height = height; - _this.build(); - return _this; - } - /** - * Refreshes plane coordinates - * @private - */ - PlaneGeometry.prototype.build = function () { - var total = this.segWidth * this.segHeight; - var verts = []; - var uvs = []; - var indices = []; - var segmentsX = this.segWidth - 1; - var segmentsY = this.segHeight - 1; - var sizeX = (this.width) / segmentsX; - var sizeY = (this.height) / segmentsY; - for (var i = 0; i < total; i++) { - var x = (i % this.segWidth); - var y = ((i / this.segWidth) | 0); - verts.push(x * sizeX, y * sizeY); - uvs.push(x / segmentsX, y / segmentsY); - } - var totalSub = segmentsX * segmentsY; - for (var i = 0; i < totalSub; i++) { - var xpos = i % segmentsX; - var ypos = (i / segmentsX) | 0; - var value = (ypos * this.segWidth) + xpos; - var value2 = (ypos * this.segWidth) + xpos + 1; - var value3 = ((ypos + 1) * this.segWidth) + xpos; - var value4 = ((ypos + 1) * this.segWidth) + xpos + 1; - indices.push(value, value2, value3, value2, value4, value3); - } - this.buffers[0].data = new Float32Array(verts); - this.buffers[1].data = new Float32Array(uvs); - this.indexBuffer.data = new Uint16Array(indices); - // ensure that the changes are uploaded - this.buffers[0].update(); - this.buffers[1].update(); - this.indexBuffer.update(); - }; - return PlaneGeometry; - }(MeshGeometry)); - - /** - * RopeGeometry allows you to draw a geometry across several points and then manipulate these points. - * - * ```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * const rope = new PIXI.RopeGeometry(100, points); - * ``` - * - * @class - * @extends PIXI.MeshGeometry - * @memberof PIXI - * - */ - var RopeGeometry = /** @class */ (function (_super) { - __extends$j(RopeGeometry, _super); - /** - * @param {number} [width=200] - The width (i.e., thickness) of the rope. - * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope. - * @param {number} [textureScale=0] - By default the rope texture will be stretched to match - * rope length. If textureScale is positive this value will be treated as a scaling - * factor and the texture will preserve its aspect ratio instead. To create a tiling rope - * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture, - * then set textureScale=1 to keep the original texture pixel size. - * In order to reduce alpha channel artifacts provide a larger texture and downsample - - * i.e. set textureScale=0.5 to scale it down twice. - */ - function RopeGeometry(width, points, textureScale) { - if (width === void 0) { width = 200; } - if (textureScale === void 0) { textureScale = 0; } - var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this; - /** - * An array of points that determine the rope - * @member {PIXI.Point[]} - */ - _this.points = points; - /** - * The width (i.e., thickness) of the rope. - * @member {number} - * @readOnly - */ - _this._width = width; - /** - * Rope texture scale, if zero then the rope texture is stretched. - * @member {number} - * @readOnly - */ - _this.textureScale = textureScale; - _this.build(); - return _this; - } - Object.defineProperty(RopeGeometry.prototype, "width", { - /** - * The width (i.e., thickness) of the rope. - * @member {number} - * @readOnly - */ - get: function () { - return this._width; - }, - enumerable: false, - configurable: true - }); - /** - * Refreshes Rope indices and uvs - * @private - */ - RopeGeometry.prototype.build = function () { - var points = this.points; - if (!points) - { return; } - var vertexBuffer = this.getBuffer('aVertexPosition'); - var uvBuffer = this.getBuffer('aTextureCoord'); - var indexBuffer = this.getIndex(); - // if too little points, or texture hasn't got UVs set yet just move on. - if (points.length < 1) { - return; - } - // if the number of points has changed we will need to recreate the arraybuffers - if (vertexBuffer.data.length / 4 !== points.length) { - vertexBuffer.data = new Float32Array(points.length * 4); - uvBuffer.data = new Float32Array(points.length * 4); - indexBuffer.data = new Uint16Array((points.length - 1) * 6); - } - var uvs = uvBuffer.data; - var indices = indexBuffer.data; - uvs[0] = 0; - uvs[1] = 0; - uvs[2] = 0; - uvs[3] = 1; - var amount = 0; - var prev = points[0]; - var textureWidth = this._width * this.textureScale; - var total = points.length; // - 1; - for (var i = 0; i < total; i++) { - // time to do some smart drawing! - var index = i * 4; - if (this.textureScale > 0) { - // calculate pixel distance from previous point - var dx = prev.x - points[i].x; - var dy = prev.y - points[i].y; - var distance = Math.sqrt((dx * dx) + (dy * dy)); - prev = points[i]; - amount += distance / textureWidth; - } - else { - // stretch texture - amount = i / (total - 1); - } - uvs[index] = amount; - uvs[index + 1] = 0; - uvs[index + 2] = amount; - uvs[index + 3] = 1; - } - var indexCount = 0; - for (var i = 0; i < total - 1; i++) { - var index = i * 2; - indices[indexCount++] = index; - indices[indexCount++] = index + 1; - indices[indexCount++] = index + 2; - indices[indexCount++] = index + 2; - indices[indexCount++] = index + 1; - indices[indexCount++] = index + 3; - } - // ensure that the changes are uploaded - uvBuffer.update(); - indexBuffer.update(); - this.updateVertices(); - }; - /** - * refreshes vertices of Rope mesh - */ - RopeGeometry.prototype.updateVertices = function () { - var points = this.points; - if (points.length < 1) { - return; - } - var lastPoint = points[0]; - var nextPoint; - var perpX = 0; - var perpY = 0; - var vertices = this.buffers[0].data; - var total = points.length; - for (var i = 0; i < total; i++) { - var point = points[i]; - var index = i * 4; - if (i < points.length - 1) { - nextPoint = points[i + 1]; - } - else { - nextPoint = point; - } - perpY = -(nextPoint.x - lastPoint.x); - perpX = nextPoint.y - lastPoint.y; - var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY)); - var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2; - perpX /= perpLength; - perpY /= perpLength; - perpX *= num; - perpY *= num; - vertices[index] = point.x + perpX; - vertices[index + 1] = point.y + perpY; - vertices[index + 2] = point.x - perpX; - vertices[index + 3] = point.y - perpY; - lastPoint = point; - } - this.buffers[0].update(); - }; - RopeGeometry.prototype.update = function () { - if (this.textureScale > 0) { - this.build(); // we need to update UVs - } - else { - this.updateVertices(); - } - }; - return RopeGeometry; - }(MeshGeometry)); - - /** - * The rope allows you to draw a texture across several points and then manipulate these points - * - *```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * let rope = new PIXI.SimpleRope(PIXI.Texture.from("snake.png"), points); - * ``` - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - * - */ - var SimpleRope = /** @class */ (function (_super) { - __extends$j(SimpleRope, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the rope. - * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope. - * @param {number} [textureScale=0] - Optional. Positive values scale rope texture - * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture - * and downsampling here. If set to zero, texture will be streched instead. - */ - function SimpleRope(texture, points, textureScale) { - if (textureScale === void 0) { textureScale = 0; } - var _this = this; - var ropeGeometry = new RopeGeometry(texture.height, points, textureScale); - var meshMaterial = new MeshMaterial(texture); - if (textureScale > 0) { - // attempt to set UV wrapping, will fail on non-power of two textures - texture.baseTexture.wrapMode = exports.WRAP_MODES.REPEAT; - } - _this = _super.call(this, ropeGeometry, meshMaterial) || this; - /** - * re-calculate vertices by rope points each frame - * - * @member {boolean} - */ - _this.autoUpdate = true; - return _this; - } - SimpleRope.prototype._render = function (renderer) { - var geometry = this.geometry; - if (this.autoUpdate || geometry._width !== this.shader.texture.height) { - geometry._width = this.shader.texture.height; - geometry.update(); - } - _super.prototype._render.call(this, renderer); - }; - return SimpleRope; - }(Mesh)); - - /** - * The SimplePlane allows you to draw a texture across several points and then manipulate these points - * - *```js - * for (let i = 0; i < 20; i++) { - * points.push(new PIXI.Point(i * 50, 0)); - * }; - * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from("snake.png"), points); - * ``` - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - * - */ - var SimplePlane = /** @class */ (function (_super) { - __extends$j(SimplePlane, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the SimplePlane. - * @param {number} verticesX - The number of vertices in the x-axis - * @param {number} verticesY - The number of vertices in the y-axis - */ - function SimplePlane(texture, verticesX, verticesY) { - var _this = this; - var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY); - var meshMaterial = new MeshMaterial(Texture.WHITE); - _this = _super.call(this, planeGeometry, meshMaterial) || this; - // lets call the setter to ensure all necessary updates are performed - _this.texture = texture; - return _this; - } - /** - * Method used for overrides, to do something in case texture frame was changed. - * Meshes based on plane can override it and change more details based on texture. - */ - SimplePlane.prototype.textureUpdated = function () { - this._textureID = this.shader.texture._updateID; - var geometry = this.geometry; - geometry.width = this.shader.texture.width; - geometry.height = this.shader.texture.height; - geometry.build(); - }; - Object.defineProperty(SimplePlane.prototype, "texture", { - get: function () { - return this.shader.texture; - }, - set: function (value) { - // Track texture same way sprite does. - // For generated meshes like NineSlicePlane it can change the geometry. - // Unfortunately, this method might not work if you directly change texture in material. - if (this.shader.texture === value) { - return; - } - this.shader.texture = value; - this._textureID = -1; - if (value.baseTexture.valid) { - this.textureUpdated(); - } - else { - value.once('update', this.textureUpdated, this); - } - }, - enumerable: false, - configurable: true - }); - SimplePlane.prototype._render = function (renderer) { - if (this._textureID !== this.shader.texture._updateID) { - this.textureUpdated(); - } - _super.prototype._render.call(this, renderer); - }; - SimplePlane.prototype.destroy = function (options) { - this.shader.texture.off('update', this.textureUpdated, this); - _super.prototype.destroy.call(this, options); - }; - return SimplePlane; - }(Mesh)); - - /** - * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. - * For more robust customization, use {@link PIXI.Mesh}. - * - * @class - * @extends PIXI.Mesh - * @memberof PIXI - */ - var SimpleMesh = /** @class */ (function (_super) { - __extends$j(SimpleMesh, _super); - /** - * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use - * @param {Float32Array} [vertices] - if you want to specify the vertices - * @param {Float32Array} [uvs] - if you want to specify the uvs - * @param {Uint16Array} [indices] - if you want to specify the indices - * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts - */ - function SimpleMesh(texture, vertices, uvs, indices, drawMode) { - if (texture === void 0) { texture = Texture.EMPTY; } - var _this = this; - var geometry = new MeshGeometry(vertices, uvs, indices); - geometry.getBuffer('aVertexPosition').static = false; - var meshMaterial = new MeshMaterial(texture); - _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this; - /** - * upload vertices buffer each frame - * @member {boolean} - */ - _this.autoUpdate = true; - return _this; - } - Object.defineProperty(SimpleMesh.prototype, "vertices", { - /** - * Collection of vertices data. - * @member {Float32Array} - */ - get: function () { - return this.geometry.getBuffer('aVertexPosition').data; - }, - set: function (value) { - this.geometry.getBuffer('aVertexPosition').data = value; - }, - enumerable: false, - configurable: true - }); - SimpleMesh.prototype._render = function (renderer) { - if (this.autoUpdate) { - this.geometry.getBuffer('aVertexPosition').update(); - } - _super.prototype._render.call(this, renderer); - }; - return SimpleMesh; - }(Mesh)); - - var DEFAULT_BORDER_SIZE = 10; - /** - * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful - * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically - * - *```js - * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15); - * ``` - *
-	 *      A                          B
-	 *    +---+----------------------+---+
-	 *  C | 1 |          2           | 3 |
-	 *    +---+----------------------+---+
-	 *    |   |                      |   |
-	 *    | 4 |          5           | 6 |
-	 *    |   |                      |   |
-	 *    +---+----------------------+---+
-	 *  D | 7 |          8           | 9 |
-	 *    +---+----------------------+---+
-
-	 *  When changing this objects width and/or height:
-	 *     areas 1 3 7 and 9 will remain unscaled.
-	 *     areas 2 and 8 will be stretched horizontally
-	 *     areas 4 and 6 will be stretched vertically
-	 *     area 5 will be stretched both horizontally and vertically
-	 * 
- * - * @class - * @extends PIXI.SimplePlane - * @memberof PIXI - * - */ - var NineSlicePlane = /** @class */ (function (_super) { - __extends$j(NineSlicePlane, _super); - /** - * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. - * @param {number} [leftWidth=10] - size of the left vertical bar (A) - * @param {number} [topHeight=10] - size of the top horizontal bar (C) - * @param {number} [rightWidth=10] - size of the right vertical bar (B) - * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D) - */ - function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) { - if (leftWidth === void 0) { leftWidth = DEFAULT_BORDER_SIZE; } - if (topHeight === void 0) { topHeight = DEFAULT_BORDER_SIZE; } - if (rightWidth === void 0) { rightWidth = DEFAULT_BORDER_SIZE; } - if (bottomHeight === void 0) { bottomHeight = DEFAULT_BORDER_SIZE; } - var _this = _super.call(this, Texture.WHITE, 4, 4) || this; - _this._origWidth = texture.orig.width; - _this._origHeight = texture.orig.height; - /** - * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - * @override - */ - _this._width = _this._origWidth; - /** - * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - * @override - */ - _this._height = _this._origHeight; - /** - * The width of the left column (a) - * - * @member {number} - * @private - */ - _this._leftWidth = leftWidth; - /** - * The width of the right column (b) - * - * @member {number} - * @private - */ - _this._rightWidth = rightWidth; - /** - * The height of the top row (c) - * - * @member {number} - * @private - */ - _this._topHeight = topHeight; - /** - * The height of the bottom row (d) - * - * @member {number} - * @private - */ - _this._bottomHeight = bottomHeight; - // lets call the setter to ensure all necessary updates are performed - _this.texture = texture; - return _this; - } - NineSlicePlane.prototype.textureUpdated = function () { - this._textureID = this.shader.texture._updateID; - this._refresh(); - }; - Object.defineProperty(NineSlicePlane.prototype, "vertices", { - get: function () { - return this.geometry.getBuffer('aVertexPosition').data; - }, - set: function (value) { - this.geometry.getBuffer('aVertexPosition').data = value; - }, - enumerable: false, - configurable: true - }); - /** - * Updates the horizontal vertices. - * - */ - NineSlicePlane.prototype.updateHorizontalVertices = function () { - var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; - vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale); - vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height; - }; - /** - * Updates the vertical vertices. - * - */ - NineSlicePlane.prototype.updateVerticalVertices = function () { - var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; - vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale); - vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; - }; - /** - * Returns the smaller of a set of vertical and horizontal scale of nine slice corners. - * - * @return {number} Smaller number of vertical and horizontal scale. - * @private - */ - NineSlicePlane.prototype._getMinScale = function () { - var w = this._leftWidth + this._rightWidth; - var scaleW = this._width > w ? 1.0 : this._width / w; - var h = this._topHeight + this._bottomHeight; - var scaleH = this._height > h ? 1.0 : this._height / h; - var scale = Math.min(scaleW, scaleH); - return scale; - }; - Object.defineProperty(NineSlicePlane.prototype, "width", { - /** - * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - get: function () { - return this._width; - }, - set: function (value) { - this._width = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "height", { - /** - * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - get: function () { - return this._height; - }, - set: function (value) { - this._height = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "leftWidth", { - /** - * The width of the left column - * - * @member {number} - */ - get: function () { - return this._leftWidth; - }, - set: function (value) { - this._leftWidth = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "rightWidth", { - /** - * The width of the right column - * - * @member {number} - */ - get: function () { - return this._rightWidth; - }, - set: function (value) { - this._rightWidth = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "topHeight", { - /** - * The height of the top row - * - * @member {number} - */ - get: function () { - return this._topHeight; - }, - set: function (value) { - this._topHeight = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NineSlicePlane.prototype, "bottomHeight", { - /** - * The height of the bottom row - * - * @member {number} - */ - get: function () { - return this._bottomHeight; - }, - set: function (value) { - this._bottomHeight = value; - this._refresh(); - }, - enumerable: false, - configurable: true - }); - /** - * Refreshes NineSlicePlane coords. All of them. - */ - NineSlicePlane.prototype._refresh = function () { - var texture = this.texture; - var uvs = this.geometry.buffers[1].data; - this._origWidth = texture.orig.width; - this._origHeight = texture.orig.height; - var _uvw = 1.0 / this._origWidth; - var _uvh = 1.0 / this._origHeight; - uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0; - uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0; - uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1; - uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1; - uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth; - uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth); - uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight; - uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight); - this.updateHorizontalVertices(); - this.updateVerticalVertices(); - this.geometry.buffers[0].update(); - this.geometry.buffers[1].update(); - }; - return NineSlicePlane; - }(SimplePlane)); - - /*! - * @pixi/sprite-animated - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * @pixi/sprite-animated is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics$k = function(d, b) { - extendStatics$k = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; - return extendStatics$k(d, b); - }; - - function __extends$k(d, b) { - extendStatics$k(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - /** - * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. - * - * ```js - * let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; - * let textureArray = []; - * - * for (let i=0; i < 4; i++) - * { - * let texture = PIXI.Texture.from(alienImages[i]); - * textureArray.push(texture); - * }; - * - * let animatedSprite = new PIXI.AnimatedSprite(textureArray); - * ``` - * - * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} - * containing the animation definitions: - * - * ```js - * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); - * - * function setup() { - * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; - * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); - * ... - * } - * ``` - * - * @class - * @extends PIXI.Sprite - * @memberof PIXI - */ - var AnimatedSprite = /** @class */ (function (_super) { - __extends$k(AnimatedSprite, _super); - /** - * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame - * objects that make up the animation. - * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. - */ - function AnimatedSprite(textures, autoUpdate) { - if (autoUpdate === void 0) { autoUpdate = true; } - var _this = _super.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture) || this; - /** - * @type {PIXI.Texture[]} - * @private - */ - _this._textures = null; - /** - * @type {number[]} - * @private - */ - _this._durations = null; - /** - * `true` uses PIXI.Ticker.shared to auto update animation time. - * - * @type {boolean} - * @default true - * @private - */ - _this._autoUpdate = autoUpdate; - /** - * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time. - * - * @type {boolean} - * @default false - * @private - */ - _this._isConnectedToTicker = false; - /** - * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower. - * - * @member {number} - * @default 1 - */ - _this.animationSpeed = 1; - /** - * Whether or not the animate sprite repeats after playing. - * - * @member {boolean} - * @default true - */ - _this.loop = true; - /** - * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes. - * - * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools. - * Changing anchor for each frame allows to pin sprite origin to certain moving feature - * of the frame (e.g. left foot). - * - * Note: Enabling this will override any previously set `anchor` on each frame change. - * - * @member {boolean} - * @default false - */ - _this.updateAnchor = false; - /** - * User-assigned function to call when an AnimatedSprite finishes playing. - * - * @example - * animation.onComplete = function () { - * // finished! - * }; - * @member {Function} - */ - _this.onComplete = null; - /** - * User-assigned function to call when an AnimatedSprite changes which texture is being rendered. - * - * @example - * animation.onFrameChange = function () { - * // updated! - * }; - * @member {Function} - */ - _this.onFrameChange = null; - /** - * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and - * loops around to start again. - * - * @example - * animation.onLoop = function () { - * // looped! - * }; - * @member {Function} - */ - _this.onLoop = null; - /** - * Elapsed time since animation has been started, used internally to display current texture. - * - * @member {number} - * @private - */ - _this._currentTime = 0; - _this._playing = false; - /** - * The texture index that was displayed last time - * - * @member {number} - * @private - */ - _this._previousFrame = null; - _this.textures = textures; - return _this; - } - /** - * Stops the AnimatedSprite. - * - */ - AnimatedSprite.prototype.stop = function () { - if (!this._playing) { - return; - } - this._playing = false; - if (this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - }; - /** - * Plays the AnimatedSprite. - * - */ - AnimatedSprite.prototype.play = function () { - if (this._playing) { - return; - } - this._playing = true; - if (this._autoUpdate && !this._isConnectedToTicker) { - Ticker.shared.add(this.update, this, exports.UPDATE_PRIORITY.HIGH); - this._isConnectedToTicker = true; - } - }; - /** - * Stops the AnimatedSprite and goes to a specific frame. - * - * @param {number} frameNumber - Frame index to stop at. - */ - AnimatedSprite.prototype.gotoAndStop = function (frameNumber) { - this.stop(); - var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - if (previousFrame !== this.currentFrame) { - this.updateTexture(); - } - }; - /** - * Goes to a specific frame and begins playing the AnimatedSprite. - * - * @param {number} frameNumber - Frame index to start at. - */ - AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) { - var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - if (previousFrame !== this.currentFrame) { - this.updateTexture(); - } - this.play(); - }; - /** - * Updates the object transform for rendering. - * - * @param {number} deltaTime - Time since last tick. - */ - AnimatedSprite.prototype.update = function (deltaTime) { - if (!this._playing) { - return; - } - var elapsed = this.animationSpeed * deltaTime; - var previousFrame = this.currentFrame; - if (this._durations !== null) { - var lag = this._currentTime % 1 * this._durations[this.currentFrame]; - lag += elapsed / 60 * 1000; - while (lag < 0) { - this._currentTime--; - lag += this._durations[this.currentFrame]; - } - var sign = Math.sign(this.animationSpeed * deltaTime); - this._currentTime = Math.floor(this._currentTime); - while (lag >= this._durations[this.currentFrame]) { - lag -= this._durations[this.currentFrame] * sign; - this._currentTime += sign; - } - this._currentTime += lag / this._durations[this.currentFrame]; - } - else { - this._currentTime += elapsed; - } - if (this._currentTime < 0 && !this.loop) { - this.gotoAndStop(0); - if (this.onComplete) { - this.onComplete(); - } - } - else if (this._currentTime >= this._textures.length && !this.loop) { - this.gotoAndStop(this._textures.length - 1); - if (this.onComplete) { - this.onComplete(); - } - } - else if (previousFrame !== this.currentFrame) { - if (this.loop && this.onLoop) { - if (this.animationSpeed > 0 && this.currentFrame < previousFrame) { - this.onLoop(); - } - else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) { - this.onLoop(); - } - } - this.updateTexture(); - } - }; - /** - * Updates the displayed texture to match the current frame index. - * - * @private - */ - AnimatedSprite.prototype.updateTexture = function () { - var currentFrame = this.currentFrame; - if (this._previousFrame === currentFrame) { - return; - } - this._previousFrame = currentFrame; - this._texture = this._textures[currentFrame]; - this._textureID = -1; - this._textureTrimmedID = -1; - this._cachedTint = 0xFFFFFF; - this.uvs = this._texture._uvs.uvsFloat32; - if (this.updateAnchor) { - this._anchor.copyFrom(this._texture.defaultAnchor); - } - if (this.onFrameChange) { - this.onFrameChange(this.currentFrame); - } - }; - /** - * Stops the AnimatedSprite and destroys it. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options - * have been set to that value. - * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy - * method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well. - * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well. - */ - AnimatedSprite.prototype.destroy = function (options) { - this.stop(); - _super.prototype.destroy.call(this, options); - this.onComplete = null; - this.onFrameChange = null; - this.onLoop = null; - }; - /** - * A short hand way of creating an AnimatedSprite from an array of frame ids. - * - * @static - * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames. - * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames. - */ - AnimatedSprite.fromFrames = function (frames) { - var textures = []; - for (var i = 0; i < frames.length; ++i) { - textures.push(Texture.from(frames[i])); - } - return new AnimatedSprite(textures); - }; - /** - * A short hand way of creating an AnimatedSprite from an array of image ids. - * - * @static - * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames. - * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames. - */ - AnimatedSprite.fromImages = function (images) { - var textures = []; - for (var i = 0; i < images.length; ++i) { - textures.push(Texture.from(images[i])); - } - return new AnimatedSprite(textures); - }; - Object.defineProperty(AnimatedSprite.prototype, "totalFrames", { - /** - * The total number of frames in the AnimatedSprite. This is the same as number of textures - * assigned to the AnimatedSprite. - * - * @readonly - * @member {number} - * @default 0 - */ - get: function () { - return this._textures.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "textures", { - /** - * The array of textures used for this AnimatedSprite. - * - * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} - */ - get: function () { - return this._textures; - }, - set: function (value) { - if (value[0] instanceof Texture) { - this._textures = value; - this._durations = null; - } - else { - this._textures = []; - this._durations = []; - for (var i = 0; i < value.length; i++) { - this._textures.push(value[i].texture); - this._durations.push(value[i].time); - } - } - this._previousFrame = null; - this.gotoAndStop(0); - this.updateTexture(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "currentFrame", { - /** - * The AnimatedSprites current frame index. - * - * @member {number} - * @readonly - */ - get: function () { - var currentFrame = Math.floor(this._currentTime) % this._textures.length; - if (currentFrame < 0) { - currentFrame += this._textures.length; - } - return currentFrame; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "playing", { - /** - * Indicates if the AnimatedSprite is currently playing. - * - * @member {boolean} - * @readonly - */ - get: function () { - return this._playing; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnimatedSprite.prototype, "autoUpdate", { - /** - * Whether to use PIXI.Ticker.shared to auto update animation time - * - * @member {boolean} - */ - get: function () { - return this._autoUpdate; - }, - set: function (value) { - if (value !== this._autoUpdate) { - this._autoUpdate = value; - if (!this._autoUpdate && this._isConnectedToTicker) { - Ticker.shared.remove(this.update, this); - this._isConnectedToTicker = false; - } - else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) { - Ticker.shared.add(this.update, this); - this._isConnectedToTicker = true; - } - } - }, - enumerable: false, - configurable: true - }); - return AnimatedSprite; - }(Sprite)); - - // Install renderer plugins - Renderer.registerPlugin('accessibility', AccessibilityManager); - Renderer.registerPlugin('extract', Extract); - Renderer.registerPlugin('interaction', InteractionManager); - Renderer.registerPlugin('particle', ParticleRenderer); - Renderer.registerPlugin('prepare', Prepare); - Renderer.registerPlugin('batch', BatchRenderer); - Renderer.registerPlugin('tilingSprite', TilingSpriteRenderer); - Loader$1.registerPlugin(BitmapFontLoader); - Loader$1.registerPlugin(SpritesheetLoader); - Application.registerPlugin(TickerPlugin); - Application.registerPlugin(AppLoaderPlugin); - /** - * String of the current PIXI version. - * - * @static - * @constant - * @memberof PIXI - * @name VERSION - * @type {string} - */ - var VERSION$1 = '5.3.8'; - /** - * @namespace PIXI - */ - /** - * This namespace contains WebGL-only display filters that can be applied - * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. - * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. - * - * All filters must extend {@link PIXI.Filter}. - * - * @example - * // Create a new application - * const app = new PIXI.Application(); - * - * // Draw a green rectangle - * const rect = new PIXI.Graphics() - * .beginFill(0x00ff00) - * .drawRect(40, 40, 200, 200); - * - * // Add a blur filter - * rect.filters = [new PIXI.filters.BlurFilter()]; - * - * // Display rectangle - * app.stage.addChild(rect); - * document.body.appendChild(app.view); - * @namespace PIXI.filters - */ - var filters = { - AlphaFilter: AlphaFilter, - BlurFilter: BlurFilter, - BlurFilterPass: BlurFilterPass, - ColorMatrixFilter: ColorMatrixFilter, - DisplacementFilter: DisplacementFilter, - FXAAFilter: FXAAFilter, - NoiseFilter: NoiseFilter, - }; - - exports.AbstractBatchRenderer = AbstractBatchRenderer; - exports.AbstractRenderer = AbstractRenderer; - exports.AccessibilityManager = AccessibilityManager; - exports.AnimatedSprite = AnimatedSprite; - exports.AppLoaderPlugin = AppLoaderPlugin; - exports.Application = Application; - exports.Attribute = Attribute; - exports.BasePrepare = BasePrepare; - exports.BaseRenderTexture = BaseRenderTexture; - exports.BaseTexture = BaseTexture; - exports.BatchDrawCall = BatchDrawCall; - exports.BatchGeometry = BatchGeometry; - exports.BatchPluginFactory = BatchPluginFactory; - exports.BatchRenderer = BatchRenderer; - exports.BatchShaderGenerator = BatchShaderGenerator; - exports.BatchTextureArray = BatchTextureArray; - exports.BitmapFont = BitmapFont; - exports.BitmapFontData = BitmapFontData; - exports.BitmapFontLoader = BitmapFontLoader; - exports.BitmapText = BitmapText; - exports.Bounds = Bounds; - exports.Buffer = Buffer; - exports.Circle = Circle; - exports.Container = Container; - exports.CountLimiter = CountLimiter; - exports.DEG_TO_RAD = DEG_TO_RAD; - exports.DisplayObject = DisplayObject; - exports.Ellipse = Ellipse; - exports.Extract = Extract; - exports.FillStyle = FillStyle; - exports.Filter = Filter; - exports.FilterState = FilterState; - exports.Framebuffer = Framebuffer; - exports.GLFramebuffer = GLFramebuffer; - exports.GLProgram = GLProgram; - exports.GLTexture = GLTexture; - exports.GRAPHICS_CURVES = GRAPHICS_CURVES; - exports.Geometry = Geometry; - exports.Graphics = Graphics; - exports.GraphicsData = GraphicsData; - exports.GraphicsGeometry = GraphicsGeometry; - exports.IGLUniformData = IGLUniformData; - exports.InteractionData = InteractionData; - exports.InteractionEvent = InteractionEvent; - exports.InteractionManager = InteractionManager; - exports.InteractionTrackingData = InteractionTrackingData; - exports.LineStyle = LineStyle; - exports.Loader = Loader$1; - exports.LoaderResource = LoaderResource; - exports.MaskData = MaskData; - exports.Matrix = Matrix; - exports.Mesh = Mesh; - exports.MeshBatchUvs = MeshBatchUvs; - exports.MeshGeometry = MeshGeometry; - exports.MeshMaterial = MeshMaterial; - exports.NineSlicePlane = NineSlicePlane; - exports.ObjectRenderer = ObjectRenderer; - exports.ObservablePoint = ObservablePoint; - exports.PI_2 = PI_2; - exports.ParticleContainer = ParticleContainer; - exports.ParticleRenderer = ParticleRenderer; - exports.PlaneGeometry = PlaneGeometry; - exports.Point = Point; - exports.Polygon = Polygon; - exports.Prepare = Prepare; - exports.Program = Program; - exports.Quad = Quad; - exports.QuadUv = QuadUv; - exports.RAD_TO_DEG = RAD_TO_DEG; - exports.Rectangle = Rectangle; - exports.RenderTexture = RenderTexture; - exports.RenderTexturePool = RenderTexturePool; - exports.Renderer = Renderer; - exports.RopeGeometry = RopeGeometry; - exports.RoundedRectangle = RoundedRectangle; - exports.Runner = Runner; - exports.Shader = Shader; - exports.SimpleMesh = SimpleMesh; - exports.SimplePlane = SimplePlane; - exports.SimpleRope = SimpleRope; - exports.Sprite = Sprite; - exports.SpriteMaskFilter = SpriteMaskFilter; - exports.Spritesheet = Spritesheet; - exports.SpritesheetLoader = SpritesheetLoader; - exports.State = State; - exports.System = System; - exports.TemporaryDisplayObject = TemporaryDisplayObject; - exports.Text = Text; - exports.TextMetrics = TextMetrics; - exports.TextStyle = TextStyle; - exports.Texture = Texture; - exports.TextureLoader = TextureLoader; - exports.TextureMatrix = TextureMatrix; - exports.TextureUvs = TextureUvs; - exports.Ticker = Ticker; - exports.TickerPlugin = TickerPlugin; - exports.TilingSprite = TilingSprite; - exports.TilingSpriteRenderer = TilingSpriteRenderer; - exports.TimeLimiter = TimeLimiter; - exports.Transform = Transform; - exports.UniformGroup = UniformGroup; - exports.VERSION = VERSION$1; - exports.ViewableBuffer = ViewableBuffer; - exports.accessibleTarget = accessibleTarget; - exports.autoDetectRenderer = autoDetectRenderer; - exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; - exports.defaultFilterVertex = defaultFilter; - exports.defaultVertex = _default; - exports.filters = filters; - exports.graphicsUtils = index$2; - exports.groupD8 = groupD8; - exports.interactiveTarget = interactiveTarget; - exports.isMobile = isMobile$1; - exports.resources = index; - exports.settings = settings; - exports.systems = systems; - exports.uniformParsers = uniformParsers; - exports.useDeprecated = useDeprecated; - exports.utils = utils_es; - - return exports; - -}({})); -PIXI.useDeprecated(); //# sourceMappingURL=pixi.js.map diff --git a/www/js/libs/pixi.js.map b/www/js/libs/pixi.js.map deleted file mode 100644 index 8611735..0000000 --- a/www/js/libs/pixi.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pixi.js","sources":["../../../node_modules/es6-promise-polyfill/promise.js","../../../node_modules/object-assign/index.js","../../../packages/polyfill/src/Promise.ts","../../../packages/polyfill/src/Object.assign.ts","../../../packages/polyfill/src/requestAnimationFrame.ts","../../../packages/polyfill/src/Math.sign.ts","../../../packages/polyfill/src/Number.isInteger.ts","../../../packages/polyfill/src/index.ts","../../../node_modules/ismobilejs/src/isMobile.ts","../../../packages/settings/src/utils/isMobile.ts","../../../packages/settings/src/utils/maxRecommendedTextures.ts","../../../packages/settings/src/utils/canUploadSameBuffer.ts","../../../packages/settings/src/settings.ts","../../../node_modules/eventemitter3/index.js","../../../node_modules/earcut/src/earcut.js","../../../node_modules/url/node_modules/punycode/punycode.js","../../../node_modules/url/util.js","../../../node_modules/querystring/decode.js","../../../node_modules/querystring/encode.js","../../../node_modules/querystring/index.js","../../../node_modules/url/url.js","../../../packages/constants/src/index.ts","../../../packages/utils/src/settings.ts","../../../packages/utils/src/browser/hello.ts","../../../packages/utils/src/browser/isWebGLSupported.ts","../../../packages/utils/src/color/hex.ts","../../../packages/utils/src/color/premultiply.ts","../../../packages/utils/src/data/createIndicesForQuads.ts","../../../packages/utils/src/data/getBufferType.ts","../../../packages/utils/src/data/interleaveTypedArrays.ts","../../../packages/utils/src/data/pow2.ts","../../../packages/utils/src/data/removeItems.ts","../../../packages/utils/src/data/sign.ts","../../../packages/utils/src/data/uid.ts","../../../packages/utils/src/logging/deprecation.ts","../../../packages/utils/src/media/caches.ts","../../../packages/utils/src/media/CanvasRenderTarget.ts","../../../packages/utils/src/media/trimCanvas.ts","../../../packages/utils/src/const.ts","../../../packages/utils/src/network/decomposeDataUri.ts","../../../packages/utils/src/network/determineCrossOrigin.ts","../../../packages/utils/src/network/getResolutionOfUrl.ts","../../../packages/math/src/const.ts","../../../packages/math/src/shapes/Rectangle.ts","../../../packages/math/src/shapes/Circle.ts","../../../packages/math/src/shapes/Ellipse.ts","../../../packages/math/src/shapes/Polygon.ts","../../../packages/math/src/shapes/RoundedRectangle.ts","../../../packages/math/src/Point.ts","../../../packages/math/src/ObservablePoint.ts","../../../packages/math/src/Matrix.ts","../../../packages/math/src/groupD8.ts","../../../packages/math/src/Transform.ts","../../../packages/display/src/settings.ts","../../../packages/display/src/Bounds.ts","../../../node_modules/tslib/tslib.es6.js","../../../packages/display/src/DisplayObject.ts","../../../packages/display/src/Container.ts","../../../packages/accessibility/src/accessibleTarget.ts","../../../packages/accessibility/src/AccessibilityManager.ts","../../../packages/ticker/src/settings.ts","../../../packages/ticker/src/const.ts","../../../packages/ticker/src/TickerListener.ts","../../../packages/ticker/src/Ticker.ts","../../../packages/ticker/src/TickerPlugin.ts","../../../packages/interaction/src/InteractionData.ts","../../../packages/interaction/src/InteractionEvent.ts","../../../packages/interaction/src/InteractionTrackingData.ts","../../../packages/interaction/src/TreeSearch.ts","../../../packages/interaction/src/interactiveTarget.ts","../../../packages/interaction/src/InteractionManager.ts","../../../packages/runner/src/Runner.ts","../../../packages/core/src/settings.ts","../../../packages/core/src/textures/resources/autoDetectResource.ts","../../../packages/core/src/textures/resources/Resource.ts","../../../packages/core/src/textures/resources/BufferResource.ts","../../../packages/core/src/textures/BaseTexture.ts","../../../packages/core/src/textures/resources/AbstractMultiResource.ts","../../../packages/core/src/textures/resources/ArrayResource.ts","../../../packages/core/src/textures/resources/BaseImageResource.ts","../../../packages/core/src/textures/resources/CanvasResource.ts","../../../packages/core/src/textures/resources/CubeResource.ts","../../../packages/core/src/textures/resources/ImageResource.ts","../../../packages/core/src/textures/resources/SVGResource.ts","../../../packages/core/src/textures/resources/VideoResource.ts","../../../packages/core/src/textures/resources/ImageBitmapResource.ts","../../../packages/core/src/textures/resources/index.ts","../../../packages/core/src/System.ts","../../../packages/core/src/textures/resources/DepthResource.ts","../../../packages/core/src/framebuffer/Framebuffer.ts","../../../packages/core/src/renderTexture/BaseRenderTexture.ts","../../../packages/core/src/textures/TextureUvs.ts","../../../packages/core/src/textures/Texture.ts","../../../packages/core/src/renderTexture/RenderTexture.ts","../../../packages/core/src/renderTexture/RenderTexturePool.ts","../../../packages/core/src/geometry/Attribute.ts","../../../packages/core/src/geometry/Buffer.ts","../../../packages/core/src/geometry/utils/getBufferType.ts","../../../packages/core/src/geometry/utils/interleaveTypedArrays.ts","../../../packages/core/src/geometry/Geometry.ts","../../../packages/core/src/utils/Quad.ts","../../../packages/core/src/utils/QuadUv.ts","../../../packages/core/src/shader/UniformGroup.ts","../../../packages/core/src/filters/FilterState.ts","../../../packages/core/src/filters/FilterSystem.ts","../../../packages/core/src/batch/ObjectRenderer.ts","../../../packages/core/src/batch/BatchSystem.ts","../../../packages/core/src/context/ContextSystem.ts","../../../packages/core/src/framebuffer/GLFramebuffer.ts","../../../packages/core/src/framebuffer/FramebufferSystem.ts","../../../packages/core/src/geometry/GLBuffer.ts","../../../packages/core/src/geometry/GeometrySystem.ts","../../../packages/core/src/mask/MaskData.ts","../../../packages/core/src/shader/utils/compileProgram.ts","../../../packages/core/src/shader/utils/defaultValue.ts","../../../packages/core/src/shader/utils/getTestContext.ts","../../../packages/core/src/shader/utils/getMaxFragmentPrecision.ts","../../../packages/core/src/shader/utils/setPrecision.ts","../../../packages/core/src/shader/utils/mapSize.ts","../../../packages/core/src/shader/utils/mapType.ts","../../../packages/core/src/shader/utils/uniformParsers.ts","../../../packages/core/src/shader/utils/generateUniformsSync.ts","../../../packages/core/src/shader/utils/checkMaxIfStatementsInShader.ts","../../../packages/core/src/shader/utils/unsafeEvalSupported.ts","../../../packages/core/src/shader/Program.ts","../../../packages/core/src/shader/Shader.ts","../../../packages/core/src/state/State.ts","../../../packages/core/src/filters/Filter.ts","../../../packages/core/src/textures/TextureMatrix.ts","../../../packages/core/src/filters/spriteMask/SpriteMaskFilter.ts","../../../packages/core/src/mask/MaskSystem.ts","../../../packages/core/src/mask/AbstractMaskSystem.ts","../../../packages/core/src/mask/ScissorSystem.ts","../../../packages/core/src/mask/StencilSystem.ts","../../../packages/core/src/projection/ProjectionSystem.ts","../../../packages/core/src/renderTexture/RenderTextureSystem.ts","../../../packages/core/src/shader/GLProgram.ts","../../../packages/core/src/shader/ShaderSystem.ts","../../../packages/core/src/state/utils/mapWebGLBlendModesToPixi.ts","../../../packages/core/src/state/StateSystem.ts","../../../packages/core/src/textures/TextureGCSystem.ts","../../../packages/core/src/textures/GLTexture.ts","../../../packages/core/src/textures/TextureSystem.ts","../../../packages/core/src/AbstractRenderer.ts","../../../packages/core/src/Renderer.ts","../../../packages/core/src/autoDetectRenderer.ts","../../../packages/core/src/batch/BatchDrawCall.ts","../../../packages/core/src/batch/BatchTextureArray.ts","../../../packages/core/src/geometry/ViewableBuffer.ts","../../../packages/core/src/batch/AbstractBatchRenderer.ts","../../../packages/core/src/batch/BatchShaderGenerator.ts","../../../packages/core/src/batch/BatchGeometry.ts","../../../packages/core/src/batch/BatchPluginFactory.ts","../../../packages/app/src/Application.ts","../../../packages/app/src/ResizePlugin.ts","../../../packages/app/src/index.ts","../../../packages/extract/src/Extract.ts","../../../node_modules/parse-uri/index.js","../../../node_modules/mini-signals/lib/mini-signals.js","../../../node_modules/resource-loader/src/async.js","../../../node_modules/resource-loader/src/middleware/caching.js","../../../node_modules/resource-loader/src/Resource.js","../../../node_modules/resource-loader/src/encodeBinary.js","../../../node_modules/resource-loader/src/middleware/parsing.js","../../../node_modules/resource-loader/src/Loader.js","../../../packages/loaders/src/LoaderResource.ts","../../../packages/loaders/src/TextureLoader.ts","../../../packages/loaders/src/Loader.ts","../../../packages/loaders/src/AppLoaderPlugin.ts","../../../packages/particles/src/ParticleContainer.ts","../../../packages/particles/src/ParticleBuffer.ts","../../../packages/particles/src/ParticleRenderer.ts","../../../packages/graphics/src/const.ts","../../../packages/graphics/src/styles/FillStyle.ts","../../../packages/graphics/src/utils/buildPoly.ts","../../../packages/graphics/src/utils/buildCircle.ts","../../../packages/graphics/src/utils/buildRectangle.ts","../../../packages/graphics/src/utils/buildRoundedRectangle.ts","../../../packages/graphics/src/utils/buildLine.ts","../../../packages/graphics/src/utils/Star.ts","../../../packages/graphics/src/utils/ArcUtils.ts","../../../packages/graphics/src/utils/BezierUtils.ts","../../../packages/graphics/src/utils/QuadraticUtils.ts","../../../packages/graphics/src/utils/BatchPart.ts","../../../packages/graphics/src/utils/index.ts","../../../packages/graphics/src/GraphicsData.ts","../../../packages/graphics/src/GraphicsGeometry.ts","../../../packages/graphics/src/styles/LineStyle.ts","../../../packages/graphics/src/Graphics.ts","../../../packages/sprite/src/Sprite.ts","../../../packages/text/src/const.ts","../../../packages/text/src/TextStyle.ts","../../../packages/text/src/TextMetrics.ts","../../../packages/text/src/Text.ts","../../../packages/prepare/src/settings.ts","../../../packages/prepare/src/CountLimiter.ts","../../../packages/prepare/src/BasePrepare.ts","../../../packages/prepare/src/Prepare.ts","../../../packages/prepare/src/TimeLimiter.ts","../../../packages/spritesheet/src/Spritesheet.ts","../../../packages/spritesheet/src/SpritesheetLoader.ts","../../../packages/sprite-tiling/src/TilingSprite.ts","../../../packages/sprite-tiling/src/TilingSpriteRenderer.ts","../../../packages/mesh/src/MeshBatchUvs.ts","../../../packages/mesh/src/Mesh.ts","../../../packages/mesh/src/MeshMaterial.ts","../../../packages/mesh/src/MeshGeometry.ts","../../../packages/text-bitmap/src/BitmapFontData.ts","../../../packages/text-bitmap/src/formats/TextFormat.ts","../../../packages/text-bitmap/src/formats/XMLFormat.ts","../../../packages/text-bitmap/src/formats/XMLStringFormat.ts","../../../packages/text-bitmap/src/formats/index.ts","../../../packages/text-bitmap/src/utils/generateFillStyle.ts","../../../packages/text-bitmap/src/utils/drawGlyph.ts","../../../packages/text-bitmap/src/utils/resolveCharacters.ts","../../../packages/text-bitmap/src/BitmapFont.ts","../../../packages/text-bitmap/src/BitmapText.ts","../../../packages/text-bitmap/src/BitmapFontLoader.ts","../../../packages/filters/filter-alpha/src/AlphaFilter.ts","../../../packages/filters/filter-blur/src/generateBlurVertSource.ts","../../../packages/filters/filter-blur/src/generateBlurFragSource.ts","../../../packages/filters/filter-blur/src/BlurFilterPass.ts","../../../packages/filters/filter-blur/src/BlurFilter.ts","../../../packages/filters/filter-color-matrix/src/ColorMatrixFilter.ts","../../../packages/filters/filter-displacement/src/DisplacementFilter.ts","../../../packages/filters/filter-fxaa/src/FXAAFilter.ts","../../../packages/filters/filter-noise/src/NoiseFilter.ts","../../../packages/mixin-cache-as-bitmap/src/index.ts","../../../packages/mixin-get-child-by-name/src/index.ts","../../../packages/mixin-get-global-position/src/index.ts","../src/useDeprecated.ts","../../../packages/mesh-extras/src/geometry/PlaneGeometry.ts","../../../packages/mesh-extras/src/geometry/RopeGeometry.ts","../../../packages/mesh-extras/src/SimpleRope.ts","../../../packages/mesh-extras/src/SimplePlane.ts","../../../packages/mesh-extras/src/SimpleMesh.ts","../../../packages/mesh-extras/src/NineSlicePlane.ts","../../../packages/sprite-animated/src/AnimatedSprite.ts","../src/index.ts"],"sourcesContent":["(function(global){\n\n//\n// Check for native Promise and it has correct interface\n//\n\nvar NativePromise = global['Promise'];\nvar nativePromiseSupported =\n NativePromise &&\n // Some of these methods are missing from\n // Firefox/Chrome experimental implementations\n 'resolve' in NativePromise &&\n 'reject' in NativePromise &&\n 'all' in NativePromise &&\n 'race' in NativePromise &&\n // Older version of the spec had a resolver object\n // as the arg rather than a function\n (function(){\n var resolve;\n new NativePromise(function(r){ resolve = r; });\n return typeof resolve === 'function';\n })();\n\n\n//\n// export if necessary\n//\n\nif (typeof exports !== 'undefined' && exports)\n{\n // node.js\n exports.Promise = nativePromiseSupported ? NativePromise : Promise;\n exports.Polyfill = Promise;\n}\nelse\n{\n // AMD\n if (typeof define == 'function' && define.amd)\n {\n define(function(){\n return nativePromiseSupported ? NativePromise : Promise;\n });\n }\n else\n {\n // in browser add to global\n if (!nativePromiseSupported)\n global['Promise'] = Promise;\n }\n}\n\n\n//\n// Polyfill\n//\n\nvar PENDING = 'pending';\nvar SEALED = 'sealed';\nvar FULFILLED = 'fulfilled';\nvar REJECTED = 'rejected';\nvar NOOP = function(){};\n\nfunction isArray(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n}\n\n// async calls\nvar asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;\nvar asyncQueue = [];\nvar asyncTimer;\n\nfunction asyncFlush(){\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++)\n asyncQueue[i][0](asyncQueue[i][1]);\n\n // reset async asyncQueue\n asyncQueue = [];\n asyncTimer = false;\n}\n\nfunction asyncCall(callback, arg){\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer)\n {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n}\n\n\nfunction invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch(e) {\n rejectPromise(e);\n }\n}\n\nfunction invokeCallback(subscriber){\n var owner = subscriber.owner;\n var settled = owner.state_;\n var value = owner.data_; \n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function')\n {\n settled = FULFILLED;\n try {\n value = callback(value);\n } catch(e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value))\n {\n if (settled === FULFILLED)\n resolve(promise, value);\n\n if (settled === REJECTED)\n reject(promise, value);\n }\n}\n\nfunction handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value)\n throw new TypeError('A promises callback cannot return that same promise.');\n\n if (value && (typeof value === 'function' || typeof value === 'object'))\n {\n var then = value.then; // then should be retrived only once\n\n if (typeof then === 'function')\n {\n then.call(value, function(val){\n if (!resolved)\n {\n resolved = true;\n\n if (value !== val)\n resolve(promise, val);\n else\n fulfill(promise, val);\n }\n }, function(reason){\n if (!resolved)\n {\n resolved = true;\n\n reject(promise, reason);\n }\n });\n\n return true;\n }\n }\n } catch (e) {\n if (!resolved)\n reject(promise, e);\n\n return true;\n }\n\n return false;\n}\n\nfunction resolve(promise, value){\n if (promise === value || !handleThenable(promise, value))\n fulfill(promise, value);\n}\n\nfunction fulfill(promise, value){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = value;\n\n asyncCall(publishFulfillment, promise);\n }\n}\n\nfunction reject(promise, reason){\n if (promise.state_ === PENDING)\n {\n promise.state_ = SEALED;\n promise.data_ = reason;\n\n asyncCall(publishRejection, promise);\n }\n}\n\nfunction publish(promise) {\n var callbacks = promise.then_;\n promise.then_ = undefined;\n\n for (var i = 0; i < callbacks.length; i++) {\n invokeCallback(callbacks[i]);\n }\n}\n\nfunction publishFulfillment(promise){\n promise.state_ = FULFILLED;\n publish(promise);\n}\n\nfunction publishRejection(promise){\n promise.state_ = REJECTED;\n publish(promise);\n}\n\n/**\n* @class\n*/\nfunction Promise(resolver){\n if (typeof resolver !== 'function')\n throw new TypeError('Promise constructor takes a function argument');\n\n if (this instanceof Promise === false)\n throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n\n this.then_ = [];\n\n invokeResolver(resolver, this);\n}\n\nPromise.prototype = {\n constructor: Promise,\n\n state_: PENDING,\n then_: null,\n data_: undefined,\n\n then: function(onFulfillment, onRejection){\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if (this.state_ === FULFILLED || this.state_ === REJECTED)\n {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n }\n else\n {\n // subscribe\n this.then_.push(subscriber);\n }\n\n return subscriber.then;\n },\n\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n};\n\nPromise.all = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.all().');\n\n return new Class(function(resolve, reject){\n var results = [];\n var remaining = 0;\n\n function resolver(index){\n remaining++;\n return function(value){\n results[index] = value;\n if (!--remaining)\n resolve(results);\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolver(i), reject);\n else\n results[i] = promise;\n }\n\n if (!remaining)\n resolve(results);\n });\n};\n\nPromise.race = function(promises){\n var Class = this;\n\n if (!isArray(promises))\n throw new TypeError('You must pass an array to Promise.race().');\n\n return new Class(function(resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++)\n {\n promise = promises[i];\n\n if (promise && typeof promise.then === 'function')\n promise.then(resolve, reject);\n else\n resolve(promise);\n }\n });\n};\n\nPromise.resolve = function(value){\n var Class = this;\n\n if (value && typeof value === 'object' && value.constructor === Class)\n return value;\n\n return new Class(function(resolve){\n resolve(value);\n });\n};\n\nPromise.reject = function(reason){\n var Class = this;\n\n return new Class(function(resolve, reject){\n reject(reason);\n });\n};\n\n})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : this);\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","import { Polyfill } from 'es6-promise-polyfill';\n\n// Support for IE 9 - 11 which does not include Promises\nif (!window.Promise)\n{\n window.Promise = Polyfill;\n}\n","// References:\n// https://github.com/sindresorhus/object-assign\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\nimport objectAssign from 'object-assign';\n\nif (!Object.assign)\n{\n Object.assign = objectAssign;\n}\n","// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\n\nconst ONE_FRAME_TIME = 16;\n\n// Date.now\nif (!(Date.now && Date.prototype.getTime))\n{\n Date.now = function now(): number\n {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(window.performance && window.performance.now))\n{\n const startTime = Date.now();\n\n if (!window.performance)\n {\n (window as any).performance = {};\n }\n\n window.performance.now = (): number => Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n window.requestAnimationFrame = (window as any)[`${p}RequestAnimationFrame`];\n window.cancelAnimationFrame = (window as any)[`${p}CancelAnimationFrame`]\n || (window as any)[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!window.requestAnimationFrame)\n{\n window.requestAnimationFrame = (callback: (...parms: any[]) => void): number =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return window.setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!window.cancelAnimationFrame)\n{\n window.cancelAnimationFrame = (id: number): void => clearTimeout(id);\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x): number\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value): boolean\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","import './Promise';\nimport './Object.assign';\nimport './requestAnimationFrame';\nimport './Math.sign';\nimport './Number.isInteger';\n\nif (!window.ArrayBuffer)\n{\n (window as any).ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n (window as any).Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n (window as any).Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n (window as any).Uint16Array = Array;\n}\n\nif (!window.Uint8Array)\n{\n (window as any).Uint8Array = Array;\n}\n\nif (!window.Int32Array)\n{\n (window as any).Int32Array = Array;\n}\n","const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n","// The ESM/CJS versions of ismobilejs only\n// exports the function for executing\n// designed for Node-only environments\nimport isMobileCall from 'ismobilejs';\n\nconst isMobile = isMobileCall(window.navigator);\n\nexport { isMobile };\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\n\nexport interface IRenderOptions {\n view: HTMLCanvasElement;\n antialias: boolean;\n autoDensity: boolean;\n transparent: boolean;\n backgroundColor: number;\n clearBeforeRender: boolean;\n preserveDrawingBuffer: boolean;\n width: number;\n height: number;\n legacy: boolean;\n}\n\nexport interface ISettings {\n MIPMAP_TEXTURES: number;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: number;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: number;\n SCALE_MODE: number;\n PRECISION_VERTEX: string;\n PRECISION_FRAGMENT: string;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: number;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV {\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE {\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS {\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nexport enum BLEND_MODES {\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nexport enum DRAW_MODES {\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nexport enum FORMATS {\n RGBA = 6408,\n RGB = 6407,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nexport enum TARGETS {\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nexport enum TYPES {\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n FLOAT = 5126,\n HALF_FLOAT = 36193,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES {\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES {\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nexport enum MIPMAP_MODES {\n OFF,\n POW2,\n ON,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES {\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2,\n}\n\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES {\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES {\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nexport enum PRECISION {\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nexport enum MASK_TYPES {\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY {\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nexport { settings };\n","let saidHello = false;\nconst VERSION = '__VERSION__';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n window.console.log(...args);\n }\n else if (window.console)\n {\n window.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean|undefined;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string' && string[0] === '#')\n {\n string = string.substr(1);\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array|number[],\n alpha: number,\n out: Float32Array,\n premultiply: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array|Uint32Array = null): Uint16Array|Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(array: ITypedArray): 'Float32Array'|'Uint32Array'|'Int32Array'|'Uint16Array'|'Uint8Array'|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array|Uint32Array|Int32Array|Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1|0|1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n public canvas: HTMLCanvasElement;\n\n public context: CanvasRenderingContext2D;\n\n public resolution: number;\n\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution: number)\n {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n resize(width: number, height: number): void\n {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n }\n\n /**\n * Destroys this canvas.\n *\n */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = val;\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = val;\n }\n}\n","interface Inset {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri {\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import * as _url from 'url';\n\nlet tempAnchor: HTMLAnchorElement|undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = window.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\nexport enum SHAPES {\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n","import { SHAPES } from '../const';\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nexport class Rectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.RECT;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get left(): number\n {\n return this.x;\n }\n\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get top(): number\n {\n return this.y;\n }\n\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Circle\n{\n public x: number;\n public y: number;\n public radius: number;\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ellipse\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n}\n","import { SHAPES } from '../const';\nimport type { IPoint } from '../IPoint';\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nexport class Polygon\n{\n public points: number[];\n public closeStroke: boolean;\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPoint[]|number[]);\n constructor(...points: IPoint[]|number[]);\n /**\n * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPoint[]|number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPoint).x, (flat[i] as IPoint).y);\n }\n\n flat = p;\n }\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = flat as number[];\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public radius: number;\n public readonly type: SHAPES.RREC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))\n {\n return true;\n }\n let dx = x - (this.x + this.radius);\n let dy = y - (this.y + this.radius);\n const radius2 = this.radius * this.radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class Point implements IPoint\n{\n public x: number;\n public y: number;\n\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class ObservablePoint implements IPoint\n{\n public cb: (this: T) => any;\n public scope: any;\n _x: number;\n _y: number;\n\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Matrix\n{\n public a: number;\n public b: number;\n public c: number;\n public d: number;\n public tx: number;\n public ty: number;\n\n public array: Float32Array|null = null;\n\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x - How much to translate x by\n * @param {number} y - How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x - The amount to scale horizontally\n * @param {number} y - The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n public worldTransform: Matrix;\n public localTransform: Matrix;\n public position: ObservablePoint;\n public scale: ObservablePoint;\n public pivot: ObservablePoint;\n public skew: ObservablePoint;\n public _parentID: number;\n _worldID: number;\n\n protected _rotation: number;\n protected _cx: number;\n protected _sx: number;\n protected _cy: number;\n protected _sy: number;\n protected _localID: number;\n protected _currentLocalID: number;\n\n constructor()\n {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n\n /**\n * Called when a value changes.\n *\n * @protected\n */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n /**\n * Updates the local transformation matrix.\n */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nexport class Bounds\n{\n public minX: number;\n public minY: number;\n public maxX: number;\n public maxY: number;\n public rect: Rectangle;\n public updateID: number;\n\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { DEG_TO_RAD, Matrix, Point, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Container } from './Container';\nimport { Bounds } from './Bounds';\n\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions {\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends GlobalMixins.DisplayObject, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should b e extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n public parent: DisplayObject;\n public worldAlpha: number;\n public transform: Transform;\n public alpha: number;\n public visible: boolean;\n public renderable: boolean;\n public filterArea: Rectangle;\n public filters: Filter[];\n public isSprite: boolean;\n public isMask: boolean;\n public _lastSortedIndex: number;\n public _mask: Container|MaskData;\n public _bounds: Bounds;\n public _localBounds: Bounds;\n\n protected _zIndex: number;\n protected _enabledFilters: Filter[];\n protected _boundsID: number;\n protected _boundsRect: Rectangle;\n protected _localBoundsRect: Rectangle;\n protected _destroyed: boolean;\n\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n this._bounds = new Bounds();\n\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n this._localBounds = null;\n\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n this._boundsID = 0;\n\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._boundsRect = null;\n\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n /**\n * Recalculates the bounds of the display object.\n */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal

(position: IPointData, from: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n destroy(_options?: IDestroyOptions|boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.removeAllListeners();\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this._mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.DisplayObject} current parent\n */\n enableTempParent(): DisplayObject\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param {PIXI.DisplayObject} cacheParent actual parent of element\n */\n disableTempParent(cacheParent: DisplayObject): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: ObservablePoint)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: ObservablePoint)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: ObservablePoint)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: ObservablePoint)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get mask(): Container|MaskData|null\n {\n return this._mask;\n }\n\n set mask(value: Container|MaskData|null)\n {\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n }\n}\n\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport { Rectangle } from '@pixi/math';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n public readonly children: DisplayObject[];\n public sortableChildren: boolean;\n public sortDirty: boolean;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n protected onChildrenChange(_length: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: T, index: number): T\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child: DisplayObject, child2: DisplayObject): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child: DisplayObject): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child: DisplayObject, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index: number): DisplayObject\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index: number): DisplayObject\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): DisplayObject[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).maskObject || child._mask) as Container;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n renderer.batch.flush();\n\n const filters = this.filters;\n const mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].render(renderer);\n }\n\n renderer.batch.flush();\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @function containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget {\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: true;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement {\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n","import { DisplayObject } from '@pixi/display';\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { accessibleTarget } from './accessibleTarget';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Container } from '@pixi/display';\nimport type { Renderer, AbstractRenderer } from '@pixi/core';\nimport type { IAccessibleHTMLElement } from './accessibleTarget';\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nexport class AccessibilityManager\n{\n public debug: boolean;\n public renderer: AbstractRenderer|Renderer;\n\n private _isActive: boolean;\n private _isMobileAccessibility: boolean;\n private _hookDiv: HTMLElement;\n private div: HTMLElement;\n private pool: IAccessibleHTMLElement[];\n private renderId: number;\n private children: DisplayObject[];\n private androidUpdateCount: number;\n private androidUpdateFrequency: number;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer|Renderer)\n {\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n this._isActive = false;\n\n this._isMobileAccessibility = false;\n\n /**\n * count to throttle div updates on android devices\n * @type number\n * @private\n */\n this.androidUpdateCount = 0;\n\n /**\n * the frequency to update the div elements ()\n * @private\n */\n this.androidUpdateFrequency = 500; // 2fps\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isActive(): boolean\n {\n return this._isActive;\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility(): boolean\n {\n return this._isMobileAccessibility;\n }\n\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n private createTouchHook(): void\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessability for this content';\n\n hookDiv.addEventListener('focus', () =>\n {\n this._isMobileAccessibility = true;\n this.activate();\n this.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n private destroyTouchHook(): void\n {\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n private activate(): void\n {\n if (this._isActive)\n {\n return;\n }\n\n this._isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).on('postrender', this.update, this);\n\n if ((this.renderer as AbstractRenderer).view.parentNode)\n {\n (this.renderer as AbstractRenderer).view.parentNode.appendChild(this.div);\n }\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n private deactivate(): void\n {\n if (!this._isActive || this._isMobileAccessibility)\n {\n return;\n }\n\n this._isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n private updateAccessibleObjects(displayObject: Container): void\n {\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i] as Container);\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n private update(): void\n {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n const now = performance.now();\n\n if (isMobile.android.device && now < this.androidUpdateCount)\n {\n return;\n }\n\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n\n if (!(this.renderer as Renderer).renderingToScreen)\n {\n return;\n }\n\n // update children...\n if (this.renderer._lastObjectRendered)\n {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered as Container);\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const rect = (this.renderer as AbstractRenderer).view.getBoundingClientRect();\n\n const resolution = this.renderer.resolution;\n\n const sx = (rect.width / (this.renderer as AbstractRenderer).width) * resolution;\n const sy = (rect.height / (this.renderer as AbstractRenderer).height) * resolution;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${(this.renderer as AbstractRenderer).width}px`;\n div.style.height = `${(this.renderer as AbstractRenderer).height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea as Rectangle;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) this.updateDebugHTML(div);\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n public updateDebugHTML(div: IAccessibleHTMLElement): void\n {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n public capHitArea(hitArea: Rectangle): void\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n if (hitArea.x + hitArea.width > (this.renderer as AbstractRenderer).width)\n {\n hitArea.width = (this.renderer as AbstractRenderer).width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > (this.renderer as AbstractRenderer).height)\n {\n hitArea.height = (this.renderer as AbstractRenderer).height - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n private addChild(displayObject: T): void\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) this.updateDebugHTML(div);\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n private _onClick(e: MouseEvent): void\n {\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'click', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'pointertap', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'tap', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n private _onFocus(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'assertive');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'mouseover', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n private _onFocusOut(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'polite');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent((e.target as any).displayObject, 'mouseout', interactionManager.eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n private _onKeyDown(e: KeyboardEvent): void\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n private _onMouseMove(e: MouseEvent): void\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n public destroy(): void\n {\n this.destroyTouchHook();\n this.div = null;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY {\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n public priority: number;\n public next: TickerListener;\n public previous: TickerListener;\n\n private fn: TickerCallback;\n private context: T;\n private once: boolean;\n private _destroyed: boolean;\n\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n static _shared: Ticker;\n static _system: Ticker;\n\n public autoStart: boolean;\n public deltaTime: number;\n public deltaMS: number;\n public elapsedMS: number;\n public lastTime: number;\n public speed: number;\n public started: boolean;\n\n private _head: TickerListener;\n private _requestId: number;\n private _maxElapsedMS: number;\n private _minElapsedMS: number;\n private _protected: boolean;\n private _lastFrame: number;\n private _tick: (time: number) => any;\n\n constructor()\n {\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / settings.TARGET_FPMS;\n\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n add(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n addOnce(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n remove(fn: TickerCallback, context: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { IApplicationOptions } from '@pixi/app';\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n","import { Point, IPointData } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\n\nexport type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionData\n{\n public global: Point;\n public target: DisplayObject;\n public originalEvent: InteractivePointerEvent;\n public identifier: number;\n public isPrimary: boolean;\n public button: number;\n public buttons: number;\n public width: number;\n public height: number;\n public tiltX: number;\n public tiltY: number;\n public pointerType: string;\n public pressure = 0;\n public rotationAngle = 0;\n public twist = 0;\n public tangentialPressure = 0;\n\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId(): number\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n public getLocalPosition

(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P\n {\n return displayObject.worldTransform.applyInverse

(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n public copyEvent(event: Touch | InteractivePointerEvent): void\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n const buttons = 'buttons' in event && event.buttons;\n\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n public reset(): void\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","import type { DisplayObject } from '@pixi/display';\nimport type { InteractionData } from './InteractionData';\n\nexport type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionEvent\n{\n public stopped: boolean;\n public stopsPropagatingAt: DisplayObject;\n public stopPropagationHint: boolean;\n public target: DisplayObject;\n public currentTarget: DisplayObject;\n public type: string;\n public data: InteractionData;\n\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n public stopPropagation(): void\n {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n }\n\n /**\n * Resets the event.\n */\n public reset(): void\n {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","export interface InteractionTrackingFlags\n{\n OVER: number;\n LEFT_DOWN: number;\n RIGHT_DOWN: number;\n NONE: number;\n}\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class InteractionTrackingData\n{\n public static FLAGS: Readonly = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n\n private readonly _pointerId: number;\n private _flags: number;\n\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n constructor(pointerId: number)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n private _doSet(flag: number, yn: boolean): void\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get pointerId(): number\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get flags(): number\n {\n return this._flags;\n }\n\n set flags(flags: number)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get none(): boolean\n {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get over(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n }\n\n set over(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get rightDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n set rightDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get leftDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n }\n\n set leftDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n }\n}\n","import { Point } from '@pixi/math';\n\nimport type { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport type { Container, DisplayObject } from '@pixi/display';\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TreeSearch\n{\n private readonly _tempPoint: Point;\n\n constructor()\n {\n this._tempPoint = new Point();\n }\n\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n public recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean, interactive?: boolean\n ): boolean\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!((displayObject._mask as any).containsPoint && (displayObject._mask as any).containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && (displayObject as Container).children)\n {\n const children = (displayObject as Container).children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && (displayObject as any).containsPoint)\n {\n if ((displayObject as any).containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n public findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n }\n}\n","import type { InteractionTrackingData } from './InteractionTrackingData';\n\nexport type Cursor = 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ns-resize'\n | 'ew-resize'\n | 'nesw-resize'\n | 'col-resize'\n | 'nwse-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out'\n | 'grab'\n | 'grabbing';\n\nexport interface IHitArea {\n contains(x: number, y: number): boolean;\n}\n\nexport interface InteractiveTarget {\n interactive: boolean;\n interactiveChildren: boolean;\n hitArea: IHitArea;\n cursor: Cursor | string;\n buttonMode: boolean;\n trackedPointers: {[x: number]: InteractionTrackingData};\n _trackedPointers: {[x: number]: InteractionTrackingData};\n}\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nexport const interactiveTarget: InteractiveTarget = {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode(): boolean\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value: boolean)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n","import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject, TemporaryDisplayObject } from '@pixi/display';\nimport { InteractionData, InteractivePointerEvent } from './InteractionData';\nimport { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport { InteractionTrackingData } from './InteractionTrackingData';\nimport { TreeSearch } from './TreeSearch';\nimport { EventEmitter } from '@pixi/utils';\nimport { interactiveTarget } from './interactiveTarget';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { Point, IPointData } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\nDisplayObject.mixin(interactiveTarget);\n\nconst MOUSE_POINTER_ID = 1;\n\n// Mock interface for hitTestEvent - only used inside hitTest()\ninterface TestInteractionEvent\n{\n target: DisplayObject;\n data: {global: Point};\n}\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent: TestInteractionEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\nexport interface InteractionManagerOptions {\n autoPreventDefault?: boolean;\n interactionFrequency?: number;\n useSystemTicker?: boolean;\n}\n\nexport interface DelayedEvent {\n displayObject: DisplayObject;\n eventString: string;\n eventData: InteractionEvent;\n}\n\ninterface CrossCSSStyleDeclaration extends CSSStyleDeclaration\n{\n msContentZooming: string;\n msTouchAction: string;\n}\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class InteractionManager extends EventEmitter\n{\n public readonly activeInteractionData: { [key: number]: InteractionData };\n public readonly supportsTouchEvents: boolean;\n public readonly supportsPointerEvents: boolean;\n public interactionDataPool: InteractionData[];\n public cursor: string;\n public delayedEvents: DelayedEvent[];\n public search: TreeSearch;\n public renderer: AbstractRenderer;\n public autoPreventDefault: boolean;\n public interactionFrequency: number;\n public mouse: InteractionData;\n public eventData: InteractionEvent;\n public moveWhenInside: boolean;\n public cursorStyles: Dict void) | CSSStyleDeclaration>;\n public currentCursorMode: string;\n public resolution: number;\n\n protected interactionDOMElement: HTMLElement;\n protected eventsAdded: boolean;\n protected tickerAdded: boolean;\n protected mouseOverRenderer: boolean;\n\n private _useSystemTicker: boolean;\n private _deltaTime: number;\n private _didMove: boolean;\n private _tempDisplayObject: DisplayObject;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n constructor(renderer: AbstractRenderer, options: InteractionManagerOptions)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n this.tickerAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObject = new TemporaryDisplayObject();\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get useSystemTicker(): boolean\n {\n return this._useSystemTicker;\n }\n set useSystemTicker(useSystemTicker: boolean)\n {\n this._useSystemTicker = useSystemTicker;\n\n if (useSystemTicker)\n {\n this.addTickerListener();\n }\n else\n {\n this.removeTickerListener();\n }\n }\n\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get lastObjectRendered(): DisplayObject\n {\n return this.renderer._lastObjectRendered || this._tempDisplayObject;\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n public hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent as InteractionEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n public setTargetElement(element: HTMLElement, resolution = 1): void\n {\n this.removeTickerListener();\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n\n this.addTickerListener();\n }\n\n /**\n * Add the ticker listener\n *\n * @private\n */\n private addTickerListener(): void\n {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker)\n {\n return;\n }\n\n Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n\n this.tickerAdded = true;\n }\n\n /**\n * Remove the ticker listener\n *\n * @private\n */\n private removeTickerListener(): void\n {\n if (!this.tickerAdded)\n {\n return;\n }\n\n Ticker.system.remove(this.tickerUpdate, this);\n\n this.tickerAdded = false;\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n private addEvents(): void\n {\n if (this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n private removeEvents(): void\n {\n if (!this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n public tickerUpdate(deltaTime: number): void\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n this.update();\n }\n\n /**\n * Updates the state of interactive objects.\n */\n public update(): void\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove)\n {\n this._didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent as PointerEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n public setCursorMode(mode: string): void\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n private dispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if ((displayObject as any)[eventString])\n {\n (displayObject as any)[eventString](eventData);\n }\n }\n }\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n private delayDispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n this.delayedEvents.push({ displayObject, eventString, eventData });\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n public mapPositionToPoint(point: IPointData, x: number, y: number): void\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * ((this.interactionDOMElement as any).width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * ((this.interactionDOMElement as any).height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n public processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n const hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n const delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n const delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (let i = 0; i < delayedLen; i++)\n {\n const { displayObject, eventString, eventData } = delayedEvents[i];\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject, eventString, eventData);\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n private onPointerDown(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && (events[0] as any).isNormalized)\n {\n const cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerDown(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n private onPointerComplete(originalEvent: InteractivePointerEvent, cancelled: boolean, func: InteractionCallback): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerCancel(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n private processPointerCancel(interactionEvent: InteractionEvent, displayObject: DisplayObject): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerUp(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerUp(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n private onPointerMove(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this._didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerMove(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n private onPointerOut(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerOverOut(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n private onPointerOver(originalEvent: InteractivePointerEvent): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n private getInteractionDataForPointerId(event: PointerEvent): InteractionData\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n private releaseInteractionDataForPointerId(pointerId: number): void\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n private configureInteractionEventForDOMEvent(interactionEvent: InteractionEvent, pointerEvent: PointerEvent,\n interactionData: InteractionData\n ): InteractionEvent\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n (pointerEvent as any).globalX = interactionData.global.x;\n (pointerEvent as any).globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n private normalizeToPointerData(event: InteractivePointerEvent): PointerEvent[]\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i] as PixiTouch;\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n const tempEvent = event as PixiPointerEvent;\n\n if (typeof tempEvent.isPrimary === 'undefined') tempEvent.isPrimary = true;\n if (typeof tempEvent.width === 'undefined') tempEvent.width = 1;\n if (typeof tempEvent.height === 'undefined') tempEvent.height = 1;\n if (typeof tempEvent.tiltX === 'undefined') tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === 'undefined') tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === 'undefined') tempEvent.pointerType = 'mouse';\n if (typeof tempEvent.pointerId === 'undefined') tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === 'undefined') tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === 'undefined') tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === 'undefined') tempEvent.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n\n normalizedEvents.push(tempEvent);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents as PointerEvent[];\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n public destroy(): void\n {\n this.removeEvents();\n\n this.removeTickerListener();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n }\n}\n\ninterface PixiPointerEvent extends PointerEvent\n{\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n isNormalized: boolean;\n}\n\ninterface PixiTouch extends Touch\n{\n button: number;\n buttons: number;\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n layerX: number;\n layerY: number;\n offsetX: number;\n offsetY: number;\n isNormalized: boolean;\n}\n","/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param {string} name - the function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /**\n * Remove all references, don't use after this.\n */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n","import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type{ ISize } from '@pixi/math';\nimport type{ ICubeResourceOptions } from './CubeResource';\nimport type{ ISVGResourceOptions } from './SVGResource';\nimport type{ IVideoResourceOptions } from './VideoResource';\n\n/**\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/**\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n | ICubeResourceOptions\n | IImageResourceOptions\n | ISVGResourceOptions\n | IVideoResourceOptions\n | IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: any): Resource;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: IAutoDetectOptions): Resource\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i];\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nexport abstract class Resource\n{\n public destroyed: boolean;\n public internal: boolean;\n protected _width: number;\n protected _height: number;\n protected onResize: Runner;\n protected onUpdate: Runner;\n protected onError: Runner;\n /**\n * @param {number} [width=0] - Width of the resource\n * @param {number} [height=0] - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new Runner('setRealSize');\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new Runner('update');\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param {number} width - X dimension\n * @param {number} height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /**\n * Has been updated trigger event\n */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BufferResource extends Resource\n{\n data: Float32Array|Uint8Array|Uint32Array;\n\n /**\n * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer\n * @param {object} options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array|Uint8Array|Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /**\n * Destroy and don't use after this\n * @override\n */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array|Uint8Array|Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap;\n\nexport interface IBaseTextureOptions {\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n resourceOptions?: any;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nexport class BaseTexture extends EventEmitter\n{\n public width: number;\n public height: number;\n public resolution: number;\n public alphaMode?: ALPHA_MODES;\n public mipmap?: MIPMAP_MODES;\n public anisotropicLevel?: number;\n public scaleMode?: SCALE_MODES;\n public wrapMode?: WRAP_MODES;\n public format?: FORMATS;\n public type?: TYPES;\n public target?: TARGETS;\n\n public readonly uid: number;\n touched: number;\n isPowerOfTwo: boolean;\n\n _glTextures: { [key: number]: GLTexture };\n dirtyId: number;\n dirtyStyleId: number;\n public cacheId: string;\n public valid: boolean;\n textureCacheIds: Array;\n public destroyed: boolean;\n public resource: Resource;\n _batchEnabled: number;\n _batchLocation: number;\n parentTextureArray: BaseTexture;\n\n constructor(resource: Resource | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = width || 0;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = height || 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n\n /**\n * How the texture wraps\n * @member {number}\n */\n this.wrapMode = wrapMode || settings.WRAP_MODE;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n this.format = format || FORMATS.RGBA;\n\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n this.type = type || TYPES.UNSIGNED_BYTE;\n\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n this.target = target || TARGETS.TEXTURE_2D;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {number}\n * @protected\n */\n this.uid = uid();\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n this.touched = 0;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n this._glTextures = {};\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n this.dirtyStyleId = 0;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n this.cacheId = null;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n this.valid = width > 0 && height > 0;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n this.textureCacheIds = [];\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n this.destroyed = false;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n this.resource = null;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchEnabled = 0;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchLocation = 0;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realWidth(): number\n {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n }\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realHeight(): number\n {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n }\n\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width - Visual width\n * @param {number} height - Visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setSize(width: number, height: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n setResource(resource: Resource): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource|string, options: IBaseTextureOptions,\n strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture|null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport { ISize } from '@pixi/math';\nimport { autoDetectResource, IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {object} [options] Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n readonly length: number;\n items: Array;\n itemDirtyIds: Array;\n private _load: Promise;\n\n baseTexture: BaseTexture;\n\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n /**\n * Collection of partial baseTextures that correspond to resources\n * @member {Array}\n * @readonly\n */\n this.items = [];\n\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n this.length = length;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Bound baseTexture, there can only be one\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n }\n\n /**\n * used from ArrayResource and CubeResource constructors\n * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param {object} [options] - detect options for resources\n * @protected\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.AbstractMultiResource} Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n constructor(source: number|Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n texture.format,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n texture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BaseImageResource extends Resource\n{\n public source: ImageSource;\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n this.source = source;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement|HTMLVideoElement, url: string, crossorigin: boolean|string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas|HTMLCanvasElement\n {\n const { OffscreenCanvas } = window;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Constructor options for CubeResource\n */\nexport interface ICubeResourceOptions extends ISize\n{\n autoLoad?: boolean;\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n linkBaseTexture: boolean;\n\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself\n * @member {boolean}\n * @protected\n */\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {object} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n autoLoad?: boolean;\n createBitmap?: boolean;\n crossorigin?: boolean|string;\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nexport class ImageResource extends BaseImageResource\n{\n url: string;\n private _load: Promise;\n private _process: Promise;\n preserveBitmap: boolean;\n createBitmap: boolean;\n alphaMode: ALPHA_MODES;\n bitmap: ImageBitmap;\n /**\n * @param {HTMLImageElement|string} source - image source or URL\n * @param {object} [options]\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement|string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n /**\n * URL of the image source\n * @member {string}\n */\n this.url = source.src;\n\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n this._process = null;\n\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n this.preserveBitmap = false;\n\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n this.bitmap = null;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap] - whether process image into bitmap\n * @returns {Promise}\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n this._process = (window.createImageBitmap as any)(source,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {string|HTMLImageElement} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string|HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean|string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\nexport class SVGResource extends BaseImageResource\n{\n public readonly svg: string;\n public readonly scale: number;\n readonly _overrideWidth: number;\n readonly _overrideHeight: number;\n private _resolve: () => void;\n private _load: Promise;\n private _crossorigin?: boolean|string;\n\n constructor(sourceBase64: string, options: ISVGResourceOptions)\n {\n options = options || {};\n\n super(document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n this.svg = sourceBase64;\n\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n this.scale = options.scale || 1;\n\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideWidth = options.width;\n\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideHeight = options.height;\n\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n this._resolve = null;\n\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n this._crossorigin = options.crossorigin;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if ((/^\\\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using regexp.\n *\n * @method\n * @param {string} svgString - a serialized svg element\n * @return {PIXI.ISize} image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && (/^data:image\\/svg\\+xml(;(charset=utf8|utf8))?;base64/).test(source))\n // source is SVG inline\n || (typeof source === 'string' && source.indexOf(']*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean|string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nexport class VideoResource extends BaseImageResource\n{\n protected _autoUpdate: boolean;\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n protected autoPlay: boolean;\n private _load: Promise;\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n constructor(source?: HTMLVideoElement|Array|string, options?: IVideoResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = true;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = options.autoPlay !== false;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n *\n * @private\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState === 3 || source.readyState === 4;\n }\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\n static TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @constant\n * @member {object}\n * @static\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {ImageBitmap} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\n/**\n * Collection of base resource types supported by PixiJS.\n *\n * Resources are used by {@link PIXI.BaseTexture} to handle different media types\n * such as images, video, SVG graphics, etc. In most use-cases, you should not\n * instantiate the resources directly. The easy thing is to use\n * {@link PIXI.BaseTexture.from}.\n * @example\n * const baseTexture = PIXI.BaseTexture.from('path/to/image.jpg');\n * @namespace PIXI.resources\n */\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import type { Renderer } from './Renderer';\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nexport class System\n{\n // public because of Filter usage,\n // protected because usually renderer it already known by those who use the system\n renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n destroy(): void\n {\n (this as any).renderer = null;\n }\n}\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0\n renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n public width: number;\n public height: number;\n public multisample: MSAA_QUALITY;\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.ceil(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.ceil(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(renderTexture, myContainer);\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable depth on the frame buffer\n */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable stencil on the frame buffer\n */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n maskStack: Array;\n filterStack: Array;\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated.\n */\n constructor(options: IBaseTextureOptions)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n super(null, options);\n\n const { width, height } = options || {};\n\n // Set defaults\n this.mipmap = 0;\n this.width = Math.ceil(width) || 100;\n this.height = Math.ceil(height) || 100;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)\n .addColorTexture(0, this);\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /**\n * Destroys this texture.\n */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n public x0: number;\n public y0: number;\n public x1: number;\n public y1: number;\n public x2: number;\n public y2: number;\n public x3: number;\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { IPointData } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string|BaseTexture|ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class Texture extends EventEmitter\n{\n public baseTexture: BaseTexture;\n public orig: Rectangle;\n public trim: Rectangle;\n public valid: boolean;\n public noFrame: boolean;\n public defaultAnchor: Point;\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n _updateID: number;\n _frame: Rectangle;\n _uvs: TextureUvs;\n textureCacheIds: Array;\n\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n this._uvs = DEFAULT_UVS;\n\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const resource = this.baseTexture as any;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n clone(): Texture\n {\n return new Texture(this.baseTexture,\n this.frame.clone(),\n this.orig.clone(),\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource, options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture)\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url The remote URL to load.\n * @param {object} [options] Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n static fromURL(url: string, options?: IBaseTextureOptions): Promise\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource as ImageResource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n static fromLoader(source: HTMLImageElement|HTMLCanvasElement, imageUrl: string, name: string): Texture\n {\n const resource = new ImageResource(source as any);\n\n resource.url = imageUrl;\n\n const baseTexture = new BaseTexture(resource, {\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n });\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n static removeFromCache(texture: string|Texture): Texture|null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.orig.height;\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n static readonly EMPTY: Texture;\n static readonly WHITE: Texture;\n}\n\nfunction createWhiteTexture(): Texture\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public filterFrame: Rectangle|null;\n public filterPoolKey: string|number|null;\n legacyRenderer: any;\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n // support for legacy..\n let _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n const width = arguments[1];\n const height = arguments[2];\n const scaleMode = arguments[3];\n const resolution = arguments[4];\n\n // we have an old render texture..\n console.warn(`Please use RenderTexture.create(${width}, ${height}) instead of the ctor directly.`);\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width,\n height,\n scaleMode,\n resolution,\n });\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n super(baseRenderTexture, frame);\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n this.filterFrame = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @member {PIXI.Framebuffer}\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return (this.baseTexture as BaseRenderTexture).framebuffer;\n }\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n resize(width: number, height: number, resizeBaseTexture = true): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n (this.baseTexture as BaseRenderTexture).resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n static create(options: IBaseTextureOptions): RenderTexture\n {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n public enableFullScreen: boolean;\n texturePool: {[x in string|number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n /**\n * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth - width of texture in pixels\n * @param {number} realHeight - height of texture in pixels\n * @returns {RenderTexture}\n */\n createTexture(realWidth: number, realHeight: number): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n let key: number|string = RenderTexturePool.SCREEN_KEY;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input: RenderTexture, resolution: number): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] - destroy all stored textures\n */\n clear(destroyTextures: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n const screenKey = RenderTexturePool.SCREEN_KEY;\n const textures = this.texturePool[screenKey];\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\n static SCREEN_KEY = 'screen';\n}\n","import type { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n /**\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data)\n */\n constructor(buffer: number, size = 0, normalized = false, type = 5126, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /**\n * Destroys the Attribute.\n */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n *\n * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nexport class Buffer\n{\n public data: ITypedArray;\n public index: boolean;\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param {boolean} [_static=true] - `true` for static buffer\n * @param {boolean} [index=false] - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n\n this._updateID = 0;\n\n this.index = index;\n\n this.static = _static;\n\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer): void\n {\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the buffer\n */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import type { ITypedArray } from '../Buffer';\n\nexport function getBufferType(array: ITypedArray): string|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from './utils/getBufferType';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n public instanced: boolean;\n public instanceCount: number;\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n refCount: number;\n /**\n * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional.\n * @param {object} [attributes] - of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param {String} id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start] - How far into the array to start reading values (used for interleaving data)\n * @param {boolean} [instance=false] - Instancing flag\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer|Float32Array|Uint32Array|Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * returns the requested attribute\n *\n * @param {String} id - the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * returns the requested buffer\n *\n * @param {String} id - the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.index = true;\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the geometry.\n */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n\n return geometry;\n }\n\n /**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries - array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n vertices: Float32Array;\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nexport class UniformGroup\n{\n public readonly uniforms: Dict;\n public readonly group: boolean;\n public id: number;\n syncUniforms: Dict;\n dirtyId: number;\n static: boolean;\n\n /**\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n * @param {boolean} [_static] - Uniforms wont be changed after creation\n */\n constructor(uniforms: Dict, _static?: boolean)\n {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n }\n\n update(): void\n {\n this.dirtyId++;\n }\n\n add(name: string, uniforms: Dict, _static: boolean): void\n {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n }\n\n static from(uniforms: Dict, _static: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static);\n }\n}\n","import { Rectangle } from '@pixi/math';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n target: IFilterTarget;\n legacy: boolean;\n resolution: number;\n sourceFrame: Rectangle;\n destinationFrame: Rectangle;\n filters: Array;\n\n constructor()\n {\n this.renderTexture = null;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new Rectangle();\n\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n }\n\n /**\n * clears the state\n * @private\n */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { System } from '../System';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\nimport { FilterState } from './FilterState';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class FilterSystem extends System\n{\n public readonly defaultFilterStack: Array;\n public statePool: Array;\n public texturePool: RenderTexturePool;\n public forceClear: boolean;\n public useMaxPadding: boolean;\n protected quad: Quad;\n protected quadUv: QuadUv;\n protected activeState: FilterState;\n protected globalUniforms: UniformGroup;\n private tempRect: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n this.defaultFilterStack = [{}] as any;\n\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n this.texturePool = new RenderTexturePool();\n\n this.texturePool.setScreenSize(renderer.view);\n\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n this.statePool = [];\n\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n this.quad = new Quad();\n\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n this.quadUv = new QuadUv();\n\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n this.tempRect = new Rectangle();\n\n /**\n * Active state\n * @member {object}\n */\n this.activeState = {} as any;\n\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n this.globalUniforms = new UniformGroup({\n outputFrame: this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n /**\n * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}\n * @member {boolean}\n */\n this.forceClear = false;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @member {boolean}\n * @default false\n */\n this.useMaxPadding = false;\n }\n\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n\n let resolution = filters[0].resolution;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n let legacy = filters[0].legacy;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || filter.legacy;\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n\n state.legacy = legacy;\n\n state.target = target;\n\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n if (autoFit)\n {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.renderTexture.clear();\n }\n\n /**\n * Pops off the filter and applies it.\n *\n */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n if (state.renderTexture.framebuffer.multisample > 1)\n {\n this.renderer.framebuffer.blit();\n }\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode = CLEAR_MODES.CLEAR): void\n {\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else\n {\n this.renderer.renderTexture.bind(filterTexture);\n }\n\n // TODO: remove in next major version\n if (typeof clearMode === 'boolean')\n {\n clearMode = clearMode ? CLEAR_MODES.CLEAR : CLEAR_MODES.BLEND;\n // get deprecation function from utils\n deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option');\n }\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && this.forceClear))\n {\n this.renderer.renderTexture.clear();\n }\n }\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /**\n * Destroys this Filter System.\n */\n destroy(): void\n {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input?: RenderTexture, resolution?: number): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /**\n * Empties the texture pool.\n */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n}\n","import type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nexport class ObjectRenderer\n{\n protected renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n flush(): void\n {\n // flush!\n }\n\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { System } from '../System';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class BatchSystem extends System\n{\n public readonly emptyRenderer: ObjectRenderer;\n public currentRenderer: ObjectRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(renderer);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Reset the system to an empty renderer\n */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param {PIXI.BaseTexture[]} - arr copy destination\n * @param {number} maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray - textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures\n * @param {number} batchId - marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { System } from '../System';\nimport { settings } from '../settings';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict {\n uint32Indices: boolean;\n}\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ContextSystem extends System\n{\n public webGLVersion: number;\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n /* eslint-disable camelcase */\n extensions:\n {\n drawBuffers?: WEBGL_draw_buffers;\n depthTexture?: OES_texture_float;\n loseContext?: WEBGL_lose_context;\n vertexArrayObject?: OES_vertex_array_object;\n anisotropicFiltering?: EXT_texture_filter_anisotropic;\n uint32ElementIndex?: OES_element_index_uint;\n floatTexture?: OES_texture_float;\n floatTextureLinear?: OES_texture_float_linear;\n textureHalfFloat?: OES_texture_half_float;\n textureHalfFloatLinear?: OES_texture_half_float_linear;\n colorBufferFloat?: WEBGL_color_buffer_float;\n };\n /* eslint-enable camelcase */\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n this.webGLVersion = 1;\n\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n this.extensions = {};\n\n /**\n * Features supported by current context\n * @member {object}\n * @private\n * @readonly\n * @property {boolean} uint32Indices - Supports of 32-bit indices buffer\n */\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl - new webgl context\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n }\n\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n event.preventDefault();\n }\n\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n public framebuffer: WebGLFramebuffer;\n public stencil: WebGLRenderbuffer;\n public multisample: MSAA_QUALITY;\n public msaaBuffer: WebGLRenderbuffer;\n public blitFramebuffer: Framebuffer;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = 0;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = 0;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = 0;\n\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class FramebufferSystem extends System\n{\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n for (let i = 0; i < colorTextures.length; i++)\n {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n updateFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1)\n {\n fbo.msaaBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n if (i === 0 && fbo.multisample > 1)\n {\n continue;\n }\n\n const texture = framebuffer.colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n }\n\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))\n {\n fbo.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture)\n { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (fbo.multisample <= 1)\n {\n return;\n }\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]);\n }\n framebuffer = fbo.blitFramebuffer;\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height,\n destPixels.x, destPixels.y, destPixels.width, destPixels.height,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n framebuffer.enableStencil();\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { System } from '../System';\nimport { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Buffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class GeometrySystem extends System\n{\n public hasVao: boolean;\n public hasInstance: boolean;\n public canUseUInt32ElementIndex: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n readonly managedGeometries: {[key: number]: Geometry};\n readonly managedBuffers: {[key: number]: Buffer};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this._activeGeometry = null;\n this._activeVao = null;\n\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n this.hasVao = true;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n this.hasInstance = true;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n this.canUseUInt32ElementIndex = false;\n\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedGeometries = {};\n\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedBuffers = {};\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry - instance of geometry to bind\n * @param {PIXI.Shader} [shader] - instance of shader to use vao for\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /**\n * Reset and unbind any active VAO and geometry\n */\n reset(): void\n {\n this.unbind();\n }\n\n /**\n * Update buffers\n * @protected\n */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n const { gl } = this;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n\n if (buffer._updateID !== glBuffer.updateID)\n {\n glBuffer.updateID = buffer._updateID;\n\n // TODO can cache this on buffer! maybe added a getter / setter?\n const type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n\n this._boundBuffer = glBuffer;\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n }\n\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry - to get signature from\n * @param {PIXI.Program} program - to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers\n */\n protected initGeometryVao(geometry: Geometry, program: Program, incRefCount = true): WebGLVertexArrayObject\n {\n this.checkCompatibility(geometry, program);\n\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n if (!buffer._glBuffers[CONTEXT_UID])\n {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeBuffer(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n let all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (let i = 0; i < all.length; i++)\n {\n this.disposeBuffer(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /**\n * Unbind/reset everything\n * @protected\n */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\n\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nexport class MaskData\n{\n public type: MASK_TYPES;\n public autoDetect: boolean;\n public maskObject: IMaskTarget;\n public pooled: boolean;\n public isMaskData: true;\n _stencilCounter: number;\n _scissorCounter: number;\n _scissorRect: Rectangle;\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = MASK_TYPES.NONE;\n\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n }\n\n /**\n * resets the mask data after popMask()\n */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n }\n\n /**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param src {string} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nexport function compileProgram(gl: WebGLRenderingContextBase, vertexSrc: string, fragmentSrc: string,\n attributeLocations?: Dict): WebGLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n let program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations)\n {\n for (const i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS))\n {\n console.warn(vertexSrc);\n console.error(gl.getShaderInfoLog(glVertShader));\n }\n\n if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS))\n {\n console.warn(fragmentSrc);\n console.error(gl.getShaderInfoLog(glFragShader));\n }\n\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nexport function defaultValue(type: string, size: number): number|Float32Array|Int32Array|boolean|boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = document.createElement('canvas');\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext);\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: string;\n\nexport function getMaxFragmentPrecision(): string\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: string, maxSupportedPrecision: string): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.shader\n * @param type {String}\n * @return {Number}\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any): boolean =>\n // eslint-disable-next-line max-len\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray,\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }`,\n\n vec2: `\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i].group)\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv[\"${i}\"], syncData);\n `);\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cv = ud[\"${i}\"].value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /**\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n defaultValue,\n compileProgram,\n mapSize,\n mapType,\n getTestContext,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n type: string;\n size: number;\n isArray: RegExpMatchArray;\n value: any;\n}\n\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n public vertexSrc: string;\n public fragmentSrc: string;\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n attributeData: { [key: string]: IAttributeData};\n uniformData: {[key: string]: IUniformData};\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name] - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\n protected extractData(vertexSrc: string, fragmentSrc: string): void\n {\n const gl = getTestContext();\n\n if (gl)\n {\n const program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n\n gl.deleteProgram(program);\n }\n else\n {\n this.uniformData = {};\n this.attributeData = {};\n }\n }\n\n /**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\n protected getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n {\n const attributes: {[key: string]: IAttributeData} = {};\n const attributesArray: Array = [];\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n const type = mapType(gl, attribData.type);\n\n /*eslint-disable */\n const data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n\n attributesArray.sort((a, b) => (a.name > b.name) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < attributesArray.length; i++)\n {\n attributesArray[i].location = i;\n }\n\n return attributes;\n }\n\n /**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\n private getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n {\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = uniformData.name.match(/\\[.*?\\]$/);\n const type = mapType(gl, uniformData.type);\n\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray:isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n\n return uniforms;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nexport class Shader\n{\n public program: Program;\n public uniformGroup: UniformGroup;\n /**\n * @param {PIXI.Program} [program] - The program the shader will use.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms: Dict)\n {\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (const i in program.uniformData)\n {\n if (this.uniformGroup.uniforms[i] instanceof Array)\n {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { State } from '../state/State';\nimport { settings } from '@pixi/settings';\nimport defaultVertex from './defaultFilter.vert';\nimport defaultFragment from './defaultFilter.frag';\n\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterSystem } from './FilterSystem';\nimport type { FilterState } from './FilterState';\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class Filter extends Shader\n{\n public padding: number;\n public resolution: number;\n public enabled: boolean;\n public autoFit: boolean;\n public legacy: boolean;\n state: State;\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n this.legacy = !!this.program.attributeData.aTextureCoord;\n\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n this.state = new State();\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * Used for caching shader IDs\n *\n * @static\n * @type {object}\n * @protected\n */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n public mapCoord: Matrix;\n public clampOffset: number;\n public clampMargin: number;\n readonly uClampFrame: Float32Array;\n readonly uClampOffset: Float32Array;\n _textureID: number;\n _updateID: number;\n _texture: Texture;\n isSimple: boolean;\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport { Matrix, Point } from '@pixi/math';\nimport { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n maskMatrix: Matrix;\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n constructor(sprite: IMaskTarget)\n {\n const maskMatrix = new Matrix();\n\n super(vertex, fragment);\n\n sprite.renderable = false;\n\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n this.maskSprite = sprite;\n\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n this.maskMatrix = maskMatrix;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this.maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { System } from '../System';\nimport { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class MaskSystem extends System\n{\n public enableScissor: boolean;\n protected readonly alphaMaskPool: Array;\n protected alphaMaskIndex: number;\n private readonly maskDataPool: Array;\n private maskStack: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n this.enableScissor = false;\n\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n this.alphaMaskPool = [];\n\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n this.maskDataPool = [];\n\n this.maskStack = [];\n\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData|IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n\n return;\n }\n maskData.type = MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect())\n {\n const matrix = maskObject.worldTransform;\n\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n\n let rotX = Math.atan2(matrix.b, matrix.a);\n let rotXY = Math.atan2(matrix.d, matrix.c);\n\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n\n if (rotX === 0 && rotXY === 9000)\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n popSpriteMask(): void\n {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n }\n}\n","import { System } from '../System';\n\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class AbstractMaskSystem extends System\n{\n protected maskStack: Array;\n protected glConst: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n this.glConst = 0;\n }\n\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /**\n * Destroys the mask stack.\n *\n */\n destroy(): void\n {\n super.destroy();\n\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n maskObject.renderable = true;\n\n const prevData = maskData._scissorRect;\n const bounds = maskObject.getBounds(true);\n const { gl } = this.renderer;\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n bounds.fit(prevData);\n }\n else\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n }\n\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n pop(): void\n {\n const { gl } = this.renderer;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n const rt = this.renderer.renderTexture.current;\n const { transform, sourceFrame, destinationFrame } = this.renderer.projection;\n const resolution = rt ? rt.resolution : this.renderer.resolution;\n let x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n let y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n const width = rect.width * resolution;\n const height = rect.height * resolution;\n\n if (transform)\n {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt)\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n\n this.renderer.gl.scissor(x, y, width, height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n _getBitwiseMask(): number\n {\n return (1 << this.getStackLength()) - 1;\n }\n}\n","import { System } from '../System';\nimport { Matrix } from '@pixi/math';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nexport class ProjectionSystem extends System\n{\n public destinationFrame: Rectangle;\n public sourceFrame: Rectangle;\n public defaultFrame: Rectangle;\n public projectionMatrix: Matrix;\n public transform: Matrix;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = null;\n\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.defaultFrame = null;\n\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle).\n *\n * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this.\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { BUFFER_BITS } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n// Temporary rectangle for passing the framebuffer viewport\nconst viewportFrame = new Rectangle();\n\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class RenderTextureSystem extends System\n{\n public clearColor: number[];\n public defaultMaskStack: Array;\n public current: RenderTexture;\n public readonly sourceFrame: Rectangle;\n public readonly destinationFrame: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n this.clearColor = renderer._backgroundColorRgba;\n\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n this.defaultMaskStack = [];\n\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n this.current = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture\n *\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n * @return {PIXI.Renderer} Returns itself.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /**\n * Resets renderTexture state\n */\n reset(): void\n {\n this.bind(null);\n }\n}\n","import type { Dict } from '@pixi/utils';\n\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nexport class GLProgram\n{\n public program: WebGLProgram;\n public uniformData: Dict;\n public uniformGroups: Dict;\n /**\n * Makes a new Pixi program\n *\n * @param program {WebGLProgram} webgl program\n * @param uniformData {Object} uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n }\n\n /**\n * Destroys this program\n */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n }\n}\n","import { System } from '../System';\nimport { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported, defaultValue, compileProgram } from './utils';\n\nimport type { IGLUniformData } from './GLProgram';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// defualt sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class ShaderSystem extends System\n{\n protected gl: IRenderingContext;\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n private cache: Dict;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n this.cache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n *\n * syncs uniforms on the group\n * @param {*} group - the uniform group to sync\n * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getglProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])\n {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n /* eslint-enable @typescript-eslint/explicit-module-boundary-types */\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData);\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group - the uniform group to get signature of\n * @param {Object} uniformData - uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n private getSignature(group: UniformGroup, uniformData: Dict): string\n {\n const uniforms = group.uniforms;\n\n const strings = [];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n getglProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader - the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n generateShader(shader: Shader): GLProgram\n {\n const gl = this.gl;\n\n const program = shader.program;\n\n const attribMap: Dict = {};\n\n for (const i in program.attributeData)\n {\n attribMap[i] = program.attributeData[i].location;\n }\n\n const shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(shaderProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(shaderProgram, uniformData);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Destroys this System and removes all its textures\n */\n destroy(): void\n {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { System } from '../System';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StateSystem extends System\n{\n public stateId: number;\n public polygonOffset: number;\n public blendMode: BLEND_MODES;\n protected _blendEq: boolean;\n protected gl: IRenderingContext;\n protected blendModes: number[][];\n protected readonly map: Array<(value: boolean) => void>;\n protected readonly checks: Array<(system: this, state: State) => void>;\n protected defaultState: State;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = null;\n\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n this.stateId = 0;\n\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n this.polygonOffset = 0;\n\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n this.blendMode = BLEND_MODES.NONE;\n\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n this._blendEq = false;\n\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n this.map = [];\n\n // map functions for when we set state..\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n this.checks = [];\n\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func - the checking function to add or remove\n * @param {boolean} value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n}\n","import { System } from '../System';\nimport { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture {\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class TextureGCSystem extends System\n{\n public count: number;\n public checkCount: number;\n public maxIdle: number;\n public checkCountMax: number;\n public mode: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n}\n","/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLTexture\n{\n public texture: WebGLTexture;\n public width: number;\n public height: number;\n public mipmap: boolean;\n public wrapMode: number;\n public type: number;\n public internalFormat: number;\n dirtyId: number;\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n }\n}\n","import { System } from '../System';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES } from '@pixi/constants';\n\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class TextureSystem extends System\n{\n public boundTextures: BaseTexture[];\n public managedTextures: Array;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected webGLVersion: number;\n protected unknownTexture: BaseTexture;\n protected _unknownBoundTextures: boolean;\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n bind(texture: Texture|BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n if (texture)\n {\n texture = texture.castToBaseTexture();\n\n if (!texture || texture.parentTextureArray)\n {\n // cannot bind partial texture\n // TODO: report a warning\n return;\n }\n\n if (texture.valid)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2)\n {\n return;\n }\n const gl = this.renderer.gl;\n\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === TYPES.HALF_FLOAT)\n {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA16F;\n }\n }\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture|Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n}\n","import { hex2string, hex2rgb, deprecation, EventEmitter } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { DisplayObject } from '@pixi/display';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Container } from '@pixi/display';\n\nconst tempMatrix = new Matrix();\n\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n width?: number;\n height?: number;\n view?: HTMLCanvasElement;\n transparent?: boolean | 'notMultiplied';\n autoDensity?: boolean;\n antialias?: boolean;\n resolution?: number;\n preserveDrawingBuffer?: boolean;\n clearBeforeRender?: boolean;\n backgroundColor?: number;\n powerPreference?: WebGLPowerPreference;\n context?: IRenderingContext;\n}\n\ninterface IRendererOptionsLegacy extends IRendererOptions\n{\n autoResize?: boolean;\n roundPixels?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly transparent: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: DisplayObject;\n\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n // Deprecation notice for renderer roundPixels option\n if ((options as IRendererOptionsLegacy).roundPixels)\n {\n settings.ROUND_PIXELS = (options as IRendererOptionsLegacy).roundPixels;\n deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n this.autoDensity = options.autoDensity || (options as IRendererOptionsLegacy).autoResize || false;\n // autoResize is deprecated, provides fallback support\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n generateTexture(displayObject: DisplayObject,\n scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture\n {\n region = region || (displayObject as Container).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width | 0,\n height: region.height | 0,\n scaleMode,\n resolution,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n }\n\n abstract render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\n\nimport type { IRendererOptions, IRendererPlugins } from './AbstractRenderer';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { DisplayObject } from '@pixi/display';\nimport type { System } from './System';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Extract } from '@pixi/extract';\n\nexport interface IRendererPluginConstructor {\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin {\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class Renderer extends AbstractRenderer\n{\n public gl: IRenderingContext;\n public globalUniforms: UniformGroup;\n public CONTEXT_UID: number;\n public renderingToScreen: boolean;\n public extract: Extract;\n // systems\n public mask: MaskSystem;\n public context: ContextSystem;\n public state: StateSystem;\n public shader: ShaderSystem;\n public texture: TextureSystem;\n public geometry: GeometrySystem;\n public framebuffer: FramebufferSystem;\n public scissor: ScissorSystem;\n public stencil: StencilSystem;\n public projection: ProjectionSystem;\n public textureGC: TextureGCSystem;\n public filter: FilterSystem;\n public renderTexture: RenderTextureSystem;\n public batch: BatchSystem;\n\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @static\n * @private\n */\n static create(options: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n * @public\n */\n constructor(options? : IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n // TODO legacy!\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n addSystem(ClassRef: { new(renderer: Renderer): T}, name: string): this\n {\n if (!name)\n {\n name = ClassRef.name;\n }\n\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n this.runners.resize.emit(screenWidth, screenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /**\n * Clear the frame buffer\n */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.Renderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n */\n\n static __plugins: IRendererPlugins;\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n }\n}\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n public elements: BaseTexture[];\n public ids: number[];\n public count: number;\n\n constructor()\n {\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n public rawBinaryData: ArrayBuffer;\n public uint32View: Uint32Array;\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n constructor(size: number)\n {\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n */\nexport interface IBatchableElement {\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public size: number;\n public MAX_TEXTURES: number;\n\n protected shaderGenerator: BatchShaderGenerator;\n protected geometryClass: typeof BatchGeometry;\n protected vertexSize: number;\n protected _vertexCount: number;\n protected _indexCount: number;\n protected _bufferedElements: Array;\n protected _bufferedTextures: Array;\n protected _bufferSize: number;\n protected _shader: Shader;\n protected _flushId: number;\n protected _aBuffers: Array;\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n private _packedGeometries: Array;\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n this.shaderGenerator = null;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n this.geometryClass = null;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n this.vertexSize = null;\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._vertexCount = 0;\n\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._indexCount = 0;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n this._bufferedElements = [];\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n this._bufferedTextures = [];\n\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n this._bufferSize = 0;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n this._shader = null;\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n this._packedGeometries = [];\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n this._packedGeometryPoolSize = 2;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n this._flushId = 0;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n this._aBuffers = {} as any;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n this._iBuffers = {} as any;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /**\n * Renders the content _now_ and empties the current batch.\n */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /**\n * Starts a new sprite batch.\n */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /**\n * Stops and flushes the current batch.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n public vertexSrc: string;\n public fragTemplate: string;\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n /**\n * @param {string} vertexSrc - Vertex shader\n * @param {string} fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n _buffer: Buffer;\n _indexBuffer: Buffer;\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._buffer = new Buffer(null, _static, false);\n\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @static\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n","import { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer, IRendererOptionsAuto, AbstractRenderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IApplicationPlugin {\n init: (...params: any[]) => any;\n destroy: (...params: any[]) => any;\n}\n\nexport interface IApplicationOptions extends IRendererOptionsAuto {\n autoStart?: boolean;\n sharedTicker?: boolean;\n sharedLoader?: boolean;\n resizeTo?: Window | HTMLElement;\n resizeThrottle?: number;\n}\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport class Application\n{\n public static _plugins: IApplicationPlugin[];\n\n public stage: Container;\n public renderer: Renderer|AbstractRenderer;\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n constructor(options?: IApplicationOptions)\n {\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n // install plugins here\n Application._plugins.forEach((plugin) =>\n {\n plugin.init.call(this, options);\n });\n }\n\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\n static registerPlugin(plugin: IApplicationPlugin): void\n {\n Application._plugins.push(plugin);\n }\n\n /**\n * Render the current stage.\n */\n public render(): void\n {\n // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject\n // This can be fixed when CanvasRenderer is converted.\n this.renderer.render(this.stage as any);\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view(): HTMLCanvasElement\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen(): Rectangle\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n public destroy(removeView?: boolean, stageOptions?: IDestroyOptions|boolean): void\n {\n // Destroy plugins in the opposite order\n // which they were constructed\n const plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach((plugin) =>\n {\n plugin.destroy.call(this);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n }\n}\n\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n","import type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Renderer } from '@pixi/core';\nimport type { IApplicationOptions } from './Application';\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nexport class ResizePlugin\n{\n public static resizeTo: Window|HTMLElement;\n public static resize: () => void;\n public static renderer: Renderer|CanvasRenderer;\n public static queueResize: () => void;\n private static _resizeId: number;\n private static _resizeTo: Window|HTMLElement;\n private static cancelResize: () => void;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo',\n {\n set(dom: Window|HTMLElement)\n {\n window.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom)\n {\n window.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * Resize is throttled, so it's\n * safe to call this multiple times per frame and it'll\n * only be called once.\n * @method PIXI.Application#queueResize\n */\n this.queueResize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n this.cancelResize();\n\n // // Throttle resize events per raf\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n\n /**\n * Cancel the resize queue.\n * @method PIXI.Application#cancelResize\n * @private\n */\n this.cancelResize = (): void =>\n {\n if (this._resizeId)\n {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n * @method PIXI.Application#resize\n */\n this.resize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n // clear queue resize\n this.cancelResize();\n\n let width: number;\n let height: number;\n\n // Resize to the window\n if (this._resizeTo === window)\n {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n // Resize to other HTML entities\n else\n {\n const { clientWidth, clientHeight } = this._resizeTo as HTMLElement;\n\n width = clientWidth;\n height = clientHeight;\n }\n\n this.renderer.resize(width, height);\n };\n\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n static destroy(): void\n {\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n","import { Application } from './Application';\nimport { ResizePlugin } from './ResizePlugin';\n\nApplication.registerPlugin(ResizePlugin);\n\nexport * from './Application';\n","import { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { RenderTexture } from '@pixi/core';\n\nimport type { Renderer, IRendererPlugin } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\n\nconst TEMP_RECT = new Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nexport class Extract implements IRendererPlugin\n{\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.Extract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n let canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n const target = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n\n target.context.scale(1, -1);\n\n // we can't render to itself because we should be empty before render.\n target.context.drawImage(canvasBuffer.canvas, 0, -height);\n\n canvasBuffer.destroy();\n canvasBuffer = target;\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8Array\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\n static arrayPostDivide(\n pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray\n ): void\n {\n for (let i = 0; i < pixels.length; i += 4)\n {\n const alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n }\n}\n","'use strict'\n\nfunction parseURI (str, opts) {\n if (!str) return undefined\n\n opts = opts || {}\n\n var o = {\n key: [\n 'source',\n 'protocol',\n 'authority',\n 'userInfo',\n 'user',\n 'password',\n 'host',\n 'port',\n 'relative',\n 'path',\n 'directory',\n 'file',\n 'query',\n 'anchor'\n ],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n\nmodule.exports = parseURI\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() { /* empty */ }\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\nexport function eachSeries(array, iterator, callback, deferNext) {\n let i = 0;\n const len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(() => {\n iterator(array[i++], next);\n }, 1);\n }\n else {\n iterator(array[i++], next);\n }\n })();\n}\n\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\nexport function queue(worker, concurrency) {\n if (concurrency == null) { // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n }\n else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n let workers = 0;\n const q = {\n _tasks: [],\n concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push(data, callback) {\n _insert(data, false, callback);\n },\n kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift(data, callback) {\n _insert(data, true, callback);\n },\n process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n const task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length() {\n return q._tasks.length;\n },\n running() {\n return workers;\n },\n idle() {\n return q._tasks.length + workers === 0;\n },\n pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false;\n\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n },\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') { // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) { // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(() => q.drain(), 1);\n\n return;\n }\n\n const item = {\n data,\n callback: typeof callback === 'function' ? callback : _noop,\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n }\n else {\n q._tasks.push(item);\n }\n\n setTimeout(() => q.process(), 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) { // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= (q.concurrency - q.buffer)) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n","// a simple in-memory cache for resources\nconst cache = {};\n\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function caching(resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(() => (cache[this.url] = this.data));\n }\n\n next();\n}\n","import parseUri from 'parse-uri';\nimport Signal from 'mini-signals';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nconst useXdr = !!(window.XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\nlet tempAnchor = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop() { /* empty */ }\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\nclass Resource {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n constructor(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.url = url;\n\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.extension = this._getExtension();\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n this.timeout = options.timeout || 0;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n this.metadata = options.metadata || {};\n\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n this.error = null;\n\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n this.children = [];\n\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n this.type = Resource.TYPE.UNKNOWN;\n\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n this.progressChunk = 0;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._dequeue = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._onLoadBinding = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n this._elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n get isDataUrl() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n get isComplete() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n get isLoading() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n\n /**\n * Marks the resource as complete.\n *\n */\n complete() {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr) {\n this.xhr.abort();\n }\n else if (this.xdr) {\n this.xdr.abort();\n }\n else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n }\n // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb) {\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n }\n else {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n _setFlag(flag, value) {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /**\n * Finalizes the load.\n *\n * @private\n */\n _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url)) {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i) {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n _createSource(type, url, mime) {\n if (!mime) {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n _onError(event) {\n this.abort(`Failed to load element using: ${event.target.nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n _onTimeout() {\n this.abort(`Load timed out.`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnError() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnTimeout() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnAbort() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n _xhrOnLoad() {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n }\n else {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n const protocol = url.protocol ? `${url.protocol}:` : '';\n\n // if cross origin\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n _getExtension() {\n let url = this.url;\n let ext = '';\n\n if (this.isDataUrl) {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: (1 << 0),\n COMPLETE: (1 << 1),\n LOADING: (1 << 2),\n};\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6,\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4,\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n /** Blob */\n BLOB: 'blob',\n /** Document */\n DOCUMENT: 'document',\n /** Object */\n JSON: 'json',\n /** String */\n TEXT: 'text',\n};\n\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO,\n};\n\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n};\n\n// We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nexport { Resource };\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input) {\n let output = '';\n let inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { Resource } from '../Resource';\nimport { encodeBinary } from '../encodeBinary';\n\nconst Url = window.URL || window.webkitURL;\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function parsing(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () => {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () => {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import Signal from 'mini-signals';\nimport parseUri from 'parse-uri';\nimport * as async from './async';\nimport { Resource } from './Resource';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\nclass Loader {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10) {\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n this.loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n this.defaultQueryString = '';\n\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n this._resourcesParsing = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n this.resources = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n this.onError = new Signal();\n\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n this.onLoad = new Signal();\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n // Add default before middleware\n for (let i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n }\n\n // Add default after middleware\n for (let i = 0; i < Loader._defaultAfterMiddleware.length; ++i) {\n this.use(Loader._defaultAfterMiddleware[i]);\n }\n }\n\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (let i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading) {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i) {\n if (!parent.children[i].isComplete) {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i) {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources) {\n const res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n this._onComplete();\n }\n else {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n get concurrency() {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n set concurrency(concurrency) {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _prepareUrl(url) {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n ) {\n result = `${this.baseUrl}/${url}`;\n }\n else {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString) {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += `&${this.defaultQueryString}`;\n }\n else {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n _loadResource(resource, dequeue) {\n resource._dequeue = dequeue;\n\n // run before middleware\n async.eachSeries(\n this._beforeMiddleware,\n (fn, next) => {\n fn.call(this, resource, () => {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () => {\n if (resource.isComplete) {\n this._onLoad(resource);\n }\n else {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /**\n * Called once loading has started.\n *\n * @private\n */\n _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n _onLoad(resource) {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n async.eachSeries(\n this._afterMiddleware,\n (fn, next) => {\n fn.call(this, resource, next);\n },\n () => {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error) {\n this.onError.dispatch(resource.error, this, resource);\n }\n else {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0) {\n this._onComplete();\n }\n },\n true\n );\n }\n}\n\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultBeforeMiddleware = [];\n\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultAfterMiddleware = [];\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\nexport { Loader };\n\n","import { Resource } from 'resource-loader';\n\nimport type { Spritesheet } from '@pixi/spritesheet';\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, Resource.IMetadata {\n imageMetadata?: any;\n}\nexport interface ILoaderResource extends GlobalMixins.ILoaderResource, Resource\n{\n texture?: Texture;\n spritesheet?: Spritesheet;\n\n // required for Spritesheet\n textures?: Dict;\n\n // required specific type for Spritesheet\n metadata: IResourceMetadata;\n}\n\n// Mix constructor and typeof Resource , otherwise we can't access to statics field\ntype TLoaderResource = { new(...args: any[]): ILoaderResource } & typeof Resource;\n\n/**\n* Reference to **{@link https://github.com/englercj/resource-loader\n* resource-loader}**'s Resource class.\n* @see http://englercj.github.io/resource-loader/Resource.html\n* @class LoaderResource\n* @memberof PIXI\n*/\nexport const LoaderResource: TLoaderResource = Resource;\n","import { Resource } from 'resource-loader';\nimport { Texture } from '@pixi/core';\n\nimport type { ILoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class TextureLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n public static use(resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n }\n}\n","import { Loader as ResourceLoader, middleware } from 'resource-loader';\nimport { TextureLoader } from './TextureLoader';\n\nimport type { Resource } from 'resource-loader';\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nexport class Loader extends ResourceLoader\n{\n /**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\n private static _plugins: Array = [];\n private static _shared: Loader;\n private _protected: boolean;\n\n constructor(baseUrl?: string, concurrency?: number)\n {\n super(baseUrl, concurrency);\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n }\n\n /**\n * Destroy the loader, removes references.\n * @memberof PIXI.Loader#\n * @method destroy\n * @public\n */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n }\n}\n\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: middleware.parsing });\n\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n\nexport interface ILoaderPlugin {\n add?(): void;\n pre?(resource: Resource, next?: (...args: any[]) => void): void;\n use?(resource: Resource, next?: (...args: any[]) => void): void;\n}\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef {object} ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {object} ICallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalCallback\n * @param {function} callback - Callback function\n * @param {object} [context] - Context\n * @returns {ICallbackID} - CallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalDetach\n * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef ILoaderSignal\n * @property {ISignalCallback} add - Register callback\n * @property {ISignalCallback} once - Register oneshot callback\n * @property {ISignalDetach} detach - Detach specific callback by ID\n */\n\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when the loader begins to loading process.\n * @member {PIXI.Loader.ILoaderSignal} onStart\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded or errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onProgress\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onError\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded resource.\n * @member {PIXI.Loader.ILoaderSignal} onLoad\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when completely loaded all resources.\n * @member {PIXI.Loader.ILoaderSignal} onComplete\n */\n","import { Loader } from './Loader';\n\nimport type { IApplicationOptions } from '@pixi/app';\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n public static loader: Loader;\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n static init(options?: IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { hex2rgb } from '@pixi/utils';\n\nimport type { BaseTexture, Renderer } from '@pixi/core';\nimport type { ParticleBuffer } from './ParticleBuffer';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IParticleProperties {\n vertices?: boolean;\n position?: boolean;\n rotation?: boolean;\n uvs?: boolean;\n tint?: boolean;\n alpha?: boolean;\n scale?: boolean;\n}\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class ParticleContainer extends Container\n{\n public readonly blendMode: BLEND_MODES;\n public autoResize: boolean;\n public roundPixels: boolean;\n public baseTexture: BaseTexture;\n public tintRgb: Float32Array;\n\n _maxSize: number;\n _buffers: ParticleBuffer[];\n _batchSize: number;\n _properties: boolean[];\n _bufferUpdateIDs: number[];\n _updateID: number;\n private _tint: number;\n\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] - If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n constructor(maxSize = 1500, properties: IParticleProperties, batchSize = 16384, autoResize = false)\n {\n super();\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n const maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {Array}\n * @private\n */\n this._buffers = null;\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n public setProperties(properties: IParticleProperties): void\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform(): void\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n }\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n public render(renderer: Renderer): void\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = (this.children[0] as any)._texture.baseTexture;\n if (!this.baseTexture.valid)\n {\n this.baseTexture.once('update', () => this.onChildrenChange(0));\n }\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n }\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n protected onChildrenChange(smallestChildIndex: number): void\n {\n const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n }\n\n public dispose(): void\n {\n if (this._buffers)\n {\n for (let i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n\n this._buffers = null;\n }\n }\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.dispose();\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n }\n}\n","import { createIndicesForQuads } from '@pixi/utils';\nimport { Geometry, Buffer } from '@pixi/core';\nimport { TYPES } from '@pixi/constants';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { IParticleRendererProperty } from './ParticleRenderer';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class ParticleBuffer\n{\n public geometry: Geometry;\n public staticStride: number;\n public staticBuffer: Buffer;\n public staticData: Float32Array;\n public staticDataUint32: Uint32Array;\n public dynamicStride: number;\n public dynamicBuffer: Buffer;\n public dynamicData: Float32Array;\n public dynamicDataUint32: Uint32Array;\n public _updateID: number;\n\n indexBuffer: Buffer;\n private size: number;\n private dynamicProperties: IParticleRendererProperty[];\n private staticProperties: IParticleRendererProperty[];\n\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(properties: IParticleRendererProperty[], dynamicPropertyFlags: boolean[], size: number)\n {\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n private initBuffers(): void\n {\n const geometry = this.geometry;\n\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.dynamicBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.staticBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n }\n\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n destroy(): void\n {\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { ObjectRenderer, Shader, State } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { ParticleBuffer } from './ParticleBuffer';\nimport fragment from './particles.frag';\nimport vertex from './particles.vert';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { ParticleContainer } from './ParticleContainer';\nimport type { Renderer } from '@pixi/core';\n\nexport interface IParticleRendererProperty {\n attributeName: string;\n size: number;\n type?: TYPES;\n uploadFunction: (...params: any[]) => any;\n offset: number;\n}\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nexport class ParticleRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public shader: Shader;\n public tempMatrix: Matrix;\n public properties: IParticleRendererProperty[];\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n\n this.shader = Shader.from(vertex, fragment, {});\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n public render(container: ParticleContainer): void\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n const baseTexture = (children[0] as any)._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n private generateBuffers(container: ParticleContainer): ParticleBuffer[]\n {\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n private _generateOneMoreBuffer(container: ParticleContainer): ParticleBuffer\n {\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadVertices(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadPosition(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadRotation(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadUvs(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = (children[startIndex + i] as any)._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadTint(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n const alpha = sprite.alpha;\n\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied\n ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n */\n public destroy(): void\n {\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n }\n}\n","/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n *\n * @name LINE_JOIN\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet\n * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @property {string} ROUND - 'round': add an arc at the joint\n */\nexport enum LINE_JOIN {\n MITER = 'miter',\n BEVEL = 'bevel',\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n *\n * @name LINE_CAP\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @property {string} ROUND - 'round': add semicircle at ends\n * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end)\n */\nexport enum LINE_CAP {\n BUTT = 'butt',\n ROUND = 'round',\n SQUARE = 'square'\n}\n\nexport interface IGraphicsCurvesSettings {\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nexport const GRAPHICS_CURVES: IGraphicsCurvesSettings = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n","import { Texture } from '@pixi/core';\nimport type { Matrix } from '@pixi/math';\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform aplpied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n public matrix: Matrix = null;\n\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /**\n * Reset\n */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /**\n * Destroy and don't use after this\n */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n","import { earcut } from '@pixi/utils';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Polygon } from '@pixi/math';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n","// for type only\nimport { SHAPES } from '@pixi/math';\n\nimport type { Circle, Ellipse } from '@pixi/math';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildCircle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape as Circle;\n const points = graphicsData.points;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n const ellipseData = graphicsData.shape as Ellipse;\n\n width = ellipseData.width;\n height = ellipseData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n let totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n\n totalSegs /= 2.3;\n\n const seg = (Math.PI * 2) / totalSegs;\n\n for (let i = 0; i < totalSegs - 0.5; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(points[0], points[1]);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n let vertPos = verts.length / 2;\n const center = vertPos;\n\n const circle = (graphicsData.shape) as Circle;\n const matrix = graphicsData.matrix;\n const x = circle.x;\n const y = circle.y;\n\n // Push center (special point)\n verts.push(\n graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x,\n graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n\n for (let i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n","import type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n","import { earcut } from '@pixi/utils';\n\n// for type only\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { RoundedRectangle } from '@pixi/math';\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1: number, n2: number, perc: number): number\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number,\n out: Array = []): Array\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n const rrectData = graphicsData.shape as RoundedRectangle;\n const points = graphicsData.points;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n // Don't allow negative radius or greater than half the smallest width\n const radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n\n points.length = 0;\n\n // No radius, do a simple rectangle\n if (!radius)\n {\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n }\n else\n {\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n }\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n const vecPos = verts.length / 2;\n\n const triangles = earcut(points, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = points.length; i < j; i++)\n {\n verts.push(points[i], points[++i]);\n }\n },\n};\n","import { Point, SHAPES } from '@pixi/math';\n\nimport type { Polygon } from '@pixi/math';\nimport type { GraphicsData } from '../GraphicsData';\nimport type { GraphicsGeometry } from '../GraphicsGeometry';\nimport { LINE_JOIN, LINE_CAP } from '../const';\nimport { GRAPHICS_CURVES } from '../const';\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(\n x: number,\n y: number,\n nx: number,\n ny: number,\n innerWeight: number,\n outerWeight: number,\n clockwise: boolean, /* rotation for square (true at left end, false at right end) */\n verts: Array\n): number\n{\n const ix = x - (nx * innerWeight);\n const iy = y - (ny * innerWeight);\n const ox = x + (nx * outerWeight);\n const oy = y + (ny * outerWeight);\n\n /* Rotate nx,ny for extension vector */\n let exx; let\n eyy;\n\n if (clockwise)\n {\n exx = ny;\n eyy = -nx;\n }\n else\n {\n exx = -ny;\n eyy = nx;\n }\n\n /* [i|0]x,y extended at cap */\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n\n return 2;\n}\n\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(\n cx: number,\n cy: number,\n sx: number,\n sy: number,\n ex: number,\n ey: number,\n verts: Array,\n clockwise: boolean, /* if not cap, then clockwise is turn of joint, otherwise rotation from angle0 to angle1 */\n): number\n{\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n\n if (clockwise && angle0 < angle1)\n {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1)\n {\n angle1 += Math.PI * 2;\n }\n\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n\n const radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n const segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n const angleInc = angleDiff / segCount;\n\n startAngle += angleInc;\n\n if (clockwise)\n {\n verts.push(cx, cy);\n verts.push(sx, sy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n }\n\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else\n {\n verts.push(sx, sy);\n verts.push(cx, cy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n\n return segCount * 2;\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n const shape = graphicsData.shape as Polygon;\n let points = graphicsData.points || shape.points.slice();\n const eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n const style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = graphicsGeometry.points;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n\n // Max. inner and outer width\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n\n /* Line segments of interest where (x1,y1) forms the corner. */\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n let perpx = -(y0 - y1);\n let perpy = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = style.alignment;// 0.5;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x0 - (perpx * (innerWeight - outerWeight) * 0.5),\n y0 - (perpy * (innerWeight - outerWeight) * 0.5),\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight),\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight),\n verts,\n true,\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n\n // Push first point (below & above vertices)\n verts.push(\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight));\n verts.push(\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight));\n\n for (let i = 1; i < length - 1; ++i)\n {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n\n /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n const cross = (dy0 * dx1) - (dy1 * dx0);\n const clockwise = (cross < 0);\n\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1)\n {\n verts.push(\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight));\n verts.push(\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight));\n\n continue;\n }\n\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n const c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n const c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n const px = ((dx0 * c2) - (dx1 * c1)) / cross;\n const py = ((dy1 * c1) - (dy0 * c2)) / cross;\n const pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n\n /* Inner miter point */\n const imx = x1 + ((px - x1) * innerWeight);\n const imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n const omx = x1 - ((px - x1) * outerWeight);\n const omy = y1 - ((py - y1) * outerWeight);\n\n /* Is the inside miter point too far away, creating a spike? */\n const smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n const insideMiterOk = pdist <= smallerInsideDiagonalSq;\n\n if (insideMiterOk)\n {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n if (clockwise) /* rotating at inner angle */\n {\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));// first segment's outer vertex\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));// second segment's outer vertex\n }\n else /* rotating at outer angle */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));// first segment's inner vertex\n verts.push(omx, omy);// outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));// second segment's outer vertex\n verts.push(omx, omy);// outer miter point\n }\n\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 4;\n\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 4;\n\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else\n {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n // Nothing needed\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 2;\n }\n else /* arc is inside */\n {\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 2;\n }\n }\n else\n {\n if (clockwise)\n {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else\n {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x1 - (perpx * (innerWeight - outerWeight) * 0.5),\n y1 - (perpy * (innerWeight - outerWeight) * 0.5),\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight),\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight),\n verts,\n false\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n\n const indices = graphicsGeometry.indices;\n const eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n\n // indices.push(indexStart);\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i)\n {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2)\n {\n continue;\n }\n\n indices.push(i, i + 1, i + 2);\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n let i = 0;\n\n const shape = graphicsData.shape as Polygon;\n const points = graphicsData.points || shape.points;\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) return;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n const length = points.length / 2;\n\n const startIndex = verts.length / 2;\n let currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nexport function buildLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n","import { Polygon, PI_2 } from '@pixi/math';\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI.graphicsUtils\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nexport class Star extends Polygon\n{\n constructor(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0)\n {\n innerRadius = innerRadius || radius / 2;\n\n const startAngle = (-1 * Math.PI / 2) + rotation;\n const len = points * 2;\n const delta = PI_2 / len;\n const polygon = [];\n\n for (let i = 0; i < len; i++)\n {\n const r = i % 2 ? innerRadius : radius;\n const angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n super(polygon);\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\nimport { PI_2 } from '@pixi/math';\n\ninterface IArcLikeShape {\n cx: number;\n cy: number;\n radius: number;\n startAngle: number;\n endAngle: number;\n anticlockwise: boolean;\n}\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nexport class ArcUtils\n{\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array): IArcLikeShape\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius,\n startAngle,\n endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n }\n\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n static arc(_startX: number, _startY: number, cx: number, cy: number, radius: number,\n startAngle: number, endAngle: number, _anticlockwise: boolean, points: Array): void\n {\n const sweep = endAngle - startAngle;\n const n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n const theta = (sweep) / (n * 2);\n const theta2 = theta * 2;\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n const segMinus = n - 1;\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n const angle = ((theta) + startAngle + (theta2 * real));\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n }\n /* eslint-enable max-len */\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n","import type { LineStyle } from '../styles/LineStyle';\nimport type { FillStyle } from '../styles/FillStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n","/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\nimport { buildPoly } from './buildPoly';\nexport { buildPoly };\n\nimport { buildCircle } from './buildCircle';\nexport { buildCircle };\n\nimport { buildRectangle } from './buildRectangle';\nexport { buildRectangle };\n\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\nexport { buildRoundedRectangle };\n\nexport * from './buildLine';\nexport * from './Star';\nexport * from './ArcUtils';\nexport * from './BezierUtils';\nexport * from './QuadraticUtils';\nexport * from './BatchPart';\n\n// for type only\nimport { BatchPart } from './BatchPart';\nimport { SHAPES } from '@pixi/math';\nimport { BatchDrawCall } from '@pixi/core';\nimport { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nexport const BATCH_POOL: Array = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array = [];\n","import type { Matrix, SHAPES, IShape } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n shape: IShape;\n lineStyle: LineStyle;\n fillStyle: FillStyle;\n matrix: Matrix;\n type: SHAPES;\n points: number[];\n holes: Array;\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /**\n * Destroys the Graphics data.\n *\n */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n","import {\n buildLine,\n buildPoly,\n BatchPart,\n FILL_COMMANDS,\n BATCH_POOL,\n DRAW_CALL_POOL,\n} from './utils';\n\nimport {\n BatchGeometry,\n BatchDrawCall,\n BatchTextureArray,\n BaseTexture,\n Texture,\n} from '@pixi/core';\n\nimport { DRAW_MODES, WRAP_MODES } from '@pixi/constants';\nimport { SHAPES, Point, Matrix } from '@pixi/math';\nimport { GraphicsData } from './GraphicsData';\nimport { premultiplyTint } from '@pixi/utils';\nimport { Bounds } from '@pixi/display';\n\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * @description Complex shape type\n * @todo Move to Math shapes\n */\ntype IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nconst tmpPoint = new Point();\nconst tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nexport class GraphicsGeometry extends BatchGeometry\n{\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\n public static BATCHABLE_SIZE = 100;\n\n public closePointEps: number;\n public boundsPadding: number;\n\n uvsFloat32: Float32Array = null;\n indicesUint16: Uint16Array | Uint32Array = null;\n batchable: boolean;\n points: Array;\n colors: Array;\n uvs: Array;\n indices: Array;\n textureIds: Array;\n graphicsData: Array;\n drawCalls: Array;\n batchDirty: number;\n batches: Array;\n\n protected dirty: number;\n protected cacheDirty: number;\n protected clearDirty: number;\n protected shapeIndex: number;\n protected _bounds: Bounds;\n protected boundsDirty: number;\n\n constructor()\n {\n super();\n\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n this.points = [];\n\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n this.colors = [];\n\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n this.uvs = [];\n\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n this.indices = [];\n\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n this.textureIds = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n this.graphicsData = [];\n\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n this.dirty = 0;\n\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n this.batchDirty = -1;\n\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n this.cacheDirty = -1;\n\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n this.clearDirty = 0;\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n this.drawCalls = [];\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n * @protected\n */\n this.batches = [];\n\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n this.shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n this.boundsDirty = -1;\n\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n this.boundsPadding = 0;\n\n this.batchable = false;\n\n this.indicesUint16 = null;\n\n this.uvsFloat32 = null;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n this.closePointEps = 1e-4;\n }\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n public get bounds(): Bounds\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n }\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n protected invalidate(): void\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batchPart = this.batches[i];\n\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n\n this.batches.length = 0;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n public clear(): GraphicsGeometry\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawShape(\n shape: IShape,\n fillStyle: FillStyle = null,\n lineStyle: LineStyle = null,\n matrix: Matrix = null): GraphicsGeometry\n {\n const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawHole(shape: IShape, matrix: Matrix = null): GraphicsGeometry\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n const data = new GraphicsData(shape, null, null, matrix);\n\n const lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n public destroy(): void\n {\n super.destroy();\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n }\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n public containsPoint(point: IPointData): boolean\n {\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n let hitHole = false;\n\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices\n */\n updateBatches(allow32Indices?: boolean): void\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n const uvs = this.uvs;\n const graphicsData = this.graphicsData;\n\n let batchPart: BatchPart = null;\n\n let currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (let i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n const data = graphicsData[i];\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n const command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (let j = 0; j < 2; j++)\n {\n const style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) continue;\n\n const nextTexture = style.texture.baseTexture;\n const index = this.indices.length;\n const attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n const size = (this.points.length / 2) - attribIndex;\n\n if (size === 0) continue;\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n\n const index = this.indices.length;\n const attrib = this.points.length / 2;\n\n if (batchPart)\n {\n batchPart.end(index, attrib);\n }\n\n if (this.batches.length === 0)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length)\n {\n this.indicesUint16.set(this.indices);\n }\n else\n {\n const need32\n = attrib > 0xffff && allow32Indices;\n\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n }\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n protected _compareStyles(styleA: FillStyle | LineStyle, styleB: FillStyle | LineStyle): boolean\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!(styleA as LineStyle).native !== !!(styleB as LineStyle).native)\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n protected validateBatching(): boolean\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (let i = 0, l = this.graphicsData.length; i < l; i++)\n {\n const data = this.graphicsData[i];\n const fill = data.fillStyle;\n const line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) return false;\n if (line && !line.texture.baseTexture.valid) return false;\n }\n\n return true;\n }\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n protected packBatches(): void\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n const batches = this.batches;\n\n for (let i = 0, l = batches.length; i < l; i++)\n {\n const batch = batches[i];\n\n for (let j = 0; j < batch.size; j++)\n {\n const index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n }\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n protected isBatchable(): boolean\n {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2)\n {\n return false;\n }\n\n const batches = this.batches;\n\n for (let i = 0; i < batches.length; i++)\n {\n if ((batches[i].style as LineStyle).native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n }\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n protected buildDrawCalls(): void\n {\n let TICK = ++BaseTexture._globalBatch;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n let currentGroup: BatchDrawCall = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n let textureCount = 0;\n let currentTexture = null;\n let textureId = 0;\n let native = false;\n let drawMode = DRAW_MODES.TRIANGLES;\n\n let index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (let i = 0; i < this.batches.length; i++)\n {\n const data = this.batches[i];\n\n // TODO add some full on MAX_TEXTURE CODE..\n const MAX_TEXTURES = 8;\n\n // Forced cast for checking `native` without errors\n const style = data.style as LineStyle;\n\n const nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1;// touch;\n\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize);\n this.addTextureIds(textureIds, textureId, data.attribSize);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n }\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n protected packAttributes(): void\n {\n const verts = this.points;\n const uvs = this.uvs;\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n const glPoints = new ArrayBuffer(verts.length * 3 * 4);\n const f32 = new Float32Array(glPoints);\n const u32 = new Uint32Array(glPoints);\n\n let p = 0;\n\n for (let i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n }\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processFill(data: GraphicsData): void\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n const command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n }\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processLine(data: GraphicsData): void\n {\n buildLine(data, this);\n\n for (let i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n }\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n protected processHoles(holes: Array): void\n {\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n const command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n }\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n protected calculateBounds(): void\n {\n const bounds = this._bounds;\n const sequenceBounds = tmpBounds;\n let curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const shape = data.shape;\n const type = data.type;\n const lineStyle = data.lineStyle;\n const nextMatrix = data.matrix || Matrix.IDENTITY;\n let lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n const alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n const rect = shape as Rectangle | RoundedRectangle;\n\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n const circle = shape as Circle;\n\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y,\n circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n const ellipse = shape as Ellipse;\n\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y,\n ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else\n {\n const poly = shape as Polygon;\n // adding directly to the bounds\n\n bounds.addVerticesMatrix(curMatrix, (poly.points as any), 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n }\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n protected transformPoints(points: Array, matrix: Matrix): void\n {\n for (let i = 0; i < points.length / 2; i++)\n {\n const x = points[(i * 2)];\n const y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n }\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n */\n protected addColors(colors: Array, color: number, alpha: number, size: number): void\n {\n // TODO use the premultiply bits Ivan added\n const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n const rgba = premultiplyTint(rgb, alpha);\n\n while (size-- > 0)\n {\n colors.push(rgba);\n }\n }\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n */\n protected addTextureIds(textureIds: Array, id: number, size: number): void\n {\n while (size-- > 0)\n {\n textureIds.push(id);\n }\n }\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n protected addUvs(\n verts: Array,\n uvs: Array,\n texture: Texture,\n start: number, size:\n number, matrix:\n Matrix = null): void\n {\n let index = 0;\n const uvsStart = uvs.length;\n const frame = texture.frame;\n\n while (index < size)\n {\n let x = verts[(start + index) * 2];\n let y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n const nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n const baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n }\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n protected adjustUvs(uvs: Array, texture: Texture, start: number, size: number): void\n {\n const baseTexture = texture.baseTexture;\n const eps = 1e-6;\n const finish = start + (size * 2);\n const frame = texture.frame;\n const scaleX = frame.width / baseTexture.width;\n const scaleY = frame.height / baseTexture.height;\n let offsetX = frame.x / frame.width;\n let offsetY = frame.y / frame.height;\n let minX = Math.floor(uvs[start] + eps);\n let minY = Math.floor(uvs[start + 1] + eps);\n\n for (let i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (let i = start; i < finish; i += 2)\n {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n }\n}\n","import { FillStyle } from './FillStyle';\nimport { LINE_JOIN, LINE_CAP } from '../const';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nexport class LineStyle extends FillStyle\n{\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n public width = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n public alignment = 0.5;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n public native = false;\n\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /**\n * Miter limit.\n *\n * @member {number}\n * @default 10\n */\n public miterLimit = 10;\n\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /**\n * Reset the line style to default.\n */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n }\n}\n","import {\n Circle,\n Ellipse,\n PI_2,\n Point,\n Polygon,\n Rectangle,\n RoundedRectangle,\n Matrix,\n SHAPES,\n} from '@pixi/math';\n\nimport { Texture, UniformGroup, State, Renderer, BatchDrawCall } from '@pixi/core';\nimport { BezierUtils, QuadraticUtils, ArcUtils, Star } from './utils';\nimport { hex2rgb, deprecation } from '@pixi/utils';\nimport { GraphicsGeometry } from './GraphicsGeometry';\nimport { FillStyle } from './styles/FillStyle';\nimport { LineStyle } from './styles/LineStyle';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { Shader } from '@pixi/core';\n\nimport type { IShape, IPointData } from '@pixi/math';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { LINE_JOIN, LINE_CAP } from './const';\n\n/**\n * Batch element computed from Graphics geometry\n */\nexport interface IGraphicsBatchElement {\n vertexData: Float32Array;\n blendMode: BLEND_MODES;\n indices: Uint16Array | Uint32Array;\n uvs: Float32Array;\n alpha: number;\n worldAlpha: number;\n _batchRGB: number[];\n _tintRGB: number;\n _texture: Texture;\n}\n\nexport interface IFillStyleOptions {\n color?: number;\n alpha?: number;\n texture?: Texture;\n matrix?: Matrix;\n}\n\nexport interface ILineStyleOptions extends IFillStyleOptions {\n width?: number;\n alignment?: number;\n native?: boolean;\n cap?: LINE_CAP;\n join?: LINE_JOIN;\n miterLimit?: number;\n}\n\nconst temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nconst DEFAULT_SHADERS: {[key: string]: Shader} = {};\n\nexport interface Graphics extends GlobalMixins.Graphics, Container {}\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Graphics extends Container\n{\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\n\n static _TEMP_POINT = new Point();\n\n public shader: Shader;\n public pluginName: string;\n\n protected currentPath: Polygon;\n protected batches: Array;\n protected batchTint: number;\n protected batchDirty: number;\n protected vertexData: Float32Array;\n\n protected _fillStyle: FillStyle;\n protected _lineStyle: LineStyle;\n protected _matrix: Matrix;\n protected _holeMode: boolean;\n protected _transformID: number;\n protected _tint: number;\n\n private state: State;\n private _geometry: GraphicsGeometry;\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n public get geometry(): GraphicsGeometry\n {\n return this._geometry;\n }\n\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n constructor(geometry: GraphicsGeometry = null)\n {\n super();\n\n this._geometry = geometry || new GraphicsGeometry();\n this._geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n this.state = State.for2d();\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n this._fillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n this._lineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n this._matrix = null;\n\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n this._holeMode = false;\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n this.currentPath = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n this.batches = [];\n\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchTint = -1;\n\n /**\n * Update dirty for limiting calculating batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchDirty = -1;\n\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n this.vertexData = null;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n this._transformID = -1;\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n public clone(): Graphics\n {\n this.finishPoly();\n\n return new Graphics(this._geometry);\n }\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n public set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n public get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n this._tint = value;\n }\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n public get fill(): FillStyle\n {\n return this._fillStyle;\n }\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n public get line(): LineStyle\n {\n return this._lineStyle;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(options: ILineStyleOptions = null): this\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n // eslint-disable-next-line\n const args = arguments;\n\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n\n return this.lineTextureStyle(options);\n }\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTextureStyle(options: ILineStyleOptions): this\n {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number')\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n\n // eslint-disable-next-line\n const [width, texture, color, alpha, matrix, alignment, native] = arguments as any;\n\n options = { width, texture, color, alpha, matrix, alignment, native };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Start a polygon object internally\n * @protected\n */\n protected startPoly(): void\n {\n if (this.currentPath)\n {\n const points = this.currentPath.points;\n const len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n }\n\n /**\n * Finish the polygon object.\n * @protected\n */\n finishPoly(): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public moveTo(x: number, y: number): this\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTo(x: number, y: number): this\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n const points = this.currentPath.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n }\n\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n protected _initCurve(x = 0, y = 0): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n const points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this\n {\n this._initCurve(x1, y1);\n\n const points = this.currentPath.points;\n\n const result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n const { cx, cy, radius, startAngle, endAngle, anticlockwise } = result;\n\n this.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise = false): this\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n const eps = this._geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tessellation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public beginFill(color = 0, alpha = 1): this\n {\n return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });\n }\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginTextureFill(options: IFillStyleOptions): this\n {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof Texture)\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n\n // eslint-disable-next-line\n const [texture, color, alpha, matrix] = arguments as any;\n\n options = { texture, color, alpha, matrix };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options) as IFillStyleOptions;\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public endFill(): this\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n }\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRect(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n }\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawCircle(x: number, y: number, radius: number): this\n {\n return this.drawShape(new Circle(x, y, radius));\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawEllipse(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n }\n\n public drawPolygon(...path: Array | Array): this\n public drawPolygon(path: Array | Array | Polygon): this\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawPolygon(...path: any[]): this\n {\n let points: Array | Array;\n let closeStroke = true;// !!this._fillStyle;\n\n const poly = path[0] as Polygon;\n\n // check if data has points..\n if (poly.points)\n {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else\n if (Array.isArray(path[0]))\n {\n points = path[0];\n }\n else\n {\n points = path;\n }\n\n const shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawShape(shape: IShape): this\n {\n if (!this._holeMode)\n {\n this._geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this._geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n }\n\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0): this\n {\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation) as Polygon);\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public clear(): this\n {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n public isFastRect(): boolean\n {\n const data = this._geometry.graphicsData;\n\n return data.length === 1\n && data[0].shape.type === SHAPES.RECT\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n const hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n\n geometry.updateBatches(hasuint32);\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n }\n\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n protected _populateBatches(): void\n {\n const geometry = this._geometry;\n const blendMode = this.blendMode;\n const len = geometry.batches.length;\n\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (let i = 0; i < len; i++)\n {\n const gI = geometry.batches[i];\n const color = gI.style.color;\n const vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n const batch = {\n vertexData,\n blendMode,\n indices,\n uvs,\n _batchRGB: hex2rgb(color) as Array,\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n }\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderBatched(renderer: Renderer): void\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (let i = 0, l = this.batches.length; i < l; i++)\n {\n const batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n }\n\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderDirect(renderer: Renderer): void\n {\n const shader = this._resolveDirectShader(renderer);\n\n const geometry = this._geometry;\n const tint = this.tint;\n const worldAlpha = this.worldAlpha;\n const uniforms = shader.uniforms;\n const drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (let i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n }\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void\n {\n const { texArray, type, size, start } = drawCall;\n const groupTextureCount = texArray.count;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(texArray.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n }\n\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _resolveDirectShader(renderer: Renderer): Shader\n {\n let shader = this.shader;\n\n const pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n const MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n const sampleValues = new Int32Array(MAX_TEXTURES);\n\n for (let i = 0; i < MAX_TEXTURES; i++)\n {\n sampleValues[i] = i;\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n const program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n }\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n }\n\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n protected calculateTints(): void\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n const tintRGB = hex2rgb(this.tint, temp);\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batch = this.batches[i];\n\n const batchTint = batch._batchRGB;\n\n const r = (tintRGB[0] * batchTint[0]) * 255;\n const g = (tintRGB[1] * batchTint[1]) * 255;\n const b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n const color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n }\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n protected calculateVertices(): void\n {\n const wtID = this.transform._worldID;\n\n if (this._transformID === wtID)\n {\n return;\n }\n\n this._transformID = wtID;\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const data = this._geometry.points;// batch.vertexDataOriginal;\n const vertexData = this.vertexData;\n\n let count = 0;\n\n for (let i = 0; i < data.length; i += 2)\n {\n const x = data[i];\n const y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n public closePath(): this\n {\n const currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n\n return this;\n }\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n public setMatrix(matrix: Matrix): this\n {\n this._matrix = matrix;\n\n return this;\n }\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n public beginHole(): this\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n }\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n public endHole(): this\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n super.destroy(options);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource|Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n public pluginName: string;\n\n _width: number;\n _height: number;\n _texture: Texture;\n _textureID: number;\n _cachedTint: number;\n protected _textureTrimmedID: number;\n protected uvs: Float32Array;\n protected _anchor: ObservablePoint;\n protected vertexData: Float32Array;\n\n private vertexTrimmedData: Float32Array;\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n private _tint: number;\n\n // Internal-only properties\n _tintRGB: number;\n\n /**\n * @param {PIXI.Texture} [texture] - The texture for this sprite.\n */\n constructor(texture: Texture)\n {\n super();\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 16777215\n */\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n static from(source: SpriteSource, options: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport enum TEXT_GRADIENT {\n LINEAR_VERTICAL = 0,\n LINEAR_HORIZONTAL = 1\n}\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from './const';\nimport { hex2string } from '@pixi/utils';\n\nexport type TextStyleAlign = 'left'|'center'|'right';\nexport type TextStyleFill = string|string[]|number|number[]|CanvasGradient|CanvasPattern;\nexport type TextStyleFontStyle = 'normal'|'italic'|'oblique';\nexport type TextStyleFontVariant = 'normal'|'small-caps';\nexport type TextStyleFontWeight = 'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900';\nexport type TextStyleLineJoin = 'miter'|'round'|'bevel';\nexport type TextStyleTextBaseline = 'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom';\nexport type TextStyleWhiteSpace = 'normal'|'pre'|'pre-line';\n\nexport interface ITextStyle {\n align: TextStyleAlign;\n breakWords: boolean;\n dropShadow: boolean;\n dropShadowAlpha: number;\n dropShadowAngle: number;\n dropShadowBlur: number;\n dropShadowColor: string|number;\n dropShadowDistance: number;\n fill: TextStyleFill;\n fillGradientType: TEXT_GRADIENT;\n fillGradientStops: number[];\n fontFamily: string | string[];\n fontSize: number | string;\n fontStyle: TextStyleFontStyle;\n fontVariant: TextStyleFontVariant;\n fontWeight: TextStyleFontWeight;\n letterSpacing: number;\n lineHeight: number;\n lineJoin: TextStyleLineJoin;\n miterLimit: number;\n padding: number;\n stroke: string|number;\n strokeThickness: number;\n textBaseline: TextStyleTextBaseline;\n trim: boolean;\n whiteSpace: TextStyleWhiteSpace;\n wordWrap: boolean;\n wordWrapWidth: number;\n leading: number;\n}\n\nconst defaultStyle: ITextStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nexport class TextStyle implements ITextStyle\n{\n public styleID: number;\n\n protected _align: TextStyleAlign;\n protected _breakWords: boolean;\n protected _dropShadow: boolean;\n protected _dropShadowAlpha: number;\n protected _dropShadowAngle: number;\n protected _dropShadowBlur: number;\n protected _dropShadowColor: string|number;\n protected _dropShadowDistance: number;\n protected _fill: TextStyleFill;\n protected _fillGradientType: TEXT_GRADIENT;\n protected _fillGradientStops: number[];\n protected _fontFamily: string|string[];\n protected _fontSize: number|string;\n protected _fontStyle: TextStyleFontStyle;\n protected _fontVariant: TextStyleFontVariant;\n protected _fontWeight: TextStyleFontWeight;\n protected _letterSpacing: number;\n protected _lineHeight: number;\n protected _lineJoin: TextStyleLineJoin;\n protected _miterLimit: number;\n protected _padding: number;\n protected _stroke: string|number;\n protected _strokeThickness: number;\n protected _textBaseline: TextStyleTextBaseline;\n protected _trim: boolean;\n protected _whiteSpace: TextStyleWhiteSpace;\n protected _wordWrap: boolean;\n protected _wordWrapWidth: number;\n protected _leading: number;\n\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style: Partial)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n const clonedProperties: Partial = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n public reset(): void\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align(): TextStyleAlign\n {\n return this._align;\n }\n set align(align: TextStyleAlign)\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get breakWords(): boolean\n {\n return this._breakWords;\n }\n set breakWords(breakWords: boolean)\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get dropShadow(): boolean\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow: boolean)\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get dropShadowAlpha(): number\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha: number)\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get dropShadowAngle(): number\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle: number)\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get dropShadowBlur(): number\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur: number)\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get dropShadowColor(): number | string\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor: number | string)\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get dropShadowDistance(): number\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance: number)\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill(): TextStyleFill\n {\n return this._fill;\n }\n set fill(fill: TextStyleFill)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n const outputColor = getColor(fill as any);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get fillGradientType(): TEXT_GRADIENT\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType: TEXT_GRADIENT)\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get fillGradientStops(): number[]\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops: number[])\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get fontFamily(): string | string[]\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily: string | string[])\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get fontSize(): number | string\n {\n return this._fontSize;\n }\n set fontSize(fontSize: number | string)\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle(): TextStyleFontStyle\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle: TextStyleFontStyle)\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant(): TextStyleFontVariant\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant: TextStyleFontVariant)\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight(): TextStyleFontWeight\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight: TextStyleFontWeight)\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing: number)\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get lineHeight(): number\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight: number)\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /**\n * The space between lines\n *\n * @member {number}\n */\n get leading(): number\n {\n return this._leading;\n }\n set leading(leading: number)\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin(): TextStyleLineJoin\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin: TextStyleLineJoin)\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get miterLimit(): number\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit: number)\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get padding(): number\n {\n return this._padding;\n }\n set padding(padding: number)\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get stroke(): string | number\n {\n return this._stroke;\n }\n set stroke(stroke: string | number)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get strokeThickness(): number\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness: number)\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline(): TextStyleTextBaseline\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline: TextStyleTextBaseline)\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get trim(): boolean\n {\n return this._trim;\n }\n set trim(trim: boolean)\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace(): TextStyleWhiteSpace\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace: TextStyleWhiteSpace)\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get wordWrap(): boolean\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap: boolean)\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get wordWrapWidth(): number\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth: number)\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n public toFontString(): string\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies: string|string[] = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n (fontFamilies as string[])[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${(fontFamilies as string[]).join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {string|number} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color: string|number): string\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if (typeof color === 'string')\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {string|number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color: (string|number)[]): string[];\nfunction getColor(color: string|number): string;\nfunction getColor(color: string|number|(string|number)[]): string|string[]\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color as string[];\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 - First array to compare\n * @param {Array} array2 - Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1: T[], array2: T[]): boolean\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target - Target object to copy properties into\n * @param {Object} source - Source object for the properties to copy\n * @param {string} propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target: Record, source: Record, propertyObj: Record): void {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import { TextStyle, TextStyleWhiteSpace } from './TextStyle';\n\ninterface IFontMetrics {\n ascent: number;\n descent: number;\n fontSize: number;\n}\n\ntype CharacterWidthCache = { [key: string]: number };\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nexport class TextMetrics\n{\n public text: string;\n public style: TextStyle;\n public width: number;\n public height: number;\n public lines: string[];\n public lineWidths: number[];\n public lineHeight: number;\n public maxLineWidth: number;\n public fontProperties: IFontMetrics;\n\n public static METRICS_STRING: string;\n public static BASELINE_SYMBOL: string;\n public static BASELINE_MULTIPLIER: number;\n\n // TODO: These should be protected but they're initialized outside of the class.\n public static _canvas: HTMLCanvasElement|OffscreenCanvas;\n public static _context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D;\n public static _fonts: { [font: string]: IFontMetrics };\n public static _newlines: number[];\n public static _breakingSpaces: number[];\n\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[],\n lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics)\n {\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n public static measureText(text: string, style: TextStyle, wordWrap: boolean, canvas = TextMetrics._canvas): TextMetrics\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize as number;\n fontProperties.ascent = style.fontSize as number;\n }\n\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n private static wordWrap(text: string, style: TextStyle, canvas = TextMetrics._canvas): string\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache: CharacterWidthCache = Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = TextMetrics.wordWrapSplit(token);\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n private static addLine(line: string, newLine = true): string\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key - The key\n * @param {number} letterSpacing - The letter spacing\n * @param {object} cache - The cache\n * @param {CanvasRenderingContext2D} context - The canvas context\n * @return {number} The from cache.\n */\n private static getFromCache(key: string, letterSpacing: number, cache: CharacterWidthCache,\n context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D): number\n {\n let width = cache[key];\n\n if (typeof width !== 'number')\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace - The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n private static collapseSpaces(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace - The white space\n * @return {boolean} should collapse\n */\n private static collapseNewlines(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text - The text\n * @return {string} trimmed string\n */\n private static trimRight(text: string): string\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if newline, False otherwise.\n */\n private static isNewline(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n private static isBreakingSpace(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text - The text\n * @return {string[]} A tokenized array\n */\n private static tokenize(text: string): string[]\n {\n const tokens: string[] = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param {string} token - The token\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakWords(_token: string, breakWords: boolean): boolean\n {\n return breakWords;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param {string} char - The character\n * @param {string} nextChar - The next character\n * @param {string} token - The token/word the characters are from\n * @param {number} index - The index in the token of the char\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number,\n _breakWords: boolean): boolean\n {\n return true;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param {string} token - The token to split\n * @return {string[]} The characters of the token\n */\n static wordWrapSplit(token: string): string[]\n {\n return token.split('');\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\n public static measureFont(font: string): IFontMetrics\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties: IFontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n public static clearMetrics(font = ''): void\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nconst canvas = ((): HTMLCanvasElement|OffscreenCanvas =>\n{\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext('2d');\n\n if (context && context.measureText)\n {\n return c;\n }\n\n return document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n","/* eslint max-depth: [2, 8] */\nimport { Sprite } from '@pixi/sprite';\nimport { Texture } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { Rectangle } from '@pixi/math';\nimport { sign, trimCanvas, hex2rgb, string2hex } from '@pixi/utils';\nimport { TEXT_GRADIENT } from './const';\nimport { TextStyle } from './TextStyle';\nimport { TextMetrics } from './TextMetrics';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Renderer } from '@pixi/core';\nimport type { ITextStyle } from './TextStyle';\n\nconst defaultDestroyOptions: IDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class Text extends Sprite\n{\n public canvas: HTMLCanvasElement;\n public context: CanvasRenderingContext2D;\n public localStyleID: number;\n public dirty: boolean;\n\n _resolution: number;\n _autoResolution: boolean;\n protected _text: string;\n protected _font: string;\n protected _style: TextStyle;\n protected _styleListener: () => void;\n private _ownCanvas: boolean;\n\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n constructor(text: string, style: Partial|TextStyle, canvas: HTMLCanvasElement)\n {\n let ownCanvas = false;\n\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n ownCanvas = true;\n }\n\n canvas.width = 3;\n canvas.height = 3;\n\n const texture = Texture.from(canvas);\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n super(texture);\n\n /**\n * Keep track if this Text object created it's own canvas\n * element (`true`) or uses the constructor argument (`false`).\n * Used to workaround a GC issues with Safari < 13 when\n * destroying Text. See `destroy` for more info.\n *\n * @member {boolean}\n * @private\n */\n this._ownCanvas = ownCanvas;\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n this._resolution = settings.RESOLUTION;\n this._autoResolution = true;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n /**\n * Renders text to its canvas, and updates its texture.\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n *\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n public updateText(respectDirty: boolean): void\n {\n const style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n const context = this.context;\n const measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n const width = measured.width;\n const height = measured.height;\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n\n context.scale(this._resolution, this._resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n let linePositionX: number;\n let linePositionY: number;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n const passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (let i = 0; i < passesCount; ++i)\n {\n const isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n const dsOffsetShadow = dsOffsetText * this._resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines, measured);\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n context.strokeStyle = style.stroke as string;\n\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n\n this.updateTexture();\n }\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n private drawLetterSpacing(text: string, x: number, y: number, isStroke = false): void\n {\n const style = this._style;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n let currentPosition = x;\n\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n const stringArray = Array.from ? Array.from(text) : text.split('');\n let previousWidth = this.context.measureText(text).width;\n let currentWidth = 0;\n\n for (let i = 0; i < stringArray.length; ++i)\n {\n const currentChar = stringArray[i];\n\n if (isStroke)\n {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n private updateTexture(): void\n {\n const canvas = this.canvas;\n\n if (this._style.trim)\n {\n const trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n const texture = this._texture;\n const style = this._style;\n const padding = style.trim ? 0 : style.padding;\n const baseTexture = texture.baseTexture;\n\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n\n // Recursively updates transform of all objects from the root to this one\n this._recursivePostUpdateTransform();\n\n this.dirty = false;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super._render(renderer);\n }\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n this.updateText(true);\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n }\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n private _generateFillStyle(style: TextStyle, lines: string[], metrics: TextMetrics): string|CanvasGradient|CanvasPattern\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n }\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n super.destroy(options);\n\n // set canvas width and height to 0 to workaround memory leak in Safari < 13\n // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12\n if (this._ownCanvas)\n {\n this.canvas.height = this.canvas.width = 0;\n }\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n }\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get style(): TextStyle|Partial\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle\n // since the setter creates the TextStyle. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n return this._style;\n }\n\n set style(style: TextStyle|Partial)\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n }\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get text(): string\n {\n return this._text;\n }\n\n set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._autoResolution = false;\n\n if (this._resolution === value)\n {\n return;\n }\n\n this._resolution = value;\n this.dirty = true;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\nexport { settings };\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class CountLimiter\n{\n public maxItemsPerFrame: number;\n public itemsLeft: number;\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame: number)\n {\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return this.itemsLeft-- > 0;\n }\n}\n","import { Texture, BaseTexture } from '@pixi/core';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\nimport { CountLimiter } from './CountLimiter';\n\nimport type { AbstractRenderer } from '@pixi/core';\n\ninterface IArrowFunction {\n (): void;\n}\ninterface IUploadHook {\n (helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean;\n}\n\ninterface IFindHook {\n (item: any, queue: Array): boolean;\n}\n\nexport interface IDisplayObjectExtended extends DisplayObject {\n _textures?: Array;\n _texture?: Texture;\n style?: TextStyle;\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\n\nfunction findMultipleBaseTextures(item: IDisplayObjectExtended, queue: Array): boolean\n{\n let result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item: Texture, queue: Array): boolean\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n const texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item._texture && item._texture instanceof Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof TextStyle)\n {\n const font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item: TextStyle, queue: Array): boolean\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI\n */\nexport class BasePrepare\n{\n private limiter: CountLimiter;\n protected renderer: AbstractRenderer;\n protected uploadHookHelper: any;\n protected queue: Array;\n public addHooks: Array;\n public uploadHooks: Array;\n public completes: Array;\n public ticking: boolean;\n private delayedTick: IArrowFunction;\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer)\n {\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {object}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = (): void =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item: IDisplayObjectExtended | IUploadHook | IFindHook | (() => void), done: () => void): void\n {\n if (typeof item === 'function')\n {\n done = item as () => void;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item as IDisplayObjectExtended | IUploadHook | IFindHook);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick(): void\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems(): void\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {this} Instance of plugin for chaining.\n */\n registerFindHook(addHook: IFindHook): this\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {this} Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook: IUploadHook): this\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {this} Instance of plugin for chaining.\n */\n add(item: IDisplayObjectExtended | IUploadHook | IFindHook): this\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy(): void\n {\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { BasePrepare, IDisplayObjectExtended } from './BasePrepare';\n\nimport type { AbstractRenderer, Renderer } from '@pixi/core';\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])\n {\n (renderer as Renderer).texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n const { geometry } = item;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n const { batches } = geometry;\n\n // upload all textures found in styles\n for (let i = 0; i < batches.length; i++)\n {\n const { texture } = batches[i].style;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n (renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class Prepare extends BasePrepare\n{\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n public maxMilliseconds: number;\n public frameStart: number;\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n constructor(maxMilliseconds: number)\n {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { getResolutionOfUrl } from '@pixi/utils';\nimport type { Dict } from '@pixi/utils';\nimport type { resources } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n */\nexport interface ISpritesheetFrameData {\n frame: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n w: number;\n h: number;\n };\n spriteSourceSize?: {\n x: number;\n y: number;\n };\n anchor?: IPointData;\n}\n\n/**\n * Atlas format.\n */\nexport interface ISpritesheetData {\n frames: Dict;\n animations?: Dict;\n meta: {\n scale: string;\n };\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nexport class Spritesheet\n{\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n static readonly BATCH_SIZE = 1000;\n\n public baseTexture: BaseTexture;\n public textures: Dict;\n public animations: Dict;\n public data: ISpritesheetData;\n public resolution: number;\n\n private _texture: Texture;\n private _frames: Dict;\n private _frameKeys: string[];\n private _batchIndex: number;\n private _callback: (textures: Dict) => void;\n\n /**\n * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(texture: BaseTexture | Texture, data: ISpritesheetData, resolutionFilename: string = null)\n {\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n * @type {PIXI.Texture}\n * @private\n */\n this._texture = texture instanceof Texture ? texture : null;\n\n /**\n * Reference to ths source texture.\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n const resource = this.baseTexture.resource as resources.ImageResource;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n private _updateResolution(resolutionFilename: string = null): number\n {\n const { scale } = this.data.meta;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n public parse(callback: () => void): void\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n private _processFrames(initialFrameIndex: number): void\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /**\n * Parse animations config\n *\n * @private\n */\n private _processAnimations(): void\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++)\n {\n const frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /**\n * The parse has completed.\n *\n * @private\n */\n private _parseComplete(): void\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n private _nextBatch(): void\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n public destroy(destroyBase = false): void\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this._texture?.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n }\n}\n","import { url } from '@pixi/utils';\nimport { Spritesheet } from './Spritesheet';\nimport { LoaderResource } from '@pixi/loaders';\nimport type { Loader, ILoaderResource } from '@pixi/loaders';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class SpritesheetLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(resource: ILoaderResource, next: (...args: unknown[]) => void): void\n {\n // because this is middleware, it execute in loader context. `this` = loader\n const loader = (this as any) as Loader;\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res: ILoaderResource)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n }\n\n /**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\n static getResourcePath(resource: ILoaderResource, baseUrl: string): string\n {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n }\n}\n","import { Texture, TextureMatrix } from '@pixi/core';\nimport { Point, Rectangle, Transform } from '@pixi/math';\nimport { Sprite } from '@pixi/sprite';\nimport { deprecation } from '@pixi/utils';\nimport type { Renderer, IBaseTextureOptions, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPoint, IPointData, ISize, ObservablePoint } from '@pixi/math';\n\nconst tempPoint = new Point();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface TilingSprite extends GlobalMixins.TilingSprite {}\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class TilingSprite extends Sprite\n{\n public tileTransform: Transform;\n public uvMatrix: TextureMatrix;\n public uvRespectAnchor: boolean;\n\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n constructor(texture: Texture, width = 100, height = 100)\n {\n super(texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n this.tileTransform = new Transform();\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = this.texture.uvMatrix || new TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get clampMargin(): number\n {\n return this.uvMatrix.clampMargin;\n }\n\n set clampMargin(value: number)\n {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n }\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tileScale(): ObservablePoint\n {\n return this.tileTransform.scale;\n }\n\n set tileScale(value: ObservablePoint)\n {\n this.tileTransform.scale.copyFrom(value as IPoint);\n }\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tilePosition(): ObservablePoint\n {\n return this.tileTransform.position;\n }\n\n set tilePosition(value: ObservablePoint)\n {\n this.tileTransform.position.copyFrom(value as IPoint);\n }\n\n /**\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n if (this.uvMatrix)\n {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n // tweak our texture temporarily..\n const texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const minX = this._width * -this._anchor._x;\n const minY = this._height * -this._anchor._y;\n const maxX = this._width * (1 - this._anchor._x);\n const maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.IPointData} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._width;\n const height = this._height;\n const x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n const y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.tileTransform = null;\n this.uvMatrix = null;\n }\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {number} options.width - required width of the tiling sprite\n * @param {number} options.height - required height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n static from(source: TextureSource, options: ISize & IBaseTextureOptions): TilingSprite\n {\n // Deprecated\n if (typeof options === 'number')\n {\n deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args');\n // eslint-disable-next-line prefer-rest-params\n options = { width: options, height: arguments[2] } as ISize;\n }\n\n return new TilingSprite(\n Texture.from(source, options),\n options.width,\n options.height\n );\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n }\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n }\n}\n","import { ObjectRenderer, Shader, State, QuadUv } from '@pixi/core';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\n\nimport vertex from './tilingSprite.vert';\nimport fragment from './tilingSprite.frag';\nimport fragmentSimple from './tilingSprite_simple.frag';\n\nimport type { Renderer } from '@pixi/core';\nimport type { TilingSprite } from './TilingSprite';\n\nconst tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class TilingSpriteRenderer extends ObjectRenderer\n{\n public shader: Shader;\n public simpleShader: Shader;\n public quad: QuadUv;\n public readonly state: State;\n\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n const uniforms = { globals: this.renderer.globalUniforms };\n\n this.shader = Shader.from(vertex, fragment, uniforms);\n\n this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);\n\n this.quad = new QuadUv();\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n *\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n public render(ts: TilingSprite): void\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.invalidate();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvMatrix;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode as any);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n\n this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode as any);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n","import type { TextureMatrix, Buffer } from '@pixi/core';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nexport class MeshBatchUvs\n{\n public readonly data: Float32Array;\n public uvBuffer: Buffer;\n public uvMatrix: TextureMatrix;\n\n private _bufferUpdateId: number;\n private _textureUpdateId: number;\n\n // Internal-only properties\n _updateID: number;\n\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n constructor(uvBuffer: Buffer, uvMatrix: TextureMatrix)\n {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n }\n\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n public update(forceUpdate?: boolean): void\n {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID\n )\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n const data = this.uvBuffer.data as Float32Array;\n\n if (!this.data || this.data.length !== data.length)\n {\n (this.data as any) = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n }\n}\n","import { State } from '@pixi/core';\nimport { Point, Polygon } from '@pixi/math';\nimport { BLEND_MODES, DRAW_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { MeshBatchUvs } from './MeshBatchUvs';\nimport { MeshMaterial } from './MeshMaterial';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Texture, Renderer, Geometry, Buffer } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst tempPolygon = new Polygon();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Mesh extends GlobalMixins.Mesh {}\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Mesh extends Container\n{\n public readonly geometry: Geometry;\n public shader: MeshMaterial;\n public state: State;\n public drawMode: DRAW_MODES;\n public start: number;\n public size: number;\n\n private vertexData: Float32Array;\n private vertexDirty: number;\n private _transformID: number;\n private _roundPixels: boolean;\n private batchUvs: MeshBatchUvs;\n\n // Internal-only properties\n uvs: Float32Array;\n indices: Uint16Array;\n _tintRGB: number;\n _texture: Texture;\n\n /**\n * @param {PIXI.Geometry} geometry - the geometry the mesh will use\n * @param {PIXI.MeshMaterial} shader - the shader the mesh will use\n * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts\n */\n constructor(geometry: Geometry, shader: MeshMaterial, state?: State, drawMode = DRAW_MODES.TRIANGLES)\n {\n super();\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n this.geometry = geometry;\n\n geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n this.shader = shader;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = state || State.for2d();\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n this.drawMode = drawMode;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n this.start = 0;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n this.size = 0;\n\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n this.uvs = null;\n\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n this.indices = null;\n\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n this.vertexData = new Float32Array(1);\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n this.vertexDirty = 0;\n\n this._transformID = -1;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n this.batchUvs = null;\n }\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get uvBuffer(): Buffer\n {\n return this.geometry.buffers[1];\n }\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get verticesBuffer(): Buffer\n {\n return this.geometry.buffers[0];\n }\n\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.MeshMaterial}\n */\n set material(value: MeshMaterial)\n {\n this.shader = value;\n }\n\n get material(): MeshMaterial\n {\n return this.shader;\n }\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this.shader.tint;\n }\n\n set tint(value: number)\n {\n this.shader.tint = value;\n }\n\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n set texture(value: Texture)\n {\n this.shader.texture = value;\n }\n\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _render(renderer: Renderer): void\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n const vertices = this.geometry.buffers[0].data;\n\n // TODO benchmark check for attribute size..\n if (\n this.shader.batchable\n && this.drawMode === DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2\n )\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n }\n\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderDefault(renderer: Renderer): void\n {\n const shader = this.shader;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n if (shader.program.uniformData.translationMatrix)\n {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n }\n\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderToBatch(renderer: Renderer): void\n {\n const geometry = this.geometry;\n\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data as Uint16Array;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n\n const pluginName = this.material.pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n }\n\n /**\n * Updates vertexData field based on transform and vertices\n */\n public calculateVertices(): void\n {\n const geometry = this.geometry;\n const vertices = geometry.buffers[0].data;\n\n if ((geometry as any).vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const vertexData = this.vertexData;\n\n for (let i = 0; i < vertexData.length / 2; i++)\n {\n const x = vertices[(i * 2)];\n const y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n\n this.vertexDirty = (geometry as any).vertexDirtyId;\n }\n\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n public calculateUvs(): void\n {\n const geomUvs = this.geometry.buffers[1];\n\n if (!this.shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data as Float32Array;\n }\n }\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n const points = tempPolygon.points;\n const indices = this.geometry.getIndex().data;\n const len = indices.length;\n const step = this.drawMode === 4 ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n (this as any).geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n }\n\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\n public static BATCHABLE_SIZE = 100;\n}\n\n","import { Program, Shader, TextureMatrix } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba } from '@pixi/utils';\nimport fragment from './shader/mesh.frag';\nimport vertex from './shader/mesh.vert';\n\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IMeshMaterialOptions {\n alpha?: number;\n tint?: number;\n pluginName?: string;\n program?: Program;\n uniforms?: Dict;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MeshMaterial extends GlobalMixins.MeshMaterial {}\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class MeshMaterial extends Shader\n{\n public readonly uvMatrix: TextureMatrix;\n\n public batchable: boolean;\n public pluginName: string;\n\n // Internal-only properties\n _tintRGB: number;\n\n private _colorDirty: boolean;\n private _alpha: number;\n private _tint: number;\n\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n constructor(uSampler: Texture, options?: IMeshMaterialOptions)\n {\n const uniforms = {\n uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n super(options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.uniforms.uSampler;\n }\n set texture(value: Texture)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n }\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set alpha(value: number)\n {\n if (value === this._alpha) return;\n\n this._alpha = value;\n this._colorDirty = true;\n }\n get alpha(): number\n {\n return this._alpha;\n }\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set tint(value: number)\n {\n if (value === this._tint) return;\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n }\n get tint(): number\n {\n return this._tint;\n }\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n public update(): void\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n const baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(\n this._tint, this._alpha, this.uniforms.uColor, (baseTexture.alphaMode as unknown as boolean)\n );\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Buffer, Geometry } from '@pixi/core';\n\nimport type { IArrayBuffer } from '@pixi/core';\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class MeshGeometry extends Geometry\n{\n // Internal-only properties\n _updateId: number;\n\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n constructor(vertices?: IArrayBuffer, uvs?: IArrayBuffer, index?: IArrayBuffer)\n {\n super();\n\n const verticesBuffer = new Buffer(vertices);\n const uvsBuffer = new Buffer(uvs, true);\n const indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get vertexDirtyId(): number\n {\n return this.buffers[0]._updateID;\n }\n}\n","/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n public info: IBitmapFontDataInfo[];\n public common: IBitmapFontDataCommon[];\n public page: IBitmapFontDataPage[];\n public char: IBitmapFontDataChar[];\n public kerning: IBitmapFontDataKerning[];\n\n constructor()\n {\n /**\n * @member {PIXI.IBitmapFontDataInfo[]}\n * @readOnly\n */\n this.info = [];\n\n /**\n * @member {PIXI.IBitmapFontDataCommon[]}\n * @readOnly\n */\n this.common = [];\n\n /**\n * @member {PIXI.IBitmapFontDataPage[]}\n * @readOnly\n */\n this.page = [];\n\n /**\n * @member {PIXI.IBitmapFontDataChar[]}\n * @readOnly\n */\n this.char = [];\n\n /**\n * @member {PIXI.IBitmapFontDataKerning[]}\n * @readOnly\n */\n this.kerning = [];\n }\n}\n\nexport interface IBitmapFontDataInfo {\n face: string;\n size: number;\n}\n\nexport interface IBitmapFontDataCommon {\n lineHeight: number;\n}\n\nexport interface IBitmapFontDataPage {\n id: number;\n file: string;\n}\n\nexport interface IBitmapFontDataChar {\n id: number;\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n xoffset: number;\n yoffset: number;\n xadvance: number;\n}\n\nexport interface IBitmapFontDataKerning {\n first: number;\n second: number;\n amount: number;\n}\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataInfo\n * @property {string} face\n * @property {number} size\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataCommon\n * @property {number} lineHeight\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataPage\n * @property {number} id\n * @property {string} file\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataChar\n * @property {string} id\n * @property {number} page\n * @property {number} x\n * @property {number} y\n * @property {number} width\n * @property {number} height\n * @property {number} xoffset\n * @property {number} yoffset\n * @property {number} xadvance\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataKerning\n * @property {number} first\n * @property {number} second\n * @property {number} amount\n */\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * Internal data format used to convert to BitmapFontData.\n * @private\n */\ninterface IBitmapFontRawData {\n info: {\n face: string;\n size: string;\n }[];\n common: { lineHeight: string }[];\n page: {\n id: string;\n file: string;\n }[];\n chars: {\n count: number;\n }[];\n char: {\n id: string;\n page: string;\n x: string;\n y: string;\n width: string;\n height: string;\n xoffset: string;\n yoffset: string;\n xadvance: string;\n }[];\n kernings?: {\n count: number;\n }[];\n kerning?: {\n first: string;\n second: string;\n amount: string;\n }[];\n}\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @class\n * @private\n */\nexport class TextFormat\n{\n /**\n * Check if resource refers to txt font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n }\n\n /**\n * Convert text font data to a javascript object.\n *\n * @static\n * @private\n * @param {string} txt - Raw string data to be converted\n * @return {PIXI.BitmapFontData} Parsed font data\n */\n static parse(txt: string): BitmapFontData\n {\n // Retrieve data item\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData: IBitmapFontRawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n };\n\n for (const i in items)\n {\n // Extract item name\n const name = items[i].match(/^[a-z]+/gm)[0] as keyof BitmapFontData;\n\n // Extract item attribute list as string ex.: \"width=10\"\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n\n // Convert attribute list into an object\n const itemData: any = {};\n\n for (const i in attributeList)\n {\n // Split key-value pairs\n const split = attributeList[i].split('=');\n const key = split[0];\n\n // Remove eventual quotes from value\n const strValue = split[1].replace(/\"/gm, '');\n\n // Try to convert value into float\n const floatValue = parseFloat(strValue);\n\n // Use string value case float value is NaN\n const value = isNaN(floatValue) ? strValue : floatValue;\n\n itemData[key] = value;\n }\n\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n\n const font = new BitmapFontData();\n\n rawData.info.forEach((info) => font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }));\n\n rawData.common.forEach((common) => font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }));\n\n rawData.page.forEach((page) => font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }));\n\n rawData.char.forEach((char) => font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }));\n\n rawData.kerning.forEach((kerning) => font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }));\n\n return font;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLFormat\n{\n /**\n * Check if resource refers to xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n }\n\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {XMLDocument} xml\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xml: XMLDocument): BitmapFontData\n {\n const data = new BitmapFontData();\n const info = xml.getElementsByTagName('info');\n const common = xml.getElementsByTagName('common');\n const page = xml.getElementsByTagName('page');\n const char = xml.getElementsByTagName('char');\n const kerning = xml.getElementsByTagName('kerning');\n\n for (let i = 0; i < info.length; i++)\n {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n\n for (let i = 0; i < common.length; i++)\n {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n\n for (let i = 0; i < page.length; i++)\n {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n\n for (let i = 0; i < char.length; i++)\n {\n const letter = char[i];\n\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n\n for (let i = 0; i < kerning.length; i++)\n {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n\n return data;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\nimport { XMLFormat } from './XMLFormat';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n if (typeof data === 'string' && data.indexOf('') > -1)\n {\n const xml = new self.DOMParser().parseFromString(data, 'text/xml');\n\n return XMLFormat.test(xml);\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {string} xmlTxt\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n const xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml');\n\n return XMLFormat.parse(xml);\n }\n}\n","import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nexport function autoDetectFormat(data: unknown): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n","import { TextStyle, TextMetrics, TEXT_GRADIENT } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nexport function generateFillStyle(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n style: TextStyle,\n resolution: number,\n lines: string[],\n metrics: TextMetrics\n): string|CanvasGradient|CanvasPattern\n{\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n}\n","import { generateFillStyle } from './generateFillStyle';\nimport { hex2rgb, string2hex } from '@pixi/utils';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n if (style.dropShadow)\n {\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n","/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...item.split(''));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n","import { getResolutionOfUrl } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { TextStyle, TextMetrics } from '@pixi/text';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFontData } from './BitmapFontData';\nimport { resolveCharacters, drawGlyph } from './utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITextStyle } from '@pixi/text';\n\nexport interface IBitmapFontCharacter\n{\n xOffset: number;\n yOffset: number;\n xAdvance: number;\n texture: Texture;\n page: number;\n kerning: Dict;\n}\n\nexport interface IBitmapFontOptions\n{\n chars?: string | (string | string[])[];\n resolution?: number;\n padding?: number;\n textureWidth?: number;\n textureHeight?: number;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFont\n{\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n public static readonly ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n public static readonly NUMERIC = [['0', '9']];\n\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @readonly\n * @static\n * @member {string[][]}\n */\n public static readonly ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n\n /**\n * This character set consists of all the ASCII table.\n * @readonly\n * @static\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n public static readonly ASCII = [[' ', '~']];\n\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @readonly\n * @static\n * @member {PIXI.IBitmapFontOptions}\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC\n */\n public static readonly defaultOptions: IBitmapFontOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n\n /**\n * Collection of available/installed fonts.\n *\n * @readonly\n * @static\n * @member {Object.}\n */\n public static readonly available: Dict = {};\n public readonly font: string;\n public readonly size: number;\n public readonly lineHeight: number;\n public readonly chars: Dict;\n public readonly pageTextures: Dict;\n\n /**\n * @param {PIXI.BitmapFontData} data\n * @param {PIXI.Texture[]|Object.} textures\n */\n constructor(data: BitmapFontData, textures: Texture[]|Dict)\n {\n const [info] = data.info;\n const [common] = data.common;\n const [page] = data.page;\n const res = getResolutionOfUrl(page.file);\n const pageTextures: Dict = {};\n\n /**\n * The name of the font face.\n *\n * @member {string}\n * @readonly\n */\n this.font = info.face;\n\n /**\n * The size of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.size = info.size;\n\n /**\n * The line-height of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.lineHeight = common.lineHeight / res;\n\n /**\n * The map of characters by character code.\n *\n * @member {object}\n * @readonly\n */\n this.chars = {};\n\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n *\n * @member {object}\n * @readonly\n * @private\n */\n this.pageTextures = pageTextures;\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < data.page.length; i++)\n {\n const { id, file } = data.page[i];\n\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n }\n\n // parse letters\n for (let i = 0; i < data.char.length; i++)\n {\n const { id, page } = data.char[i];\n let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];\n\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n\n const rect = new Rectangle(\n x + (pageTextures[page].frame.x / res),\n y + (pageTextures[page].frame.y / res),\n width,\n height\n );\n\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new Texture(\n pageTextures[page].baseTexture,\n rect\n ),\n page,\n };\n }\n\n // parse kernings\n for (let i = 0; i < data.kerning.length; i++)\n {\n let { first, second, amount } = data.kerning[i];\n\n first /= res;\n second /= res;\n amount /= res;\n\n if (this.chars[second])\n {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n\n /**\n * Remove references to created glyph textures.\n */\n public destroy(): void\n {\n for (const id in this.chars)\n {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n\n for (const id in this.pageTextures)\n {\n this.pageTextures[id].destroy(true);\n this.pageTextures[id] = null;\n }\n\n // Set readonly null.\n (this as any).chars = null;\n (this as any).pageTextures = null;\n }\n\n /**\n * Register a new bitmap font.\n *\n * @static\n * @param {XMLDocument|string|PIXI.BitmapFontData} data - The\n * characters map that could be provided as xml or raw string.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]}\n * textures - List of textures for each page.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n public static install(\n data: string|XMLDocument|BitmapFontData,\n textures: Texture|Texture[]|Dict\n ): BitmapFont\n {\n let fontData;\n\n if (data instanceof BitmapFontData)\n {\n fontData = data;\n }\n else\n {\n const format = autoDetectFormat(data);\n\n if (!format)\n {\n throw new Error('Unrecognized data format for font.');\n }\n\n fontData = format.parse(data as any);\n }\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n const font = new BitmapFont(fontData, textures);\n\n BitmapFont.available[font.font] = font;\n\n return font;\n }\n\n /**\n * Remove bitmap font by name.\n *\n * @static\n * @param {string} name\n */\n public static uninstall(name: string): void\n {\n const font = BitmapFont.available[name];\n\n if (!font)\n {\n throw new Error(`No font found named '${name}'`);\n }\n\n font.destroy();\n delete BitmapFont.available[name];\n }\n\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param {string} name - The name of the custom font to use with BitmapText.\n * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont.\n * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return {PIXI.BitmapFont} Font generated by style options.\n * @static\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n public static from(name: string, textStyle?: TextStyle | Partial, options?: IBitmapFontOptions): BitmapFont\n {\n if (!name)\n {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n\n const {\n chars,\n padding,\n resolution,\n textureWidth,\n textureHeight } = Object.assign(\n {}, BitmapFont.defaultOptions, options);\n\n const charsList = resolveCharacters(chars);\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const lineWidth = textureWidth;\n const fontData = new BitmapFontData();\n\n fontData.info[0] = {\n face: style.fontFamily as string,\n size: style.fontSize as number,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize as number,\n };\n\n let positionX = 0;\n let positionY = 0;\n\n let canvas;\n let context;\n let baseTexture;\n let maxCharHeight = 0;\n const baseTextures = [];\n const textures: Texture[] = [];\n\n for (let i = 0; i < charsList.length; i++)\n {\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n\n context = canvas.getContext('2d');\n baseTexture = new BaseTexture(canvas, { resolution });\n\n baseTextures.push(baseTexture);\n textures.push(new Texture(baseTexture));\n\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n\n // Measure glyph dimensions\n const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);\n const width = metrics.width;\n const height = Math.ceil(metrics.height);\n\n // This is ugly - but italics are given more space so they don't overlap\n const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution))\n {\n if (positionY === 0)\n {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is `\n + `too small for ${style.fontSize}px fonts`);\n }\n\n --i;\n\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth)\n {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n\n // Unique (numeric) ID mapping to this glyph\n const id = metrics.text.charCodeAt(0);\n\n // Create a texture holding just the glyph\n fontData.char.push({\n id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n\n const font = new BitmapFont(fontData, textures);\n\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined)\n {\n BitmapFont.uninstall(name);\n }\n\n BitmapFont.available[name] = font;\n\n return font;\n }\n}\n\n/**\n * @memberof PIXI\n * @interface IBitmapFontOptions\n * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate\n * @property {number} [resolution=1] - the resolution for rendering\n * @property {number} [padding=4] - the padding between glyphs in the atlas\n * @property {number} [textureWidth=512] - the width of the texture atlas\n * @property {number} [textureHeight=512] - the height of the texture atlas\n */\n\n","import { ObservablePoint, Point } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { removeItems, deprecation } from '@pixi/utils';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Rectangle } from '@pixi/math';\nimport { Texture } from '@pixi/core';\nimport type { IBitmapTextStyle } from './BitmapTextStyle';\nimport type { TextStyleAlign } from '@pixi/text';\nimport type { BitmapFontData } from './BitmapFontData';\nimport { Container } from '@pixi/display';\nimport type { IDestroyOptions } from '@pixi/display';\n\ninterface PageMeshData {\n index: number;\n indexCount: number;\n vertexCount: number;\n uvsCount: number;\n total: number;\n mesh: Mesh;\n vertices?: Float32Array;\n uvs?: Float32Array;\n indices?: Uint16Array;\n}\ninterface CharRenderData {\n texture: Texture;\n line: number;\n charCode: number;\n position: Point;\n}\n\nconst pageMeshDataPool: PageMeshData[] = [];\nconst charRenderDataPool: CharRenderData[] = [];\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class BitmapText extends Container\n{\n public static styleDefaults: Partial = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n public dirty: boolean;\n protected _textWidth: number;\n protected _textHeight: number;\n protected _text: string;\n protected _maxWidth: number;\n protected _maxLineHeight: number;\n protected _letterSpacing: number;\n protected _anchor: ObservablePoint;\n protected _fontName: string;\n protected _fontSize: number;\n protected _align: TextStyleAlign;\n protected _activePagesMeshData: PageMeshData[];\n protected _tint = 0xFFFFFF;\n protected _roundPixels: boolean;\n private _textureCache: Record;\n\n /**\n * @param {string} text - A string that you would like the text to display.\n * @param {object} style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n constructor(text: string, style: Partial = {})\n {\n super();\n\n if (style.font)\n {\n deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.');\n\n this._upgradeStyle(style);\n }\n\n // Apply the defaults\n const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(\n {}, BitmapText.styleDefaults, style);\n\n if (!BitmapFont.available[fontName])\n {\n throw new Error(`Missing BitmapFont \"${fontName}\"`);\n }\n\n /**\n * Collection of page mesh data.\n *\n * @member {object}\n * @private\n */\n this._activePagesMeshData = [];\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the current text align.\n *\n * @member {string}\n * @private\n */\n this._align = align;\n\n /**\n * Private tracker for the current tint.\n *\n * @member {number}\n * @private\n */\n this._tint = tint;\n\n /**\n * Private tracker for the current font name.\n *\n * @member {string}\n * @private\n */\n this._fontName = fontName;\n\n /**\n * Private tracker for the current font size.\n *\n * @member {number}\n * @private\n */\n this._fontSize = fontSize || BitmapFont.available[fontName].size;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = maxWidth;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = letterSpacing;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint((): void => { this.dirty = true; }, this, 0, 0);\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Set to `true` if the BitmapText needs to be redrawn.\n *\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * Cached char texture is destroyed when BitmapText is destroyed\n * @member {Record}\n * @private\n */\n this._textureCache = {};\n }\n\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n public updateText(): void\n {\n const data = BitmapFont.available[this._fontName];\n const scale = this._fontSize / data.size;\n const pos = new Point();\n const chars: CharRenderData[] = [];\n const lineWidths = [];\n const text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n const textLength = text.length;\n const maxWidth = this._maxWidth * data.size / this._fontSize;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n\n for (let i = 0; i < textLength; i++)\n {\n const charCode = text.charCodeAt(i);\n const char = text.charAt(i);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n const charRenderData = charRenderDataPool.pop() || {\n texture: Texture.EMPTY,\n line: 0,\n charCode: 0,\n position: new Point(),\n };\n\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n\n chars.push(charRenderData);\n\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n const lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n\n const pagesMeshData: Record = {};\n\n const newPagesMeshData: PageMeshData[] = [];\n\n const activePagesMeshData = this._activePagesMeshData;\n\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const texture = chars[i].texture;\n const baseTextureUid = texture.baseTexture.uid;\n\n if (!pagesMeshData[baseTextureUid])\n {\n let pageMeshData = pageMeshDataPool.pop();\n\n if (!pageMeshData)\n {\n const geometry = new MeshGeometry();\n const material = new MeshMaterial(Texture.EMPTY);\n\n const mesh = new Mesh(geometry, material);\n\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n\n // TODO need to get page texture here somehow..\n const { _textureCache } = this;\n\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n\n pageMeshData.mesh.tint = this._tint;\n\n newPagesMeshData.push(pageMeshData);\n\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n\n pagesMeshData[baseTextureUid].total++;\n }\n\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1)\n {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (let i = 0; i < newPagesMeshData.length; i++)\n {\n if (newPagesMeshData[i].mesh.parent !== this)\n {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n const total = pageMeshData.total;\n\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else\n {\n const total = pageMeshData.total;\n const vertices = pageMeshData.vertices;\n\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (let i = total * 4 * 2; i < vertices.length; i++)\n {\n vertices[i] = 0;\n }\n }\n\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const char = chars[i];\n let offset = char.position.x + lineAlignOffsets[char.line];\n\n if (this._roundPixels)\n {\n offset = Math.round(offset);\n }\n\n const xPos = offset * scale;\n const yPos = char.position.y * scale;\n const texture = char.texture;\n\n const pageMesh = pagesMeshData[texture.baseTexture.uid];\n\n const textureFrame = texture.frame;\n const textureUvs = texture._uvs;\n\n const index = pageMesh.index++;\n\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n let vertexCount = 0;\n\n const anchorOffsetX = this._textWidth * this.anchor.x;\n const anchorOffsetY = this._textHeight * this.anchor.y;\n\n for (let i = 0; i < pageMeshData.total; i++)\n {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n\n this._maxLineHeight = maxLineHeight * scale;\n\n const vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n const textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n const indexBuffer = pageMeshData.mesh.geometry.getIndex();\n\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n\n for (let i = 0; i < chars.length; i++)\n {\n charRenderDataPool.push(chars[i]);\n }\n }\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n updateTransform(): void\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n public getLocalBounds(): Rectangle\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n protected validate(): void\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n * @default 0xffffff\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n if (this._tint === value) return;\n\n this._tint = value;\n\n for (let i = 0; i < this._activePagesMeshData.length; i++)\n {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n }\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n public get align(): TextStyleAlign\n {\n return this._align;\n }\n\n public set align(value: TextStyleAlign)\n {\n if (this._align !== value)\n {\n this._align = value;\n this.dirty = true;\n }\n }\n\n /**\n * The name of the BitmapFont.\n *\n * @member {string}\n */\n public get fontName(): string\n {\n return this._fontName;\n }\n\n public set fontName(value: string)\n {\n if (!BitmapFont.available[value])\n {\n throw new Error(`Missing BitmapFont \"${value}\"`);\n }\n\n if (this._fontName !== value)\n {\n this._fontName = value;\n this.dirty = true;\n }\n }\n\n /**\n * The size of the font to display.\n *\n * @member {number}\n */\n public get fontSize(): number\n {\n return this._fontSize;\n }\n\n public set fontSize(value: number)\n {\n if (this._fontSize !== value)\n {\n this._fontSize = value;\n this.dirty = true;\n }\n }\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n public get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n public set anchor(value: ObservablePoint)\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n }\n\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n public get text(): string\n {\n return this._text;\n }\n\n public set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n public get maxWidth(): number\n {\n return this._maxWidth;\n }\n\n public set maxWidth(value: number)\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n public get maxLineHeight(): number\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textWidth(): number\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n public get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n\n public set letterSpacing(value: number)\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n public get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n public set roundPixels(value: boolean)\n {\n if (value !== this._roundPixels)\n {\n this._roundPixels = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textHeight(): number\n {\n this.validate();\n\n return this._textHeight;\n }\n\n /**\n * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties.\n *\n * @private\n * @deprecated since 5.3.0\n */\n _upgradeStyle(style: Partial): void\n {\n if (typeof style.font === 'string')\n {\n const valueSplit = style.font.split(' ');\n\n style.fontName = valueSplit.length === 1\n ? valueSplit[0]\n : valueSplit.slice(1).join(' ');\n\n if (valueSplit.length >= 2)\n {\n style.fontSize = parseInt(valueSplit[0], 10);\n }\n }\n else\n {\n style.fontName = style.font.name;\n style.fontSize = typeof style.font.size === 'number'\n ? style.font.size\n : parseInt(style.font.size, 10);\n }\n }\n\n destroy(options?: boolean | IDestroyOptions): void\n {\n const { _textureCache } = this;\n\n for (const id in _textureCache)\n {\n const texture = _textureCache[id];\n\n texture.destroy();\n delete _textureCache[id];\n }\n\n this._textureCache = null;\n\n super.destroy(options);\n }\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @deprecated since 5.3.0\n * @see PIXI.BitmapFont.install\n * @static\n */\n static registerFont(data: string|XMLDocument|BitmapFontData, textures: Texture|Texture[]|Dict): BitmapFont\n {\n deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install');\n\n return BitmapFont.install(data, textures);\n }\n\n /**\n * Get the list of installed fonts.\n *\n * @see PIXI.BitmapFont.available\n * @deprecated since 5.3.0\n * @static\n * @readonly\n * @member {Object.}\n */\n static get fonts(): Dict\n {\n deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available');\n\n return BitmapFont.available;\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { ILoaderResource } from '@pixi/loaders';\nimport type { Dict } from '@pixi/utils';\nimport type { Loader } from '@pixi/loaders';\nimport type { Texture } from '@pixi/core';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class BitmapFontLoader\n{\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n public static add(): void\n {\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(this: Loader, resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n const format = autoDetectFormat(resource.data);\n\n // Resource was not recognised as any of the expected font data format\n if (!format)\n {\n next();\n\n return;\n }\n\n const baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n const data = format.parse(resource.data);\n const textures: Dict = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page: ILoaderResource): void =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === data.page.length)\n {\n resource.bitmapFont = BitmapFont.install(data, textures);\n next();\n }\n };\n\n for (let i = 0; i < data.page.length; ++i)\n {\n const pageFile = data.page[i].file;\n const url = baseUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource: ILoaderResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n }\n\n /**\n * Get folder path from a resource\n * @private\n * @param {PIXI.Loader} loader\n * @param {PIXI.LoaderResource} resource\n * @return {string}\n */\n private static getBaseUrl(loader: Loader, resource: ILoaderResource): string\n {\n let resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (resUrl === '.')\n {\n resUrl = '';\n }\n\n if (loader.baseUrl && resUrl)\n {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/')\n {\n resUrl += '/';\n }\n }\n }\n\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/')\n {\n resUrl += '/';\n }\n\n return resUrl;\n }\n\n /**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url - Path to get directory for\n */\n private static dirname(url: string): string\n {\n const dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n }\n}\n","import { Filter, defaultVertex } from '@pixi/core';\nimport fragment from './alpha.frag';\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class AlphaFilter extends Filter\n{\n /**\n * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n","const vertTemplate = `\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }`;\n\nexport function generateBlurVertSource(kernelSize: number, x: boolean): string\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n\n return vertSource;\n}\n","interface IGAUSSIAN_VALUES {\n [x: number]: number[];\n}\nconst GAUSSIAN_VALUES: IGAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport function generateBlurFragSource(kernelSize: number): string\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value: number;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value].toString());\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n\n return fragSource;\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { generateBlurVertSource } from './generateBlurVertSource';\nimport { generateBlurFragSource } from './generateBlurFragSource';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilterPass extends Filter\n{\n public horizontal: boolean;\n public strength: number;\n public passes: number;\n\n private _quality: number;\n\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(horizontal: boolean, strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n const vertSrc = generateBlurVertSource(kernelSize, horizontal);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution;\n\n this._quality = 0;\n\n this.quality = quality;\n\n this.blur = strength;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else\n {\n const renderTarget = filterManager.getFilterTexture();\n const renderer = filterManager.renderer;\n\n let flip = input;\n let flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n\n for (let i = 1; i < this.passes - 1; i++)\n {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n\n this.uniforms.uSampler = flop;\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n }\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur(): number\n {\n return this.strength;\n }\n\n set blur(value: number)\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality(): number\n {\n return this._quality;\n }\n\n set quality(value: number)\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { BlurFilterPass } from './BlurFilterPass';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilter extends Filter\n{\n public blurXFilter: BlurFilterPass;\n public blurYFilter: BlurFilterPass;\n\n private _repeatEdgePixels: boolean;\n\n /**\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n super();\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution;\n this.quality = quality;\n this.blur = strength;\n\n this.repeatEdgePixels = false;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n apply(filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const xStrength = Math.abs(this.blurXFilter.strength);\n const yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n const renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n }\n\n protected updatePadding(): void\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get blur(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value: number)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get quality(): number\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value: number)\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get blurX(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value: number)\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get blurY(): number\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value: number)\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.blurYFilter.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blurYFilter.blendMode = value;\n }\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {boolean}\n * @default false\n */\n get repeatEdgePixels(): boolean\n {\n return this._repeatEdgePixels;\n }\n\n set repeatEdgePixels(value: boolean)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './colorMatrix.frag';\n\nimport type { ArrayFixed } from '@pixi/utils';\n\nexport type ColorMatrix = ArrayFixed;\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class ColorMatrixFilter extends Filter\n{\n public grayscale: (scale: number, multiply: boolean) => void;\n\n constructor()\n {\n const uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n super(defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n private _loadMatrix(matrix: ColorMatrix, multiply = false): void\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix) as any;\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n private _multiply(out: ColorMatrix, a: ColorMatrix, b: ColorMatrix): ColorMatrix\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n private _colorMatrix(matrix: ColorMatrix): ColorMatrix\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m as any;\n }\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public brightness(b: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public greyscale(scale: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public blackAndWhite(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public hue(rotation: number, multiply: boolean): void\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix: ColorMatrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public contrast(amount: number, multiply: boolean): void\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix: ColorMatrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public saturate(amount = 0, multiply?: boolean): void\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix: ColorMatrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n public desaturate(): void // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public negative(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public sepia(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public technicolor(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public polaroid(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public toBGR(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public kodachrome(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public browni(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public vintage(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {number} lightColor - Tone values, example: `0xFFE580`\n * @param {number} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean): void\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix: ColorMatrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public night(intensity: number, multiply: boolean): void\n {\n intensity = intensity || 0.1;\n\n const matrix: ColorMatrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public predator(amount: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public lsd(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n public reset(): void\n {\n const matrix: ColorMatrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix(): ColorMatrix\n {\n return this.uniforms.m;\n }\n\n set matrix(value: ColorMatrix)\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\nimport fragment from './displacement.frag';\nimport vertex from './displacement.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { RenderTexture, systems, Texture, ISpriteMaskTarget } from '@pixi/core';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class DisplacementFilter extends Filter\n{\n public maskSprite: ISpriteMaskTarget;\n public maskMatrix: Matrix;\n public scale: Point;\n\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} [scale] - The scale of the displacement\n */\n constructor(sprite: ISpriteMaskTarget, scale: number)\n {\n const maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n super(vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - clearMode.\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n const wt = this.maskSprite.worldTransform;\n const lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n const lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n }\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get map(): Texture\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value: Texture)\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport vertex from './fxaa.vert';\nimport fragment from './fxaa.frag';\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nexport class FXAAFilter extends Filter\n{\n constructor()\n {\n // TODO - needs work\n super(vertex, fragment);\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './noise.frag';\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class NoiseFilter extends Filter\n{\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get noise(): number\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value: number)\n {\n this.uniforms.uNoise = value;\n }\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get seed(): number\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value: number)\n {\n this.uniforms.uSeed = value;\n }\n}\n","import { Texture, BaseTexture, RenderTexture, Renderer, MaskData } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Container, DisplayObject, IDestroyOptions } from '@pixi/display';\nimport { IPointData, Matrix, Rectangle } from '@pixi/math';\nimport { uid } from '@pixi/utils';\nimport { settings } from '@pixi/settings';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\n\nconst _tempMatrix = new Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = null;\n\n// figured there's no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nexport class CacheData\n{\n public textureCacheId: string;\n public originalRender: (renderer: Renderer) => void;\n public originalRenderCanvas: (renderer: CanvasRenderer) => void;\n public originalCalculateBounds: () => void;\n public originalGetLocalBounds: (rect?: Rectangle) => Rectangle;\n public originalUpdateTransform: () => void;\n public originalDestroy: (options?: IDestroyOptions|boolean) => void;\n public originalMask: Container|MaskData;\n public originalFilterArea: Rectangle;\n public originalContainsPoint: (point: IPointData) => boolean;\n public sprite: Sprite;\n\n constructor()\n {\n this.textureCacheId = null;\n\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.originalContainsPoint = null;\n this.sprite = null;\n }\n}\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get(): CacheData\n {\n return this._cacheAsBitmap;\n },\n set(value: CacheData): void\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n let data: CacheData;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCached = function _renderCached(renderer: Renderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._render(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer: Renderer): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n const bounds = (this as Container).getLocalBounds(null, true).clone();\n\n // add some padding!\n if (this.filters)\n {\n const padding = this.filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n const cachedRenderTexture = renderer.renderTexture.current;\n const cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();\n const cachedProjectionTransform = renderer.projection.transform;\n\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);\n\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);\n\n // renderer.filterManager.filterStack = stack;\n\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.enableTempParent();\n this.updateTransform();\n this.disableTempParent(null);\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(\n renderer: CanvasRenderer\n): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n const bounds = (this as Container).getLocalBounds(null, true);\n\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n const cachedRenderTarget = renderer.context;\n const cachedProjectionTransform = (renderer as any)._projTransform;\n\n bounds.ceil(settings.RESOLUTION);\n\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n this.transform.localTransform.copyTo(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n (renderer as any)._projTransform = cachedProjectionTransform;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = (renderer as any)._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds(): void\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n (this._cacheData.sprite as any)._calculateBounds();\n this._bounds.updateID = (this as any)._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds(): Rectangle\n{\n return this._cacheData.sprite.getLocalBounds(null);\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject(): void\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options: IDestroyOptions|boolean): void\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n","import { DisplayObject, Container } from '@pixi/display';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\nDisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container.\n *\n * Recursive searches are done in a preorder traversal.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\nContainer.prototype.getChildByName = function getChildByName(name: string, deep?: boolean): DisplayObject\n{\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n if (deep)\n {\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n const child = (this.children[i] as Container);\n\n if (!child.getChildByName)\n {\n continue;\n }\n\n const target = (this.children[i] as Container).getChildByName(name, true);\n\n if (target)\n {\n return target;\n }\n }\n }\n\n return null;\n};\n","import { DisplayObject } from '@pixi/display';\nimport { Point } from '@pixi/math';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\nDisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point: Point = new Point(), skipUpdate = false): Point\n{\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","import { deprecation } from '@pixi/utils';\nimport type {\n systems,\n resources,\n Renderer,\n ImageSource,\n BaseTexture,\n RenderTexture,\n Texture,\n State,\n AbstractRenderer } from '@pixi/core';\nimport type { DisplayObject, Container } from '@pixi/display';\nimport type { TilingSprite } from '@pixi/sprite-tiling';\nimport type {\n Point,\n ObservablePoint,\n IPoint,\n Rectangle,\n Transform,\n groupD8,\n Matrix } from '@pixi/math';\nimport type { InteractionManager, InteractionData, InteractionEvent } from '@pixi/interaction';\nimport type { AccessibilityManager } from '@pixi/accessibility';\nimport type { Ticker } from '@pixi/ticker';\nimport type { Graphics, GraphicsData } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\nimport type { BitmapText, BitmapFontLoader } from '@pixi/text-bitmap';\nimport type { CanvasRenderTarget } from '@pixi/utils';\nimport type { Loader, LoaderResource } from '@pixi/loaders';\nimport type { BasePrepare, Prepare } from '@pixi/prepare';\nimport type { Extract } from '@pixi/extract';\nimport type { AnimatedSprite } from '@pixi/sprite-animated';\nimport type { Mesh } from '@pixi/mesh';\nimport type { ParticleContainer } from '@pixi/particles';\nimport type { SpritesheetLoader } from '@pixi/spritesheet';\nimport type {\n SimpleRope,\n NineSlicePlane,\n SimpleMesh,\n SimplePlane } from '@pixi/mesh-extras';\n\nconst v5 = '5.0.0';\n\n// Canvas deprecations needs to get moved\n// to the legacy package, but for now, we'll\n// ad this reminder\ntype $FixLegacy = any;\n\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useDeprecated(this: any): void\n{\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const PIXI = this;\n\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get(): RegExp\n {\n deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get(): {[name: string]: number}\n {\n deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get(): typeof Renderer\n {\n deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n\n return PIXI.Renderer;\n },\n },\n\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get(): CanvasRenderTarget\n {\n deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get(): Loader\n {\n deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n\n return PIXI.Loader.shared;\n },\n },\n\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get(): systems.FilterSystem\n {\n deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n\n return PIXI.systems.FilterSystem;\n },\n },\n\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get(): $FixLegacy\n {\n deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n\n return PIXI.canvasUtils;\n },\n },\n\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get(): typeof groupD8\n {\n deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n\n return PIXI.groupD8;\n },\n },\n });\n\n /**\n * @namespace PIXI.accessibility\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.accessibility = {};\n\n Object.defineProperties(PIXI.accessibility, {\n /**\n * @class PIXI.accessibility.AccessibilityManager\n * @deprecated since 5.3.0\n * @see PIXI.AccessibilityManager\n */\n AccessibilityManager: {\n get(): typeof AccessibilityManager\n {\n deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager');\n\n return PIXI.AccessibilityManager;\n },\n },\n });\n\n /**\n * @namespace PIXI.interaction\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.interaction = {};\n\n Object.defineProperties(PIXI.interaction, {\n /**\n * @class PIXI.interaction.InteractionManager\n * @deprecated since 5.3.0\n * @see PIXI.InteractionManager\n */\n InteractionManager: {\n get(): typeof InteractionManager\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager');\n\n return PIXI.InteractionManager;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionData\n * @deprecated since 5.3.0\n * @see PIXI.InteractionData\n */\n InteractionData: {\n get(): typeof InteractionData\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData');\n\n return PIXI.InteractionData;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionEvent\n * @deprecated since 5.3.0\n * @see PIXI.InteractionEvent\n */\n InteractionEvent: {\n get(): typeof InteractionEvent\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent');\n\n return PIXI.InteractionEvent;\n },\n },\n });\n\n /**\n * @namespace PIXI.prepare\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.prepare = {};\n\n Object.defineProperties(PIXI.prepare, {\n /**\n * @class PIXI.prepare.BasePrepare\n * @deprecated since 5.2.1\n * @see PIXI.BasePrepare\n */\n BasePrepare: {\n get(): typeof BasePrepare\n {\n deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare');\n\n return PIXI.BasePrepare;\n },\n },\n /**\n * @class PIXI.prepare.Prepare\n * @deprecated since 5.2.1\n * @see PIXI.Prepare\n */\n Prepare: {\n get(): typeof Prepare\n {\n deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n },\n /**\n * @class PIXI.prepare.CanvasPrepare\n * @deprecated since 5.2.1\n * @see PIXI.CanvasPrepare\n */\n CanvasPrepare: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare');\n\n return PIXI.CanvasPrepare;\n },\n },\n });\n\n /**\n * @namespace PIXI.extract\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.extract = {};\n\n Object.defineProperties(PIXI.extract, {\n /**\n * @class PIXI.extract.Extract\n * @deprecated since 5.2.1\n * @see PIXI.Extract\n */\n Extract: {\n get(): typeof Extract\n {\n deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n },\n /**\n * @class PIXI.extract.CanvasExtract\n * @deprecated since 5.2.1\n * @see PIXI.CanvasExtract\n */\n CanvasExtract: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract');\n\n return PIXI.CanvasExtract;\n },\n },\n });\n\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get(): typeof TilingSprite\n {\n deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get(): typeof AnimatedSprite\n {\n deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get(): typeof BitmapText\n {\n deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n\n return PIXI.BitmapText;\n },\n },\n });\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromFrame\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromFrame = function fromFrame(frameId: string, width: number, height: number): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from');\n\n return PIXI.TilingSprite.from(frameId, { width, height });\n };\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromImage\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromImage = function fromImage(\n imageId: string,\n width: number,\n height: number,\n options: any = {}): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from');\n\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object')\n {\n options = {\n // eslint-disable-next-line prefer-rest-params\n scaleMode: arguments[4],\n resourceOptions: {\n // eslint-disable-next-line prefer-rest-params\n crossorigin: arguments[3],\n },\n };\n }\n\n options.width = width;\n options.height = height;\n\n return PIXI.TilingSprite.from(imageId, options);\n };\n\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get(): typeof resources.SVGResource.getSize\n {\n deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n\n return PIXI.resources.SVGResource.getSize;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get(): typeof SimpleMesh\n {\n deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get(): typeof NineSlicePlane\n {\n deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get(): typeof SimplePlane\n {\n deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get(): typeof SimpleRope\n {\n deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get(): typeof Mesh\n {\n deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n\n return PIXI.MeshRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get(): typeof ParticleContainer\n {\n deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n\n return PIXI.ParticleRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get(): typeof Ticker\n {\n deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get(): Ticker\n {\n deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n\n return PIXI.Ticker.shared;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get(): typeof Loader\n {\n deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get(): typeof LoaderResource\n {\n deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get(): typeof BitmapFontLoader.use\n {\n deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get(): void\n {\n deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed');\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get(): typeof SpritesheetLoader.use\n {\n deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get(): typeof SpritesheetLoader.getResourcePath\n {\n deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware: any): typeof Loader\n {\n deprecation(v5,\n 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'\n );\n\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n\n // convenience for converting event name to signal name\n const eventToSignal = (event: any): string =>\n `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n\n Object.assign(PIXI.Loader.prototype,\n {\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#on\n * @deprecated since 5.0.0\n */\n on(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#on is completely deprecated, use PIXI.Loader#${signal}.add`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#once\n * @deprecated since 5.0.0\n */\n once(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#once is completely deprecated, use PIXI.Loader#${signal}.once`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#off\n * @deprecated since 5.0.0\n */\n off(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#off is completely deprecated, use PIXI.Loader#${signal}.detach`);\n },\n });\n\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get(): typeof Extract\n {\n deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n });\n\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get(): typeof Prepare\n {\n deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n });\n\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n\n this._render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(this: DisplayObject, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n\n this.renderAdvanced(renderer);\n };\n\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get(): number\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n\n return 0;\n },\n set(): void\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n\n const { BaseTexture: BaseTextureAny } = PIXI;\n\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTextureAny.prototype.loadSource = function loadSource(image: string | HTMLImageElement): void\n {\n deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n\n const resource = PIXI.resources.autoDetectResource(image);\n\n resource.internal = true;\n\n this.setResource(resource);\n this.update();\n };\n\n let baseTextureIdDeprecation = false;\n\n Object.defineProperties(BaseTextureAny.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get(): boolean\n {\n deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resources.ImageResource#url\n */\n imageUrl: {\n get(this: BaseTexture): string\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n return (this.resource as resources.ImageResource)?.url;\n },\n\n set(this: BaseTexture, imageUrl: string): void\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n if (this.resource)\n {\n (this.resource as resources.ImageResource).url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get(this: BaseTexture): ImageSource\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n\n return (this.resource as resources.BaseImageResource).source;\n },\n set(this: BaseTexture, source: ImageSource): void\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n\n if (this.resource)\n {\n (this.resource as resources.BaseImageResource).source = source;\n }\n },\n },\n\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get(this: BaseTexture): boolean\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: BaseTexture, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get(this: BaseTexture): number\n {\n if (!baseTextureIdDeprecation)\n {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n\n return this._batchLocation;\n },\n set(this: BaseTexture, value: number): void\n {\n this._batchLocation = value;\n },\n },\n });\n\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromImage = function fromImage(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromCanvas = function fromCanvas(canvas: HTMLCanvasElement, scaleMode: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n\n return BaseTextureAny.from(canvas, { scaleMode });\n };\n\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromSVG = function fromSVG(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get(this: resources.ImageResource): boolean\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: resources.ImageResource, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(this: Point, p: IPoint): Point\n {\n deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(this: ObservablePoint, p: IPoint): ObservablePoint\n {\n deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(this: Rectangle, p: Rectangle): Rectangle\n {\n deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(this: Matrix, p: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n\n return this.copyTo(p);\n };\n\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(this: systems.StateSystem, s: State): void\n {\n deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n\n return this.set(s);\n };\n\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget(this: systems.FilterSystem, _clear: boolean, resolution: number)\n {\n deprecation(v5,\n 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'\n );\n\n return this.getFilterTexture(null, resolution);\n },\n\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget(this: systems.FilterSystem, renderTexture: any)\n {\n deprecation(v5,\n 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture'\n );\n\n this.returnFilterTexture(renderTexture);\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: any)\n {\n deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n\n const mappedMatrix = outputMatrix.identity();\n const { sourceFrame, destinationFrame } = this.activeState;\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n\n return mappedMatrix;\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n\n const { sourceFrame, destinationFrame } = this.activeState;\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n\n const translateScaleX = (destinationFrame.width / sourceFrame.width);\n const translateScaleY = (destinationFrame.height / sourceFrame.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n },\n });\n\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.size property has been removed');\n\n return this._frame;\n },\n },\n });\n\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurXFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(true, strength, quality, resolution, kernelSize);\n }\n }\n\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurYFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(false, strength, quality, resolution, kernelSize);\n }\n }\n\n Object.assign(PIXI.filters, {\n BlurXFilter,\n BlurYFilter,\n });\n\n const {\n Sprite: SpriteAny,\n Texture: TextureAny,\n Graphics: GraphicsAny } = PIXI;\n\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!GraphicsAny.prototype.generateCanvasTexture)\n {\n GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture(): void\n {\n deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(GraphicsAny.prototype, 'graphicsData', {\n get(this: Graphics): GraphicsData[]\n {\n deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n\n return this.geometry.graphicsData;\n },\n });\n\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Sprite\n {\n deprecation(v5, `PIXI.Sprite.${name} method is deprecated, use PIXI.Sprite.from`);\n\n return SpriteAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame');\n\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Texture\n {\n deprecation(v5, `PIXI.Texture.${name} method is deprecated, use PIXI.Texture.from`);\n\n return TextureAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromImage = textureFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame');\n\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get(this: AbstractRenderer): boolean\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n return this.autoDensity;\n },\n set(this: any, value: boolean): void\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n this.autoDensity = value;\n },\n });\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get(this: Renderer)\n {\n deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n\n return this.texture;\n },\n });\n\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n\n /**\n * @memberof PIXI.BitmapText\n * @member {object} font\n * @deprecated since 5.3.0\n */\n Object.defineProperty(PIXI.BitmapText.prototype, 'font', {\n get(this: BitmapText): any\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n return {\n name: this._fontName,\n size: this._fontSize,\n tint: this._tint,\n align: this._align,\n };\n },\n set(this: BitmapText, value: any)\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n if (!value)\n {\n return;\n }\n\n const style: any = { font: value };\n\n this._upgradeStyle(style);\n\n style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size;\n\n this._fontName = style.fontName;\n this._fontSize = style.fontSize;\n\n this.dirty = true;\n },\n });\n}\n","import { MeshGeometry } from '@pixi/mesh';\n\nexport class PlaneGeometry extends MeshGeometry\n{\n public segWidth: number;\n public segHeight: number;\n public width: number;\n public height: number;\n\n constructor(width = 100, height = 100, segWidth = 10, segHeight = 10)\n {\n super();\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n build(): void\n {\n const total = this.segWidth * this.segHeight;\n const verts = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.segWidth - 1;\n const segmentsY = this.segHeight - 1;\n\n const sizeX = (this.width) / segmentsX;\n const sizeY = (this.height) / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.segWidth);\n const y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.segWidth) + xpos;\n const value2 = (ypos * this.segWidth) + xpos + 1;\n const value3 = ((ypos + 1) * this.segWidth) + xpos;\n const value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nexport class RopeGeometry extends MeshGeometry\n{\n public points: IPoint[];\n public readonly textureScale: number;\n _width: number;\n\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n constructor(width = 200, points: IPoint[], textureScale = 0)\n {\n super(new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this._width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n private build(): void\n {\n const points = this.points;\n\n if (!points) return;\n\n const vertexBuffer = this.getBuffer('aVertexPosition');\n const uvBuffer = this.getBuffer('aTextureCoord');\n const indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n const uvs = uvBuffer.data;\n const indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n let amount = 0;\n let prev = points[0];\n const textureWidth = this._width * this.textureScale;\n const total = points.length; // - 1;\n\n for (let i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n const index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n const dx = prev.x - points[i].x;\n const dy = prev.y - points[i].y;\n const distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n let indexCount = 0;\n\n for (let i = 0; i < total - 1; i++)\n {\n const index = i * 2;\n\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n public updateVertices(): void\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n const vertices = this.buffers[0].data;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n }\n\n public update(): void\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n }\n}\n","import { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { RopeGeometry } from './geometry/RopeGeometry';\n\nimport type { Texture, Renderer } from '@pixi/core';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimpleRope extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be streched instead.\n */\n constructor(texture: Texture, points: IPoint[], textureScale = 0)\n {\n const ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n const meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n super(ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n _render(renderer: Renderer): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.shader.texture.height)\n {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { PlaneGeometry } from './geometry/PlaneGeometry';\n\nimport type{ Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimplePlane extends Mesh\n{\n protected _textureID: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the SimplePlane.\n * @param {number} verticesX - The number of vertices in the x-axis\n * @param {number} verticesY - The number of vertices in the y-axis\n */\n constructor(texture: Texture, verticesX: number, verticesY: number)\n {\n const planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n const meshMaterial = new MeshMaterial(Texture.WHITE);\n\n super(planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n\n const geometry: PlaneGeometry = this.geometry as any;\n\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n\n geometry.build();\n }\n\n set texture(value: Texture)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n }\n\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n _render(renderer: Renderer): void\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n super._render(renderer);\n }\n\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.shader.texture.off('update', this.textureUpdated, this);\n super.destroy(options);\n }\n}\n","import { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { Texture } from '@pixi/core';\n\nimport type { ITypedArray, IArrayBuffer, Renderer } from '@pixi/core';\nimport type { DRAW_MODES } from '@pixi/constants';\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nexport class SimpleMesh extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(\n texture = Texture.EMPTY,\n vertices?: IArrayBuffer,\n uvs?: IArrayBuffer,\n indices?: IArrayBuffer,\n drawMode?: DRAW_MODES\n )\n {\n const geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n const meshMaterial = new MeshMaterial(texture);\n\n super(geometry, meshMaterial, null, drawMode);\n\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n _render(renderer: Renderer): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SimplePlane } from './SimplePlane';\n\nimport type { ITypedArray } from '@pixi/core';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface NineSlicePlane extends GlobalMixins.NineSlicePlane {}\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *

\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nexport class NineSlicePlane extends SimplePlane\n{\n private _origWidth: number;\n private _origHeight: number;\n _leftWidth: number;\n _rightWidth: number;\n _topHeight: number;\n _bottomHeight: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n constructor(\n texture: Texture,\n leftWidth = DEFAULT_BORDER_SIZE,\n topHeight = DEFAULT_BORDER_SIZE,\n rightWidth = DEFAULT_BORDER_SIZE,\n bottomHeight = DEFAULT_BORDER_SIZE\n )\n {\n super(Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n this._leftWidth = leftWidth;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n this._rightWidth = rightWidth;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n this._topHeight = topHeight;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n this._bottomHeight = bottomHeight;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n }\n\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n /**\n * Updates the horizontal vertices.\n *\n */\n public updateHorizontalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /**\n * Updates the vertical vertices.\n *\n */\n public updateVerticalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return {number} Smaller number of vertical and horizontal scale.\n * @private\n */\n private _getMinScale(): number\n {\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this._width > w ? 1.0 : this._width / w;\n\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this._height > h ? 1.0 : this._height / h;\n\n const scale = Math.min(scaleW, scaleH);\n\n return scale;\n }\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n this._refresh();\n }\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n this._refresh();\n }\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get leftWidth(): number\n {\n return this._leftWidth;\n }\n\n set leftWidth(value: number)\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get rightWidth(): number\n {\n return this._rightWidth;\n }\n\n set rightWidth(value: number)\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get topHeight(): number\n {\n return this._topHeight;\n }\n\n set topHeight(value: number)\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get bottomHeight(): number\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value: number)\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n private _refresh(): void\n {\n const texture = this.texture;\n\n const uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class AnimatedSprite extends Sprite\n{\n public animationSpeed: number;\n public loop: boolean;\n public updateAnchor: boolean;\n public onComplete: () => void;\n public onFrameChange: (currentFrame: number) => void;\n public onLoop: () => void;\n\n private _playing: boolean;\n private _textures: Texture[];\n private _durations: number[];\n private _autoUpdate: boolean;\n private _isConnectedToTicker: boolean;\n private _currentTime: number;\n private _previousFrame: number;\n\n /**\n * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n constructor(textures: Texture[]|FrameObject[], autoUpdate = true)\n {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n this._textures = null;\n\n /**\n * @type {number[]}\n * @private\n */\n this._durations = null;\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n this._playing = false;\n\n /**\n * The texture index that was displayed last time\n *\n * @member {number}\n * @private\n */\n this._previousFrame = null;\n\n this.textures = textures;\n }\n\n /**\n * Stops the AnimatedSprite.\n *\n */\n public stop(): void\n {\n if (!this._playing)\n {\n return;\n }\n\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Plays the AnimatedSprite.\n *\n */\n public play(): void\n {\n if (this._playing)\n {\n return;\n }\n\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n public gotoAndStop(frameNumber: number): void\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n public gotoAndPlay(frameNumber: number): void\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @param {number} deltaTime - Time since last tick.\n */\n update(deltaTime: number): void\n {\n if (!this._playing)\n {\n return;\n }\n\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n private updateTexture(): void\n {\n const currentFrame = this.currentFrame;\n\n if (this._previousFrame === currentFrame)\n {\n return;\n }\n\n this._previousFrame = currentFrame;\n\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.stop();\n super.destroy(options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames.\n */\n public static fromFrames(frames: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n public static fromImages(images: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get totalFrames(): number\n {\n return this._textures.length;\n }\n\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]}\n */\n get textures(): Texture[]|FrameObject[]\n {\n return this._textures;\n }\n\n set textures(value: Texture[]|FrameObject[])\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value as Texture[];\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push((value[i] as FrameObject).texture);\n this._durations.push((value[i] as FrameObject).time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n get currentFrame(): number\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n get playing(): boolean\n {\n return this._playing;\n }\n\n /**\n * Whether to use PIXI.Ticker.shared to auto update animation time\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\nexport interface FrameObject {\n texture: Texture;\n time: number;\n}\n\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n","import '@pixi/polyfill';\n\nimport * as utils from '@pixi/utils';\nimport { AccessibilityManager } from '@pixi/accessibility';\nimport { InteractionManager } from '@pixi/interaction';\nimport { Application } from '@pixi/app';\nimport { Renderer, BatchRenderer } from '@pixi/core';\nimport { Extract } from '@pixi/extract';\nimport { Loader, AppLoaderPlugin } from '@pixi/loaders';\nimport { ParticleRenderer } from '@pixi/particles';\nimport { Prepare } from '@pixi/prepare';\nimport { SpritesheetLoader } from '@pixi/spritesheet';\nimport { TilingSpriteRenderer } from '@pixi/sprite-tiling';\nimport { BitmapFontLoader } from '@pixi/text-bitmap';\nimport { TickerPlugin } from '@pixi/ticker';\nimport { AlphaFilter } from '@pixi/filter-alpha';\nimport { BlurFilter, BlurFilterPass } from '@pixi/filter-blur';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { DisplacementFilter } from '@pixi/filter-displacement';\nimport { FXAAFilter } from '@pixi/filter-fxaa';\nimport { NoiseFilter } from '@pixi/filter-noise';\nimport '@pixi/mixin-cache-as-bitmap';\nimport '@pixi/mixin-get-child-by-name';\nimport '@pixi/mixin-get-global-position';\n\n// Export deprecations so Rollup can call it\n// in the footer after global is defined\n// other module must call this manually\nimport { useDeprecated } from './useDeprecated';\n\n// Install renderer plugins\nRenderer.registerPlugin('accessibility', AccessibilityManager);\nRenderer.registerPlugin('extract', Extract);\nRenderer.registerPlugin('interaction', InteractionManager);\nRenderer.registerPlugin('particle', ParticleRenderer);\nRenderer.registerPlugin('prepare', Prepare);\nRenderer.registerPlugin('batch', BatchRenderer);\nRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n\nLoader.registerPlugin(BitmapFontLoader);\nLoader.registerPlugin(SpritesheetLoader);\n\nApplication.registerPlugin(TickerPlugin);\nApplication.registerPlugin(AppLoaderPlugin);\n\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nexport const VERSION = '__VERSION__';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nexport const filters = {\n AlphaFilter,\n BlurFilter,\n BlurFilterPass,\n ColorMatrixFilter,\n DisplacementFilter,\n FXAAFilter,\n NoiseFilter,\n};\n\n// Export ES for those importing specifically by name,\nexport * from '@pixi/accessibility';\nexport * from '@pixi/app';\nexport * from '@pixi/constants';\nexport * from '@pixi/core';\nexport * from '@pixi/display';\nexport * from '@pixi/extract';\nexport * from '@pixi/graphics';\nexport * from '@pixi/loaders';\nexport * from '@pixi/interaction';\nexport * from '@pixi/math';\nexport * from '@pixi/mesh';\nexport * from '@pixi/mesh-extras';\nexport * from '@pixi/particles';\nexport * from '@pixi/prepare';\nexport * from '@pixi/runner';\nexport * from '@pixi/sprite';\nexport * from '@pixi/spritesheet';\nexport * from '@pixi/sprite-animated';\nexport * from '@pixi/sprite-tiling';\nexport * from '@pixi/text';\nexport * from '@pixi/text-bitmap';\nexport * from '@pixi/ticker';\nexport * from '@pixi/settings';\nexport {\n utils,\n useDeprecated,\n};\n"],"names":["define","global","this","arguments","Polyfill","isMobile","isMobileCall","hasOwnProperty","require$$0","require$$1","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","sign","_url.parse","SHAPES","EventEmitter","UPDATE_PRIORITY","extendStatics","__extends","getBufferType","map","interleaveTypedArrays","UID","byteSizeMap","defaultVertex","defaultFragment","BLEND","OFFSET","CULLING","DEPTH_TEST","WINDING","_noop","eachSeries","array","iterator","callback","deferNext","i","len","length","next","err","setTimeout","onlyOnce","fn","onceWrapper","Error","callFn","apply","queue","worker","concurrency","workers","q","_tasks","saturated","unsaturated","buffer","empty","drain","error","started","paused","push","data","_insert","kill","unshift","process","task","shift","_next","running","idle","pause","resume","w","insertAtFront","item","cache","caching","resource","url","complete","onComplete","once","useXdr","window","XDomainRequest","XMLHttpRequest","tempAnchor","STATUS_NONE","STATUS_OK","STATUS_EMPTY","STATUS_IE_BUG_EMPTY","STATUS_TYPE_OK","Resource","setExtensionLoadType","extname","loadType","setExtMap","_loadTypeMap","setExtensionXhrType","xhrType","_xhrTypeMap","name","options","_flags","_setFlag","STATUS_FLAGS","DATA_URL","indexOf","extension","_getExtension","crossOrigin","timeout","_determineLoadType","metadata","xhr","children","type","TYPE","UNKNOWN","progressChunk","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","bind","_boundOnError","_onError","_boundOnProgress","_onProgress","_boundOnTimeout","_onTimeout","_boundXhrOnError","_xhrOnError","_boundXhrOnTimeout","_xhrOnTimeout","_boundXhrOnAbort","_xhrOnAbort","_boundXhrOnLoad","_xhrOnLoad","onStart","Signal","onProgress","onAfterMiddleware","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","isLoading","isComplete","LOADING","dispatch","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","_loadXdr","_loadXhr","_hasFlag","flag","value","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","COMPLETE","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","Array","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","mime","source","event","target","nodeName","lengthComputable","loaded","total","reqType","status","statusText","text","responseText","BUFFER","statusType","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parseUri","strictMode","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","substring","queryStart","hashStart","index","Math","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","NONE","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","val","toString","replace","_keyStr","encodeBinary","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","paddingBytes","charAt","Url","URL","webkitURL","parsing","Blob","getResponseHeader","createObjectURL","blob","revokeObjectURL","MAX_PROGRESS","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","d","_loadResource","_queue","async","resources","onError","onLoad","_defaultBeforeMiddleware","pre","_defaultAfterMiddleware","use","add","key","parentResource","_prepareUrl","parent","incompleteChildren","fullChunk","eachChunk","reset","k","res","detach","_onStart","_onComplete","numTasks","chunk","parsedUrl","result","path","hash","exec","substr","dequeue","call","_onLoad","splice","LoaderPreStatic","LoaderUseStatic","ResourceLoader","middleware","vertex","fragment","LINE_JOIN","LINE_CAP","earcut","TEXT_GRADIENT","tempPoint","tempMat","fragTemplate","defaultFilterVertex","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA,CAAC,SAAS,MAAM,CAAC;;;;;;CAMjB,IAAI,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;CACtC,IAAI,sBAAsB;GACxB,aAAa;;;GAGb,SAAS,IAAI,aAAa;GAC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C,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;CAC3D,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;CACtD,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CAC5C,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;CAChD,QAAQ,CAAC,cAAc,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC;AAE9DkS,SAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;AACxCA,SAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;CAEzC,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;CACzC,WAAW,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;;;;;;;;;;AAW5C,KAAa6D,SAAO,GAAG,OAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCrC,KAAa,OAAO,GAAG;KACnB,WAAW,aAAA;KACX,UAAU,YAAA;KACV,cAAc,gBAAA;KACd,iBAAiB,mBAAA;KACjB,kBAAkB,oBAAA;KAClB,UAAU,YAAA;KACV,WAAW,aAAA;EACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/www/js/libs/pixi.min.js b/www/js/libs/pixi.min.js deleted file mode 100644 index 2620366..0000000 --- a/www/js/libs/pixi.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * pixi.js - v5.3.8 - * Compiled Sat, 20 Mar 2021 23:46:58 UTC - * - * pixi.js is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ -var PIXI=function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,e){return t(e={exports:{}},e.exports),e.exports}var i=r(function(t,r){!function(t){var e=t.Promise,i=e&&"resolve"in e&&"reject"in e&&"all"in e&&"race"in e&&function(){var t;return new e(function(e){t=e}),"function"==typeof t}();r?(r.Promise=i?e:T,r.Polyfill=T):i||(t.Promise=T);var n="pending",o="sealed",s="fulfilled",a="rejected",h=function(){};function u(t){return"[object Array]"===Object.prototype.toString.call(t)}var l,c="undefined"!=typeof setImmediate?setImmediate:setTimeout,d=[];function p(){for(var t=0;t0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),window.ArrayBuffer||(window.ArrayBuffer=Array),window.Float32Array||(window.Float32Array=Array),window.Uint32Array||(window.Uint32Array=Array),window.Uint16Array||(window.Uint16Array=Array),window.Uint8Array||(window.Uint8Array=Array),window.Int32Array||(window.Int32Array=Array);var f=/iPhone/i,m=/iPod/i,v=/iPad/i,y=/\biOS-universal(?:.+)Mac\b/i,g=/\bAndroid(?:.+)Mobile\b/i,_=/Android/i,x=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,b=/Silk/i,E=/Windows Phone/i,T=/\bWindows(?:.+)ARM\b/i,P=/BlackBerry/i,S=/BB10/i,w=/Opera Mini/i,I=/\b(CriOS|Chrome)(?:.+)Mobile/i,A=/Mobile(?:.+)Firefox\b/i,O=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};var M=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=e.userAgent,i=r.split("[FBAN");void 0!==i[1]&&(r=i[0]),void 0!==(i=r.split("Twitter"))[1]&&(r=i[0]);var n=function(t){return function(e){return e.test(t)}}(r),o={apple:{phone:n(f)&&!n(E),ipod:n(m),tablet:!n(f)&&(n(v)||O(e))&&!n(E),universal:n(y),device:(n(f)||n(m)||n(v)||n(y)||O(e))&&!n(E)},amazon:{phone:n(x),tablet:!n(x)&&n(b),device:n(x)||n(b)},android:{phone:!n(E)&&n(x)||!n(E)&&n(g),tablet:!n(E)&&!n(x)&&!n(g)&&(n(b)||n(_)),device:!n(E)&&(n(x)||n(b)||n(g)||n(_))||n(/\bokhttp\b/i)},windows:{phone:n(E),tablet:n(T),device:n(E)||n(T)},other:{blackberry:n(P),blackberry10:n(S),opera:n(w),firefox:n(A),chrome:n(I),device:n(P)||n(S)||n(w)||n(A)||n(I)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}(window.navigator);var C={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(M.tablet||M.phone){var r;M.apple.device&&(r=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(r[1],10)<11&&(e=!1),M.android.device&&(r=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(r[1],10)<7&&(e=!1)}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:M.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!M.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},D=r(function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,o||t,s),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,s=new Array(o);n80*r){i=o=t[0],n=s=t[1];for(var f=r;fo&&(o=a),h>s&&(s=h);u=0!==(u=Math.max(o-i,s-n))?1/u:0}return U(d,p,r,i,n,u),p}function F(t,e,r,i,n){var o,s;if(n===st(t,e,r,i)>0)for(o=e;o=e;o-=i)s=it(o,t[o],t[o+1],s);return s&&J(s,s.next)&&(nt(s),s=s.next),s}function B(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!J(i,i.next)&&0!==Z(i.prev,i,i.next))i=i.next;else{if(nt(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function U(t,e,r,i,n,o,s){if(t){!s&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=V(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,s,a,h,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,i=r,a=0,e=0;e0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(s>1)}(n)}(t,i,n,o);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?X(t,i,n,o):k(t))e.push(a.i/r),e.push(t.i/r),e.push(h.i/r),nt(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?U(t=j(B(t),e,r),e,r,i,n,o,2):2===s&&G(t,e,r,i,n,o):U(B(t),e,r,i,n,o,1);break}}}function k(t){var e=t.prev,r=t,i=t.next;if(Z(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(q(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&Z(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function X(t,e,r,i){var n=t.prev,o=t,s=t.next;if(Z(n,o,s)>=0)return!1;for(var a=n.xo.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,l=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,c=V(a,h,e,r,i),d=V(u,l,e,r,i),p=t.prevZ,f=t.nextZ;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Z(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Z(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&q(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Z(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function j(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!J(n,o)&&Q(n,i,i.next,o)&&et(n,o)&&et(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),nt(i),nt(i.next),i=t=o),i=i.next}while(i!==t);return B(i)}function G(t,e,r,i,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&K(s,a)){var h=rt(s,a);return s=B(s,s.next),h=B(h,h.next),U(s,e,r,i,n,o),void U(h,e,r,i,n,o)}a=a.next}s=s.next}while(s!==t)}function H(t,e){return t.x-e.x}function Y(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x=i.x&&i.x>=l&&n!==i.x&&q(or.x||i.x===r.x&&z(r,i)))&&(r=i,d=h)),i=i.next}while(i!==u);return r}(t,e)){var r=rt(e,t);B(e,e.next),B(r,r.next)}}function z(t,e){return Z(t.prev,t,e.prev)<0&&Z(e.next,t,t.next)<0}function V(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function W(t){var e=t,r=t;do{(e.x=0&&(t-s)*(i-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(n-s)*(i-a)>=0}function K(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Q(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(et(t,e)&&et(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(Z(t.prev,t,e.prev)||Z(t,e.prev,e))||J(t,e)&&Z(t.prev,t,t.next)>0&&Z(e.prev,e,e.next)>0)}function Z(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function J(t,e){return t.x===e.x&&t.y===e.y}function Q(t,e,r,i){var n=tt(Z(t,e,r)),o=tt(Z(t,e,i)),s=tt(Z(r,i,t)),a=tt(Z(r,i,e));return n!==o&&s!==a||(!(0!==n||!$(t,r,e))||(!(0!==o||!$(t,i,e))||(!(0!==s||!$(r,t,i))||!(0!==a||!$(r,e,i)))))}function $(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function tt(t){return t>0?1:t<0?-1:0}function et(t,e){return Z(t.prev,t,t.next)<0?Z(t,e,t.next)>=0&&Z(t,t.prev,e)>=0:Z(t,e,t.prev)<0||Z(t,t.next,e)<0}function rt(t,e){var r=new ot(t.i,t.x,t.y),i=new ot(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function it(t,e,r,i){var n=new ot(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function nt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ot(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function st(t,e,r,i){for(var n=0,o=e,s=r-i;o0&&(i+=t[n-1].length,r.holes.push(i))}return r},R.default=L;var at=r(function(t,r){!function(i){var n=r&&!r.nodeType&&r,o=t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,h,u=2147483647,l=36,c=1,d=26,p=38,f=700,m=72,v=128,y="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-c,T=Math.floor,P=String.fromCharCode;function S(t){throw RangeError(b[t])}function w(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function I(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+w((t=t.replace(x,".")).split("."),e).join(".")}function A(t){for(var e,r,i=[],n=0,o=t.length;n=55296&&e<=56319&&n65535&&(e+=P((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=P(t)}).join("")}function M(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function C(t,e,r){var i=0;for(t=r?T(t/f):t>>1,t+=T(t/e);t>E*d>>1;i+=l)t=T(t/E);return T(i+(E+1)*t/(t+p))}function D(t){var e,r,i,n,o,s,a,h,p,f,g,_=[],x=t.length,b=0,E=v,P=m;for((r=t.lastIndexOf(y))<0&&(r=0),i=0;i=128&&S("not-basic"),_.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=x&&S("invalid-input"),((h=(g=t.charCodeAt(n++))-48<10?g-22:g-65<26?g-65:g-97<26?g-97:l)>=l||h>T((u-b)/s))&&S("overflow"),b+=h*s,!(h<(p=a<=P?c:a>=P+d?d:a-P));a+=l)s>T(u/(f=l-p))&&S("overflow"),s*=f;P=C(b-o,e=_.length+1,0==o),T(b/e)>u-E&&S("overflow"),E+=T(b/e),b%=e,_.splice(b++,0,E)}return O(_)}function R(t){var e,r,i,n,o,s,a,h,p,f,g,_,x,b,E,w=[];for(_=(t=A(t)).length,e=v,r=0,o=m,s=0;s<_;++s)(g=t[s])<128&&w.push(P(g));for(i=n=w.length,n&&w.push(y);i<_;){for(a=u,s=0;s<_;++s)(g=t[s])>=e&&gT((u-r)/(x=i+1))&&S("overflow"),r+=(a-e)*x,e=a,s=0;s<_;++s)if((g=t[s])u&&S("overflow"),g==e){for(h=r,p=l;!(h<(f=p<=o?c:p>=o+d?d:p-o));p+=l)E=h-f,b=l-f,w.push(P(M(f+E%b,0))),h=T(E/b);w.push(P(M(h,0))),o=C(r,x,i==n),r=0,++i}++r,++e}return w.join("")}if(a={version:"1.3.2",ucs2:{decode:A,encode:O},decode:D,encode:R,toASCII:function(t){return I(t,function(t){return _.test(t)?"xn--"+R(t):t})},toUnicode:function(t){return I(t,function(t){return g.test(t)?D(t.slice(4).toLowerCase()):t})}},n&&o)if(t.exports==n)o.exports=a;else for(h in a)a.hasOwnProperty(h)&&(n[h]=a[h]);else i.punycode=a}(e)}),ht={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}};ht.isString,ht.isObject,ht.isNull,ht.isNullOrUndefined;function ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var lt=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if("string"!=typeof t||0===t.length)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var h=0;h=0?(u=p.substr(0,f),l=p.substr(f+1)):(u=p,l=""),c=decodeURIComponent(u),d=decodeURIComponent(l),ut(n,c)?Array.isArray(n[c])?n[c].push(d):n[c]=[n[c],d]:n[c]=d}return n},ct=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},dt=function(t,e,r,i){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map(function(i){var n=encodeURIComponent(ct(i))+r;return Array.isArray(t[i])?t[i].map(function(t){return n+encodeURIComponent(ct(t))}).join(e):n+encodeURIComponent(ct(t[i]))}).join(e):i?encodeURIComponent(ct(i))+r+encodeURIComponent(ct(t)):""},pt=r(function(t,e){e.decode=e.parse=lt,e.encode=e.stringify=dt}),ft=(pt.decode,pt.parse,pt.encode,pt.stringify,Dt),mt=function(t,e){return Dt(t,!1,!0).resolve(e)},vt=function(t,e){if(!t)return e;return Dt(t,!1,!0).resolveObject(e)},yt=function(t){ht.isString(t)&&(t=Dt(t));if(!(t instanceof _t))return _t.prototype.format.call(t);return t.format()},gt=_t;function _t(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var xt=/^([a-z0-9.+-]+:)/i,bt=/:[0-9]*$/,Et=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Tt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Pt=["'"].concat(Tt),St=["%","/","?",";","#"].concat(Pt),wt=["/","?","#"],It=/^[+a-z0-9A-Z_-]{0,63}$/,At=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ot={javascript:!0,"javascript:":!0},Mt={javascript:!0,"javascript:":!0},Ct={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Dt(t,e,r){if(t&&ht.isObject(t)&&t instanceof _t)return t;var i=new _t;return i.parse(t,e,r),i}_t.prototype.parse=function(t,e,r){if(!ht.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=-1!==i&&i127?x+="x":x+=_[b];if(!x.match(It)){var T=y.slice(0,f),P=y.slice(f+1),S=_.match(At);S&&(T.push(S[1]),P.unshift(S[2])),P.length&&(s="/"+P.join(".")+s),this.hostname=T.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=at.toASCII(this.hostname));var w=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+w,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Ot[u])for(f=0,g=Pt.length;f0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift());return r.search=t.search,r.query=t.query,ht.isNull(r.pathname)&&ht.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===b||".."===b)||""===b,T=0,P=_.length;P>=0;P--)"."===(b=_[P])?_.splice(P,1):".."===b?(_.splice(P,1),T++):T&&(_.splice(P,1),T--);if(!y&&!g)for(;T--;T)_.unshift("..");!y||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var S,w=""===_[0]||_[0]&&"/"===_[0].charAt(0);x&&(r.hostname=r.host=w?"":_.length?_.shift():"",(S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift()));return(y=y||r.host&&_.length)&&!w&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),ht.isNull(r.pathname)&&ht.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},_t.prototype.parseHost=function(){var t=this.host,e=bt.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var Rt={parse:ft,resolve:mt,resolveObject:vt,format:yt,Url:gt};!function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(t.ENV||(t.ENV={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(t.RENDERER_TYPE||(t.RENDERER_TYPE={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(t.BUFFER_BITS||(t.BUFFER_BITS={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(t.BLEND_MODES||(t.BLEND_MODES={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(t.DRAW_MODES||(t.DRAW_MODES={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(t.FORMATS||(t.FORMATS={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(t.TARGETS||(t.TARGETS={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.FLOAT=5126]="FLOAT",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(t.TYPES||(t.TYPES={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(t.SCALE_MODES||(t.SCALE_MODES={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(t.WRAP_MODES||(t.WRAP_MODES={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON"}(t.MIPMAP_MODES||(t.MIPMAP_MODES={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(t.ALPHA_MODES||(t.ALPHA_MODES={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(t.CLEAR_MODES||(t.CLEAR_MODES={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(t.GC_MODES||(t.GC_MODES={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(t.PRECISION||(t.PRECISION={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE"}(t.MASK_TYPES||(t.MASK_TYPES={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(t.MSAA_QUALITY||(t.MSAA_QUALITY={})),C.RETINA_PREFIX=/@([0-9\.]+)x/,C.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!0;var Lt,Nt=!1,Ft="5.3.8";function Bt(t){var e;if(!Nt){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var r=["\n %c %c %c PixiJS "+Ft+" - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=window.console).log.apply(e,r)}else window.console&&window.console.log("PixiJS "+Ft+" - "+t+" - http://www.pixijs.com/");Nt=!0}}function Ut(){return void 0===Lt&&(Lt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:C.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!window.WebGLRenderingContext)return!1;var e=document.createElement("canvas"),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!(!r||!r.getContextAttributes().stencil);if(r){var n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch(t){return!1}}()),Lt}function kt(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function Xt(t){var e=t.toString(16);return"#"+(e="000000".substr(0,6-e.length)+e)}function jt(t){return"string"==typeof t&&"#"===t[0]&&(t=t.substr(1)),parseInt(t,16)}var Gt=function(){for(var e=[],r=[],i=0;i<32;i++)e[i]=i,r[i]=i;e[t.BLEND_MODES.NORMAL_NPM]=t.BLEND_MODES.NORMAL,e[t.BLEND_MODES.ADD_NPM]=t.BLEND_MODES.ADD,e[t.BLEND_MODES.SCREEN_NPM]=t.BLEND_MODES.SCREEN,r[t.BLEND_MODES.NORMAL]=t.BLEND_MODES.NORMAL_NPM,r[t.BLEND_MODES.ADD]=t.BLEND_MODES.ADD_NPM,r[t.BLEND_MODES.SCREEN]=t.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(r),n.push(e),n}();function Ht(t,e){return Gt[e?1:0][t]}function Yt(t,e,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e):(r[0]=t[0],r[1]=t[1],r[2]=t[2]),r[3]=e,r}function zt(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var r=t>>16&255,i=t>>8&255,n=255&t;return(255*e<<24)+((r=r*e+.5|0)<<16)+((i=i*e+.5|0)<<8)+(n=n*e+.5|0)}function Vt(t,e,r,i){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,(i||void 0===i)&&(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}function Wt(t,e){void 0===e&&(e=null);var r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+r);for(var i=0,n=0;i>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function Jt(t){return!(t&t-1||!t)}function Qt(t){var e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,e|=r=((t>>>=r)>15?1:0)<<2,(e|=r=((t>>>=r)>3?1:0)<<1)|(t>>>=r)>>1}function $t(t,e,r){var i,n=t.length;if(!(e>=n||0===r)){var o=n-(r=e+r>n?n-e:r);for(i=e;i=this.x&&t=this.y&&ee!=u>e&&t<(e-a)/(u-a)*(h-s)+s&&(r=!r)}return r},e}(),Te=function(){function e(e,r,i,n,o){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=20),this.x=e,this.y=r,this.width=i,this.height=n,this.radius=o,this.type=t.SHAPES.RREC}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height,this.radius)},e.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(e>=this.y+this.radius&&e<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var r=t-(this.x+this.radius),i=e-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=t-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=e-(this.y+this.height-this.radius))*i<=n)return!0;if((r=t-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}(),Pe=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},t}(),Se=function(){function t(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this._x=r,this._y=i,this.cb=t,this.scope=e}return t.prototype.clone=function(e,r){return void 0===e&&(e=this.cb),void 0===r&&(r=this.scope),new t(e,r,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),we=function(){function t(t,e,r,i,n,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,r,i,n,o){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r},t.prototype.apply=function(t,e){e=e||new Pe;var r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new Pe;var r=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*r*i+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*n+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this},t.prototype.append=function(t){var e=this.a,r=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,r,i,n,o,s,a,h){return this.a=Math.cos(s+h)*n,this.b=Math.sin(s+h)*n,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var r=this.a,i=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,r=this.b,i=this.c,n=this.d,o=-Math.atan2(-i,n),s=Math.atan2(r,e),a=Math.abs(o+s);return a<1e-5||Math.abs(ve-a)<1e-5?(t.rotation=s,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=s),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx,t.position.y=this.ty,t},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,i=this.d,n=this.tx,o=t*i-e*r;return this.a=i/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),Ie=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ae=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Oe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Me=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ce=[],De=[],Re=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];Ce.push(e);for(var r=0;r<16;r++)for(var i=Re(Ie[t]*Ie[r]+Oe[t]*Ae[r]),n=Re(Ae[t]*Ie[r]+Me[t]*Ae[r]),o=Re(Ie[t]*Oe[r]+Oe[t]*Me[r]),s=Re(Ae[t]*Oe[r]+Me[t]*Me[r]),a=0;a<16;a++)if(Ie[a]===i&&Ae[a]===n&&Oe[a]===o&&Me[a]===s){e.push(a);break}}for(t=0;t<16;t++){var h=new we;h.set(Ie[t],Ae[t],Oe[t],Me[t],0,0),De.push(h)}}();var Le={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return Ie[t]},uY:function(t){return Ae[t]},vX:function(t){return Oe[t]},vY:function(t){return Me[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return Ce[t][e]},sub:function(t,e){return Ce[t][Le.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?Le.S:Le.N:2*Math.abs(e)<=Math.abs(t)?t>0?Le.E:Le.W:e>0?t>0?Le.SE:Le.SW:t>0?Le.NE:Le.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=De[Le.inv(e)];n.tx=r,n.ty=i,t.append(n)}},Ne=function(){function t(){this.worldTransform=new we,this.localTransform=new we,this.position=new Se(this.onChange,this,0,0),this.scale=new Se(this.onChange,this,1,1),this.pivot=new Se(this.onChange,this,0,0),this.skew=new Se(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();C.SORTABLE_CHILDREN=!1;var Fe=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?_e.EMPTY:((t=t||new _e(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addQuad=function(t){var e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=t[0],s=t[1];e=oi?o:i,n=s>n?s:n,e=(o=t[2])i?o:i,n=s>n?s:n,e=(o=t[4])i?o:i,n=s>n?s:n,e=(o=t[6])i?o:i,n=s>n?s:n,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},t.prototype.addFrame=function(t,e,r,i,n){this.addFrameMatrix(t.worldTransform,e,r,i,n)},t.prototype.addFrameMatrix=function(t,e,r,i,n){var o=t.a,s=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=o*e+a*r+u,v=s*e+h*r+l;c=mp?m:p,f=v>f?v:f,c=(m=o*i+a*r+u)p?m:p,f=v>f?v:f,c=(m=o*e+a*n+u)p?m:p,f=v>f?v:f,c=(m=o*i+a*n+u)p?m:p,f=v>f?v:f,this.minX=c,this.minY=d,this.maxX=p,this.maxY=f},t.prototype.addVertexData=function(t,e,r){for(var i=this.minX,n=this.minY,o=this.maxX,s=this.maxY,a=e;ao?h:o,s=u>s?u:s}this.minX=i,this.minY=n,this.maxX=o,this.maxY=s},t.prototype.addVertices=function(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)},t.prototype.addVerticesMatrix=function(t,e,r,i,n,o){void 0===n&&(n=0),void 0===o&&(o=n);for(var s=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,d=this.minX,p=this.minY,f=this.maxX,m=this.maxY,v=r;vi?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,r,i,n,o){t-=n,e-=o,r+=n,i+=o,this.minX=this.minXr?this.maxX:r,this.minY=this.minYi?this.maxY:i},t}(),Be=function(t,e){return(Be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function Ue(t,e){function r(){this.constructor=t}Be(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var ke=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Ne,e.alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Fe,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return Ue(e,t),e.mixin=function(t){for(var r=Object.keys(t),i=0;i1)for(var i=0;ithis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(t);$t(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,e=[],r=0;r1)for(var i=0;i0&&n<=e){r=this.children.splice(i,n);for(var o=0;o1&&this.children.sort(je),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t title : "+t.title+"
tabIndex: "+t.tabIndex},t.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0),t.x+t.width>this.renderer.width&&(t.width=this.renderer.width-t.x),t.y+t.height>this.renderer.height&&(t.height=this.renderer.height-t.y)},t.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width=ze+"px",e.style.height=ze+"px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=qe.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},t.prototype._onClick=function(t){var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"click",e.eventData),e.dispatchEvent(t.target.displayObject,"pointertap",e.eventData),e.dispatchEvent(t.target.displayObject,"tap",e.eventData)},t.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseover",e.eventData)},t.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseout",e.eventData)},t.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},t.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},t.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},t}();C.TARGET_FPMS=.06,(Ye=t.UPDATE_PRIORITY||(t.UPDATE_PRIORITY={}))[Ye.INTERACTION=50]="INTERACTION",Ye[Ye.HIGH=25]="HIGH",Ye[Ye.NORMAL=0]="NORMAL",Ye[Ye.LOW=-25]="LOW",Ye[Ye.UTILITY=-50]="UTILITY";var Ze=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=0),void 0===i&&(i=!1),this.fn=t,this.context=e,this.priority=r,this.once=i,this.next=null,this.previous=null,this._destroyed=!1}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),Je=function(){function e(){var t=this;this._head=new Ze(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/C.TARGET_FPMS,this.elapsedMS=1/C.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Ze(e,r,i))},e.prototype.addOnce=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Ze(e,r,i,!0))},e.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(t,e){for(var r=this._head.next;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(e.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r=0;l--){var c=u[l],d=this.recursiveFindHit(t,c,r,i,a);if(d){if(!c.parent)continue;a=!1,d&&(t.target&&(i=!1),s=!0)}}return n&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),r&&r(t,e,!!s))),s},t.prototype.findHit=function(t,e,r,i){this.recursiveFindHit(t,e,r,i,!1)},t}(),nr={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};ke.mixin(nr);var or=1,sr={target:null,data:{global:null}},ar=function(e){function r(t,r){var i=e.call(this)||this;return r=r||{},i.renderer=t,i.autoPreventDefault=void 0===r.autoPreventDefault||r.autoPreventDefault,i.interactionFrequency=r.interactionFrequency||10,i.mouse=new $e,i.mouse.identifier=or,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[or]=i.mouse,i.interactionDataPool=[],i.eventData=new er,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!1,i.supportsTouchEvents="ontouchstart"in window,i.supportsPointerEvents=!!window.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new ir,i._tempDisplayObject=new Xe,i._useSystemTicker=void 0===r.useSystemTicker||r.useSystemTicker,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return function(t,e){function r(){this.constructor=t}tr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),Object.defineProperty(r.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),r.prototype.hitTest=function(t,e){return sr.target=null,sr.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(sr,e,null,!0),sr.target},r.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},r.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Je.system.add(this.tickerUpdate,this,t.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},r.prototype.removeTickerListener=function(){this.tickerAdded&&(Je.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},r.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0}},r.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1}},r.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime8)throw new Error("max arguments reached");var h=this.name,u=this.items;this._aliasCount++;for(var l=0,c=u.length;l0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(hr.prototype,{dispatch:{value:hr.prototype.emit},run:{value:hr.prototype.emit}}),C.PREFER_ENV=M.any?t.ENV.WEBGL:t.ENV.WEBGL2,C.STRICT_TEXTURE_CACHE=!1;var ur=[];function lr(t,e){if(!t)return null;var r="";if("string"==typeof t){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);i&&(r=i[1].toLowerCase())}for(var n=ur.length-1;n>=0;--n){var o=ur[n];if(o.test&&o.test(t,r))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var cr=function(t,e){return(cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function dr(t,e){function r(){this.constructor=t}cr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var pr=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new hr("setRealSize"),this.onUpdate=new hr("update"),this.onError=new hr("onError")}return t.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},t.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},t.prototype.resize=function(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(t.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),t.prototype.update=function(){this.destroyed||this.onUpdate.emit()},t.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.style=function(t,e,r){return!1},t.prototype.dispose=function(){},t.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},t.test=function(t,e){return!1},t}(),fr=function(e){function r(t,r){var i=this,n=r||{},o=n.width,s=n.height;if(!o||!s)throw new Error("BufferResource width or height invalid");return(i=e.call(this,o,s)||this).data=t,i}return dr(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,i.internalFormat,r.width,r.height,0,r.format,i.type,this.data)),!0},r.prototype.dispose=function(){this.data=null},r.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},r}(pr),mr={scaleMode:t.SCALE_MODES.NEAREST,format:t.FORMATS.RGBA,alphaMode:t.ALPHA_MODES.NPM},vr=function(e){function r(r,i){void 0===r&&(r=null),void 0===i&&(i=null);var n=e.call(this)||this,o=(i=i||{}).alphaMode,s=i.mipmap,a=i.anisotropicLevel,h=i.scaleMode,u=i.width,l=i.height,c=i.wrapMode,d=i.format,p=i.type,f=i.target,m=i.resolution,v=i.resourceOptions;return!r||r instanceof pr||((r=lr(r,v)).internal=!0),n.width=u||0,n.height=l||0,n.resolution=m||C.RESOLUTION,n.mipmap=void 0!==s?s:C.MIPMAP_TEXTURES,n.anisotropicLevel=void 0!==a?a:C.ANISOTROPIC_LEVEL,n.wrapMode=c||C.WRAP_MODE,n.scaleMode=void 0!==h?h:C.SCALE_MODE,n.format=d||t.FORMATS.RGBA,n.type=p||t.TYPES.UNSIGNED_BYTE,n.target=f||t.TARGETS.TEXTURE_2D,n.alphaMode=void 0!==o?o:t.ALPHA_MODES.UNPACK,void 0!==i.premultiplyAlpha&&(n.premultiplyAlpha=i.premultiplyAlpha),n.uid=re(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=u>0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(r),n}return dr(r,e),Object.defineProperty(r.prototype,"realWidth",{get:function(){return Math.ceil(this.width*this.resolution-1e-4)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"realHeight",{get:function(){return Math.ceil(this.height*this.resolution-1e-4)},enumerable:!1,configurable:!0}),r.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},r.prototype.setSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t,this.height=e,this._refreshPOT(),this.update(),this},r.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t/this.resolution,this.height=e/this.resolution,this._refreshPOT(),this.update(),this},r.prototype._refreshPOT=function(){this.isPowerOfTwo=Jt(this.realWidth)&&Jt(this.realHeight)},r.prototype.setResolution=function(t){var e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=this.width*e/t,this.height=this.height*e/t,this.emit("update",this)),this._refreshPOT(),this)},r.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},r.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},r.prototype.onError=function(t){this.emit("error",this,t)},r.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ae[this.cacheId],delete se[this.cacheId],this.cacheId=null),this.dispose(),r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},r.prototype.dispose=function(){this.emit("dispose",this)},r.prototype.castToBaseTexture=function(){return this},r.from=function(t,e,i){void 0===i&&(i=C.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;n?o=t:(t._pixiId||(t._pixiId="pixiid_"+re()),o=t._pixiId);var s=ae[o];if(n&&i&&!s)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return s||((s=new r(t,e)).cacheId=o,r.addToCache(s,o)),s},r.fromBuffer=function(e,i,n,o){e=e||new Float32Array(i*n*4);var s=new fr(e,{width:i,height:n}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new r(s,Object.assign(mr,o||{width:i,height:n,type:a}))},r.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),ae[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),ae[e]=t)},r.removeFromCache=function(t){if("string"==typeof t){var e=ae[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete ae[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,r)}else e.target=t.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this},r.prototype.upload=function(t,e,i){for(var n=this.itemDirtyIds,o=0;o]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(_r),Pr=function(t){function e(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];_r.crossOrigin(o,s,i.crossorigin);for(var a=0;a0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){var t=this.source;return 3===t.readyState||4===t.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Je.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Je.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&Je.shared.remove(this.update,this);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Je.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Je.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,r){return t instanceof HTMLVideoElement||e.TYPES.indexOf(r)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(_r),Sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return dr(e,t),e.test=function(t){return!!window.createImageBitmap&&t instanceof ImageBitmap},e}(_r);ur.push(Er,Sr,xr,Pr,Tr,fr,br,gr);var wr={Resource:pr,BaseImageResource:_r,INSTALLED:ur,autoDetectResource:lr,AbstractMultiResource:yr,ArrayResource:gr,BufferResource:fr,CanvasResource:xr,CubeResource:br,ImageResource:Er,SVGResource:Tr,VideoResource:Pr,ImageBitmapResource:Sr},Ir=function(){function t(t){this.renderer=t}return t.prototype.destroy=function(){this.renderer=null},t}(),Ar=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return dr(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,1===e.context.webGLVersion?n.DEPTH_COMPONENT:n.DEPTH_COMPONENT16,r.width,r.height,0,r.format,r.type,this.data)),!0},r}(fr),Or=function(){function e(e,r){this.width=Math.ceil(e||100),this.height=Math.ceil(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new hr("disposeFramebuffer"),this.multisample=t.MSAA_QUALITY.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,r){return void 0===e&&(e=0),this.colorTextures[e]=r||new vr(null,{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,mipmap:t.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new vr(new Ar(null,{width:this.width,height:this.height}),{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:t.MIPMAP_MODES.OFF,format:t.FORMATS.DEPTH_COMPONENT,type:t.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(t,e){if(t=Math.ceil(t),e=Math.ceil(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&e.textureCacheIds.splice(r,1),delete se[t],e}}else if(t&&t.textureCacheIds){for(var i=0;ithis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},e}(D);function Lr(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}Rr.EMPTY=new Rr(new vr),Lr(Rr.EMPTY),Lr(Rr.EMPTY.baseTexture),Rr.WHITE=function(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new Rr(new vr(new xr(t)))}(),Lr(Rr.WHITE),Lr(Rr.WHITE.baseTexture);var Nr=function(t){function e(e,r){var i=this,n=null;if(!(e instanceof Mr)){var o=arguments[1],s=arguments[2],a=arguments[3],h=arguments[4];console.warn("Please use RenderTexture.create("+o+", "+s+") instead of the ctor directly."),n=arguments[0],r=null,e=new Mr({width:o,height:s,scaleMode:a,resolution:h})}return(i=t.call(this,e,r)||this).legacyRenderer=n,i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return dr(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,r){void 0===r&&(r=!0),t=Math.ceil(t),e=Math.ceil(e),this.valid=t>0&&e>0,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r&&this.baseTexture.resize(t,e),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){return"number"==typeof t&&(t={width:t,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new e(new Mr(t))},e}(Rr),Fr=function(){function t(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return t.prototype.createTexture=function(t,e){var r=new Mr(Object.assign({width:t,height:e,resolution:1},this.textureOptions));return new Nr(r)},t.prototype.getOptimalTexture=function(e,r,i){void 0===i&&(i=1);var n=t.SCREEN_KEY;e*=i,r*=i,this.enableFullScreen&&e===this._pixelsWidth&&r===this._pixelsHeight||(n=(65535&(e=Zt(e)))<<16|65535&(r=Zt(r))),this.texturePool[n]||(this.texturePool[n]=[]);var o=this.texturePool[n].pop();return o||(o=this.createTexture(e,r)),o.filterPoolKey=n,o.setResolution(i),o},t.prototype.getFilterTexture=function(t,e){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution);return r.filterFrame=t.filterFrame,r},t.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},t.prototype.returnFilterTexture=function(t){this.returnTexture(t)},t.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var i=0;i0&&e.height>0,i)for(var n=0;n1){for(var u=0;u1&&this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,r.renderTexture,u.renderTexture,t.CLEAR_MODES.BLEND,r),this.returnFilterTexture(r.renderTexture);else{var l=r.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,r.resolution);c.filterFrame=l.filterFrame;var d=0;for(d=0;d=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)},e.prototype.boundArray=function(t,e,r,i){for(var n=t.elements,o=t.ids,s=t.count,a=0,h=0;h=0&&l=t.ENV.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var t=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:t.getExtension("EXT_color_buffer_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear")})},r.prototype.handleContextLost=function(t){t.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(t){var e=t.getContextAttributes(),r="WebGL2RenderingContext"in window&&t instanceof window.WebGL2RenderingContext;r&&(this.webGLVersion=2),e.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(Ir),ri=function(){return function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=t.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null}}(),ii=new _e,ni=function(e){function r(t){var r=e.call(this,t)||this;return r.managedFramebuffers=[],r.unknownFramebuffer=new Or(10,10),r.msaaSamples=null,r}return dr(r,e),r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new _e,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;C.PREFER_ENV===t.ENV.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=function(t){return r.drawBuffersWEBGL(t)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(t,e){var r=this.gl;if(t){var i=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==t.dirtyId&&(i.dirtyId=t.dirtyId,i.dirtyFormat!==t.dirtyFormat?(i.dirtyFormat=t.dirtyFormat,this.updateFramebuffer(t)):i.dirtySize!==t.dirtySize&&(i.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var n=0;n1&&(r.msaaBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.RGBA8,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,r.msaaBuffer));for(var n=[],o=0;o1)){var s=t.colorTextures[o],a=s.parentTextureArray||s;this.renderer.texture.bind(a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+o,s.target,a._glTextures[this.CONTEXT_UID].texture,0),n.push(e.COLOR_ATTACHMENT0+o)}if((n.length>1&&e.drawBuffers(n),t.depthTexture)&&this.writeDepthTexture){var h=t.depthTexture;this.renderer.texture.bind(h,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,0)}r.stencil||!t.stencil&&!t.depth||(r.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),t.depthTexture||e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r.stencil))},r.prototype.detectSamples=function(e){var r=this.msaaSamples,i=t.MSAA_QUALITY.NONE;if(e<=1||null===r)return i;for(var n=0;n=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.stencil&&i.deleteRenderbuffer(r.stencil))}},r.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=i.data.byteLength)e.bufferSubData(o,0,i.data);else{var s=i.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,e.bufferData(o,i.data,s)}}}},r.prototype.checkCompatibility=function(t,e){var r=t.attributes,i=e.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},r.prototype.getSignature=function(t,e){var r=t.attributes,i=e.attributeData,n=["g",t.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},r.prototype.initGeometryVao=function(t,e,r){void 0===r&&(r=!0),this.checkCompatibility(t,e);var i=this.gl,n=this.CONTEXT_UID,o=this.getSignature(t,e),s=t.glVertexArrayObjects[this.CONTEXT_UID],a=s[o];if(a)return s[e.id]=a,a;var h=t.buffers,u=t.attributes,l={},c={};for(var d in h)l[d]=0,c[d]=0;for(var d in u)!u[d].size&&e.attributeData[d]?u[d].size=e.attributeData[d].size:u[d].size||console.warn("PIXI Geometry attribute '"+d+"' size cannot be determined (likely the bound shader does not have the attribute)"),l[u[d].buffer]+=u[d].size*si[u[d].type];for(var d in u){var p=u[d],f=p.size;void 0===p.stride&&(l[p.buffer]===f*si[p.type]?p.stride=0:p.stride=l[p.buffer]),void 0===p.start&&(p.start=c[p.buffer],c[p.buffer]+=f*si[p.type])}a=i.createVertexArray(),i.bindVertexArray(a);for(var m=0;m=t.ENV.WEBGL2&&(r=e.getContext("webgl2",{})),r||((r=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?r.getExtension("WEBGL_draw_buffers"):r=null),mi=r}return mi}function yi(e,r,i){if("precision"!==e.substring(0,9)){var n=r;return r===t.PRECISION.HIGH&&i!==t.PRECISION.HIGH&&(n=t.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==t.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var gi={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function _i(t){return gi[t]}var xi=null,bi={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Ei(t,e){if(!xi){var r=Object.keys(bi);xi={};for(var i=0;i0&&(e+="\nelse "),re.name?1:-1});for(o=0;o0?this._useCurrent():t.disable(t.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,r=this.renderer.projection,i=r.transform,n=r.sourceFrame,o=r.destinationFrame,s=e?e.resolution:this.renderer.resolution,a=(t.x-n.x)*s+o.x,h=(t.y-n.y)*s+o.y,u=t.width*s,l=t.height*s;i&&(a+=i.tx*s,h+=i.ty*s),e||(h=this.renderer.height-l-h),this.renderer.gl.scissor(a,h,u,l)},e}(Gi),Yi=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=WebGLRenderingContext.STENCIL_TEST,r}return dr(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.enable(r.STENCIL_TEST)),t._stencilCounter++,r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.EQUAL,i,this._getBitwiseMask()),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clear(e.STENCIL_BUFFER_BIT),e.clearStencil(0)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e.prototype._getBitwiseMask=function(){return(1<>=1,r++;this.stateId=t.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(t.children[i])},r}(Ir),un=function(){return function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121}}(),ln=function(e){function r(t){var r=e.call(this,t)||this;return r.boundTextures=[],r.currentLocation=-1,r.managedTextures=[],r._unknownBoundTextures=!1,r.unknownTexture=new vr,r}return dr(r,e),r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r=1:r.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?r.wrapMode=e.wrapMode:r.wrapMode=t.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===t.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST)},r}(Ir),cn={FilterSystem:Jr,BatchSystem:$r,ContextSystem:ei,FramebufferSystem:ni,GeometrySystem:ai,MaskSystem:ji,ScissorSystem:Hi,StencilSystem:Yi,ProjectionSystem:zi,RenderTextureSystem:Ki,ShaderSystem:tn,StateSystem:an,TextureGCSystem:hn,TextureSystem:ln},dn=new we,pn=function(e){function r(r,i){void 0===r&&(r=t.RENDERER_TYPE.UNKNOWN);var n=e.call(this)||this;return(i=Object.assign({},C.RENDER_OPTIONS,i)).roundPixels&&(C.ROUND_PIXELS=i.roundPixels,ne("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),n.options=i,n.type=r,n.screen=new _e(0,0,i.width,i.height),n.view=i.view||document.createElement("canvas"),n.resolution=i.resolution||C.RESOLUTION,n.transparent=i.transparent,n.autoDensity=i.autoDensity||i.autoResize||!1,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,0],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n._lastObjectRendered=null,n.plugins={},n}return dr(r,e),r.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(r.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),r.prototype.resize=function(t,e){this.screen.width=t,this.screen.height=e,this.view.width=t*this.resolution,this.view.height=e*this.resolution,this.autoDensity&&(this.view.style.width=t+"px",this.view.style.height=e+"px"),this.emit("resize",t,e)},r.prototype.generateTexture=function(t,e,r,i){0===(i=i||t.getLocalBounds(null,!0)).width&&(i.width=1),0===i.height&&(i.height=1);var n=Nr.create({width:0|i.width,height:0|i.height,scaleMode:e,resolution:r});return dn.tx=-i.x,dn.ty=-i.y,this.render(t,n,!1,dn,!!t.parent),n},r.prototype.destroy=function(e){for(var r in this.plugins)this.plugins[r].destroy(),this.plugins[r]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);this.plugins=null,this.type=t.RENDERER_TYPE.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(r.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=Xt(t),kt(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),r}(D),fn=function(e){function r(i){var n=e.call(this,t.RENDERER_TYPE.WEBGL,i)||this;return i=n.options,n.gl=null,n.CONTEXT_UID=0,n.runners={destroy:new hr("destroy"),contextChange:new hr("contextChange"),reset:new hr("reset"),update:new hr("update"),postrender:new hr("postrender"),prerender:new hr("prerender"),resize:new hr("resize")},n.globalUniforms=new Kr({projectionMatrix:new we},!0),n.addSystem(ji,"mask").addSystem(ei,"context").addSystem(an,"state").addSystem(tn,"shader").addSystem(ln,"texture").addSystem(ai,"geometry").addSystem(ni,"framebuffer").addSystem(Hi,"scissor").addSystem(Yi,"stencil").addSystem(zi,"projection").addSystem(hn,"textureGC").addSystem(Jr,"filter").addSystem(Ki,"renderTexture").addSystem($r,"batch"),n.initPlugins(r.__plugins),i.context?n.context.initFromContext(i.context):n.context.initFromOptions({alpha:!!n.transparent,antialias:i.antialias,premultipliedAlpha:n.transparent&&"notMultiplied"!==n.transparent,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:n.options.powerPreference}),n.renderingToScreen=!0,Bt(2===n.context.webGLVersion?"WebGL 2":"WebGL 1"),n.resize(n.options.width,n.options.height),n}return dr(r,e),r.create=function(t){if(Ut())return new r(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},r.prototype.addSystem=function(t,e){e||(e=t.name);var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var i in this[e]=r,this.runners)this.runners[i].add(r);return this},r.prototype.render=function(t,e,r,i,n){if(this.renderingToScreen=!e,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=i,!this.context.isLost){if(e||(this._lastObjectRendered=t),!n){var o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}this.renderTexture.bind(e),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),e&&e.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},r.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(t,r)},r.prototype.reset=function(){return this.runners.reset.emit(),this},r.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},r.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},r.registerPlugin=function(t,e){r.__plugins=r.__plugins||{},r.__plugins[t]=e},r}(pn);function mn(t){return fn.create(t)}var vn="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",yn="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",gn=function(){return function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null}}(),_n=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;tthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},r.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,i=r._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++vr._globalBatch,h=0,u=i[0],l=0;n.copyBoundTextures(o,e);for(var c=0;c=e&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,c),l=c,u=i[++h],++a),d._batchEnabled=a,d.touched=s,u.elements[u.count++]=d)}u.count>0&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,this._bufferSize),++h,++a);for(c=0;c0&&(e+="\nelse "),r0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(window.DOMParser){var n=new DOMParser;this.data=n.parseFromString(r,"text/xml")}else{var o=document.createElement("div");o.innerHTML=r,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},e._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(window.origin!==window.location.origin)return"anonymous";e=e||window.location,Gn||(Gn=document.createElement("a")),Gn.href=t;var r=!(t=Dn(Gn.href,{strictMode:!0})).port&&""===e.port||t.port===e.port,i=t.protocol?t.protocol+":":"";return t.host===e.hostname&&r&&i===e.protocol?"":"anonymous"},e._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},e._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},e._getExtension=function(){var t=this.url,e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(i>-1?i:t.length,n>-1?n:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},e._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},Xn(t,[{key:"isDataUrl",get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)}},{key:"isComplete",get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)}},{key:"isLoading",get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)}}]),t}();function zn(t,e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=r)}function Vn(t){return t.toString().replace("object ","")}Yn.STATUS_FLAGS={NONE:0,DATA_URL:1,COMPLETE:2,LOADING:4},Yn.TYPE={UNKNOWN:0,JSON:1,XML:2,IMAGE:3,AUDIO:4,VIDEO:5,TEXT:6},Yn.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},Yn.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},Yn._loadTypeMap={gif:Yn.LOAD_TYPE.IMAGE,png:Yn.LOAD_TYPE.IMAGE,bmp:Yn.LOAD_TYPE.IMAGE,jpg:Yn.LOAD_TYPE.IMAGE,jpeg:Yn.LOAD_TYPE.IMAGE,tif:Yn.LOAD_TYPE.IMAGE,tiff:Yn.LOAD_TYPE.IMAGE,webp:Yn.LOAD_TYPE.IMAGE,tga:Yn.LOAD_TYPE.IMAGE,svg:Yn.LOAD_TYPE.IMAGE,"svg+xml":Yn.LOAD_TYPE.IMAGE,mp3:Yn.LOAD_TYPE.AUDIO,ogg:Yn.LOAD_TYPE.AUDIO,wav:Yn.LOAD_TYPE.AUDIO,mp4:Yn.LOAD_TYPE.VIDEO,webm:Yn.LOAD_TYPE.VIDEO},Yn._xhrTypeMap={xhtml:Yn.XHR_RESPONSE_TYPE.DOCUMENT,html:Yn.XHR_RESPONSE_TYPE.DOCUMENT,htm:Yn.XHR_RESPONSE_TYPE.DOCUMENT,xml:Yn.XHR_RESPONSE_TYPE.DOCUMENT,tmx:Yn.XHR_RESPONSE_TYPE.DOCUMENT,svg:Yn.XHR_RESPONSE_TYPE.DOCUMENT,tsx:Yn.XHR_RESPONSE_TYPE.DOCUMENT,gif:Yn.XHR_RESPONSE_TYPE.BLOB,png:Yn.XHR_RESPONSE_TYPE.BLOB,bmp:Yn.XHR_RESPONSE_TYPE.BLOB,jpg:Yn.XHR_RESPONSE_TYPE.BLOB,jpeg:Yn.XHR_RESPONSE_TYPE.BLOB,tif:Yn.XHR_RESPONSE_TYPE.BLOB,tiff:Yn.XHR_RESPONSE_TYPE.BLOB,webp:Yn.XHR_RESPONSE_TYPE.BLOB,tga:Yn.XHR_RESPONSE_TYPE.BLOB,json:Yn.XHR_RESPONSE_TYPE.JSON,text:Yn.XHR_RESPONSE_TYPE.TEXT,txt:Yn.XHR_RESPONSE_TYPE.TEXT,ttf:Yn.XHR_RESPONSE_TYPE.BUFFER,otf:Yn.XHR_RESPONSE_TYPE.BUFFER},Yn.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var Wn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var qn=window.URL||window.webkitURL;var Kn={caching:function(t,e){var r=this;Un[t.url]?(t.data=Un[t.url],t.complete()):t.onComplete.once(function(){return Un[r.url]=r.data}),e()},parsing:function(t,e){if(t.data){if(t.xhr&&t.xhrType===Yn.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var r=qn.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=Yn.TYPE.IMAGE,void(t.data.onload=function(){qn.revokeObjectURL(r),t.data.onload=null,e()})}}else{var i=t.xhr.getResponseHeader("content-type");if(i&&0===i.indexOf("image"))return t.data=new Image,t.data.src="data:"+i+";base64,"+function(t){for(var e="",r=0;r>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(var s=0;s16384&&(n=16384),s._properties=[!1,!0,!1,!1,!1],s._maxSize=r,s._batchSize=n,s._buffers=null,s._bufferUpdateIDs=[],s._updateID=0,s.interactiveChildren=!1,s.blendMode=t.BLEND_MODES.NORMAL,s.autoResize=o,s.roundPixels=!0,s.baseTexture=null,s.setProperties(i),s._tint=0,s.tintRgb=new Float32Array(4),s.tint=16777215,s}return no(r,e),r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(r.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,kt(t,this.tintRgb)},enumerable:!1,configurable:!0}),r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return e.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.lengthr&&!t.autoResize&&(o=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var a=e[0]._texture.baseTexture;this.state.blendMode=Ht(t.blendMode,a.alphaMode),n.state.set(this.state);var h=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Yt(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,a.alphaMode),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);for(var l=!1,c=0,d=0;ci&&(p=i),d>=s.length&&s.push(this._generateOneMoreBuffer(t));var f=s[d];f.uploadDynamic(e,c,p);var m=t._bufferUpdateIDs[d]||0;(l=l||f._updateID0,u=a.alpha,l=u<1&&h?zt(a._tintRGB,u):a._tintRGB+(255*u<<24);i[o]=l,i[o+n]=l,i[o+2*n]=l,i[o+3*n]=l,o+=4*n}},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},r}(Qr);(oo=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",oo.BEVEL="bevel",oo.ROUND="round",(so=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",so.ROUND="round",so.SQUARE="square";var po={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var r=Math.ceil(t/this.maxLength);return rthis.maxSegments&&(r=this.maxSegments),r}},fo=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Rr.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Rr.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),mo=function(t,e){return(mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function vo(t,e){function r(){this.constructor=t}mo(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var yo={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,i=t.holes,n=e.points,o=e.indices;if(r.length>=6){for(var s=[],a=0;ac&&(c+=2*Math.PI);var d=l,p=c-l,f=Math.abs(p),m=Math.sqrt(h*h+u*u),v=1+(15*f*Math.sqrt(m)/Math.PI>>0),y=p/v;if(d+=y,a){s.push(t,e),s.push(r,i);for(var g=1,_=d;g_?(X?(p.push(V,W),p.push(E+w*R,T+I*R),p.push(V,W),p.push(E+A*R,T+O*R)):(p.push(E-w*D,T-I*D),p.push(q,K),p.push(E-A*D,T-O*D),p.push(q,K)),m+=2):s.join===t.LINE_JOIN.ROUND?X?(p.push(V,W),p.push(E+w*R,T+I*R),m+=Po(E,T,E+w*R,T+I*R,E+A*R,T+O*R,p,!0)+4,p.push(V,W),p.push(E+A*R,T+O*R)):(p.push(E-w*D,T-I*D),p.push(q,K),m+=Po(E,T,E-w*D,T-I*D,E-A*D,T-O*D,p,!1)+4,p.push(E-A*D,T-O*D),p.push(q,K)):(p.push(V,W),p.push(q,K)):(p.push(E-w*D,T-I*D),p.push(E+w*R,T+I*R),s.join===t.LINE_JOIN.BEVEL||z/g>_||(s.join===t.LINE_JOIN.ROUND?m+=X?Po(E,T,E+w*R,T+I*R,E+A*R,T+O*R,p,!0)+2:Po(E,T,E-w*D,T-I*D,E-A*D,T-O*D,p,!1)+2:(X?(p.push(q,K),p.push(q,K)):(p.push(V,W),p.push(V,W)),m+=2)),p.push(E-A*D,T-O*D),p.push(E+A*R,T+O*R),m+=2)}}x=n[2*(f-2)],b=n[2*(f-2)+1],E=n[2*(f-1)],w=-(b-(T=n[2*(f-1)+1])),I=x-E,w/=M=Math.sqrt(w*w+I*I),I/=M,w*=y,I*=y,p.push(E-w*D,T-I*D),p.push(E+w*R,T+I*R),u||(s.cap===t.LINE_CAP.ROUND?m+=Po(E-w*(D-R)*.5,T-I*(D-R)*.5,E-w*D,T-I*D,E+w*R,T+I*R,p,!1)+2:s.cap===t.LINE_CAP.SQUARE&&(m+=To(E,T,w,I,D,R,!1,p)));var J=r.indices,Q=po.epsilon*po.epsilon;for(L=v;Ll*a}},t.arc=function(t,e,r,i,n,o,s,a,h){for(var u=s-o,l=po._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/ve)),c=u/(2*l),d=2*c,p=Math.cos(c),f=Math.sin(c),m=l-1,v=m%1/m,y=0;y<=m;++y){var g=c+o+d*(y+v*y),_=Math.cos(g),x=-Math.sin(g);h.push((p*_+f*x)*n+r,(p*-x+f*_)*n+i)}},t}(),Oo=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o,s,a){for(var h=0,u=0,l=0,c=0,d=0,p=0,f=0,m=0,v=0,y=0,g=0,_=t,x=e,b=1;b<=10;++b)y=_-(m=(f=(p=(d=1-(u=b/10))*d)*d)*t+3*p*u*r+3*d*(l=u*u)*n+(c=l*u)*s),g=x-(v=f*e+3*p*u*i+3*d*l*o+c*a),_=m,x=v,h+=Math.sqrt(y*y+g*g);return h},t.curveTo=function(e,r,i,n,o,s,a){var h=a[a.length-2],u=a[a.length-1];a.length-=2;var l=po._segmentsCount(t.curveLength(h,u,e,r,i,n,o,s)),c=0,d=0,p=0,f=0,m=0;a.push(h,u);for(var v=1,y=0;v<=l;++v)p=(d=(c=1-(y=v/l))*c)*c,m=(f=y*y)*y,a.push(p*h+3*d*y*e+3*c*f*i+m*o,p*u+3*d*y*r+3*c*f*n+m*s)},t}(),Mo=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o){var s=t-2*r+n,a=e-2*i+o,h=2*r-2*t,u=2*i-2*e,l=4*(s*s+a*a),c=4*(s*h+a*u),d=h*h+u*u,p=2*Math.sqrt(l+c+d),f=Math.sqrt(l),m=2*l*f,v=2*Math.sqrt(d),y=c/f;return(m*p+f*c*(p-v)+(4*d*l-c*c)*Math.log((2*f+y+p)/(y+v)))/(4*m)},t.curveTo=function(e,r,i,n,o){for(var s=o[o.length-2],a=o[o.length-1],h=po._segmentsCount(t.curveLength(s,a,e,r,i,n)),u=0,l=0,c=1;c<=h;++c){var d=c/h;u=s+(e-s)*d,l=a+(r-a)*d,o.push(u+(e+(i-e)*d-u)*d,l+(r+(n-r)*d-l)*d)}},t}(),Co=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),Do=((wo={})[t.SHAPES.POLY]=yo,wo[t.SHAPES.CIRC]=go,wo[t.SHAPES.ELIP]=go,wo[t.SHAPES.RECT]=_o,wo[t.SHAPES.RREC]=Eo,wo),Ro=[],Lo=[],No={buildPoly:yo,buildCircle:go,buildRectangle:_o,buildRoundedRectangle:Eo,FILL_COMMANDS:Do,BATCH_POOL:Ro,DRAW_CALL_POOL:Lo,buildLine:So,Star:Io,ArcUtils:Ao,BezierUtils:Oo,QuadraticUtils:Mo,BatchPart:Co},Fo=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null),this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type,this.points=[],this.holes=[]}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),Bo=new Pe,Uo=new Fe,ko=function(e){function r(){var t=e.call(this)||this;return t.uvsFloat32=null,t.indicesUint16=null,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.dirty=0,t.batchDirty=-1,t.cacheDirty=-1,t.clearDirty=0,t.drawCalls=[],t.batches=[],t.shapeIndex=0,t._bounds=new Fe,t.boundsDirty=-1,t.boundsPadding=0,t.batchable=!1,t.indicesUint16=null,t.uvsFloat32=null,t.closePointEps=1e-4,t}return vo(r,e),Object.defineProperty(r.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),r.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},r.prototype.drawShape=function(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null);var n=new Fo(t,e,r,i);return this.graphicsData.push(n),this.dirty++,this},r.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var r=new Fo(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this},r.prototype.destroy=function(){e.prototype.destroy.call(this);for(var t=0;t0&&(o=(n=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s65535&&e;this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},r.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},r.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t131070)return!1;for(var t=this.batches,e=0;e0&&((o=Lo.pop())||((o=new gn).texArray=new _n),this.drawCalls.push(o)),o.start=c,o.size=0,o.texArray.count=0,o.type=l),f.touched=1,f._batchEnabled=e,f._batchLocation=s,f.wrapMode=10497,o.texArray.elements[o.texArray.count++]=f,s++)),o.size+=d.size,c+=d.size,h=f._batchLocation,this.addColors(i,p.color,p.alpha,d.attribSize),this.addTextureIds(n,h,d.attribSize)}vr._globalBatch=e,this.packAttributes()},r.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),o=new Float32Array(n),s=new Uint32Array(n),a=0,h=0;h>16)+(65280&e)+((255&e)<<16),r);i-- >0;)t.push(n)},r.prototype.addTextureIds=function(t,e,r){for(;r-- >0;)t.push(e)},r.prototype.addUvs=function(t,e,r,i,n,o){void 0===o&&(o=null);for(var s=0,a=e.length,h=r.frame;s0&&e.alpha>0;return l?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:l},e)):this._lineStyle.reset(),this},r.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ee,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ee,this.currentPath.closeStroke=!1},r.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},r.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},r.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var r=this.currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this},r.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},r.prototype.quadraticCurveTo=function(t,e,r,i){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Mo.curveTo(t,e,r,i,n),this},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._initCurve(),Oo.curveTo(t,e,r,i,n,o,this.currentPath.points),this},r.prototype.arcTo=function(t,e,r,i,n){this._initCurve(t,e);var o=this.currentPath.points,s=Ao.curveTo(t,e,r,i,n,o);if(s){var a=s.cx,h=s.cy,u=s.radius,l=s.startAngle,c=s.endAngle,d=s.anticlockwise;this.arc(a,h,u,l,c,d)}return this},r.prototype.arc=function(t,e,r,i,n,o){if(void 0===o&&(o=!1),i===n)return this;if(!o&&n<=i?n+=ve:o&&i<=n&&(i+=ve),0===n-i)return this;var s=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var l=Math.abs(u[u.length-2]-s),c=Math.abs(u[u.length-1]-a);l0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this},r.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},r.prototype.drawRect=function(t,e,r,i){return this.drawShape(new _e(t,e,r,i))},r.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new Te(t,e,r,i,n))},r.prototype.drawCircle=function(t,e,r){return this.drawShape(new xe(t,e,r))},r.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new be(t,e,r,i))},r.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],i=0;i>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(var a=0,h=s.length;a>16)+(65280&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,r=e.a,i=e.b,n=e.c,o=e.d,s=e.tx,a=e.ty,h=this._geometry.points,u=this.vertexData,l=0,c=0;c=i&&Vo.x=n&&Vo.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Rr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),r}(Ge),Ko=function(t,e){return(Ko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};(zo=t.TEXT_GRADIENT||(t.TEXT_GRADIENT={}))[zo.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",zo[zo.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL";var Zo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:t.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},Jo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Qo=function(){function t(t){this.styleID=0,this.reset(),es(this,t,t)}return t.prototype.clone=function(){var e={};return es(e,this,Zo),new t(e)},t.prototype.reset=function(){es(this,Zo,Zo)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=ts(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=ts(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var r=0;r=0;r--){var i=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&Jo.indexOf(i)<0&&(i='"'+i+'"'),e[r]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function $o(t){return"number"==typeof t?Xt(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function ts(t){if(Array.isArray(t)){for(var e=0;ef)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(y,r.breakWords))for(var b=t.wordWrapSplit(y),E=0;Ef&&(a+=t.addLine(s),p=!1,s="",o=0),s+=T,o+=I}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var A=v===m.length-1;a+=t.addLine(y,!A),p=!1,s="",o=0}else x+o>f&&(p=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(y)||p)&&(s+=y,o+=x)}return a+=t.addLine(s,!1)},t.addLine=function(e,r){return void 0===r&&(r=!0),e=t.trimRight(e),e=r?e+"\n":e},t.getFromCache=function(t,e,r,i){var n=r[t];if("number"!=typeof n){var o=t.length*e;n=i.measureText(t).width+o,r[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var r=e.length-1;r>=0;r--){var i=e[r];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var r=[],i="";if("string"!=typeof e)return r;for(var n=0;na;--d){for(m=0;m0},t}();function hs(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var i=0;i=0;e--)this.add(t.children[e]);return this},e.prototype.destroy=function(){this.ticking&&Je.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},e}();function vs(t,e){return e instanceof vr&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function ys(t,e){if(!(e instanceof Ho))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n=i&&Ss.x=n&&Ss.y>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;Vt(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(Ri),js=function(e){function r(r,i,n){var o=e.call(this)||this,s=new kr(r),a=new kr(i,!0),h=new kr(n,!0,!0);return o.addAttribute("aVertexPosition",s,2,!1,t.TYPES.FLOAT).addAttribute("aTextureCoord",a,2,!1,t.TYPES.FLOAT).addIndex(h),o._updateId=-1,o}return Rs(r,e),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(zr),Gs=function(t,e){return(Gs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Hs=function(){return function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]}}(),Ys=function(){function t(){}return t.test=function(t){return"string"==typeof t&&0===t.indexOf("info face=")},t.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[]};for(var i in e){var n=e[i].match(/^[a-z]+/gm)[0],o=e[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(var a in o){var h=o[a].split("="),u=h[0],l=h[1].replace(/"/gm,""),c=parseFloat(l),d=isNaN(c)?l:c;s[u]=d}r[n].push(s)}var p=new Hs;return r.info.forEach(function(t){return p.info.push({face:t.face,size:parseInt(t.size,10)})}),r.common.forEach(function(t){return p.common.push({lineHeight:parseInt(t.lineHeight,10)})}),r.page.forEach(function(t){return p.page.push({id:parseInt(t.id,10),file:t.file})}),r.char.forEach(function(t){return p.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})}),r.kerning.forEach(function(t){return p.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})}),p},t}(),zs=function(){function t(){}return t.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},t.parse=function(t){for(var e=new Hs,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),s=t.getElementsByTagName("kerning"),a=0;a")>-1){var e=(new self.DOMParser).parseFromString(t,"text/xml");return zs.test(e)}return!1},t.parse=function(t){var e=(new window.DOMParser).parseFromString(t,"text/xml");return zs.parse(e)},t}(),Ws=[Ys,zs,Vs];function qs(t){for(var e=0;e=u-P*a){if(0===g)throw new Error("[BitmapFont] textureHeight "+u+"px is too small for "+c.fontSize+"px fonts");--b,f=null,m=null,v=null,g=0,y=0,_=0}else if(_=Math.max(P+E.fontProperties.descent,_),S*a+y>=d)--b,g+=_*a,g=Math.ceil(g),y=0,_=0;else{Zs(f,m,E,y,g,a,c);var w=E.text.charCodeAt(0);p.char.push({id:w,page:x.length-1,x:y/a,y:g/a,width:S,height:P,xoffset:0,yoffset:0,xadvance:Math.ceil(T-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),y+=(S+2*s)*a,y=Math.ceil(y)}}var I=new t(p,x);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=I,I},t.ALPHA=[["a","z"],["A","Z"]," "],t.NUMERIC=[["0","9"]],t.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],t.ASCII=[[" ","~"]],t.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:t.ALPHANUMERIC},t.available={},t}(),Qs=[],$s=[],ta=function(t){function e(r,i){void 0===i&&(i={});var n=t.call(this)||this;n._tint=16777215,i.font&&(ne("5.3.0","PIXI.BitmapText constructor style.font property is deprecated."),n._upgradeStyle(i));var o=Object.assign({},e.styleDefaults,i),s=o.align,a=o.tint,h=o.maxWidth,u=o.letterSpacing,l=o.fontName,c=o.fontSize;if(!Js.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=s,n._tint=a,n._fontName=l,n._fontSize=c||Js.available[l].size,n._text=r,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Se(function(){n.dirty=!0},n,0,0),n._roundPixels=C.ROUND_PIXELS,n.dirty=!0,n._textureCache={},n}return function(t,e){function r(){this.constructor=t}Gs(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.updateText=function(){for(var t,e=Js.available[this._fontName],r=this._fontSize/e.size,i=new Pe,n=[],o=[],s=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",a=s.length,h=this._maxWidth*e.size/this._fontSize,u=null,l=0,c=0,d=0,p=-1,f=0,m=0,v=0,y=0;y0&&i.x>h&&($t(n,1+p-++m,1+y-p),y=p,p=-1,o.push(f),c=Math.max(c,f),d++,i.x=0,i.y+=e.lineHeight,u=null)}}else o.push(l),c=Math.max(c,l),++d,++m,i.x=0,i.y+=e.lineHeight,u=null}var E=s.charAt(s.length-1);"\r"!==E&&"\n"!==E&&(/(?:\s)/.test(E)&&(l=f),o.push(l),c=Math.max(c,l));var T=[];for(y=0;y<=d;y++){var P=0;"right"===this._align?P=c-o[y]:"center"===this._align&&(P=(c-o[y])/2),T.push(P)}var S=n.length,w={},I=[],A=this._activePagesMeshData;for(y=0;y6*R)||z.vertices.length<2*Bs.BATCHABLE_SIZE)z.vertices=new Float32Array(8*R),z.uvs=new Float32Array(8*R),z.indices=new Uint16Array(6*R);else for(var L=z.total,N=z.vertices,F=4*L*2;F=2&&(t.fontSize=parseInt(e[0],10))}else t.fontName=t.font.name,t.fontSize="number"==typeof t.font.size?t.font.size:parseInt(t.font.size,10)},e.prototype.destroy=function(e){var r=this._textureCache;for(var i in r){r[i].destroy(),delete r[i]}this._textureCache=null,t.prototype.destroy.call(this,e)},e.registerFont=function(t,e){return ne("5.3.0","PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install"),Js.install(t,e)},Object.defineProperty(e,"fonts",{get:function(){return ne("5.3.0","PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available"),Js.available},enumerable:!1,configurable:!0}),e.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},e}(Ge),ea=function(){function t(){}return t.add=function(){Qn.setExtensionXhrType("fnt",Qn.XHR_RESPONSE_TYPE.TEXT)},t.use=function(e,r){var i=qs(e.data);if(i)for(var n=t.getBaseUrl(this,e),o=i.parse(e.data),s={},a=function(t){s[t.metadata.pageFile]=t.texture,Object.keys(s).length===o.page.length&&(e.bitmapFont=Js.install(o,s),r())},h=0;h=i&&(e=t-s-1),o+=a=a.replace("%value%",r[e].toString()),o+="\n"}return n=(n=n.replace("%blur%",o)).replace("%size%",t.toString())}(o);return(s=t.call(this,a,h)||this).horizontal=e,s.resolution=n,s._quality=0,s.quality=i,s.blur=r,s}return sa(e,t),e.prototype.apply=function(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{var n=t.getFilterTexture(),o=t.renderer,s=e,a=n;this.state.blend=!1,t.applyFilter(this,s,a,xa.CLEAR);for(var h=1;h>16&255)/255,s=(r>>8&255)/255,a=(255&r)/255,h=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,l=(255&i)/255,c=[.3,.59,.11,0,0,o,s,a,t=t||.2,0,h,u,l,e=e||.15,0,o-h,s-u,a-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Ni);Ca.prototype.grayscale=Ca.prototype.greyscale;var Da=function(t,e){return(Da=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ra="varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",La="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n",Na=function(t){function e(e,r){var i=this,n=new we;return e.renderable=!1,(i=t.call(this,La,Ra,{mapSampler:e._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,i.maskMatrix=n,null==r&&(r=20),i.scale=new Pe(r,r),i}return function(t,e){function r(){this.constructor=t}Da(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.apply=function(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),s=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==s&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/s,this.uniforms.rotation[3]=n.d/s),t.applyFilter(this,e,r,i)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e}(Ni),Fa=function(t,e){return(Fa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var Ba="\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",Ua='varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n',ka=function(t){function e(){return t.call(this,Ba,Ua)||this}return function(t,e){function r(){this.constructor=t}Fa(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Ni),Xa=function(t,e){return(Xa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var ja="precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",Ga=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random());var i=t.call(this,yn,ja,{uNoise:0,uSeed:0})||this;return i.noise=e,i.seed=r,i}return function(t,e){function r(){this.constructor=t}Xa(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e}(Ni),Ha=new we;ke.prototype._cacheAsBitmap=!1,ke.prototype._cacheData=null;var Ya=function(){return function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}();Object.defineProperties(ke.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new Ya),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),ke.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},ke.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.alpha;this.alpha=1,t.batch.flush();var r=this.getLocalBounds(null,!0).clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(C.RESOLUTION);var n=t.renderTexture.current,o=t.renderTexture.sourceFrame.clone(),s=t.projection.transform,a=Nr.create({width:r.width,height:r.height}),h="cacheAsBitmap_"+re();this._cacheData.textureCacheId=h,vr.addToCache(a.baseTexture,h),Rr.addToCache(a,h);var u=this.transform.localTransform.copyTo(Ha).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,a,!0,u,!1),t.projection.transform=s,t.renderTexture.bind(n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var l=new qo(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-r.x/r.width,l.anchor.y=-r.y/r.height,l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)}},ke.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},ke.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;var i=t.context,n=t._projTransform;e.ceil(C.RESOLUTION);var o=Nr.create({width:e.width,height:e.height}),s="cacheAsBitmap_"+re();this._cacheData.textureCacheId=s,vr.addToCache(o.baseTexture,s),Rr.addToCache(o,s);var a=Ha;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,o,!0,a,!1),t.context=i,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var h=new qo(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},ke.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},ke.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},ke.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,vr.removeFromCache(this._cacheData.textureCacheId),Rr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},ke.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},ke.prototype.name=null,Ge.prototype.getChildByName=function(t,e){for(var r=0,i=this.children.length;r0){var d=a.x-t[l].x,p=a.y-t[l].y,f=Math.sqrt(d*d+p*p);a=t[l],s+=f/h}else s=l/(u-1);n[c]=s,n[c+1]=0,n[c+2]=s,n[c+3]=1}var m=0;for(l=0;l0?this.textureScale*this._width/2:this._width/2;i/=l,n/=l,i*=c,n*=c,o[u]=h.x+i,o[u+1]=h.y+n,o[u+2]=h.x-i,o[u+3]=h.y-n,r=h}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(js),Qa=function(e){function r(r,i,n){void 0===n&&(n=0);var o=this,s=new Ja(r.height,i,n),a=new Xs(r);return n>0&&(r.baseTexture.wrapMode=t.WRAP_MODES.REPEAT),(o=e.call(this,s,a)||this).autoUpdate=!0,o}return Ka(r,e),r.prototype._render=function(t){var r=this.geometry;(this.autoUpdate||r._width!==this.shader.texture.height)&&(r._width=this.shader.texture.height,r.update()),e.prototype._render.call(this,t)},r}(Bs),$a=function(t){function e(e,r,i){var n=this,o=new Za(e.width,e.height,r,i),s=new Xs(Rr.WHITE);return(n=t.call(this,o,s)||this).texture=e,n}return Ka(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry;t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build()},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(Bs),th=function(t){function e(e,r,i,n,o){void 0===e&&(e=Rr.EMPTY);var s=this,a=new js(r,i,n);a.getBuffer("aVertexPosition").static=!1;var h=new Xs(e);return(s=t.call(this,a,h,null,o)||this).autoUpdate=!0,s}return Ka(e,t),Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},e}(Bs),eh=10,rh=function(t){function e(e,r,i,n,o){void 0===r&&(r=eh),void 0===i&&(i=eh),void 0===n&&(n=eh),void 0===o&&(o=eh);var s=t.call(this,Rr.WHITE,4,4)||this;return s._origWidth=e.orig.width,s._origHeight=e.orig.height,s._width=s._origWidth,s._height=s._origHeight,s._leftWidth=r,s._rightWidth=n,s._topHeight=i,s._bottomHeight=o,s.texture=e,s}return Ka(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(e,i)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}($a),ih=function(t,e){return(ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var nh=function(e){function r(t,r){void 0===r&&(r=!0);var i=e.call(this,t[0]instanceof Rr?t[0]:t[0].texture)||this;return i._textures=null,i._durations=null,i._autoUpdate=r,i._isConnectedToTicker=!1,i.animationSpeed=1,i.loop=!0,i.updateAnchor=!1,i.onComplete=null,i.onFrameChange=null,i.onLoop=null,i._currentTime=0,i._playing=!1,i._previousFrame=null,i.textures=t,i}return function(t,e){function r(){this.constructor=t}ih(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Je.shared.remove(this.update,this),this._isConnectedToTicker=!1))},r.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Je.shared.add(this.update,this,t.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},r.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},r.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},r.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer&&this.onLoop()),this.updateTexture())}},r.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},r.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},r.fromFrames=function(t){for(var e=[],i=0;i Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n window.requestAnimationFrame = (window as any)[`${p}RequestAnimationFrame`];\n window.cancelAnimationFrame = (window as any)[`${p}CancelAnimationFrame`]\n || (window as any)[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!window.requestAnimationFrame)\n{\n window.requestAnimationFrame = (callback: (...parms: any[]) => void): number =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return window.setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!window.cancelAnimationFrame)\n{\n window.cancelAnimationFrame = (id: number): void => clearTimeout(id);\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x): number\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value): boolean\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","import './Promise';\nimport './Object.assign';\nimport './requestAnimationFrame';\nimport './Math.sign';\nimport './Number.isInteger';\n\nif (!window.ArrayBuffer)\n{\n (window as any).ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n (window as any).Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n (window as any).Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n (window as any).Uint16Array = Array;\n}\n\nif (!window.Uint8Array)\n{\n (window as any).Uint8Array = Array;\n}\n\nif (!window.Int32Array)\n{\n (window as any).Int32Array = Array;\n}\n","const appleIphone = /iPhone/i;\nconst appleIpod = /iPod/i;\nconst appleTablet = /iPad/i;\nconst appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nconst androidPhone = /\\bAndroid(?:.+)Mobile\\b/i; // Match 'Android' AND 'Mobile'\nconst androidTablet = /Android/i;\nconst amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i; // Match 'Silk' AND 'Mobile'\nconst amazonTablet = /Silk/i;\nconst windowsPhone = /Windows Phone/i;\nconst windowsTablet = /\\bWindows(?:.+)ARM\\b/i; // Match 'Windows' AND 'ARM'\nconst otherBlackBerry = /BlackBerry/i;\nconst otherBlackBerry10 = /BB10/i;\nconst otherOpera = /Opera Mini/i;\nconst otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nconst otherFirefox = /Mobile(?:.+)Firefox\\b/i; // Match 'Mobile' AND 'Firefox'\n\nexport type UserAgent = string;\nexport type Navigator = {\n userAgent: string;\n platform: string;\n maxTouchPoints?: number;\n};\n\nconst isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {\n return (\n typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined'\n );\n};\n\nfunction createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {\n return (regex: RegExp): boolean => regex.test(userAgent);\n}\n\nexport type isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport type IsMobileParameter = UserAgent | Navigator;\n\nexport default function isMobile(param?: IsMobileParameter): isMobileResult {\n let nav: Navigator = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0,\n };\n\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0,\n };\n } else if (typeof param === 'string') {\n nav.userAgent = param;\n } else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0,\n };\n }\n\n let userAgent = nav.userAgent;\n\n // Facebook mobile app's integrated browser adds a bunch of strings that\n // match everything. Strip it out if it exists.\n let tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n // Twitter mobile app's integrated browser on iPad adds a \"Twitter for\n // iPhone\" string. Same probably happens on other tablet platforms.\n // This will confuse detection so strip it out if it exists.\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n\n const match = createMatch(userAgent);\n\n const result: isMobileResult = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet:\n !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device:\n (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet),\n },\n android: {\n phone:\n (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet:\n !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device:\n (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i),\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet),\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device:\n match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome),\n },\n any: false,\n phone: false,\n tablet: false,\n };\n\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n // excludes 'other' devices and ipods, targeting touchscreen phones\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n\n return result;\n}\n","// The ESM/CJS versions of ismobilejs only\n// exports the function for executing\n// designed for Node-only environments\nimport isMobileCall from 'ismobilejs';\n\nconst isMobile = isMobileCall(window.navigator);\n\nexport { isMobile };\n","import { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\n\nexport interface IRenderOptions {\n view: HTMLCanvasElement;\n antialias: boolean;\n autoDensity: boolean;\n transparent: boolean;\n backgroundColor: number;\n clearBeforeRender: boolean;\n preserveDrawingBuffer: boolean;\n width: number;\n height: number;\n legacy: boolean;\n}\n\nexport interface ISettings {\n MIPMAP_TEXTURES: number;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: number;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: number;\n SCALE_MODE: number;\n PRECISION_VERTEX: string;\n PRECISION_FRAGMENT: string;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: number;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: 1,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n *\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} autoDensity=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n autoDensity: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 33071,\n\n /**\n * Default scale mode for textures.\n *\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 1,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n *\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? 'highp' : 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n *\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n\n // filter collinear points around the cuts\n filterPoints(outerNode, outerNode.next);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV {\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE {\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS {\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nexport enum BLEND_MODES {\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nexport enum DRAW_MODES {\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nexport enum FORMATS {\n RGBA = 6408,\n RGB = 6407,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nexport enum TARGETS {\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} FLOAT=5126\n * @property {number} HALF_FLOAT=36193\n */\nexport enum TYPES {\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n FLOAT = 5126,\n HALF_FLOAT = 36193,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES {\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES {\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n */\nexport enum MIPMAP_MODES {\n OFF,\n POW2,\n ON,\n}\n\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES {\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2,\n}\n\n/**\n * How to clear renderTextures in filter\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Preserve the information in the texture, blend above\n * @property {number} CLEAR - Must use `gl.clear` operation\n * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES {\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES {\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nexport enum PRECISION {\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nexport enum MASK_TYPES {\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY {\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * For most scenarios this should be left as true, as otherwise the user may have a poor experience.\n * However, it can be useful to disable under certain scenarios, such as headless unit tests.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true;\n\nexport { settings };\n","let saidHello = false;\nconst VERSION = '__VERSION__';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n window.console.log(...args);\n }\n else if (window.console)\n {\n window.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean|undefined;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a hexadecimal string to a hexadecimal color number.\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string' && string[0] === '#')\n {\n string = string.substr(1);\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array|number[],\n alpha: number,\n out: Float32Array,\n premultiply: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array|Uint32Array = null): Uint16Array|Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(array: ITypedArray): 'Float32Array'|'Uint32Array'|'Int32Array'|'Uint16Array'|'Uint8Array'|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array|Uint32Array|Int32Array|Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1|0|1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n public canvas: HTMLCanvasElement;\n\n public context: CanvasRenderingContext2D;\n\n public resolution: number;\n\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution: number)\n {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n resize(width: number, height: number): void\n {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n }\n\n /**\n * Destroys this canvas.\n *\n */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = val;\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = val;\n }\n}\n","interface Inset {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import * as _url from 'url';\n\nlet tempAnchor: HTMLAnchorElement|undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = window.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","/**\n * Two Pi.\n *\n * @static\n * @constant {number} PI_2\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant {number} DEG_TO_RAD\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\nexport enum SHAPES {\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {enum}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n * @enum {number}\n */\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri {\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { SHAPES } from '../const';\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nexport class Rectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.RECT;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get left(): number\n {\n return this.x;\n }\n\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get top(): number\n {\n return this.y;\n }\n\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n * @member {PIXI.Rectangle}\n * @return {PIXI.Rectangle} An empty rectangle\n */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.\n * @return {PIXI.Rectangle} Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.\n * @return {PIXI.Rectangle} Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n * @return {PIXI.Rectangle} Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n * @return {PIXI.Rectangle} Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n * @return {PIXI.Rectangle} Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n * @return {PIXI.Rectangle} Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Circle\n{\n public x: number;\n public y: number;\n public radius: number;\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ellipse\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n}\n","import { SHAPES } from '../const';\nimport type { IPoint } from '../IPoint';\n\n/**\n * A class to define a shape via user defined co-orinates.\n *\n * @class\n * @memberof PIXI\n */\nexport class Polygon\n{\n public points: number[];\n public closeStroke: boolean;\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPoint[]|number[]);\n constructor(...points: IPoint[]|number[]);\n /**\n * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPoint[]|number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPoint).x, (flat[i] as IPoint).y);\n }\n\n flat = p;\n }\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = flat as number[];\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n\n /**\n * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.\n * @member {boolean}\n * @default true\n */\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public radius: number;\n public readonly type: SHAPES.RREC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))\n {\n return true;\n }\n let dx = x - (this.x + this.radius);\n let dy = y - (this.y + this.radius);\n const radius2 = this.radius * this.radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class Point implements IPoint\n{\n public x: number;\n public y: number;\n\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * An ObservablePoint is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nexport class ObservablePoint implements IPoint\n{\n public cb: (this: T) => any;\n public scope: any;\n _x: number;\n _y: number;\n\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns {this} Returns itself.\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.IPointData} p - The point to copy from.\n * @returns {this} Returns itself.\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y into the given point\n *\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Matrix\n{\n public a: number;\n public b: number;\n public c: number;\n public d: number;\n public tx: number;\n public ty: number;\n\n public array: Float32Array|null = null;\n\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.IPointData} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x - How much to translate x by\n * @param {number} y - How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x - The amount to scale horizontally\n * @param {number} y - The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform} transform - The transform to apply the properties to.\n * @return {PIXI.Transform} The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy to.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @static\n * @const\n * @member {PIXI.Matrix}\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @memberof PIXI\n */\nexport class Transform\n{\n /**\n * A default (identity) transform\n *\n * @static\n * @constant\n * @member {PIXI.Transform}\n */\n public static readonly IDENTITY = new Transform();\n\n public worldTransform: Matrix;\n public localTransform: Matrix;\n public position: ObservablePoint;\n public scale: ObservablePoint;\n public pivot: ObservablePoint;\n public skew: ObservablePoint;\n public _parentID: number;\n _worldID: number;\n\n protected _rotation: number;\n protected _cx: number;\n protected _sx: number;\n protected _cy: number;\n protected _sy: number;\n protected _localID: number;\n protected _currentLocalID: number;\n\n constructor()\n {\n /**\n * The world transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n\n /**\n * The local transformation matrix.\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n /**\n * The rotation amount.\n *\n * @protected\n * @member {number}\n */\n this._rotation = 0;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cx = 1;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sx = 0;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._cy = 0;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n *\n * @protected\n * @member {number}\n */\n this._sy = 1;\n\n /**\n * The locally unique ID of the local transform.\n *\n * @protected\n * @member {number}\n */\n this._localID = 0;\n\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._currentLocalID = 0;\n\n /**\n * The locally unique ID of the world transform.\n *\n * @protected\n * @member {number}\n */\n this._worldID = 0;\n\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n *\n * @protected\n * @member {number}\n */\n this._parentID = 0;\n }\n\n /**\n * Called when a value changes.\n *\n * @protected\n */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /**\n * Called when the skew or the rotation changes.\n *\n * @protected\n */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n /**\n * Updates the local transformation matrix.\n */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param {PIXI.Transform} parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nexport class Bounds\n{\n public minX: number;\n public minY: number;\n public maxX: number;\n public maxY: number;\n public rect: Rectangle;\n public updateID: number;\n\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { DEG_TO_RAD, Matrix, Point, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Container } from './Container';\nimport { Bounds } from './Bounds';\n\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions {\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends GlobalMixins.DisplayObject, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and should not be used on its own; rather it should b e extended.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n public parent: DisplayObject;\n public worldAlpha: number;\n public transform: Transform;\n public alpha: number;\n public visible: boolean;\n public renderable: boolean;\n public filterArea: Rectangle;\n public filters: Filter[];\n public isSprite: boolean;\n public isMask: boolean;\n public _lastSortedIndex: number;\n public _mask: Container|MaskData;\n public _bounds: Bounds;\n public _localBounds: Bounds;\n\n protected _zIndex: number;\n protected _enabledFilters: Filter[];\n protected _boundsID: number;\n protected _boundsRect: Rectangle;\n protected _localBoundsRect: Rectangle;\n protected _destroyed: boolean;\n\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n this._bounds = new Bounds();\n\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n this._localBounds = null;\n\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n this._boundsID = 0;\n\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._boundsRect = null;\n\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n /**\n * Recalculates the bounds of the display object.\n */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal

(position: IPointData, from: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n destroy(_options?: IDestroyOptions|boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.removeAllListeners();\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this._mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.DisplayObject} current parent\n */\n enableTempParent(): DisplayObject\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param {PIXI.DisplayObject} cacheParent actual parent of element\n */\n disableTempParent(cacheParent: DisplayObject): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: ObservablePoint)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: ObservablePoint)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: ObservablePoint)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: ObservablePoint)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get mask(): Container|MaskData|null\n {\n return this._mask;\n }\n\n set mask(value: Container|MaskData|null)\n {\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n }\n}\n\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @function displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport { Rectangle } from '@pixi/math';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * A Container represents a collection of display objects.\n *\n * It is the base class of all display objects that act as a container for other objects (like Sprites).\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n public readonly children: DisplayObject[];\n public sortableChildren: boolean;\n public sortDirty: boolean;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n protected onChildrenChange(_length: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: T, index: number): T\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child: DisplayObject, child2: DisplayObject): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child: DisplayObject): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child: DisplayObject, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index: number): DisplayObject\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index: number): DisplayObject\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): DisplayObject[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.\n */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).maskObject || child._mask) as Container;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n renderer.batch.flush();\n\n const filters = this.filters;\n const mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].render(renderer);\n }\n\n renderer.batch.flush();\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @function containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget {\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: true;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement {\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n","import { DisplayObject } from '@pixi/display';\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { accessibleTarget } from './accessibleTarget';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Container } from '@pixi/display';\nimport type { Renderer, AbstractRenderer } from '@pixi/core';\nimport type { IAccessibleHTMLElement } from './accessibleTarget';\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nexport class AccessibilityManager\n{\n public debug: boolean;\n public renderer: AbstractRenderer|Renderer;\n\n private _isActive: boolean;\n private _isMobileAccessibility: boolean;\n private _hookDiv: HTMLElement;\n private div: HTMLElement;\n private pool: IAccessibleHTMLElement[];\n private renderId: number;\n private children: DisplayObject[];\n private androidUpdateCount: number;\n private androidUpdateFrequency: number;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer|Renderer)\n {\n /**\n * @type {?HTMLElement}\n * @private\n */\n this._hookDiv = null;\n\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n this._isActive = false;\n\n this._isMobileAccessibility = false;\n\n /**\n * count to throttle div updates on android devices\n * @type number\n * @private\n */\n this.androidUpdateCount = 0;\n\n /**\n * the frequency to update the div elements ()\n * @private\n */\n this.androidUpdateFrequency = 500; // 2fps\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isActive(): boolean\n {\n return this._isActive;\n }\n\n /**\n * A flag\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility(): boolean\n {\n return this._isMobileAccessibility;\n }\n\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n private createTouchHook(): void\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessability for this content';\n\n hookDiv.addEventListener('focus', () =>\n {\n this._isMobileAccessibility = true;\n this.activate();\n this.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n private destroyTouchHook(): void\n {\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n private activate(): void\n {\n if (this._isActive)\n {\n return;\n }\n\n this._isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).on('postrender', this.update, this);\n\n if ((this.renderer as AbstractRenderer).view.parentNode)\n {\n (this.renderer as AbstractRenderer).view.parentNode.appendChild(this.div);\n }\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n private deactivate(): void\n {\n if (!this._isActive || this._isMobileAccessibility)\n {\n return;\n }\n\n this._isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n // TODO: Remove casting when CanvasRenderer is converted\n (this.renderer as AbstractRenderer).off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n private updateAccessibleObjects(displayObject: Container): void\n {\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i] as Container);\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n private update(): void\n {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n const now = performance.now();\n\n if (isMobile.android.device && now < this.androidUpdateCount)\n {\n return;\n }\n\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n\n if (!(this.renderer as Renderer).renderingToScreen)\n {\n return;\n }\n\n // update children...\n if (this.renderer._lastObjectRendered)\n {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered as Container);\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const rect = (this.renderer as AbstractRenderer).view.getBoundingClientRect();\n\n const resolution = this.renderer.resolution;\n\n const sx = (rect.width / (this.renderer as AbstractRenderer).width) * resolution;\n const sy = (rect.height / (this.renderer as AbstractRenderer).height) * resolution;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${(this.renderer as AbstractRenderer).width}px`;\n div.style.height = `${(this.renderer as AbstractRenderer).height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea as Rectangle;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) this.updateDebugHTML(div);\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n public updateDebugHTML(div: IAccessibleHTMLElement): void\n {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n public capHitArea(hitArea: Rectangle): void\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n if (hitArea.x + hitArea.width > (this.renderer as AbstractRenderer).width)\n {\n hitArea.width = (this.renderer as AbstractRenderer).width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > (this.renderer as AbstractRenderer).height)\n {\n hitArea.height = (this.renderer as AbstractRenderer).height - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n private addChild(displayObject: T): void\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) this.updateDebugHTML(div);\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n private _onClick(e: MouseEvent): void\n {\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'click', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'pointertap', interactionManager.eventData\n );\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'tap', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n private _onFocus(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'assertive');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent(\n (e.target as IAccessibleHTMLElement).displayObject, 'mouseover', interactionManager.eventData\n );\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n private _onFocusOut(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'polite');\n }\n\n // TODO: Remove casting when CanvasRenderer is converted\n const interactionManager = (this.renderer as AbstractRenderer).plugins.interaction;\n\n interactionManager.dispatchEvent((e.target as any).displayObject, 'mouseout', interactionManager.eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n private _onKeyDown(e: KeyboardEvent): void\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n private _onMouseMove(e: MouseEvent): void\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n public destroy(): void\n {\n this.destroyTouchHook();\n this.div = null;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY {\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","import { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n public priority: number;\n public next: TickerListener;\n public previous: TickerListener;\n\n private fn: TickerCallback;\n private context: T;\n private once: boolean;\n private _destroyed: boolean;\n\n /**\n * Constructor\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n /**\n * The handler function to execute.\n * @private\n * @member {Function}\n */\n this.fn = fn;\n\n /**\n * The calling to execute.\n * @private\n * @member {*}\n */\n this.context = context;\n\n /**\n * The current priority.\n * @private\n * @member {number}\n */\n this.priority = priority;\n\n /**\n * If this should only execute once.\n * @private\n * @member {boolean}\n */\n this.once = once;\n\n /**\n * The next item in chain.\n * @private\n * @member {TickerListener}\n */\n this.next = null;\n\n /**\n * The previous item in chain.\n * @private\n * @member {TickerListener}\n */\n this.previous = null;\n\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param {Function} fn - The listener function to be added for one update\n * @param {any} [context] - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param {TickerListener} previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n static _shared: Ticker;\n static _system: Ticker;\n\n public autoStart: boolean;\n public deltaTime: number;\n public deltaMS: number;\n public elapsedMS: number;\n public lastTime: number;\n public speed: number;\n public started: boolean;\n\n private _head: TickerListener;\n private _requestId: number;\n private _maxElapsedMS: number;\n private _minElapsedMS: number;\n private _protected: boolean;\n private _lastFrame: number;\n private _tick: (time: number) => any;\n\n constructor()\n {\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n\n /**\n * Internal current frame request ID\n * @type {?number}\n * @private\n */\n this._requestId = null;\n\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Internal value managed by maxFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n * @type {number}\n * @private\n */\n this._minElapsedMS = 0;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.deltaMS = 1 / settings.TARGET_FPMS;\n\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n\n /**\n * If enabled, deleting is disabled.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n * @member {number}\n * @default -1\n * @private\n */\n this._lastFrame = -1;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n add(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {*} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n addOnce(fn: TickerCallback, context: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {*} [context] - The listener context to be removed\n * @returns {PIXI.Ticker} This instance of a ticker\n */\n remove(fn: TickerCallback, context: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\nimport type { IApplicationOptions } from '@pixi/app';\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n *\n * @method PIXI.Application#stop\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n *\n * @method PIXI.Application#start\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n","import { Point, IPointData } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\n\nexport type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionData\n{\n public global: Point;\n public target: DisplayObject;\n public originalEvent: InteractivePointerEvent;\n public identifier: number;\n public isPrimary: boolean;\n public button: number;\n public buttons: number;\n public width: number;\n public height: number;\n public tiltX: number;\n public tiltY: number;\n public pointerType: string;\n public pressure = 0;\n public rotationAngle = 0;\n public twist = 0;\n public tangentialPressure = 0;\n\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId(): number\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n public getLocalPosition

(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P\n {\n return displayObject.worldTransform.applyInverse

(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n public copyEvent(event: Touch | InteractivePointerEvent): void\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n const buttons = 'buttons' in event && event.buttons;\n\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n public reset(): void\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","import type { DisplayObject } from '@pixi/display';\nimport type { InteractionData } from './InteractionData';\n\nexport type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionEvent\n{\n public stopped: boolean;\n public stopsPropagatingAt: DisplayObject;\n public stopPropagationHint: boolean;\n public target: DisplayObject;\n public currentTarget: DisplayObject;\n public type: string;\n public data: InteractionData;\n\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n public stopPropagation(): void\n {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n }\n\n /**\n * Resets the event.\n */\n public reset(): void\n {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","export interface InteractionTrackingFlags\n{\n OVER: number;\n LEFT_DOWN: number;\n RIGHT_DOWN: number;\n NONE: number;\n}\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class InteractionTrackingData\n{\n public static FLAGS: Readonly = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n\n private readonly _pointerId: number;\n private _flags: number;\n\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n constructor(pointerId: number)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n private _doSet(flag: number, yn: boolean): void\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get pointerId(): number\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get flags(): number\n {\n return this._flags;\n }\n\n set flags(flags: number)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get none(): boolean\n {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get over(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n }\n\n set over(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get rightDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n set rightDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get leftDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n }\n\n set leftDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n }\n}\n","import { Point } from '@pixi/math';\n\nimport type { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport type { Container, DisplayObject } from '@pixi/display';\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TreeSearch\n{\n private readonly _tempPoint: Point;\n\n constructor()\n {\n this._tempPoint = new Point();\n }\n\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n public recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean, interactive?: boolean\n ): boolean\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!((displayObject._mask as any).containsPoint && (displayObject._mask as any).containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && (displayObject as Container).children)\n {\n const children = (displayObject as Container).children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && (displayObject as any).containsPoint)\n {\n if ((displayObject as any).containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n public findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n }\n}\n","import type { InteractionTrackingData } from './InteractionTrackingData';\n\nexport type Cursor = 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ns-resize'\n | 'ew-resize'\n | 'nesw-resize'\n | 'col-resize'\n | 'nwse-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out'\n | 'grab'\n | 'grabbing';\n\nexport interface IHitArea {\n contains(x: number, y: number): boolean;\n}\n\nexport interface InteractiveTarget {\n interactive: boolean;\n interactiveChildren: boolean;\n hitArea: IHitArea;\n cursor: Cursor | string;\n buttonMode: boolean;\n trackedPointers: {[x: number]: InteractionTrackingData};\n _trackedPointers: {[x: number]: InteractionTrackingData};\n}\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nexport const interactiveTarget: InteractiveTarget = {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.IHitArea}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode(): boolean\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value: boolean)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n","import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject, TemporaryDisplayObject } from '@pixi/display';\nimport { InteractionData, InteractivePointerEvent } from './InteractionData';\nimport { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport { InteractionTrackingData } from './InteractionTrackingData';\nimport { TreeSearch } from './TreeSearch';\nimport { EventEmitter } from '@pixi/utils';\nimport { interactiveTarget } from './interactiveTarget';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { Point, IPointData } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\n// Mix interactiveTarget into DisplayObject.prototype,\n// after deprecation has been handled\nDisplayObject.mixin(interactiveTarget);\n\nconst MOUSE_POINTER_ID = 1;\n\n// Mock interface for hitTestEvent - only used inside hitTest()\ninterface TestInteractionEvent\n{\n target: DisplayObject;\n data: {global: Point};\n}\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent: TestInteractionEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\nexport interface InteractionManagerOptions {\n autoPreventDefault?: boolean;\n interactionFrequency?: number;\n useSystemTicker?: boolean;\n}\n\nexport interface DelayedEvent {\n displayObject: DisplayObject;\n eventString: string;\n eventData: InteractionEvent;\n}\n\ninterface CrossCSSStyleDeclaration extends CSSStyleDeclaration\n{\n msContentZooming: string;\n msTouchAction: string;\n}\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class InteractionManager extends EventEmitter\n{\n public readonly activeInteractionData: { [key: number]: InteractionData };\n public readonly supportsTouchEvents: boolean;\n public readonly supportsPointerEvents: boolean;\n public interactionDataPool: InteractionData[];\n public cursor: string;\n public delayedEvents: DelayedEvent[];\n public search: TreeSearch;\n public renderer: AbstractRenderer;\n public autoPreventDefault: boolean;\n public interactionFrequency: number;\n public mouse: InteractionData;\n public eventData: InteractionEvent;\n public moveWhenInside: boolean;\n public cursorStyles: Dict void) | CSSStyleDeclaration>;\n public currentCursorMode: string;\n public resolution: number;\n\n protected interactionDOMElement: HTMLElement;\n protected eventsAdded: boolean;\n protected tickerAdded: boolean;\n protected mouseOverRenderer: boolean;\n\n private _useSystemTicker: boolean;\n private _deltaTime: number;\n private _didMove: boolean;\n private _tempDisplayObject: DisplayObject;\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n constructor(renderer: AbstractRenderer, options: InteractionManagerOptions)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n this.tickerAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObject = new TemporaryDisplayObject();\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get useSystemTicker(): boolean\n {\n return this._useSystemTicker;\n }\n set useSystemTicker(useSystemTicker: boolean)\n {\n this._useSystemTicker = useSystemTicker;\n\n if (useSystemTicker)\n {\n this.addTickerListener();\n }\n else\n {\n this.removeTickerListener();\n }\n }\n\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get lastObjectRendered(): DisplayObject\n {\n return this.renderer._lastObjectRendered || this._tempDisplayObject;\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n public hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent as InteractionEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n public setTargetElement(element: HTMLElement, resolution = 1): void\n {\n this.removeTickerListener();\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n\n this.addTickerListener();\n }\n\n /**\n * Add the ticker listener\n *\n * @private\n */\n private addTickerListener(): void\n {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker)\n {\n return;\n }\n\n Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n\n this.tickerAdded = true;\n }\n\n /**\n * Remove the ticker listener\n *\n * @private\n */\n private removeTickerListener(): void\n {\n if (!this.tickerAdded)\n {\n return;\n }\n\n Ticker.system.remove(this.tickerUpdate, this);\n\n this.tickerAdded = false;\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n private addEvents(): void\n {\n if (this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n private removeEvents(): void\n {\n if (!this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (window.navigator.msPointerEnabled)\n {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n public tickerUpdate(deltaTime: number): void\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n this.update();\n }\n\n /**\n * Updates the state of interactive objects.\n */\n public update(): void\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove)\n {\n this._didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent as PointerEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n public setCursorMode(mode: string): void\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n private dispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if ((displayObject as any)[eventString])\n {\n (displayObject as any)[eventString](eventData);\n }\n }\n }\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n private delayDispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n this.delayedEvents.push({ displayObject, eventString, eventData });\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n public mapPositionToPoint(point: IPointData, x: number, y: number): void\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * ((this.interactionDOMElement as any).width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * ((this.interactionDOMElement as any).height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n public processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n const hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n const delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n const delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (let i = 0; i < delayedLen; i++)\n {\n const { displayObject, eventString, eventData } = delayedEvents[i];\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject, eventString, eventData);\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n private onPointerDown(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && (events[0] as any).isNormalized)\n {\n const cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerDown(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n private onPointerComplete(originalEvent: InteractivePointerEvent, cancelled: boolean, func: InteractionCallback): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerCancel(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n private processPointerCancel(interactionEvent: InteractionEvent, displayObject: DisplayObject): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerUp(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerUp(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n private onPointerMove(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this._didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerMove(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n private onPointerOut(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerOverOut(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n private onPointerOver(originalEvent: InteractivePointerEvent): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n private getInteractionDataForPointerId(event: PointerEvent): InteractionData\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n private releaseInteractionDataForPointerId(pointerId: number): void\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n private configureInteractionEventForDOMEvent(interactionEvent: InteractionEvent, pointerEvent: PointerEvent,\n interactionData: InteractionData\n ): InteractionEvent\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n (pointerEvent as any).globalX = interactionData.global.x;\n (pointerEvent as any).globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n private normalizeToPointerData(event: InteractivePointerEvent): PointerEvent[]\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i] as PixiTouch;\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n const tempEvent = event as PixiPointerEvent;\n\n if (typeof tempEvent.isPrimary === 'undefined') tempEvent.isPrimary = true;\n if (typeof tempEvent.width === 'undefined') tempEvent.width = 1;\n if (typeof tempEvent.height === 'undefined') tempEvent.height = 1;\n if (typeof tempEvent.tiltX === 'undefined') tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === 'undefined') tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === 'undefined') tempEvent.pointerType = 'mouse';\n if (typeof tempEvent.pointerId === 'undefined') tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === 'undefined') tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === 'undefined') tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === 'undefined') tempEvent.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n\n normalizedEvents.push(tempEvent);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents as PointerEvent[];\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n public destroy(): void\n {\n this.removeEvents();\n\n this.removeTickerListener();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n }\n}\n\ninterface PixiPointerEvent extends PointerEvent\n{\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n isNormalized: boolean;\n}\n\ninterface PixiTouch extends Touch\n{\n button: number;\n buttons: number;\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n layerX: number;\n layerY: number;\n offsetX: number;\n offsetY: number;\n isNormalized: boolean;\n}\n","/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.update.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject1);\n *\n * myGame.update.emit(time);\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param {string} name - the function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - optional parameters to pass to each listener\n * @return {PIXI.Runner}\n */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n * @return {PIXI.Runner}\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listenr that you would like to remove.\n * @return {PIXI.Runner}\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /**\n * Remove all listeners from the Runner\n * @return {PIXI.Runner}\n */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /**\n * Remove all references, don't use after this.\n */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @member {boolean}\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n *\n * @member {string}\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n","import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type{ ISize } from '@pixi/math';\nimport type{ ICubeResourceOptions } from './CubeResource';\nimport type{ ISVGResourceOptions } from './SVGResource';\nimport type{ IVideoResourceOptions } from './VideoResource';\n\n/**\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/**\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n | ICubeResourceOptions\n | IImageResourceOptions\n | ISVGResourceOptions\n | IVideoResourceOptions\n | IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: any): Resource;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}.\n * @example\n * class CustomResource extends PIXI.resources.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.resources.INSTALLED.push(CustomResource);\n *\n * @name PIXI.resources.INSTALLED\n * @type {Array<*>}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.resources.ImageResource}\n * - {@link PIXI.resources.CanvasResource}\n * - {@link PIXI.resources.VideoResource}\n * - {@link PIXI.resources.SVGResource}\n * - {@link PIXI.resources.BufferResource}\n * @static\n * @function PIXI.resources.autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.resources.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: IAutoDetectOptions): Resource\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i];\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @class\n * @memberof PIXI.resources\n */\nexport abstract class Resource\n{\n public destroyed: boolean;\n public internal: boolean;\n protected _width: number;\n protected _height: number;\n protected onResize: Runner;\n protected onUpdate: Runner;\n protected onError: Runner;\n /**\n * @param {number} [width=0] - Width of the resource\n * @param {number} [height=0] - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n /**\n * Internal width of the resource\n * @member {number}\n * @protected\n */\n this._width = width;\n\n /**\n * Internal height of the resource\n * @member {number}\n * @protected\n */\n this._height = height;\n\n /**\n * If resource has been destroyed\n * @member {boolean}\n * @readonly\n * @default false\n */\n this.destroyed = false;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n * @member {boolean}\n * @protected\n */\n this.internal = false;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n this.onResize = new Runner('setRealSize');\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n this.onUpdate = new Runner('update');\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n *\n * @param {PIXI.BaseTexture} baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param {number} width - X dimension\n * @param {number} height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n * @member {boolean}\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /**\n * Has been updated trigger event\n */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n *\n * @member {number}\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n *\n * @member {number}\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n *\n * @param {PIXI.Renderer} renderer - yeah, renderer!\n * @param {PIXI.BaseTexture} baseTexture - the texture\n * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context\n * @returns {boolean} `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /**\n * Clean up anything, this happens when destroying is ready.\n *\n * @protected\n */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BufferResource extends Resource\n{\n data: Float32Array|Uint8Array|Uint32Array;\n\n /**\n * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer\n * @param {object} options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array|Uint8Array|Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n /**\n * Source array\n * Cannot be ClampedUint8Array because it cant be uploaded to WebGL\n *\n * @member {Float32Array|Uint8Array|Uint32Array}\n */\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /**\n * Destroy and don't use after this\n * @override\n */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array|Uint8Array|Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap;\n\nexport interface IBaseTextureOptions {\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n resourceOptions?: any;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null]\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.resources.autoDetectResource autoDetectResource}\n */\nexport class BaseTexture extends EventEmitter\n{\n public width: number;\n public height: number;\n public resolution: number;\n public alphaMode?: ALPHA_MODES;\n public mipmap?: MIPMAP_MODES;\n public anisotropicLevel?: number;\n public scaleMode?: SCALE_MODES;\n public wrapMode?: WRAP_MODES;\n public format?: FORMATS;\n public type?: TYPES;\n public target?: TARGETS;\n\n public readonly uid: number;\n touched: number;\n isPowerOfTwo: boolean;\n\n _glTextures: { [key: number]: GLTexture };\n dirtyId: number;\n dirtyStyleId: number;\n public cacheId: string;\n public valid: boolean;\n textureCacheIds: Array;\n public destroyed: boolean;\n public resource: Resource;\n _batchEnabled: number;\n _batchLocation: number;\n parentTextureArray: BaseTexture;\n\n constructor(resource: Resource | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = width || 0;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = height || 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n\n /**\n * How the texture wraps\n * @member {number}\n */\n this.wrapMode = wrapMode || settings.WRAP_MODE;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * The pixel format of the texture\n *\n * @member {PIXI.FORMATS}\n * @default PIXI.FORMATS.RGBA\n */\n this.format = format || FORMATS.RGBA;\n\n /**\n * The type of resource data\n *\n * @member {PIXI.TYPES}\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n this.type = type || TYPES.UNSIGNED_BYTE;\n\n /**\n * The target type\n *\n * @member {PIXI.TARGETS}\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n this.target = target || TARGETS.TEXTURE_2D;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @member {number}\n * @protected\n */\n this.uid = uid();\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @member {number}\n * @protected\n */\n this.touched = 0;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @member {boolean}\n * @default false\n */\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n /**\n * The map of render context textures where this is bound\n *\n * @member {Object}\n * @private\n */\n this._glTextures = {};\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n * @member {number}\n */\n this.dirtyStyleId = 0;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n this.cacheId = null;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n this.valid = width > 0 && height > 0;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n this.textureCacheIds = [];\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n this.destroyed = false;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.resources.Resource}\n * @readonly\n */\n this.resource = null;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchEnabled = 0;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n this._batchLocation = 0;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realWidth(): number\n {\n return Math.ceil((this.width * this.resolution) - 1e-4);\n }\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realHeight(): number\n {\n return Math.ceil((this.height * this.resolution) - 1e-4);\n }\n\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} width - Visual width\n * @param {number} height - Visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setSize(width: number, height: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = width;\n this.height = height;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = realWidth / this.resolution;\n this.height = realHeight / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = this.width * oldResolution / resolution;\n this.height = this.height * oldResolution / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n setResource(resource: Resource): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource|string, options: IBaseTextureOptions,\n strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture|null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport { ISize } from '@pixi/math';\nimport { autoDetectResource, IAutoDetectOptions } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {object} [options] Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n readonly length: number;\n items: Array;\n itemDirtyIds: Array;\n private _load: Promise;\n\n baseTexture: BaseTexture;\n\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n /**\n * Collection of partial baseTextures that correspond to resources\n * @member {Array}\n * @readonly\n */\n this.items = [];\n\n /**\n * Dirty IDs for each part\n * @member {Array}\n * @readonly\n */\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n /**\n * Number of elements in array\n *\n * @member {number}\n * @readonly\n */\n this.length = length;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Bound baseTexture, there can only be one\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n }\n\n /**\n * used from ArrayResource and CubeResource constructors\n * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param {object} [options] - detect options for resources\n * @protected\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.AbstractMultiResource} Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n *\n * @param {PIXI.resources.Resource} resource\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture\n * @member {PIXI.BaseTexture}\n * @override\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @override\n * @return {Promise} When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n *\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n * @param {number|Array<*>} source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n constructor(source: number|Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param {PIXI.BaseTexture} baseTexture\n * @param {number} index - Zero-based index of resource to set\n * @return {PIXI.resources.ArrayResource} Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @member {PIXI.BaseTexture}\n * @override\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BaseTexture} texture\n * @param {PIXI.GLTexture} glTexture\n * @returns {boolean} whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n texture.format,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n texture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n texture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Base for all the image/canvas resources\n * @class\n * @extends PIXI.resources.Resource\n * @memberof PIXI.resources\n */\nexport class BaseImageResource extends Resource\n{\n public source: ImageSource;\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n /**\n * The source element\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n this.source = source;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @member {boolean}\n * @default false\n * @private\n */\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @protected\n * @param {HTMLElement} element - Element to apply crossOrigin\n * @param {string} url - URL to check\n * @param {boolean|string} [crossorigin=true] - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement|HTMLVideoElement, url: string, crossorigin: boolean|string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional)\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /**\n * Destroy this BaseImageResource\n * @override\n */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLCanvasElement} source - Canvas element to use\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas|HTMLCanvasElement\n {\n const { OffscreenCanvas } = window;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Constructor options for CubeResource\n */\nexport interface ICubeResourceOptions extends ISize\n{\n autoLoad?: boolean;\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @class\n * @extends PIXI.resources.ArrayResource\n * @memberof PIXI.resources\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param {object} [options] - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n linkBaseTexture: boolean;\n\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself\n * @member {boolean}\n * @protected\n */\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding\n *\n * @override\n * @param {PIXI.BaseTexture} baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Number of texture sides to store for CubeResources\n *\n * @name PIXI.resources.CubeResource.SIDES\n * @static\n * @member {number}\n * @default 6\n */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {object} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n autoLoad?: boolean;\n createBitmap?: boolean;\n crossorigin?: boolean|string;\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n */\nexport class ImageResource extends BaseImageResource\n{\n url: string;\n private _load: Promise;\n private _process: Promise;\n preserveBitmap: boolean;\n createBitmap: boolean;\n alphaMode: ALPHA_MODES;\n bitmap: ImageBitmap;\n /**\n * @param {HTMLImageElement|string} source - image source or URL\n * @param {object} [options]\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement|string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n /**\n * URL of the image source\n * @member {string}\n */\n this.url = source.src;\n\n /**\n * When process is completed\n * @member {Promise}\n * @private\n */\n this._process = null;\n\n /**\n * If the image should be disposed after upload\n * @member {boolean}\n * @default false\n */\n this.preserveBitmap = false;\n\n /**\n * If capable, convert the image using createImageBitmap API\n * @member {boolean}\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @member {PIXI.ALPHA_MODES|null}\n * @readonly\n */\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n\n if ((options as any).premultiplyAlpha !== undefined)\n {\n // triggers deprecation\n (this as any).premultiplyAlpha = (options as any).premultiplyAlpha;\n }\n\n /**\n * The ImageBitmap element created for HTMLImageElement\n * @member {ImageBitmap}\n * @default null\n */\n this.bitmap = null;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * returns a promise when image will be loaded and processed\n *\n * @param {boolean} [createBitmap] - whether process image into bitmap\n * @returns {Promise}\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @returns {Promise} cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !window.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n this._process = (window.createImageBitmap as any)(source,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n })\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n *\n * @param {PIXI.Renderer} renderer - Renderer to upload to\n * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource\n * @param {PIXI.GLTexture} glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {string|HTMLImageElement} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string|HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean|string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {string} source - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\nexport class SVGResource extends BaseImageResource\n{\n public readonly svg: string;\n public readonly scale: number;\n readonly _overrideWidth: number;\n readonly _overrideHeight: number;\n private _resolve: () => void;\n private _load: Promise;\n private _crossorigin?: boolean|string;\n\n constructor(sourceBase64: string, options: ISVGResourceOptions)\n {\n options = options || {};\n\n super(document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n /**\n * Base64 encoded SVG element or URL for SVG file\n * @readonly\n * @member {string}\n */\n this.svg = sourceBase64;\n\n /**\n * The source scale to apply when rasterizing on load\n * @readonly\n * @member {number}\n */\n this.scale = options.scale || 1;\n\n /**\n * A width override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideWidth = options.width;\n\n /**\n * A height override for rasterization on load\n * @readonly\n * @member {number}\n */\n this._overrideHeight = options.height;\n\n /**\n * Call when completely loaded\n * @private\n * @member {function}\n */\n this._resolve = null;\n\n /**\n * Cross origin value to use\n * @private\n * @member {boolean|string}\n */\n this._crossorigin = options.crossorigin;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if ((/^\\\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using regexp.\n *\n * @method\n * @param {string} svgString - a serialized svg element\n * @return {PIXI.ISize} image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && (/^data:image\\/svg\\+xml(;(charset=utf8|utf8))?;base64/).test(source))\n // source is SVG inline\n || (typeof source === 'string' && source.indexOf(']*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean|string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for HTMLVideoElement.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\nexport class VideoResource extends BaseImageResource\n{\n protected _autoUpdate: boolean;\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n protected autoPlay: boolean;\n private _load: Promise;\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n constructor(source?: HTMLVideoElement|Array|string, options?: IVideoResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = true;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = options.autoPlay !== false;\n\n /**\n * Promise when loading\n * @member {Promise}\n * @private\n * @default null\n */\n this._load = null;\n\n /**\n * Callback when completed with load.\n * @member {function}\n * @private\n */\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture\n *\n * @param {number} [deltaTime=0] - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n *\n * @protected\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n *\n * @private\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState === 3 || source.readyState === 4;\n }\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /**\n * Destroys this texture\n * @override\n */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n *\n * @member {number}\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @constant\n * @member {Array}\n * @static\n * @readonly\n */\n static TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @constant\n * @member {object}\n * @static\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @class\n * @extends PIXI.resources.BaseImageResource\n * @memberof PIXI.resources\n * @param {ImageBitmap} source - Image element to use\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * Used to auto-detect the type of resource.\n *\n * @static\n * @param {ImageBitmap} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!window.createImageBitmap && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\n/**\n * Collection of base resource types supported by PixiJS.\n *\n * Resources are used by {@link PIXI.BaseTexture} to handle different media types\n * such as images, video, SVG graphics, etc. In most use-cases, you should not\n * instantiate the resources directly. The easy thing is to use\n * {@link PIXI.BaseTexture.from}.\n * @example\n * const baseTexture = PIXI.BaseTexture.from('path/to/image.jpg');\n * @namespace PIXI.resources\n */\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import type { Renderer } from './Renderer';\n\n/**\n * System is a base class used for extending systems used by the {@link PIXI.Renderer}\n *\n * @see PIXI.Renderer#addSystem\n * @class\n * @memberof PIXI\n */\nexport class System\n{\n // public because of Filter usage,\n // protected because usually renderer it already known by those who use the system\n renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n destroy(): void\n {\n (this as any).renderer = null;\n }\n}\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * Resource type for DepthTexture.\n * @class\n * @extends PIXI.resources.BufferResource\n * @memberof PIXI.resources\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param {PIXI.Renderer} renderer - Upload to the renderer\n * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture\n * @param {PIXI.GLTexture} glTexture - glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n baseTexture.width,\n baseTexture.height,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = baseTexture.width;\n glTexture.height = baseTexture.height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0\n renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16,\n baseTexture.width,\n baseTexture.height,\n 0,\n baseTexture.format,\n baseTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * Frame buffer used by the BaseRenderTexture\n *\n * @class\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n public width: number;\n public height: number;\n public multisample: MSAA_QUALITY;\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.ceil(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.ceil(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(renderTexture, myContainer);\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable depth on the frame buffer\n */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable stencil on the frame buffer\n */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into acount the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n maskStack: Array;\n filterStack: Array;\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated.\n */\n constructor(options: IBaseTextureOptions)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n super(null, options);\n\n const { width, height } = options || {};\n\n // Set defaults\n this.mipmap = 0;\n this.width = Math.ceil(width) || 100;\n this.height = Math.ceil(height) || 100;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution)\n .addColorTexture(0, this);\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n resize(width: number, height: number): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n this.framebuffer.resize(width * this.resolution, height * this.resolution);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /**\n * Destroys this texture.\n */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n public x0: number;\n public y0: number;\n public x1: number;\n public y1: number;\n public x2: number;\n public y2: number;\n public x3: number;\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { IPointData } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string|BaseTexture|ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class Texture extends EventEmitter\n{\n public baseTexture: BaseTexture;\n public orig: Rectangle;\n public trim: Rectangle;\n public valid: boolean;\n public noFrame: boolean;\n public defaultAnchor: Point;\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n _updateID: number;\n _frame: Rectangle;\n _uvs: TextureUvs;\n textureCacheIds: Array;\n\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n this._uvs = DEFAULT_UVS;\n\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const resource = this.baseTexture as any;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n clone(): Texture\n {\n return new Texture(this.baseTexture,\n this.frame.clone(),\n this.orig.clone(),\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source\n * Source to create texture from\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource, options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n (source as any)._pixiId = `pixiid_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId];\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture)\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url The remote URL to load.\n * @param {object} [options] Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n static fromURL(url: string, options?: IBaseTextureOptions): Promise\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource as ImageResource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n static fromLoader(source: HTMLImageElement|HTMLCanvasElement, imageUrl: string, name: string): Texture\n {\n const resource = new ImageResource(source as any);\n\n resource.url = imageUrl;\n\n const baseTexture = new BaseTexture(resource, {\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n });\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n static removeFromCache(texture: string|Texture): Texture|null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.orig.height;\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n static readonly EMPTY: Texture;\n static readonly WHITE: Texture;\n}\n\nfunction createWhiteTexture(): Texture\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\n(Texture as any).WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public filterFrame: Rectangle|null;\n public filterPoolKey: string|number|null;\n legacyRenderer: any;\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n // support for legacy..\n let _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n const width = arguments[1];\n const height = arguments[2];\n const scaleMode = arguments[3];\n const resolution = arguments[4];\n\n // we have an old render texture..\n console.warn(`Please use RenderTexture.create(${width}, ${height}) instead of the ctor directly.`);\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture({\n width,\n height,\n scaleMode,\n resolution,\n });\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {PIXI.BaseTexture}\n */\n super(baseRenderTexture, frame);\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n * You can read it inside filters.\n *\n * @readonly\n * @member {PIXI.Rectangle}\n */\n this.filterFrame = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @protected\n * @member {string}\n */\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @member {PIXI.Framebuffer}\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return (this.baseTexture as BaseRenderTexture).framebuffer;\n }\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well?\n */\n resize(width: number, height: number, resizeBaseTexture = true): void\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n (this.baseTexture as BaseRenderTexture).resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param {number} resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {object} [options] - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n static create(options: IBaseTextureOptions): RenderTexture\n {\n // fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: arguments[1],\n scaleMode: arguments[2],\n resolution: arguments[3],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Experimental!\n *\n * Texture pool, used by FilterSystem and plugins\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @class\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n public enableFullScreen: boolean;\n texturePool: {[x in string|number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n /**\n * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @member {boolean}\n * @default false\n */\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * creates of texture with params that were specified in pool constructor\n *\n * @param {number} realWidth - width of texture in pixels\n * @param {number} realHeight - height of texture in pixels\n * @returns {RenderTexture}\n */\n createTexture(realWidth: number, realHeight: number): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n let key: number|string = RenderTexturePool.SCREEN_KEY;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input: RenderTexture, resolution: number): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface\n * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool\n *\n * @param {boolean} [destroyTextures=true] - destroy all stored textures\n */\n clear(destroyTextures: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param {PIXI.ISize} size - Initial size of screen\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n const screenKey = RenderTexturePool.SCREEN_KEY;\n const textures = this.texturePool[screenKey];\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.texturePool[screenKey] = [];\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @static\n * @const {string}\n */\n static SCREEN_KEY = 'screen';\n}\n","import type { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @class\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n /**\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data)\n */\n constructor(buffer: number, size = 0, normalized = false, type = 5126, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /**\n * Destroys the Attribute.\n */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @static\n * @param {string} buffer - the id of the buffer that this attribute will look for\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data)\n *\n * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n *\n * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @class\n * @memberof PIXI\n */\nexport class Buffer\n{\n public data: ITypedArray;\n public index: boolean;\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param {boolean} [_static=true] - `true` for static buffer\n * @param {boolean} [index=false] - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n /**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @member {object}\n */\n this._glBuffers = {};\n\n this._updateID = 0;\n\n this.index = index;\n\n this.static = _static;\n\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * flags this buffer as requiring an upload to the GPU\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer): void\n {\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the buffer\n */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @static\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return {PIXI.Buffer} A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import type { ITypedArray } from '../Buffer';\n\nexport function getBufferType(array: ITypedArray): string|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from './utils/getBufferType';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n *\n * ```\n * @class\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n public instanced: boolean;\n public instanceCount: number;\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n refCount: number;\n /**\n * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional.\n * @param {object} [attributes] - of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @protected\n * @type {object}\n */\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`\n * @member {number}\n * @default 1\n */\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n\n /**\n * Count of existing (not destroyed) meshes that reference this geometry\n * @member {number}\n */\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param {String} id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param {Boolean} [normalized=false] - should the data be normalized.\n * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data)\n * @param {Number} [start] - How far into the array to start reading values (used for interleaving data)\n * @param {boolean} [instance=false] - Instancing flag\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer|Float32Array|Uint32Array|Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * returns the requested attribute\n *\n * @param {String} id - the name of the attribute required\n * @return {PIXI.Attribute} the attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * returns the requested buffer\n *\n * @param {String} id - the name of the buffer required\n * @return {PIXI.Buffer} the buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.index = true;\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * returns the index buffer\n *\n * @return {PIXI.Buffer} the index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * this function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return {PIXI.Geometry} returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /**\n * disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys the geometry.\n */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * returns a clone of the geometry\n *\n * @returns {PIXI.Geometry} a new clone of this geometry\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.index = true;\n }\n\n return geometry;\n }\n\n /**\n * merges an array of geometries into a new single one\n * geometry attribute styles must match for this operation to work\n *\n * @param {PIXI.Geometry[]} geometries - array of geometries to merge\n * @returns {PIXI.Geometry} shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.index = true;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometry.buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n vertices: Float32Array;\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * @class\n * @memberof PIXI\n */\nexport class UniformGroup\n{\n public readonly uniforms: Dict;\n public readonly group: boolean;\n public id: number;\n syncUniforms: Dict;\n dirtyId: number;\n static: boolean;\n\n /**\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n * @param {boolean} [_static] - Uniforms wont be changed after creation\n */\n constructor(uniforms: Dict, _static?: boolean)\n {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!_static;\n }\n\n update(): void\n {\n this.dirtyId++;\n }\n\n add(name: string, uniforms: Dict, _static: boolean): void\n {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n }\n\n static from(uniforms: Dict, _static: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static);\n }\n}\n","import { Rectangle } from '@pixi/math';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @class\n * @private\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n target: IFilterTarget;\n legacy: boolean;\n resolution: number;\n sourceFrame: Rectangle;\n destinationFrame: Rectangle;\n filters: Array;\n\n constructor()\n {\n this.renderTexture = null;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n * @private\n */\n this.target = null;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @member {boolean}\n * @default false\n * @private\n */\n this.legacy = false;\n\n /**\n * Resolution of filters\n * @member {number}\n * @default 1\n * @private\n */\n this.resolution = 1;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @private\n */\n this.destinationFrame = new Rectangle();\n\n /**\n * Collection of filters\n * @member {PIXI.Filter[]}\n * @private\n */\n this.filters = [];\n }\n\n /**\n * clears the state\n * @private\n */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { System } from '../System';\nimport { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\nimport { FilterState } from './FilterState';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage the filters.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class FilterSystem extends System\n{\n public readonly defaultFilterStack: Array;\n public statePool: Array;\n public texturePool: RenderTexturePool;\n public forceClear: boolean;\n public useMaxPadding: boolean;\n protected quad: Quad;\n protected quadUv: QuadUv;\n protected activeState: FilterState;\n protected globalUniforms: UniformGroup;\n private tempRect: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n * @readonly\n */\n this.defaultFilterStack = [{}] as any;\n\n /**\n * stores a bunch of PO2 textures used for filtering\n * @member {Object}\n */\n this.texturePool = new RenderTexturePool();\n\n this.texturePool.setScreenSize(renderer.view);\n\n /**\n * a pool for storing filter states, save us creating new ones each tick\n * @member {Object[]}\n */\n this.statePool = [];\n\n /**\n * A very simple geometry used when drawing a filter effect to the screen\n * @member {PIXI.Quad}\n */\n this.quad = new Quad();\n\n /**\n * Quad UVs\n * @member {PIXI.QuadUv}\n */\n this.quadUv = new QuadUv();\n\n /**\n * Temporary rect for maths\n * @type {PIXI.Rectangle}\n */\n this.tempRect = new Rectangle();\n\n /**\n * Active state\n * @member {object}\n */\n this.activeState = {} as any;\n\n /**\n * This uniform group is attached to filter uniforms when used\n * @member {PIXI.UniformGroup}\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Fload32Array} filterClamp\n */\n this.globalUniforms = new UniformGroup({\n outputFrame: this.tempRect,\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n /**\n * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}\n * @member {boolean}\n */\n this.forceClear = false;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @member {boolean}\n * @default false\n */\n this.useMaxPadding = false;\n }\n\n /**\n * Adds a new filter to the System.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n\n let resolution = filters[0].resolution;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n let legacy = filters[0].legacy;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // lets use the lowest resolution..\n resolution = Math.min(resolution, filter.resolution);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || filter.legacy;\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n\n state.legacy = legacy;\n\n state.target = target;\n\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n if (autoFit)\n {\n state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame);\n }\n\n // round to whole number based on resolution\n state.sourceFrame.ceil(resolution);\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n\n renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.renderTexture.clear();\n }\n\n /**\n * Pops off the filter and applies it.\n *\n */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = inputSize[0] * state.resolution;\n inputPixel[1] = inputSize[1] * state.resolution;\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n if (state.renderTexture.framebuffer.multisample > 1)\n {\n this.renderer.framebuffer.blit();\n }\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode = CLEAR_MODES.CLEAR): void\n {\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else\n {\n this.renderer.renderTexture.bind(filterTexture);\n }\n\n // TODO: remove in next major version\n if (typeof clearMode === 'boolean')\n {\n clearMode = clearMode ? CLEAR_MODES.CLEAR : CLEAR_MODES.BLEND;\n // get deprecation function from utils\n deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option');\n }\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && this.forceClear))\n {\n this.renderer.renderTexture.clear();\n }\n }\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n\n renderer.state.set(filter.state);\n renderer.shader.bind(filter);\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /**\n * Destroys this Filter System.\n */\n destroy(): void\n {\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @protected\n * @param {number} minWidth - The minimum width of the render texture in real pixels.\n * @param {number} minHeight - The minimum height of the render texture in real pixels.\n * @param {number} [resolution=1] - The resolution of the render texture.\n * @return {PIXI.RenderTexture} The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied\n * @param {number} [resolution] - override resolution of the renderTexture\n * @returns {PIXI.RenderTexture}\n */\n getFilterTexture(input?: RenderTexture, resolution?: number): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /**\n * Empties the texture pool.\n */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /**\n * calls `texturePool.resize()`, affects fullScreen renderTextures\n */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n}\n","import type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nexport class ObjectRenderer\n{\n protected renderer: Renderer;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.Renderer}\n */\n this.renderer = renderer;\n }\n\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n flush(): void\n {\n // flush!\n }\n\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { System } from '../System';\nimport { ObjectRenderer } from './ObjectRenderer';\n\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n/**\n * System plugin to the renderer to manage batching.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class BatchSystem extends System\n{\n public readonly emptyRenderer: ObjectRenderer;\n public currentRenderer: ObjectRenderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(renderer);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Reset the system to an empty renderer\n */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param {PIXI.BaseTexture[]} - arr copy destination\n * @param {number} maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param {PIXI.BatchTextureArray} texArray - textures to bound\n * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures\n * @param {number} batchId - marker for _batchEnabled param of textures in texArray\n * @param {number} maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { System } from '../System';\nimport { settings } from '../settings';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict {\n uint32Indices: boolean;\n}\n/**\n * System plugin to the renderer to manage the context.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ContextSystem extends System\n{\n public webGLVersion: number;\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n /* eslint-disable camelcase */\n extensions:\n {\n drawBuffers?: WEBGL_draw_buffers;\n depthTexture?: OES_texture_float;\n loseContext?: WEBGL_lose_context;\n vertexArrayObject?: OES_vertex_array_object;\n anisotropicFiltering?: EXT_texture_filter_anisotropic;\n uint32ElementIndex?: OES_element_index_uint;\n floatTexture?: OES_texture_float;\n floatTextureLinear?: OES_texture_float_linear;\n textureHalfFloat?: OES_texture_half_float;\n textureHalfFloatLinear?: OES_texture_half_float_linear;\n colorBufferFloat?: WEBGL_color_buffer_float;\n };\n /* eslint-enable camelcase */\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Either 1 or 2 to reflect the WebGL version being used\n * @member {number}\n * @readonly\n */\n this.webGLVersion = 1;\n\n /**\n * Extensions being used\n * @member {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n this.extensions = {};\n\n /**\n * Features supported by current context\n * @member {object}\n * @private\n * @readonly\n * @property {boolean} uint32Indices - Supports of 32-bit indices buffer\n */\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @member {boolean}\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handle the context change event\n * @param {WebGLRenderingContext} gl - new webgl context\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n }\n\n /**\n * Initialize the context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {object} An options object that gets passed in to the canvas element containing the context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /**\n * Auto-populate the extensions\n *\n * @protected\n */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n *\n * @protected\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n event.preventDefault();\n }\n\n /**\n * Handles a restored webgl context\n *\n * @protected\n */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /**\n * Handle the post-render runner event\n *\n * @protected\n */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context\n *\n * @protected\n * @param {WebGLRenderingContext} gl - Render context\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n public framebuffer: WebGLFramebuffer;\n public stencil: WebGLRenderbuffer;\n public multisample: MSAA_QUALITY;\n public msaaBuffer: WebGLRenderbuffer;\n public blitFramebuffer: Framebuffer;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = 0;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = 0;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = 0;\n\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class FramebufferSystem extends System\n{\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} framebuffer\n * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n this.updateFramebuffer(framebuffer);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, framebuffer.width, framebuffer.height);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n for (let i = 0; i < colorTextures.length; i++)\n {\n this.renderer.texture.bind(colorTextures[i], 0);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n updateFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1)\n {\n fbo.msaaBuffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n if (i === 0 && fbo.multisample > 1)\n {\n continue;\n }\n\n const texture = framebuffer.colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n 0);\n }\n }\n\n if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth))\n {\n fbo.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n // TODO.. this is depth AND stencil?\n if (!framebuffer.depthTexture)\n { // you can't have both, so one should take priority if enabled\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n }\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (fbo.multisample <= 1)\n {\n return;\n }\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]);\n }\n framebuffer = fbo.blitFramebuffer;\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height,\n destPixels.x, destPixels.y, destPixels.width, destPixels.height,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n framebuffer.enableStencil();\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { System } from '../System';\nimport { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Buffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class GeometrySystem extends System\n{\n public hasVao: boolean;\n public hasInstance: boolean;\n public canUseUInt32ElementIndex: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n readonly managedGeometries: {[key: number]: Geometry};\n readonly managedBuffers: {[key: number]: Buffer};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this._activeGeometry = null;\n this._activeVao = null;\n\n /**\n * `true` if we has `*_vertex_array_object` extension\n * @member {boolean}\n * @readonly\n */\n this.hasVao = true;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension\n * @member {boolean}\n * @readonly\n */\n this.hasInstance = true;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`\n * @member {boolean}\n * @readonly\n */\n this.canUseUInt32ElementIndex = false;\n\n /**\n * Cache for all geometries by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedGeometries = {};\n\n /**\n * Cache for all buffers by id, used in case renderer gets destroyed or for profiling\n * @member {object}\n * @readonly\n */\n this.managedBuffers = {};\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param {PIXI.Geometry} geometry - instance of geometry to bind\n * @param {PIXI.Shader} [shader] - instance of shader to use vao for\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /**\n * Reset and unbind any active VAO and geometry\n */\n reset(): void\n {\n this.unbind();\n }\n\n /**\n * Update buffers\n * @protected\n */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n const { gl } = this;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n\n if (buffer._updateID !== glBuffer.updateID)\n {\n glBuffer.updateID = buffer._updateID;\n\n // TODO can cache this on buffer! maybe added a getter / setter?\n const type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n\n // TODO this could change if the VAO changes...\n // need to come up with a better way to cache..\n // if (this.boundBuffers[type] !== glBuffer)\n // {\n // this.boundBuffers[type] = glBuffer;\n gl.bindBuffer(type, glBuffer.buffer);\n // }\n\n this._boundBuffer = glBuffer;\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(type, buffer.data, drawType);\n }\n }\n }\n }\n\n /**\n * Check compability between a geometry and a program\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Program instance\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param {PIXI.Geometry} geometry - to get signature from\n * @param {PIXI.Program} program - to test geometry against\n * @returns {String} Unique signature of the geometry and program\n * @protected\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically.\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for\n * @param {PIXI.Program} program - Instance of program\n * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers\n */\n protected initGeometryVao(geometry: Geometry, program: Program, incRefCount = true): WebGLVertexArrayObject\n {\n this.checkCompatibility(geometry, program);\n\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n if (!buffer._glBuffers[CONTEXT_UID])\n {\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n }\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeBuffer(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * Disposes geometry\n * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n this.disposeBuffer(buffers[i], contextLost);\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed geometries and buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n let all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n all = Object.keys(this.managedBuffers);\n for (let i = 0; i < all.length; i++)\n {\n this.disposeBuffer(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object\n *\n * @protected\n * @param {PIXI.Geometry} geometry - Geometry instance\n * @param {PIXI.Program} program - Shader program instance\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draw the geometry\n *\n * @param {Number} type - the type primitive to render\n * @param {Number} [size] - the number of elements to be rendered\n * @param {Number} [start] - Starting index\n * @param {Number} [instanceCount] - the number of instances of the set of elements to execute\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /**\n * Unbind/reset everything\n * @protected\n */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\n\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements\n *\n * Holds mask mode and temporary data about current mask\n *\n * @class\n * @memberof PIXI\n */\nexport class MaskData\n{\n public type: MASK_TYPES;\n public autoDetect: boolean;\n public maskObject: IMaskTarget;\n public pooled: boolean;\n public isMaskData: true;\n _stencilCounter: number;\n _scissorCounter: number;\n _scissorRect: Rectangle;\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n /**\n * Mask type\n * @member {PIXI.MASK_TYPES}\n */\n this.type = MASK_TYPES.NONE;\n\n /**\n * Whether we know the mask type beforehand\n * @member {boolean}\n * @default true\n */\n this.autoDetect = true;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n this.maskObject = maskObject || null;\n\n /**\n * Whether it belongs to MaskSystem pool\n * @member {boolean}\n */\n this.pooled = false;\n\n /**\n * Indicator of the type\n * @member {boolean}\n */\n this.isMaskData = true;\n\n /**\n * Stencil counter above the mask in stack\n * @member {number}\n * @private\n */\n this._stencilCounter = 0;\n /**\n * Scissor counter above the mask in stack\n * @member {number}\n * @private\n */\n this._scissorCounter = 0;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @member {PIXI.Rectangle}\n */\n this._scissorRect = null;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._target = null;\n }\n\n /**\n * resets the mask data after popMask()\n */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n }\n\n /**\n * copies counters from maskData above, called from pushMask()\n * @param {PIXI.MaskData|null} maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param src {string} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n\n/**\n * @method compileProgram\n * @private\n * @memberof PIXI.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nexport function compileProgram(gl: WebGLRenderingContextBase, vertexSrc: string, fragmentSrc: string,\n attributeLocations?: Dict): WebGLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n let program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if (attributeLocations)\n {\n for (const i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS))\n {\n console.warn(vertexSrc);\n console.error(gl.getShaderInfoLog(glVertShader));\n }\n\n if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS))\n {\n console.warn(fragmentSrc);\n console.error(gl.getShaderInfoLog(glFragShader));\n }\n\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.shader\n * @param type {String} Type of value\n * @param size {Number}\n * @private\n */\nexport function defaultValue(type: string, size: number): number|Float32Array|Int32Array|boolean|boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = document.createElement('canvas');\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext);\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: string;\n\nexport function getMaxFragmentPrecision(): string\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param {string} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: string, maxSupportedPrecision: string): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.shader\n * @param type {String}\n * @return {Number}\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any): boolean =>\n // eslint-disable-next-line max-len\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray,\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }`,\n\n vec2: `\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])',\n\n int: 'gl.uniform1i(location, v)',\n ivec2: 'gl.uniform2i(location, v[0], v[1])',\n ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n bool: 'gl.uniform1i(location, v)',\n bvec2: 'gl.uniform2i(location, v[0], v[1])',\n bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])',\n bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])',\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i].group)\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv[\"${i}\"], syncData);\n `);\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cv = ud[\"${i}\"].value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /**\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n defaultValue,\n compileProgram,\n mapSize,\n mapType,\n getTestContext,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n type: string;\n size: number;\n isArray: RegExpMatchArray;\n value: any;\n}\n\n/**\n * Helper class to create a shader program.\n *\n * @class\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n public vertexSrc: string;\n public fragmentSrc: string;\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n attributeData: { [key: string]: IAttributeData};\n uniformData: {[key: string]: IUniformData};\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name] - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n this.extractData(this.vertexSrc, this.fragmentSrc);\n\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * Extracts the data for a buy creating a small test program\n * or reading the src directly.\n * @protected\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n */\n protected extractData(vertexSrc: string, fragmentSrc: string): void\n {\n const gl = getTestContext();\n\n if (gl)\n {\n const program = compileProgram(gl, vertexSrc, fragmentSrc);\n\n this.attributeData = this.getAttributeData(program, gl);\n this.uniformData = this.getUniformData(program, gl);\n\n gl.deleteProgram(program);\n }\n else\n {\n this.uniformData = {};\n this.attributeData = {};\n }\n }\n\n /**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\n protected getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n {\n const attributes: {[key: string]: IAttributeData} = {};\n const attributesArray: Array = [];\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n const type = mapType(gl, attribData.type);\n\n /*eslint-disable */\n const data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: 0,\n };\n /* eslint-enable */\n\n attributes[attribData.name] = data;\n attributesArray.push(data);\n }\n\n attributesArray.sort((a, b) => (a.name > b.name) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < attributesArray.length; i++)\n {\n attributesArray[i].location = i;\n }\n\n return attributes;\n }\n\n /**\n * returns the uniform data from the program\n * @private\n *\n * @param {webGL-program} [program] - the webgl program\n * @param {context} [gl] - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\n private getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n {\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n // TODO expose this as a prop?\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$');\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = uniformData.name.match(/\\[.*?\\]$/);\n const type = mapType(gl, uniformData.type);\n\n /*eslint-disable */\n uniforms[name] = {\n type: type,\n size: uniformData.size,\n isArray:isArray,\n value: defaultValue(type, uniformData.size),\n };\n /* eslint-enable */\n }\n\n return uniforms;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n * @member {string}\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader\n * this method will also check to see if there is a cached program.\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {string} [name=pixi-shader] - Name for shader\n *\n * @returns {PIXI.Program} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders\n *\n * @class\n * @memberof PIXI\n */\nexport class Shader\n{\n public program: Program;\n public uniformGroup: UniformGroup;\n /**\n * @param {PIXI.Program} [program] - The program the shader will use.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms: Dict)\n {\n /**\n * Program that the shader uses\n *\n * @member {PIXI.Program}\n */\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n // time to build some getters and setters!\n // I guess down the line this could sort of generate an instruction list rather than use dirty ids?\n // does the trick for now though!\n for (const i in program.uniformData)\n {\n if (this.uniformGroup.uniforms[i] instanceof Array)\n {\n this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]);\n }\n }\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`\n * @readonly\n * @member {object}\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader\n *\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n *\n * @returns {PIXI.Shader} an shiny new Pixi shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * This is a WebGL state, and is is passed The WebGL StateManager.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @class\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values\n *\n * @member {boolean}\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @member {boolean}\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n *\n * @member {boolean}\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @member {boolean}\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @member {boolean}\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @member {number}\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { State } from '../state/State';\nimport { settings } from '@pixi/settings';\nimport defaultVertex from './defaultFilter.vert';\nimport defaultFragment from './defaultFilter.frag';\n\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterSystem } from './FilterSystem';\nimport type { FilterState } from './FilterState';\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\n\n/**\n * Filter is a special type of WebGL shader that is applied to the screen.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class Filter extends Shader\n{\n public padding: number;\n public resolution: number;\n public enabled: boolean;\n public autoFit: boolean;\n public legacy: boolean;\n state: State;\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 0;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n\n /**\n * Legacy filters use position and uvs from attributes\n * @member {boolean}\n * @readonly\n */\n this.legacy = !!this.program.attributeData.aTextureCoord;\n\n /**\n * The WebGL state the filter requires to render\n * @member {PIXI.State}\n */\n this.state = new State();\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * Used for caching shader IDs\n *\n * @static\n * @type {object}\n * @protected\n */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n public mapCoord: Matrix;\n public clampOffset: number;\n public clampMargin: number;\n readonly uClampFrame: Float32Array;\n readonly uClampOffset: Float32Array;\n _textureID: number;\n _updateID: number;\n _texture: Texture;\n isSimple: boolean;\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport { Matrix, Point } from '@pixi/math';\nimport { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n maskMatrix: Matrix;\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n constructor(sprite: IMaskTarget)\n {\n const maskMatrix = new Matrix();\n\n super(vertex, fragment);\n\n sprite.renderable = false;\n\n /**\n * Sprite mask\n * @member {PIXI.Sprite}\n */\n this.maskSprite = sprite;\n\n /**\n * Mask matrix\n * @member {PIXI.Matrix}\n */\n this.maskMatrix = maskMatrix;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this.maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { System } from '../System';\nimport { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class MaskSystem extends System\n{\n public enableScissor: boolean;\n protected readonly alphaMaskPool: Array;\n protected alphaMaskIndex: number;\n private readonly maskDataPool: Array;\n private maskStack: Array;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Enable scissor\n * @member {boolean}\n * @readonly\n */\n this.enableScissor = false;\n\n /**\n * Pool of used sprite mask filters\n * @member {PIXI.SpriteMaskFilter[]}\n * @readonly\n */\n this.alphaMaskPool = [];\n\n /**\n * Pool of mask data\n * @member {PIXI.MaskData[]}\n * @readonly\n */\n this.maskDataPool = [];\n\n this.maskStack = [];\n\n /**\n * Current index of alpha mask pool\n * @member {number}\n * @default 0\n * @readonly\n */\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData|IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]);\n maskData._target = target;\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.maskStack.push(maskData);\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.maskStack.push(maskData);\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n this.maskStack.push(maskData);\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n * Renderer batch must be flushed beforehand.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask();\n break;\n default:\n break;\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject\n * @param {PIXI.MaskData} maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n\n return;\n }\n maskData.type = MASK_TYPES.STENCIL;\n // detect scissor in graphics\n if (this.enableScissor\n && maskObject.isFastRect\n && maskObject.isFastRect())\n {\n const matrix = maskObject.worldTransform;\n\n // TODO: move the check to the matrix itself\n // we are checking that its orthogonal and x rotation is 0 90 180 or 270\n\n let rotX = Math.atan2(matrix.b, matrix.a);\n let rotXY = Math.atan2(matrix.d, matrix.c);\n\n // use the nearest degree to 0.01\n rotX = Math.round(rotX * (180 / Math.PI) * 100);\n rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX;\n\n rotX = ((rotX % 9000) + 9000) % 9000;\n rotXY = ((rotXY % 18000) + 18000) % 18000;\n\n if (rotX === 0 && rotXY === 9000)\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.MaskData} maskData - Sprite to be used as the mask\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n this.renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n */\n popSpriteMask(): void\n {\n this.renderer.filter.pop();\n this.alphaMaskIndex--;\n }\n}\n","import { System } from '../System';\n\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks of certain type\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class AbstractMaskSystem extends System\n{\n protected maskStack: Array;\n protected glConst: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * Constant for gl.enable\n * @member {number}\n * @private\n */\n this.glConst = 0;\n }\n\n /**\n * gets count of masks of certain type\n * @returns {number}\n */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /**\n * Destroys the mask stack.\n *\n */\n destroy(): void\n {\n super.destroy();\n\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage scissor rects (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n maskObject.renderable = true;\n\n const prevData = maskData._scissorRect;\n const bounds = maskObject.getBounds(true);\n const { gl } = this.renderer;\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n bounds.fit(prevData);\n }\n else\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = bounds;\n this._useCurrent();\n }\n\n /**\n * Pops scissor mask. MaskData is already removed from stack\n */\n pop(): void\n {\n const { gl } = this.renderer;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n const rt = this.renderer.renderTexture.current;\n const { transform, sourceFrame, destinationFrame } = this.renderer.projection;\n const resolution = rt ? rt.resolution : this.renderer.resolution;\n let x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x;\n let y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y;\n const width = rect.width * resolution;\n const height = rect.height * resolution;\n\n if (transform)\n {\n x += transform.tx * resolution;\n y += transform.ty * resolution;\n }\n if (!rt)\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - height - y;\n }\n\n this.renderer.gl.scissor(x, y, width, height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param {PIXI.MaskData} maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n * @private\n * @return {number} The bitwise mask.\n */\n _getBitwiseMask(): number\n {\n return (1 << this.getStackLength()) - 1;\n }\n}\n","import { System } from '../System';\nimport { Matrix } from '@pixi/math';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\n\nexport class ProjectionSystem extends System\n{\n public destinationFrame: Rectangle;\n public sourceFrame: Rectangle;\n public defaultFrame: Rectangle;\n public projectionMatrix: Matrix;\n public transform: Matrix;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = null;\n\n /**\n * Default destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.defaultFrame = null;\n\n /**\n * Project matrix\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * A transform that will be appended to the projection matrix\n * if null, nothing will be applied\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle).\n *\n * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this.\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {PIXI.Rectangle} destinationFrame - The destination frame.\n * @param {PIXI.Rectangle} sourceFrame - The source frame.\n * @param {Number} resolution - Resolution\n * @param {boolean} root - If is root\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n}\n","import { System } from '../System';\nimport { Rectangle } from '@pixi/math';\nimport { BUFFER_BITS } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n// Temporary rectangle for passing the framebuffer viewport\nconst viewportFrame = new Rectangle();\n\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class RenderTextureSystem extends System\n{\n public clearColor: number[];\n public defaultMaskStack: Array;\n public current: RenderTexture;\n public readonly sourceFrame: Rectangle;\n public readonly destinationFrame: Rectangle;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * The clear background color as rgba\n * @member {number[]}\n */\n this.clearColor = renderer._backgroundColorRgba;\n\n // TODO move this property somewhere else!\n /**\n * List of masks for the StencilSystem\n * @member {PIXI.Graphics[]}\n * @readonly\n */\n this.defaultMaskStack = [];\n\n // empty render texture?\n /**\n * Render texture\n * @member {PIXI.RenderTexture}\n * @readonly\n */\n this.current = null;\n\n /**\n * Source frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.sourceFrame = new Rectangle();\n\n /**\n * Destination frame\n * @member {PIXI.Rectangle}\n * @readonly\n */\n this.destinationFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture\n *\n * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen\n * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture\n * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n * @return {PIXI.Renderer} Returns itself.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /**\n * Resets renderTexture state\n */\n reset(): void\n {\n this.bind(null);\n }\n}\n","import type { Dict } from '@pixi/utils';\n\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nexport class GLProgram\n{\n public program: WebGLProgram;\n public uniformData: Dict;\n public uniformGroups: Dict;\n /**\n * Makes a new Pixi program\n *\n * @param program {WebGLProgram} webgl program\n * @param uniformData {Object} uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n }\n\n /**\n * Destroys this program\n */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.program = null;\n }\n}\n","import { System } from '../System';\nimport { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported, defaultValue, compileProgram } from './utils';\n\nimport type { IGLUniformData } from './GLProgram';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n// defualt sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class ShaderSystem extends System\n{\n protected gl: IRenderingContext;\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n private cache: Dict;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n /**\n * Cache to holds the generated functions. Stored against UniformObjects unique signature\n * @type {Object}\n * @private\n */\n this.cache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms.\n * @returns {PIXI.GLProgram} the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param {object} uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n *\n * syncs uniforms on the group\n * @param {*} group - the uniform group to sync\n * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getglProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id])\n {\n glProgram.uniformGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static\n * syncUnforms instead.\n *\n * @private\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n /* eslint-enable @typescript-eslint/explicit-module-boundary-types */\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData);\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param {PIXI.UniformGroup} group - the uniform group to get signature of\n * @param {Object} uniformData - uniform information generated by the shader\n * @returns {String} Unique signature of the uniform group\n * @private\n */\n private getSignature(group: UniformGroup, uniformData: Dict): string\n {\n const uniforms = group.uniforms;\n\n const strings = [];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context\n */\n getglProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @private\n * @param {PIXI.Shader} shader - the shader that the glProgram will be based on.\n * @return {PIXI.GLProgram} A shiny new glProgram!\n */\n generateShader(shader: Shader): GLProgram\n {\n const gl = this.gl;\n\n const program = shader.program;\n\n const attribMap: Dict = {};\n\n for (const i in program.attributeData)\n {\n attribMap[i] = program.attributeData[i].location;\n }\n\n const shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap);\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(shaderProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(shaderProgram, uniformData);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /**\n * Resets ShaderSystem state, does not affect WebGL state\n */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Destroys this System and removes all its textures\n */\n destroy(): void\n {\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { System } from '../System';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class StateSystem extends System\n{\n public stateId: number;\n public polygonOffset: number;\n public blendMode: BLEND_MODES;\n protected _blendEq: boolean;\n protected gl: IRenderingContext;\n protected blendModes: number[][];\n protected readonly map: Array<(value: boolean) => void>;\n protected readonly checks: Array<(system: this, state: State) => void>;\n protected defaultState: State;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n this.gl = null;\n\n /**\n * State ID\n * @member {number}\n * @readonly\n */\n this.stateId = 0;\n\n /**\n * Polygon offset\n * @member {number}\n * @readonly\n */\n this.polygonOffset = 0;\n\n /**\n * Blend mode\n * @member {number}\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n this.blendMode = BLEND_MODES.NONE;\n\n /**\n * Whether current blend equation is different\n * @member {boolean}\n * @protected\n */\n this._blendEq = false;\n\n /**\n * Collection of calls\n * @member {function[]}\n * @readonly\n */\n this.map = [];\n\n // map functions for when we set state..\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n\n /**\n * Collection of check calls\n * @member {function[]}\n * @readonly\n */\n this.checks = [];\n\n /**\n * Default WebGL State\n * @member {PIXI.State}\n * @readonly\n */\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown\n *\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Enables or disable polygon offset fill\n *\n * @param {boolean} value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * checks to see which updates should be checked based on which settings have been activated.\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param {Function} func - the checking function to add or remove\n * @param {boolean} value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @static\n * @private\n * @param {PIXI.StateSystem} System - the System to perform the state check on\n * @param {PIXI.State} state - the state that the blendMode will pulled from\n */\n static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { System } from '../System';\nimport { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture {\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI.systems\n * @extends PIXI.System\n */\nexport class TextureGCSystem extends System\n{\n public count: number;\n public checkCount: number;\n public maxIdle: number;\n public checkCountMax: number;\n public mode: number;\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n\n /**\n * Current garabage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n}\n","/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLTexture\n{\n public texture: WebGLTexture;\n public width: number;\n public height: number;\n public mipmap: boolean;\n public wrapMode: number;\n public type: number;\n public internalFormat: number;\n dirtyId: number;\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = 6408;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = 5121;\n }\n}\n","import { System } from '../System';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES } from '@pixi/constants';\n\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI.systems\n */\nexport class TextureSystem extends System\n{\n public boundTextures: BaseTexture[];\n public managedTextures: Array;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected webGLVersion: number;\n protected unknownTexture: BaseTexture;\n protected _unknownBoundTextures: boolean;\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n bind(texture: Texture|BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n if (texture)\n {\n texture = texture.castToBaseTexture();\n\n if (!texture || texture.parentTextureArray)\n {\n // cannot bind partial texture\n // TODO: report a warning\n return;\n }\n\n if (texture.valid)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = texture.format;\n glTexture.type = texture.type;\n if (this.webGLVersion !== 2)\n {\n return;\n }\n const gl = this.renderer.gl;\n\n if (texture.type === gl.FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA32F;\n }\n // that's WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n if (texture.type === TYPES.HALF_FLOAT)\n {\n glTexture.type = gl.HALF_FLOAT;\n }\n if (glTexture.type === gl.HALF_FLOAT\n && texture.format === gl.RGBA)\n {\n glTexture.internalFormat = gl.RGBA16F;\n }\n }\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture|Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n}\n","import { hex2string, hex2rgb, deprecation, EventEmitter } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { DisplayObject } from '@pixi/display';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Container } from '@pixi/display';\n\nconst tempMatrix = new Matrix();\n\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n width?: number;\n height?: number;\n view?: HTMLCanvasElement;\n transparent?: boolean | 'notMultiplied';\n autoDensity?: boolean;\n antialias?: boolean;\n resolution?: number;\n preserveDrawingBuffer?: boolean;\n clearBeforeRender?: boolean;\n backgroundColor?: number;\n powerPreference?: WebGLPowerPreference;\n context?: IRenderingContext;\n}\n\ninterface IRendererOptionsLegacy extends IRendererOptions\n{\n autoResize?: boolean;\n roundPixels?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly transparent: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: DisplayObject;\n\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n // Deprecation notice for renderer roundPixels option\n if ((options as IRendererOptionsLegacy).roundPixels)\n {\n settings.ROUND_PIXELS = (options as IRendererOptionsLegacy).roundPixels;\n deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2);\n }\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent.\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n this.autoDensity = options.autoDensity || (options as IRendererOptionsLegacy).autoResize || false;\n // autoResize is deprecated, provides fallback support\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas to the specified width and height.\n * Canvas dimensions are multiplied by resolution.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from.\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.RenderTexture} A texture of the graphics object.\n */\n generateTexture(displayObject: DisplayObject,\n scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture\n {\n region = region || (displayObject as Container).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width | 0,\n height: region.height | 0,\n scaleMode,\n resolution,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n }\n\n abstract render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\n\nimport type { IRendererOptions, IRendererPlugins } from './AbstractRenderer';\nimport type { RenderTexture } from './renderTexture/RenderTexture';\nimport type { DisplayObject } from '@pixi/display';\nimport type { System } from './System';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { Extract } from '@pixi/extract';\n\nexport interface IRendererPluginConstructor {\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin {\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class Renderer extends AbstractRenderer\n{\n public gl: IRenderingContext;\n public globalUniforms: UniformGroup;\n public CONTEXT_UID: number;\n public renderingToScreen: boolean;\n public extract: Extract;\n // systems\n public mask: MaskSystem;\n public context: ContextSystem;\n public state: StateSystem;\n public shader: ShaderSystem;\n public texture: TextureSystem;\n public geometry: GeometrySystem;\n public framebuffer: FramebufferSystem;\n public scissor: ScissorSystem;\n public stencil: StencilSystem;\n public projection: ProjectionSystem;\n public textureGC: TextureGCSystem;\n public filter: FilterSystem;\n public renderTexture: RenderTextureSystem;\n public batch: BatchSystem;\n\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @static\n * @private\n */\n static create(options: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n * @public\n */\n constructor(options? : IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n /**\n * WebGL context, set by the contextSystem (this.context)\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n // TODO legacy!\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name PIXI.Renderer#runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n /**\n * Global uniforms\n * @member {PIXI.UniformGroup}\n */\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n /**\n * Mask system instance\n * @member {PIXI.systems.MaskSystem} mask\n * @memberof PIXI.Renderer#\n * @readonly\n */\n this.addSystem(MaskSystem, 'mask')\n /**\n * Context system instance\n * @member {PIXI.systems.ContextSystem} context\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ContextSystem, 'context')\n /**\n * State system instance\n * @member {PIXI.systems.StateSystem} state\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StateSystem, 'state')\n /**\n * Shader system instance\n * @member {PIXI.systems.ShaderSystem} shader\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ShaderSystem, 'shader')\n /**\n * Texture system instance\n * @member {PIXI.systems.TextureSystem} texture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureSystem, 'texture')\n /**\n * Geometry system instance\n * @member {PIXI.systems.GeometrySystem} geometry\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(GeometrySystem, 'geometry')\n /**\n * Framebuffer system instance\n * @member {PIXI.systems.FramebufferSystem} framebuffer\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FramebufferSystem, 'framebuffer')\n /**\n * Scissor system instance\n * @member {PIXI.systems.ScissorSystem} scissor\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ScissorSystem, 'scissor')\n /**\n * Stencil system instance\n * @member {PIXI.systems.StencilSystem} stencil\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(StencilSystem, 'stencil')\n /**\n * Projection system instance\n * @member {PIXI.systems.ProjectionSystem} projection\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(ProjectionSystem, 'projection')\n /**\n * Texture garbage collector system instance\n * @member {PIXI.systems.TextureGCSystem} textureGC\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(TextureGCSystem, 'textureGC')\n /**\n * Filter system instance\n * @member {PIXI.systems.FilterSystem} filter\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(FilterSystem, 'filter')\n /**\n * RenderTexture system instance\n * @member {PIXI.systems.RenderTextureSystem} renderTexture\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(RenderTextureSystem, 'renderTexture')\n\n /**\n * Batch system instance\n * @member {PIXI.systems.BatchSystem} batch\n * @memberof PIXI.Renderer#\n * @readonly\n */\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n /**\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.transparent,\n antialias: options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Add a new system to the renderer.\n * @param {Function} ClassRef - Class reference\n * @param {string} [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return {PIXI.Renderer} Return instance of renderer\n */\n addSystem(ClassRef: { new(renderer: Renderer): T}, name: string): this\n {\n if (!name)\n {\n name = ClassRef.name;\n }\n\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered.\n * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to.\n * @param {boolean} [clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n resize(screenWidth: number, screenHeight: number): void\n {\n super.resize(screenWidth, screenHeight);\n\n this.runners.resize.emit(screenWidth, screenHeight);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.Renderer} Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /**\n * Clear the frame buffer\n */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.Renderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n */\n\n static __plugins: IRendererPlugins;\n /**\n * Adds a plugin to the renderer.\n *\n * @method\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n }\n}\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n /**\n * data for uniforms or custom webgl state\n * @member {object}\n */\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n public elements: BaseTexture[];\n public ids: number[];\n public count: number;\n\n constructor()\n {\n /**\n * inside textures array\n * @member {PIXI.BaseTexture[]}\n */\n this.elements = [];\n /**\n * Respective locations for textures\n * @member {number[]}\n */\n this.ids = [];\n /**\n * number of filled elements\n * @member {number}\n */\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides\n * typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n public rawBinaryData: ArrayBuffer;\n public uint32View: Uint32Array;\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n constructor(size: number)\n {\n /**\n * Underlying `ArrayBuffer` that holds all the data\n * and is of capacity `size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(size);\n\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n */\nexport interface IBatchableElement {\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @class\n * @protected\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public size: number;\n public MAX_TEXTURES: number;\n\n protected shaderGenerator: BatchShaderGenerator;\n protected geometryClass: typeof BatchGeometry;\n protected vertexSize: number;\n protected _vertexCount: number;\n protected _indexCount: number;\n protected _bufferedElements: Array;\n protected _bufferedTextures: Array;\n protected _bufferSize: number;\n protected _shader: Shader;\n protected _flushId: number;\n protected _aBuffers: Array;\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n private _packedGeometries: Array;\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n *\n * @member {PIXI.BatchShaderGenerator}\n * @protected\n */\n this.shaderGenerator = null;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n * @protected\n */\n this.geometryClass = null;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @member {number}\n * @readonly\n */\n this.vertexSize = null;\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @member {number}\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n\n /**\n * Total count of all vertices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._vertexCount = 0;\n\n /**\n * Total count of all indices used by the currently\n * buffered objects.\n *\n * @member {number}\n * @private\n */\n this._indexCount = 0;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n * @private\n */\n this._bufferedElements = [];\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @type {PIXI.BaseTexture[]}\n * @private\n */\n this._bufferedTextures = [];\n\n /**\n * Number of elements that are buffered and are\n * waiting to be flushed.\n *\n * @member {number}\n * @private\n */\n this._bufferSize = 0;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n *\n * @member {PIXI.Shader}\n * @protected\n */\n this._shader = null;\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @private\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n this._packedGeometries = [];\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n *\n * @member {number}\n * @private\n */\n this._packedGeometryPoolSize = 2;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n *\n * @member {number}\n * @private\n */\n this._flushId = 0;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n this._aBuffers = {} as any;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @private\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n this._iBuffers = {} as any;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @member {number}\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the\n * packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /**\n * Makes sure that static and dynamic flush pooled objects have correct dimensions\n */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry\n * object again.\n */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered\n * immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n * @param {number} start\n * @param {number} finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n *\n * @param {PIXI.BatchTextureArray} texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /**\n * Renders the content _now_ and empties the current batch.\n */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /**\n * Starts a new sprite batch.\n */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /**\n * Stops and flushes the current batch.\n */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Destroys this `AbstractBatchRenderer`. It cannot be used again.\n */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that\n * can hold atleast `size` floats.\n *\n * @param {number} size - minimum capacity required\n * @return {ViewableBuffer} - buffer than can hold atleast `size` floats\n * @private\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param {number} size - minimum required capacity\n * @return {Uint16Array} - buffer that can fit `size`\n * indices.\n * @private\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.Sprite} element - element being rendered\n * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer.\n * @param {Uint16Array} indexBuffer - index buffer\n * @param {number} aIndex - number of floats already in the attribute buffer\n * @param {number} iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @static\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n public vertexSrc: string;\n public fragTemplate: string;\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n /**\n * @param {string} vertexSrc - Vertex shader\n * @param {string} fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n /**\n * Reference to the vertex shader source.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc;\n\n /**\n * Reference to the fragement shader template. Must contain \"%count%\" and \"%forloop%\".\n *\n * @member {string}\n */\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @class\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n _buffer: Buffer;\n _indexBuffer: Buffer;\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n /**\n * Buffer used for position, color, texture IDs\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._buffer = new Buffer(null, _static, false);\n\n /**\n * Index buffer data\n *\n * @member {PIXI.Buffer}\n * @protected\n */\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/**\n * @class\n * @memberof PIXI\n * @hideconstructor\n */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @static\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @type {string}\n * @constant\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n","import { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer, IRendererOptionsAuto, AbstractRenderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IApplicationPlugin {\n init: (...params: any[]) => any;\n destroy: (...params: any[]) => any;\n}\n\nexport interface IApplicationOptions extends IRendererOptionsAuto {\n autoStart?: boolean;\n sharedTicker?: boolean;\n sharedLoader?: boolean;\n resizeTo?: Window | HTMLElement;\n resizeThrottle?: number;\n}\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport class Application\n{\n public static _plugins: IApplicationPlugin[];\n\n public stage: Container;\n public renderer: Renderer|AbstractRenderer;\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.transparent=false] - If the render view is transparent.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n constructor(options?: IApplicationOptions)\n {\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n // install plugins here\n Application._plugins.forEach((plugin) =>\n {\n plugin.init.call(this, options);\n });\n }\n\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.Application.Plugin} plugin - Plugin being installed\n */\n static registerPlugin(plugin: IApplicationPlugin): void\n {\n Application._plugins.push(plugin);\n }\n\n /**\n * Render the current stage.\n */\n public render(): void\n {\n // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject\n // This can be fixed when CanvasRenderer is converted.\n this.renderer.render(this.stage as any);\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view(): HTMLCanvasElement\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen(): Rectangle\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n public destroy(removeView?: boolean, stageOptions?: IDestroyOptions|boolean): void\n {\n // Destroy plugins in the opposite order\n // which they were constructed\n const plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach((plugin) =>\n {\n plugin.destroy.call(this);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n }\n}\n\n/**\n * @memberof PIXI.Application\n * @typedef {object} Plugin\n * @property {function} init - Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @property {function} destroy - Called when destroying Application, scoped to Application instance\n */\n\n/**\n * Collection of installed plugins.\n * @static\n * @private\n * @type {PIXI.Application.Plugin[]}\n */\nApplication._plugins = [];\n","import type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Renderer } from '@pixi/core';\nimport type { IApplicationOptions } from './Application';\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nexport class ResizePlugin\n{\n public static resizeTo: Window|HTMLElement;\n public static resize: () => void;\n public static renderer: Renderer|CanvasRenderer;\n public static queueResize: () => void;\n private static _resizeId: number;\n private static _resizeTo: Window|HTMLElement;\n private static cancelResize: () => void;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @type {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n Object.defineProperty(this, 'resizeTo',\n {\n set(dom: Window|HTMLElement)\n {\n window.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom)\n {\n window.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * Resize is throttled, so it's\n * safe to call this multiple times per frame and it'll\n * only be called once.\n * @method PIXI.Application#queueResize\n */\n this.queueResize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n this.cancelResize();\n\n // // Throttle resize events per raf\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n\n /**\n * Cancel the resize queue.\n * @method PIXI.Application#cancelResize\n * @private\n */\n this.cancelResize = (): void =>\n {\n if (this._resizeId)\n {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n * @method PIXI.Application#resize\n */\n this.resize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n // clear queue resize\n this.cancelResize();\n\n let width: number;\n let height: number;\n\n // Resize to the window\n if (this._resizeTo === window)\n {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n // Resize to other HTML entities\n else\n {\n const { clientWidth, clientHeight } = this._resizeTo as HTMLElement;\n\n width = clientWidth;\n height = clientHeight;\n }\n\n this.renderer.resize(width, height);\n };\n\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n\n /**\n * Clean up the ticker, scoped to application\n * @static\n * @private\n */\n static destroy(): void\n {\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n","import { Application } from './Application';\nimport { ResizePlugin } from './ResizePlugin';\n\nApplication.registerPlugin(ResizePlugin);\n\nexport * from './Application';\n","import { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { RenderTexture } from '@pixi/core';\n\nimport type { Renderer, IRendererPlugin } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\n\nconst TEMP_RECT = new Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nexport class Extract implements IRendererPlugin\n{\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.Extract} extract\n * @memberof PIXI.Renderer#\n * @see PIXI.Extract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n let canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n const target = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n\n target.context.scale(1, -1);\n\n // we can't render to itself because we should be empty before render.\n target.context.drawImage(canvasBuffer.canvas, 0, -height);\n\n canvasBuffer.destroy();\n canvasBuffer = target;\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target: DisplayObject|RenderTexture): Uint8Array\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data\n * @param out {number[] | Uint8Array | Uint8ClampedArray} output array\n */\n static arrayPostDivide(\n pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray\n ): void\n {\n for (let i = 0; i < pixels.length; i += 4)\n {\n const alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n }\n}\n","'use strict'\n\nfunction parseURI (str, opts) {\n if (!str) return undefined\n\n opts = opts || {}\n\n var o = {\n key: [\n 'source',\n 'protocol',\n 'authority',\n 'userInfo',\n 'user',\n 'password',\n 'host',\n 'port',\n 'relative',\n 'path',\n 'directory',\n 'file',\n 'query',\n 'anchor'\n ],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n\nmodule.exports = parseURI\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() { /* empty */ }\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @function eachSeries\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\nexport function eachSeries(array, iterator, callback, deferNext) {\n let i = 0;\n const len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(() => {\n iterator(array[i++], next);\n }, 1);\n }\n else {\n iterator(array[i++], next);\n }\n })();\n}\n\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @function queue\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\nexport function queue(worker, concurrency) {\n if (concurrency == null) { // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n }\n else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n let workers = 0;\n const q = {\n _tasks: [],\n concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push(data, callback) {\n _insert(data, false, callback);\n },\n kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift(data, callback) {\n _insert(data, true, callback);\n },\n process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n const task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length() {\n return q._tasks.length;\n },\n running() {\n return workers;\n },\n idle() {\n return q._tasks.length + workers === 0;\n },\n pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false;\n\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n },\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') { // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) { // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(() => q.drain(), 1);\n\n return;\n }\n\n const item = {\n data,\n callback: typeof callback === 'function' ? callback : _noop,\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n }\n else {\n q._tasks.push(item);\n }\n\n setTimeout(() => q.process(), 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) { // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= (q.concurrency - q.buffer)) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n","// a simple in-memory cache for resources\nconst cache = {};\n\n/**\n * A simple in-memory cache for resource.\n *\n * @memberof middleware\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function caching(resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(() => (cache[this.url] = this.data));\n }\n\n next();\n}\n","import parseUri from 'parse-uri';\nimport Signal from 'mini-signals';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nconst useXdr = !!(window.XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\nlet tempAnchor = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop() { /* empty */ }\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\nclass Resource {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n }\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n constructor(name, url, options) {\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.url = url;\n\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.extension = this._getExtension();\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n this.timeout = options.timeout || 0;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n this.metadata = options.metadata || {};\n\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n this.error = null;\n\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n this.children = [];\n\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n this.type = Resource.TYPE.UNKNOWN;\n\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n this.progressChunk = 0;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._dequeue = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._onLoadBinding = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n this._elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n get isDataUrl() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n get isComplete() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n get isLoading() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n\n /**\n * Marks the resource as complete.\n *\n */\n complete() {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr) {\n this.xhr.abort();\n }\n else if (this.xdr) {\n this.xdr.abort();\n }\n else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n }\n // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb) {\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n }\n else {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n _setFlag(flag, value) {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /**\n * Finalizes the load.\n *\n * @private\n */\n _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n }\n else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url)) {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i) {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n }\n\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n _createSource(type, url, mime) {\n if (!mime) {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n _onError(event) {\n this.abort(`Failed to load element using: ${event.target.nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n _onTimeout() {\n this.abort(`Load timed out.`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnError() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnTimeout() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n _xhrOnAbort() {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n _xhrOnLoad() {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n }\n catch (e) {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n }\n else {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n const protocol = url.protocol ? `${url.protocol}:` : '';\n\n // if cross origin\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n _getExtension() {\n let url = this.url;\n let ext = '';\n\n if (this.isDataUrl) {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: (1 << 0),\n COMPLETE: (1 << 1),\n LOADING: (1 << 2),\n};\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6,\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4,\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n /** Blob */\n BLOB: 'blob',\n /** Document */\n DOCUMENT: 'document',\n /** Object */\n JSON: 'json',\n /** String */\n TEXT: 'text',\n};\n\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO,\n};\n\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n};\n\n// We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\nexport { Resource };\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input) {\n let output = '';\n let inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { Resource } from '../Resource';\nimport { encodeBinary } from '../encodeBinary';\n\nconst Url = window.URL || window.webkitURL;\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @memberof middleware\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param {Resource} resource - Current Resource\n * @param {function} next - Callback when complete\n */\nexport function parsing(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () => {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () => {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import Signal from 'mini-signals';\nimport parseUri from 'parse-uri';\nimport * as async from './async';\nimport { Resource } from './Resource';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\nclass Loader {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10) {\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n this.loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n this.defaultQueryString = '';\n\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n this._resourcesParsing = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n this.resources = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new Signal();\n\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n this.onError = new Signal();\n\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n this.onLoad = new Signal();\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new Signal();\n\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new Signal();\n\n // Add default before middleware\n for (let i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n }\n\n // Add default after middleware\n for (let i = 0; i < Loader._defaultAfterMiddleware.length; ++i) {\n this.use(Loader._defaultAfterMiddleware[i]);\n }\n }\n\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @function\n * @variation 1\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 2\n * @param {string} name - The name of the resource to load.\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 3\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 4\n * @param {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 5\n * @param {IAddOptions} options - The options for the load. This object must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n *//**\n * @function\n * @variation 6\n * @param {Array} resources - An array of resources to load, where each is\n * either an object with the options or a string url. If you pass an object, it must contain a `url` property.\n * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (let i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading) {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i) {\n if (!parent.children[i].isComplete) {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i) {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources) {\n const res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n this._onComplete();\n }\n else {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n get concurrency() {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n set concurrency(concurrency) {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n _prepareUrl(url) {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n ) {\n result = `${this.baseUrl}/${url}`;\n }\n else {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString) {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += `&${this.defaultQueryString}`;\n }\n else {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n _loadResource(resource, dequeue) {\n resource._dequeue = dequeue;\n\n // run before middleware\n async.eachSeries(\n this._beforeMiddleware,\n (fn, next) => {\n fn.call(this, resource, () => {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () => {\n if (resource.isComplete) {\n this._onLoad(resource);\n }\n else {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /**\n * Called once loading has started.\n *\n * @private\n */\n _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n _onLoad(resource) {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n async.eachSeries(\n this._afterMiddleware,\n (fn, next) => {\n fn.call(this, resource, next);\n },\n () => {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error) {\n this.onError.dispatch(resource.error, this, resource);\n }\n else {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0) {\n this._onComplete();\n }\n },\n true\n );\n }\n}\n\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultBeforeMiddleware = [];\n\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultAfterMiddleware = [];\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n\nexport { Loader };\n\n","import { Resource } from 'resource-loader';\n\nimport type { Spritesheet } from '@pixi/spritesheet';\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, Resource.IMetadata {\n imageMetadata?: any;\n}\nexport interface ILoaderResource extends GlobalMixins.ILoaderResource, Resource\n{\n texture?: Texture;\n spritesheet?: Spritesheet;\n\n // required for Spritesheet\n textures?: Dict;\n\n // required specific type for Spritesheet\n metadata: IResourceMetadata;\n}\n\n// Mix constructor and typeof Resource , otherwise we can't access to statics field\ntype TLoaderResource = { new(...args: any[]): ILoaderResource } & typeof Resource;\n\n/**\n* Reference to **{@link https://github.com/englercj/resource-loader\n* resource-loader}**'s Resource class.\n* @see http://englercj.github.io/resource-loader/Resource.html\n* @class LoaderResource\n* @memberof PIXI\n*/\nexport const LoaderResource: TLoaderResource = Resource;\n","import { Resource } from 'resource-loader';\nimport { Texture } from '@pixi/core';\n\nimport type { ILoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class TextureLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n public static use(resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n }\n}\n","import { Loader as ResourceLoader, middleware } from 'resource-loader';\nimport { TextureLoader } from './TextureLoader';\n\nimport type { Resource } from 'resource-loader';\n\n/**\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class Loader\n * @memberof PIXI\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\nexport class Loader extends ResourceLoader\n{\n /**\n * Collection of all installed `use` middleware for Loader.\n *\n * @static\n * @member {Array} _plugins\n * @memberof PIXI.Loader\n * @private\n */\n private static _plugins: Array = [];\n private static _shared: Loader;\n private _protected: boolean;\n\n constructor(baseUrl?: string, concurrency?: number)\n {\n super(baseUrl, concurrency);\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n /**\n * If this loader cannot be destroyed.\n * @member {boolean}\n * @default false\n * @private\n */\n this._protected = false;\n }\n\n /**\n * Destroy the loader, removes references.\n * @memberof PIXI.Loader#\n * @method destroy\n * @public\n */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @type {PIXI.Loader}\n * @static\n * @memberof PIXI.Loader\n */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @static\n * @method registerPlugin\n * @memberof PIXI.Loader\n * @param {PIXI.ILoaderPlugin} plugin - The plugin to add\n * @return {PIXI.Loader} Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n }\n}\n\n// parse any blob into more usable objects (e.g. Image)\nLoader.registerPlugin({ use: middleware.parsing });\n\n// parse any Image objects into textures\nLoader.registerPlugin(TextureLoader);\n\nexport interface ILoaderPlugin {\n add?(): void;\n pre?(resource: Resource, next?: (...args: any[]) => void): void;\n use?(resource: Resource, next?: (...args: any[]) => void): void;\n}\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @memberof PIXI\n * @typedef {object} ILoaderPlugin\n * @property {function} [add] - Function to call immediate after registering plugin.\n * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {object} ICallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalCallback\n * @param {function} callback - Callback function\n * @param {object} [context] - Context\n * @returns {ICallbackID} - CallbackID\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef {function} ISignalDetach\n * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods\n */\n\n/**\n * @memberof PIXI.Loader\n * @typedef ILoaderSignal\n * @property {ISignalCallback} add - Register callback\n * @property {ISignalCallback} once - Register oneshot callback\n * @property {ISignalDetach} detach - Detach specific callback by ID\n */\n\n/**\n * @memberof PIXI.Loader\n * @callback loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when the loader begins to loading process.\n * @member {PIXI.Loader.ILoaderSignal} onStart\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded or errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onProgress\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per errored resource.\n * @member {PIXI.Loader.ILoaderSignal} onError\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched once per loaded resource.\n * @member {PIXI.Loader.ILoaderSignal} onLoad\n */\n\n/**\n * @memberof PIXI.Loader#\n * @description Dispatched when completely loaded all resources.\n * @member {PIXI.Loader.ILoaderSignal} onComplete\n */\n","import { Loader } from './Loader';\n\nimport type { IApplicationOptions } from '@pixi/app';\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n public static loader: Loader;\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n static init(options?: IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","/**\n * Supported line joints in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator\n *\n * @name LINE_JOIN\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet\n * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn\n * @property {string} ROUND - 'round': add an arc at the joint\n */\nexport enum LINE_JOIN {\n MITER = 'miter',\n BEVEL = 'bevel',\n ROUND = 'round'\n}\n\n/**\n * Support line caps in `PIXI.LineStyle` for graphics.\n *\n * @see PIXI.Graphics#lineStyle\n *\n * @name LINE_CAP\n * @memberof PIXI\n * @static\n * @enum {string}\n * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges)\n * @property {string} ROUND - 'round': add semicircle at ends\n * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end)\n */\nexport enum LINE_CAP {\n BUTT = 'butt',\n ROUND = 'round',\n SQUARE = 'square'\n}\n\nexport interface IGraphicsCurvesSettings {\n adaptive: boolean;\n maxLength: number;\n minSegments: number;\n maxSegments: number;\n\n epsilon: number;\n\n _segmentsCount(length: number, defaultSegments?: number): number;\n}\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name GRAPHICS_CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nexport const GRAPHICS_CURVES: IGraphicsCurvesSettings = {\n adaptive: true,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n\n epsilon: 0.0001,\n\n _segmentsCount(length: number, defaultSegments = 20)\n {\n if (!this.adaptive || !length || isNaN(length))\n {\n return defaultSegments;\n }\n\n let result = Math.ceil(length / this.maxLength);\n\n if (result < this.minSegments)\n {\n result = this.minSegments;\n }\n else if (result > this.maxSegments)\n {\n result = this.maxSegments;\n }\n\n return result;\n },\n};\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { hex2rgb } from '@pixi/utils';\n\nimport type { BaseTexture, Renderer } from '@pixi/core';\nimport type { ParticleBuffer } from './ParticleBuffer';\nimport type { IDestroyOptions } from '@pixi/display';\n\nexport interface IParticleProperties {\n vertices?: boolean;\n position?: boolean;\n rotation?: boolean;\n uvs?: boolean;\n tint?: boolean;\n alpha?: boolean;\n scale?: boolean;\n}\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles.\n *\n * The tradeoff of the ParticleContainer is that most advanced functionality will not work.\n * ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n *\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use:\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = PIXI.Sprite.from(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class ParticleContainer extends Container\n{\n public readonly blendMode: BLEND_MODES;\n public autoResize: boolean;\n public roundPixels: boolean;\n public baseTexture: BaseTexture;\n public tintRgb: Float32Array;\n\n _maxSize: number;\n _buffers: ParticleBuffer[];\n _batchSize: number;\n _properties: boolean[];\n _bufferUpdateIDs: number[];\n _updateID: number;\n private _tint: number;\n\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] - If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n constructor(maxSize = 1500, properties: IParticleProperties, batchSize = 16384, autoResize = false)\n {\n super();\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n const maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {Array}\n * @private\n */\n this._buffers = null;\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * Default to true here as performance is usually the priority for particles.\n *\n * @member {boolean}\n * @default true\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n public setProperties(properties: IParticleProperties): void\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform(): void\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n }\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.Renderer} renderer - The webgl renderer\n */\n public render(renderer: Renderer): void\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = (this.children[0] as any)._texture.baseTexture;\n if (!this.baseTexture.valid)\n {\n this.baseTexture.once('update', () => this.onChildrenChange(0));\n }\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n }\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n protected onChildrenChange(smallestChildIndex: number): void\n {\n const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n }\n\n public dispose(): void\n {\n if (this._buffers)\n {\n for (let i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n\n this._buffers = null;\n }\n }\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.dispose();\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n }\n}\n","import { createIndicesForQuads } from '@pixi/utils';\nimport { Geometry, Buffer } from '@pixi/core';\nimport { TYPES } from '@pixi/constants';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { IParticleRendererProperty } from './ParticleRenderer';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class ParticleBuffer\n{\n public geometry: Geometry;\n public staticStride: number;\n public staticBuffer: Buffer;\n public staticData: Float32Array;\n public staticDataUint32: Uint32Array;\n public dynamicStride: number;\n public dynamicBuffer: Buffer;\n public dynamicData: Float32Array;\n public dynamicDataUint32: Uint32Array;\n public _updateID: number;\n\n indexBuffer: Buffer;\n private size: number;\n private dynamicProperties: IParticleRendererProperty[];\n private staticProperties: IParticleRendererProperty[];\n\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(properties: IParticleRendererProperty[], dynamicPropertyFlags: boolean[], size: number)\n {\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n private initBuffers(): void\n {\n const geometry = this.geometry;\n\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.dynamicBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.staticBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n }\n\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n destroy(): void\n {\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { ObjectRenderer, Shader, State } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { ParticleBuffer } from './ParticleBuffer';\nimport fragment from './particles.frag';\nimport vertex from './particles.vert';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { ParticleContainer } from './ParticleContainer';\nimport type { Renderer } from '@pixi/core';\n\nexport interface IParticleRendererProperty {\n attributeName: string;\n size: number;\n type?: TYPES;\n uploadFunction: (...params: any[]) => any;\n offset: number;\n}\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nexport class ParticleRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public shader: Shader;\n public tempMatrix: Matrix;\n public properties: IParticleRendererProperty[];\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n\n this.shader = Shader.from(vertex, fragment, {});\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n public render(container: ParticleContainer): void\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n const baseTexture = (children[0] as any)._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n private generateBuffers(container: ParticleContainer): ParticleBuffer[]\n {\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n private _generateOneMoreBuffer(container: ParticleContainer): ParticleBuffer\n {\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadVertices(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadPosition(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadRotation(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadUvs(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = (children[startIndex + i] as any)._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadTint(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n const alpha = sprite.alpha;\n\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied\n ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n */\n public destroy(): void\n {\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n }\n}\n","import { Texture } from '@pixi/core';\nimport type { Matrix } from '@pixi/math';\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform aplpied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n public matrix: Matrix = null;\n\n /**\n * If the current fill is visible.\n *\n * @member {boolean}\n * @default false\n */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /**\n * Reset\n */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /**\n * Destroy and don't use after this\n */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n","import { earcut } from '@pixi/utils';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Polygon } from '@pixi/math';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n","// for type only\nimport { SHAPES } from '@pixi/math';\n\nimport type { Circle, Ellipse } from '@pixi/math';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildCircle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape as Circle;\n const points = graphicsData.points;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n const ellipseData = graphicsData.shape as Ellipse;\n\n width = ellipseData.width;\n height = ellipseData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n let totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n\n totalSegs /= 2.3;\n\n const seg = (Math.PI * 2) / totalSegs;\n\n for (let i = 0; i < totalSegs - 0.5; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(points[0], points[1]);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n let vertPos = verts.length / 2;\n const center = vertPos;\n\n const circle = (graphicsData.shape) as Circle;\n const matrix = graphicsData.matrix;\n const x = circle.x;\n const y = circle.y;\n\n // Push center (special point)\n verts.push(\n graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x,\n graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n\n for (let i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n","import type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n","import { earcut } from '@pixi/utils';\n\n// for type only\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { RoundedRectangle } from '@pixi/math';\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1: number, n2: number, perc: number): number\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number,\n out: Array = []): Array\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n const rrectData = graphicsData.shape as RoundedRectangle;\n const points = graphicsData.points;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n // Don't allow negative radius or greater than half the smallest width\n const radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n\n points.length = 0;\n\n // No radius, do a simple rectangle\n if (!radius)\n {\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n }\n else\n {\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n }\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n const vecPos = verts.length / 2;\n\n const triangles = earcut(points, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = points.length; i < j; i++)\n {\n verts.push(points[i], points[++i]);\n }\n },\n};\n","import { Point, SHAPES } from '@pixi/math';\n\nimport type { Polygon } from '@pixi/math';\nimport type { GraphicsData } from '../GraphicsData';\nimport type { GraphicsGeometry } from '../GraphicsGeometry';\nimport { LINE_JOIN, LINE_CAP } from '../const';\nimport { GRAPHICS_CURVES } from '../const';\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(\n x: number,\n y: number,\n nx: number,\n ny: number,\n innerWeight: number,\n outerWeight: number,\n clockwise: boolean, /* rotation for square (true at left end, false at right end) */\n verts: Array\n): number\n{\n const ix = x - (nx * innerWeight);\n const iy = y - (ny * innerWeight);\n const ox = x + (nx * outerWeight);\n const oy = y + (ny * outerWeight);\n\n /* Rotate nx,ny for extension vector */\n let exx; let\n eyy;\n\n if (clockwise)\n {\n exx = ny;\n eyy = -nx;\n }\n else\n {\n exx = -ny;\n eyy = nx;\n }\n\n /* [i|0]x,y extended at cap */\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n\n return 2;\n}\n\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(\n cx: number,\n cy: number,\n sx: number,\n sy: number,\n ex: number,\n ey: number,\n verts: Array,\n clockwise: boolean, /* if not cap, then clockwise is turn of joint, otherwise rotation from angle0 to angle1 */\n): number\n{\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n\n if (clockwise && angle0 < angle1)\n {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1)\n {\n angle1 += Math.PI * 2;\n }\n\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n\n const radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n const segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n const angleInc = angleDiff / segCount;\n\n startAngle += angleInc;\n\n if (clockwise)\n {\n verts.push(cx, cy);\n verts.push(sx, sy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n }\n\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else\n {\n verts.push(sx, sy);\n verts.push(cx, cy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n\n return segCount * 2;\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n const shape = graphicsData.shape as Polygon;\n let points = graphicsData.points || shape.points.slice();\n const eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n const style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = graphicsGeometry.points;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n\n // Max. inner and outer width\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n\n /* Line segments of interest where (x1,y1) forms the corner. */\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n let perpx = -(y0 - y1);\n let perpy = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = style.alignment;// 0.5;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x0 - (perpx * (innerWeight - outerWeight) * 0.5),\n y0 - (perpy * (innerWeight - outerWeight) * 0.5),\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight),\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight),\n verts,\n true,\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n\n // Push first point (below & above vertices)\n verts.push(\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight));\n verts.push(\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight));\n\n for (let i = 1; i < length - 1; ++i)\n {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n\n /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n const cross = (dy0 * dx1) - (dy1 * dx0);\n const clockwise = (cross < 0);\n\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1)\n {\n verts.push(\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight));\n verts.push(\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight));\n\n continue;\n }\n\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n const c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n const c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n const px = ((dx0 * c2) - (dx1 * c1)) / cross;\n const py = ((dy1 * c1) - (dy0 * c2)) / cross;\n const pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n\n /* Inner miter point */\n const imx = x1 + ((px - x1) * innerWeight);\n const imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n const omx = x1 - ((px - x1) * outerWeight);\n const omy = y1 - ((py - y1) * outerWeight);\n\n /* Is the inside miter point too far away, creating a spike? */\n const smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n const insideMiterOk = pdist <= smallerInsideDiagonalSq;\n\n if (insideMiterOk)\n {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n if (clockwise) /* rotating at inner angle */\n {\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));// first segment's outer vertex\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));// second segment's outer vertex\n }\n else /* rotating at outer angle */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));// first segment's inner vertex\n verts.push(omx, omy);// outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));// second segment's outer vertex\n verts.push(omx, omy);// outer miter point\n }\n\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 4;\n\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 4;\n\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else\n {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n // Nothing needed\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 2;\n }\n else /* arc is inside */\n {\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 2;\n }\n }\n else\n {\n if (clockwise)\n {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else\n {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x1 - (perpx * (innerWeight - outerWeight) * 0.5),\n y1 - (perpy * (innerWeight - outerWeight) * 0.5),\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight),\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight),\n verts,\n false\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n\n const indices = graphicsGeometry.indices;\n const eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n\n // indices.push(indexStart);\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i)\n {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2)\n {\n continue;\n }\n\n indices.push(i, i + 1, i + 2);\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n let i = 0;\n\n const shape = graphicsData.shape as Polygon;\n const points = graphicsData.points || shape.points;\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) return;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n const length = points.length / 2;\n\n const startIndex = verts.length / 2;\n let currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nexport function buildLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n","import { Polygon, PI_2 } from '@pixi/math';\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * @class\n * @extends PIXI.Polygon\n * @memberof PIXI.graphicsUtils\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\nexport class Star extends Polygon\n{\n constructor(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0)\n {\n innerRadius = innerRadius || radius / 2;\n\n const startAngle = (-1 * Math.PI / 2) + rotation;\n const len = points * 2;\n const delta = PI_2 / len;\n const polygon = [];\n\n for (let i = 0; i < len; i++)\n {\n const r = i % 2 ? innerRadius : radius;\n const angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n super(polygon);\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\nimport { PI_2 } from '@pixi/math';\n\ninterface IArcLikeShape {\n cx: number;\n cy: number;\n radius: number;\n startAngle: number;\n endAngle: number;\n anticlockwise: boolean;\n}\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nexport class ArcUtils\n{\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array): IArcLikeShape\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius,\n startAngle,\n endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n }\n\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n static arc(_startX: number, _startY: number, cx: number, cy: number, radius: number,\n startAngle: number, endAngle: number, _anticlockwise: boolean, points: Array): void\n {\n const sweep = endAngle - startAngle;\n const n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n const theta = (sweep) / (n * 2);\n const theta2 = theta * 2;\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n const segMinus = n - 1;\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n const angle = ((theta) + startAngle + (theta2 * real));\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n }\n /* eslint-enable max-len */\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n","import type { LineStyle } from '../styles/LineStyle';\nimport type { FillStyle } from '../styles/FillStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n","/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\nimport { buildPoly } from './buildPoly';\nexport { buildPoly };\n\nimport { buildCircle } from './buildCircle';\nexport { buildCircle };\n\nimport { buildRectangle } from './buildRectangle';\nexport { buildRectangle };\n\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\nexport { buildRoundedRectangle };\n\nexport * from './buildLine';\nexport * from './Star';\nexport * from './ArcUtils';\nexport * from './BezierUtils';\nexport * from './QuadraticUtils';\nexport * from './BatchPart';\n\n// for type only\nimport { BatchPart } from './BatchPart';\nimport { SHAPES } from '@pixi/math';\nimport { BatchDrawCall } from '@pixi/core';\nimport { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nexport const BATCH_POOL: Array = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array = [];\n","import type { Matrix, SHAPES, IShape } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n shape: IShape;\n lineStyle: LineStyle;\n fillStyle: FillStyle;\n matrix: Matrix;\n type: SHAPES;\n points: number[];\n holes: Array;\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n\n /**\n * The collection of points.\n * @member {number[]}\n */\n this.points = [];\n\n /**\n * The collection of holes.\n * @member {PIXI.GraphicsData[]}\n */\n this.holes = [];\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /**\n * Destroys the Graphics data.\n *\n */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n","import {\n buildLine,\n buildPoly,\n BatchPart,\n FILL_COMMANDS,\n BATCH_POOL,\n DRAW_CALL_POOL,\n} from './utils';\n\nimport {\n BatchGeometry,\n BatchDrawCall,\n BatchTextureArray,\n BaseTexture,\n Texture,\n} from '@pixi/core';\n\nimport { DRAW_MODES, WRAP_MODES } from '@pixi/constants';\nimport { SHAPES, Point, Matrix } from '@pixi/math';\nimport { GraphicsData } from './GraphicsData';\nimport { premultiplyTint } from '@pixi/utils';\nimport { Bounds } from '@pixi/display';\n\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * @description Complex shape type\n * @todo Move to Math shapes\n */\ntype IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nconst tmpPoint = new Point();\nconst tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nexport class GraphicsGeometry extends BatchGeometry\n{\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n *\n * @memberof PIXI.GraphicsGeometry\n * @static\n * @member {number} BATCHABLE_SIZE\n * @default 100\n */\n public static BATCHABLE_SIZE = 100;\n\n public closePointEps: number;\n public boundsPadding: number;\n\n uvsFloat32: Float32Array = null;\n indicesUint16: Uint16Array | Uint32Array = null;\n batchable: boolean;\n points: Array;\n colors: Array;\n uvs: Array;\n indices: Array;\n textureIds: Array;\n graphicsData: Array;\n drawCalls: Array;\n batchDirty: number;\n batches: Array;\n\n protected dirty: number;\n protected cacheDirty: number;\n protected clearDirty: number;\n protected shapeIndex: number;\n protected _bounds: Bounds;\n protected boundsDirty: number;\n\n constructor()\n {\n super();\n\n /**\n * An array of points to draw, 2 numbers per point\n *\n * @member {number[]}\n * @protected\n */\n this.points = [];\n\n /**\n * The collection of colors\n *\n * @member {number[]}\n * @protected\n */\n this.colors = [];\n\n /**\n * The UVs collection\n *\n * @member {number[]}\n * @protected\n */\n this.uvs = [];\n\n /**\n * The indices of the vertices\n *\n * @member {number[]}\n * @protected\n */\n this.indices = [];\n\n /**\n * Reference to the texture IDs.\n *\n * @member {number[]}\n * @protected\n */\n this.textureIds = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n * @protected\n */\n this.graphicsData = [];\n\n /**\n * Used to detect if the graphics object has changed.\n *\n * @member {number}\n * @protected\n */\n this.dirty = 0;\n\n /**\n * Batches need to regenerated if the geometry is updated.\n *\n * @member {number}\n * @protected\n */\n this.batchDirty = -1;\n\n /**\n * Used to check if the cache is dirty.\n *\n * @member {number}\n * @protected\n */\n this.cacheDirty = -1;\n\n /**\n * Used to detect if we cleared the graphicsData.\n *\n * @member {number}\n * @default 0\n * @protected\n */\n this.clearDirty = 0;\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {object[]}\n * @protected\n */\n this.drawCalls = [];\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n * @protected\n */\n this.batches = [];\n\n /**\n * Index of the last batched shape in the stack of calls.\n *\n * @member {number}\n * @protected\n */\n this.shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._bounds = new Bounds();\n\n /**\n * The bounds dirty flag.\n *\n * @member {number}\n * @protected\n */\n this.boundsDirty = -1;\n\n /**\n * Padding to add to the bounds.\n *\n * @member {number}\n * @default 0\n */\n this.boundsPadding = 0;\n\n this.batchable = false;\n\n this.indicesUint16 = null;\n\n this.uvsFloat32 = null;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n *\n * @member {number}\n */\n this.closePointEps = 1e-4;\n }\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n public get bounds(): Bounds\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n }\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n protected invalidate(): void\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batchPart = this.batches[i];\n\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n\n this.batches.length = 0;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n public clear(): GraphicsGeometry\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawShape(\n shape: IShape,\n fillStyle: FillStyle = null,\n lineStyle: LineStyle = null,\n matrix: Matrix = null): GraphicsGeometry\n {\n const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawHole(shape: IShape, matrix: Matrix = null): GraphicsGeometry\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n const data = new GraphicsData(shape, null, null, matrix);\n\n const lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n public destroy(): void\n {\n super.destroy();\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n }\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n public containsPoint(point: IPointData): boolean\n {\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n let hitHole = false;\n\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices\n */\n updateBatches(allow32Indices?: boolean): void\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n const uvs = this.uvs;\n const graphicsData = this.graphicsData;\n\n let batchPart: BatchPart = null;\n\n let currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (let i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n const data = graphicsData[i];\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n const command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (let j = 0; j < 2; j++)\n {\n const style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) continue;\n\n const nextTexture = style.texture.baseTexture;\n const index = this.indices.length;\n const attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n const size = (this.points.length / 2) - attribIndex;\n\n if (size === 0) continue;\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n\n const index = this.indices.length;\n const attrib = this.points.length / 2;\n\n if (batchPart)\n {\n batchPart.end(index, attrib);\n }\n\n if (this.batches.length === 0)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length)\n {\n this.indicesUint16.set(this.indices);\n }\n else\n {\n const need32\n = attrib > 0xffff && allow32Indices;\n\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n }\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n protected _compareStyles(styleA: FillStyle | LineStyle, styleB: FillStyle | LineStyle): boolean\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!(styleA as LineStyle).native !== !!(styleB as LineStyle).native)\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n protected validateBatching(): boolean\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (let i = 0, l = this.graphicsData.length; i < l; i++)\n {\n const data = this.graphicsData[i];\n const fill = data.fillStyle;\n const line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) return false;\n if (line && !line.texture.baseTexture.valid) return false;\n }\n\n return true;\n }\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n protected packBatches(): void\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n const batches = this.batches;\n\n for (let i = 0, l = batches.length; i < l; i++)\n {\n const batch = batches[i];\n\n for (let j = 0; j < batch.size; j++)\n {\n const index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n }\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n protected isBatchable(): boolean\n {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2)\n {\n return false;\n }\n\n const batches = this.batches;\n\n for (let i = 0; i < batches.length; i++)\n {\n if ((batches[i].style as LineStyle).native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n }\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n protected buildDrawCalls(): void\n {\n let TICK = ++BaseTexture._globalBatch;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n let currentGroup: BatchDrawCall = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n let textureCount = 0;\n let currentTexture = null;\n let textureId = 0;\n let native = false;\n let drawMode = DRAW_MODES.TRIANGLES;\n\n let index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (let i = 0; i < this.batches.length; i++)\n {\n const data = this.batches[i];\n\n // TODO add some full on MAX_TEXTURE CODE..\n const MAX_TEXTURES = 8;\n\n // Forced cast for checking `native` without errors\n const style = data.style as LineStyle;\n\n const nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1;// touch;\n\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = 10497;\n\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize);\n this.addTextureIds(textureIds, textureId, data.attribSize);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n }\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n protected packAttributes(): void\n {\n const verts = this.points;\n const uvs = this.uvs;\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n const glPoints = new ArrayBuffer(verts.length * 3 * 4);\n const f32 = new Float32Array(glPoints);\n const u32 = new Uint32Array(glPoints);\n\n let p = 0;\n\n for (let i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n }\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processFill(data: GraphicsData): void\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n const command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n }\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processLine(data: GraphicsData): void\n {\n buildLine(data, this);\n\n for (let i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n }\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n protected processHoles(holes: Array): void\n {\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n const command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n }\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n protected calculateBounds(): void\n {\n const bounds = this._bounds;\n const sequenceBounds = tmpBounds;\n let curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const shape = data.shape;\n const type = data.type;\n const lineStyle = data.lineStyle;\n const nextMatrix = data.matrix || Matrix.IDENTITY;\n let lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n const alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment));\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n const rect = shape as Rectangle | RoundedRectangle;\n\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n const circle = shape as Circle;\n\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y,\n circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n const ellipse = shape as Ellipse;\n\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y,\n ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else\n {\n const poly = shape as Polygon;\n // adding directly to the bounds\n\n bounds.addVerticesMatrix(curMatrix, (poly.points as any), 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n }\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n protected transformPoints(points: Array, matrix: Matrix): void\n {\n for (let i = 0; i < points.length / 2; i++)\n {\n const x = points[(i * 2)];\n const y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n }\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n */\n protected addColors(colors: Array, color: number, alpha: number, size: number): void\n {\n // TODO use the premultiply bits Ivan added\n const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n const rgba = premultiplyTint(rgb, alpha);\n\n while (size-- > 0)\n {\n colors.push(rgba);\n }\n }\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n */\n protected addTextureIds(textureIds: Array, id: number, size: number): void\n {\n while (size-- > 0)\n {\n textureIds.push(id);\n }\n }\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n protected addUvs(\n verts: Array,\n uvs: Array,\n texture: Texture,\n start: number, size:\n number, matrix:\n Matrix = null): void\n {\n let index = 0;\n const uvsStart = uvs.length;\n const frame = texture.frame;\n\n while (index < size)\n {\n let x = verts[(start + index) * 2];\n let y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n const nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n const baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n }\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n protected adjustUvs(uvs: Array, texture: Texture, start: number, size: number): void\n {\n const baseTexture = texture.baseTexture;\n const eps = 1e-6;\n const finish = start + (size * 2);\n const frame = texture.frame;\n const scaleX = frame.width / baseTexture.width;\n const scaleY = frame.height / baseTexture.height;\n let offsetX = frame.x / frame.width;\n let offsetY = frame.y / frame.height;\n let minX = Math.floor(uvs[start] + eps);\n let minY = Math.floor(uvs[start + 1] + eps);\n\n for (let i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (let i = start; i < finish; i += 2)\n {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n }\n}\n","import { FillStyle } from './FillStyle';\nimport { LINE_JOIN, LINE_CAP } from '../const';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nexport class LineStyle extends FillStyle\n{\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n public width = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n public alignment = 0.5;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n * @default false\n */\n public native = false;\n\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /**\n * Miter limit.\n *\n * @member {number}\n * @default 10\n */\n public miterLimit = 10;\n\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /**\n * Reset the line style to default.\n */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n }\n}\n","import {\n Circle,\n Ellipse,\n PI_2,\n Point,\n Polygon,\n Rectangle,\n RoundedRectangle,\n Matrix,\n SHAPES,\n} from '@pixi/math';\n\nimport { Texture, UniformGroup, State, Renderer, BatchDrawCall } from '@pixi/core';\nimport { BezierUtils, QuadraticUtils, ArcUtils, Star } from './utils';\nimport { hex2rgb, deprecation } from '@pixi/utils';\nimport { GraphicsGeometry } from './GraphicsGeometry';\nimport { FillStyle } from './styles/FillStyle';\nimport { LineStyle } from './styles/LineStyle';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { Shader } from '@pixi/core';\n\nimport type { IShape, IPointData } from '@pixi/math';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { LINE_JOIN, LINE_CAP } from './const';\n\n/**\n * Batch element computed from Graphics geometry\n */\nexport interface IGraphicsBatchElement {\n vertexData: Float32Array;\n blendMode: BLEND_MODES;\n indices: Uint16Array | Uint32Array;\n uvs: Float32Array;\n alpha: number;\n worldAlpha: number;\n _batchRGB: number[];\n _tintRGB: number;\n _texture: Texture;\n}\n\nexport interface IFillStyleOptions {\n color?: number;\n alpha?: number;\n texture?: Texture;\n matrix?: Matrix;\n}\n\nexport interface ILineStyleOptions extends IFillStyleOptions {\n width?: number;\n alignment?: number;\n native?: boolean;\n cap?: LINE_CAP;\n join?: LINE_JOIN;\n miterLimit?: number;\n}\n\nconst temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nconst DEFAULT_SHADERS: {[key: string]: Shader} = {};\n\nexport interface Graphics extends GlobalMixins.Graphics, Container {}\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * Note that because Graphics can share a GraphicsGeometry with other instances,\n * it is necessary to call `destroy()` to properly dereference the underlying\n * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same\n * Graphics instance and call `clear()` between redraws.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Graphics extends Container\n{\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n * @member {PIXI.Point}\n */\n\n static _TEMP_POINT = new Point();\n\n public shader: Shader;\n public pluginName: string;\n\n protected currentPath: Polygon;\n protected batches: Array;\n protected batchTint: number;\n protected batchDirty: number;\n protected vertexData: Float32Array;\n\n protected _fillStyle: FillStyle;\n protected _lineStyle: LineStyle;\n protected _matrix: Matrix;\n protected _holeMode: boolean;\n protected _transformID: number;\n protected _tint: number;\n\n private state: State;\n private _geometry: GraphicsGeometry;\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n public get geometry(): GraphicsGeometry\n {\n return this._geometry;\n }\n\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n constructor(geometry: GraphicsGeometry = null)\n {\n super();\n\n this._geometry = geometry || new GraphicsGeometry();\n this._geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n this.state = State.for2d();\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n * @protected\n */\n this._fillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n * @protected\n */\n this._lineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n * @protected\n */\n this._matrix = null;\n\n /**\n * Current hole mode is enabled.\n *\n * @member {boolean}\n * @default false\n * @protected\n */\n this._holeMode = false;\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @protected\n */\n this.currentPath = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @protected\n * @member {object[]}\n */\n this.batches = [];\n\n /**\n * Update dirty for limiting calculating tints for batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchTint = -1;\n\n /**\n * Update dirty for limiting calculating batches.\n *\n * @protected\n * @member {number}\n * @default -1\n */\n this.batchDirty = -1;\n\n /**\n * Copy of the object vertex data.\n *\n * @protected\n * @member {Float32Array}\n */\n this.vertexData = null;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n this._transformID = -1;\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n public clone(): Graphics\n {\n this.finishPoly();\n\n return new Graphics(this._geometry);\n }\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n public set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n public get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * The tint applied to the graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n this._tint = value;\n }\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n public get fill(): FillStyle\n {\n return this._fillStyle;\n }\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n public get line(): LineStyle\n {\n return this._lineStyle;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @method PIXI.Graphics#lineStyle\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(options: ILineStyleOptions = null): this\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n // eslint-disable-next-line\n const args = arguments;\n\n options = {\n width: args[0] || 0,\n color: args[1] || 0x0,\n alpha: args[2] !== undefined ? args[2] : 1,\n alignment: args[3] !== undefined ? args[3] : 0.5,\n native: !!args[4],\n };\n }\n\n return this.lineTextureStyle(options);\n }\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTextureStyle(options: ILineStyleOptions): this\n {\n // backward compatibility with params: (width, texture,\n // color, alpha, matrix, alignment, native)\n if (typeof options === 'number')\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle');\n\n // eslint-disable-next-line\n const [width, texture, color, alpha, matrix, alignment, native] = arguments as any;\n\n options = { width, texture, color, alpha, matrix, alignment, native };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Start a polygon object internally\n * @protected\n */\n protected startPoly(): void\n {\n if (this.currentPath)\n {\n const points = this.currentPath.points;\n const len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n }\n\n /**\n * Finish the polygon object.\n * @protected\n */\n finishPoly(): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public moveTo(x: number, y: number): this\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTo(x: number, y: number): this\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n const points = this.currentPath.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n }\n\n /**\n * Initialize the curve\n *\n * @protected\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n protected _initCurve(x = 0, y = 0): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n const points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this\n {\n this._initCurve(x1, y1);\n\n const points = this.currentPath.points;\n\n const result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n const { cx, cy, radius, startAngle, endAngle, anticlockwise } = result;\n\n this.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise = false): this\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n const eps = this._geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tessellation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public beginFill(color = 0, alpha = 1): this\n {\n return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });\n }\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginTextureFill(options: IFillStyleOptions): this\n {\n // backward compatibility with params: (texture, color, alpha, matrix)\n if (options instanceof Texture)\n {\n deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill');\n\n // eslint-disable-next-line\n const [texture, color, alpha, matrix] = arguments as any;\n\n options = { texture, color, alpha, matrix };\n\n // Remove undefined keys\n Object.keys(options).forEach((key) => (options as any)[key] === undefined && delete (options as any)[key]);\n }\n\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options) as IFillStyleOptions;\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public endFill(): this\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n }\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRect(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n }\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawCircle(x: number, y: number, radius: number): this\n {\n return this.drawShape(new Circle(x, y, radius));\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawEllipse(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n }\n\n public drawPolygon(...path: Array | Array): this\n public drawPolygon(path: Array | Array | Polygon): this\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawPolygon(...path: any[]): this\n {\n let points: Array | Array;\n let closeStroke = true;// !!this._fillStyle;\n\n const poly = path[0] as Polygon;\n\n // check if data has points..\n if (poly.points)\n {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else\n if (Array.isArray(path[0]))\n {\n points = path[0];\n }\n else\n {\n points = path;\n }\n\n const shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawShape(shape: IShape): this\n {\n if (!this._holeMode)\n {\n this._geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this._geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n }\n\n /**\n * Draw a star shape with an arbitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation = 0): this\n {\n return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation) as Polygon);\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public clear(): this\n {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n public isFastRect(): boolean\n {\n const data = this._geometry.graphicsData;\n\n return data.length === 1\n && data[0].shape.type === SHAPES.RECT\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n const hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n\n geometry.updateBatches(hasuint32);\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n }\n\n /**\n * Populating batches for rendering\n *\n * @protected\n */\n protected _populateBatches(): void\n {\n const geometry = this._geometry;\n const blendMode = this.blendMode;\n const len = geometry.batches.length;\n\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (let i = 0; i < len; i++)\n {\n const gI = geometry.batches[i];\n const color = gI.style.color;\n const vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n const batch = {\n vertexData,\n blendMode,\n indices,\n uvs,\n _batchRGB: hex2rgb(color) as Array,\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n }\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderBatched(renderer: Renderer): void\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (let i = 0, l = this.batches.length; i < l; i++)\n {\n const batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n }\n\n /**\n * Renders the graphics direct\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderDirect(renderer: Renderer): void\n {\n const shader = this._resolveDirectShader(renderer);\n\n const geometry = this._geometry;\n const tint = this.tint;\n const worldAlpha = this.worldAlpha;\n const uniforms = shader.uniforms;\n const drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (let i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n }\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void\n {\n const { texArray, type, size, start } = drawCall;\n const groupTextureCount = texArray.count;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(texArray.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n }\n\n /**\n * Resolves shader for direct rendering\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _resolveDirectShader(renderer: Renderer): Shader\n {\n let shader = this.shader;\n\n const pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n const MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n const sampleValues = new Int32Array(MAX_TEXTURES);\n\n for (let i = 0; i < MAX_TEXTURES; i++)\n {\n sampleValues[i] = i;\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n const program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n }\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n }\n\n /**\n * Recalcuate the tint by applying tin to batches using Graphics tint.\n * @protected\n */\n protected calculateTints(): void\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n const tintRGB = hex2rgb(this.tint, temp);\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batch = this.batches[i];\n\n const batchTint = batch._batchRGB;\n\n const r = (tintRGB[0] * batchTint[0]) * 255;\n const g = (tintRGB[1] * batchTint[1]) * 255;\n const b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n const color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n }\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recaculate the vertices.\n * @protected\n */\n protected calculateVertices(): void\n {\n const wtID = this.transform._worldID;\n\n if (this._transformID === wtID)\n {\n return;\n }\n\n this._transformID = wtID;\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const data = this._geometry.points;// batch.vertexDataOriginal;\n const vertexData = this.vertexData;\n\n let count = 0;\n\n for (let i = 0; i < data.length; i += 2)\n {\n const x = data[i];\n const y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n public closePath(): this\n {\n const currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n }\n\n return this;\n }\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n public setMatrix(matrix: Matrix): this\n {\n this._matrix = matrix;\n\n return this;\n }\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n public beginHole(): this\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n }\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n public endHole(): this\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n super.destroy(options);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource|Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n public pluginName: string;\n\n _width: number;\n _height: number;\n _texture: Texture;\n _textureID: number;\n _cachedTint: number;\n protected _textureTrimmedID: number;\n protected uvs: Float32Array;\n protected _anchor: ObservablePoint;\n protected vertexData: Float32Array;\n\n private vertexTrimmedData: Float32Array;\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n private _tint: number;\n\n // Internal-only properties\n _tintRGB: number;\n\n /**\n * @param {PIXI.Texture} [texture] - The texture for this sprite.\n */\n constructor(texture: Texture)\n {\n super();\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `texture.defaultAnchor`\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 16777215\n */\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @member {number}\n * @default 0xFFFFFF\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * this is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices()\n *\n * @private\n * @member {Float32Array}\n */\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = 'batch';\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} [rect] - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Sprite} The newly created sprite\n */\n static from(source: SpriteSource, options: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n *\n * @member {PIXI.ObservablePoint}\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport enum TEXT_GRADIENT {\n LINEAR_VERTICAL = 0,\n LINEAR_HORIZONTAL = 1\n}\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from './const';\nimport { hex2string } from '@pixi/utils';\n\nexport type TextStyleAlign = 'left'|'center'|'right';\nexport type TextStyleFill = string|string[]|number|number[]|CanvasGradient|CanvasPattern;\nexport type TextStyleFontStyle = 'normal'|'italic'|'oblique';\nexport type TextStyleFontVariant = 'normal'|'small-caps';\nexport type TextStyleFontWeight = 'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900';\nexport type TextStyleLineJoin = 'miter'|'round'|'bevel';\nexport type TextStyleTextBaseline = 'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom';\nexport type TextStyleWhiteSpace = 'normal'|'pre'|'pre-line';\n\nexport interface ITextStyle {\n align: TextStyleAlign;\n breakWords: boolean;\n dropShadow: boolean;\n dropShadowAlpha: number;\n dropShadowAngle: number;\n dropShadowBlur: number;\n dropShadowColor: string|number;\n dropShadowDistance: number;\n fill: TextStyleFill;\n fillGradientType: TEXT_GRADIENT;\n fillGradientStops: number[];\n fontFamily: string | string[];\n fontSize: number | string;\n fontStyle: TextStyleFontStyle;\n fontVariant: TextStyleFontVariant;\n fontWeight: TextStyleFontWeight;\n letterSpacing: number;\n lineHeight: number;\n lineJoin: TextStyleLineJoin;\n miterLimit: number;\n padding: number;\n stroke: string|number;\n strokeThickness: number;\n textBaseline: TextStyleTextBaseline;\n trim: boolean;\n whiteSpace: TextStyleWhiteSpace;\n wordWrap: boolean;\n wordWrapWidth: number;\n leading: number;\n}\n\nconst defaultStyle: ITextStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nexport class TextStyle implements ITextStyle\n{\n public styleID: number;\n\n protected _align: TextStyleAlign;\n protected _breakWords: boolean;\n protected _dropShadow: boolean;\n protected _dropShadowAlpha: number;\n protected _dropShadowAngle: number;\n protected _dropShadowBlur: number;\n protected _dropShadowColor: string|number;\n protected _dropShadowDistance: number;\n protected _fill: TextStyleFill;\n protected _fillGradientType: TEXT_GRADIENT;\n protected _fillGradientStops: number[];\n protected _fontFamily: string|string[];\n protected _fontSize: number|string;\n protected _fontStyle: TextStyleFontStyle;\n protected _fontVariant: TextStyleFontVariant;\n protected _fontWeight: TextStyleFontWeight;\n protected _letterSpacing: number;\n protected _lineHeight: number;\n protected _lineJoin: TextStyleLineJoin;\n protected _miterLimit: number;\n protected _padding: number;\n protected _stroke: string|number;\n protected _strokeThickness: number;\n protected _textBaseline: TextStyleTextBaseline;\n protected _trim: boolean;\n protected _whiteSpace: TextStyleWhiteSpace;\n protected _wordWrap: boolean;\n protected _wordWrapWidth: number;\n protected _leading: number;\n\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style: Partial)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n const clonedProperties: Partial = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n public reset(): void\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align(): TextStyleAlign\n {\n return this._align;\n }\n set align(align: TextStyleAlign)\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get breakWords(): boolean\n {\n return this._breakWords;\n }\n set breakWords(breakWords: boolean)\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get dropShadow(): boolean\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow: boolean)\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get dropShadowAlpha(): number\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha: number)\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get dropShadowAngle(): number\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle: number)\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get dropShadowBlur(): number\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur: number)\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get dropShadowColor(): number | string\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor: number | string)\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get dropShadowDistance(): number\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance: number)\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill(): TextStyleFill\n {\n return this._fill;\n }\n set fill(fill: TextStyleFill)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n const outputColor = getColor(fill as any);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get fillGradientType(): TEXT_GRADIENT\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType: TEXT_GRADIENT)\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get fillGradientStops(): number[]\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops: number[])\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get fontFamily(): string | string[]\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily: string | string[])\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get fontSize(): number | string\n {\n return this._fontSize;\n }\n set fontSize(fontSize: number | string)\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle(): TextStyleFontStyle\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle: TextStyleFontStyle)\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant(): TextStyleFontVariant\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant: TextStyleFontVariant)\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight(): TextStyleFontWeight\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight: TextStyleFontWeight)\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing: number)\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get lineHeight(): number\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight: number)\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /**\n * The space between lines\n *\n * @member {number}\n */\n get leading(): number\n {\n return this._leading;\n }\n set leading(leading: number)\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin(): TextStyleLineJoin\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin: TextStyleLineJoin)\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get miterLimit(): number\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit: number)\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get padding(): number\n {\n return this._padding;\n }\n set padding(padding: number)\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get stroke(): string | number\n {\n return this._stroke;\n }\n set stroke(stroke: string | number)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get strokeThickness(): number\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness: number)\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline(): TextStyleTextBaseline\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline: TextStyleTextBaseline)\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get trim(): boolean\n {\n return this._trim;\n }\n set trim(trim: boolean)\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace(): TextStyleWhiteSpace\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace: TextStyleWhiteSpace)\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get wordWrap(): boolean\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap: boolean)\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get wordWrapWidth(): number\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth: number)\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n public toFontString(): string\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies: string|string[] = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n (fontFamilies as string[])[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${(fontFamilies as string[]).join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {string|number} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color: string|number): string\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if (typeof color === 'string')\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {string|number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color: (string|number)[]): string[];\nfunction getColor(color: string|number): string;\nfunction getColor(color: string|number|(string|number)[]): string|string[]\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color as string[];\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 - First array to compare\n * @param {Array} array2 - Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1: T[], array2: T[]): boolean\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target - Target object to copy properties into\n * @param {Object} source - Source object for the properties to copy\n * @param {string} propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target: Record, source: Record, propertyObj: Record): void {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import { TextStyle, TextStyleWhiteSpace } from './TextStyle';\n\ninterface IFontMetrics {\n ascent: number;\n descent: number;\n fontSize: number;\n}\n\ntype CharacterWidthCache = { [key: string]: number };\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberof PIXI\n */\nexport class TextMetrics\n{\n public text: string;\n public style: TextStyle;\n public width: number;\n public height: number;\n public lines: string[];\n public lineWidths: number[];\n public lineHeight: number;\n public maxLineWidth: number;\n public fontProperties: IFontMetrics;\n\n public static METRICS_STRING: string;\n public static BASELINE_SYMBOL: string;\n public static BASELINE_MULTIPLIER: number;\n\n // TODO: These should be protected but they're initialized outside of the class.\n public static _canvas: HTMLCanvasElement|OffscreenCanvas;\n public static _context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D;\n public static _fonts: { [font: string]: IFontMetrics };\n public static _newlines: number[];\n public static _breakingSpaces: number[];\n\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[],\n lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics)\n {\n /**\n * The text that was measured\n *\n * @member {string}\n */\n this.text = text;\n\n /**\n * The style that was measured\n *\n * @member {PIXI.TextStyle}\n */\n this.style = style;\n\n /**\n * The measured width of the text\n *\n * @member {number}\n */\n this.width = width;\n\n /**\n * The measured height of the text\n *\n * @member {number}\n */\n this.height = height;\n\n /**\n * An array of lines of the text broken by new lines and wrapping is specified in style\n *\n * @member {string[]}\n */\n this.lines = lines;\n\n /**\n * An array of the line widths for each line matched to `lines`\n *\n * @member {number[]}\n */\n this.lineWidths = lineWidths;\n\n /**\n * The measured line height for this style\n *\n * @member {number}\n */\n this.lineHeight = lineHeight;\n\n /**\n * The maximum line width for all measured lines\n *\n * @member {number}\n */\n this.maxLineWidth = maxLineWidth;\n\n /**\n * The font properties object from TextMetrics.measureFont\n *\n * @member {PIXI.IFontMetrics}\n */\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n public static measureText(text: string, style: TextStyle, wordWrap: boolean, canvas = TextMetrics._canvas): TextMetrics\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize as number;\n fontProperties.ascent = style.fontSize as number;\n }\n\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n private static wordWrap(text: string, style: TextStyle, canvas = TextMetrics._canvas): string\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache: CharacterWidthCache = Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = TextMetrics.wordWrapSplit(token);\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n private static addLine(line: string, newLine = true): string\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key - The key\n * @param {number} letterSpacing - The letter spacing\n * @param {object} cache - The cache\n * @param {CanvasRenderingContext2D} context - The canvas context\n * @return {number} The from cache.\n */\n private static getFromCache(key: string, letterSpacing: number, cache: CharacterWidthCache,\n context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D): number\n {\n let width = cache[key];\n\n if (typeof width !== 'number')\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace - The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n private static collapseSpaces(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace - The white space\n * @return {boolean} should collapse\n */\n private static collapseNewlines(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text - The text\n * @return {string} trimmed string\n */\n private static trimRight(text: string): string\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if newline, False otherwise.\n */\n private static isNewline(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char - The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n private static isBreakingSpace(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text - The text\n * @return {string[]} A tokenized array\n */\n private static tokenize(text: string): string[]\n {\n const tokens: string[] = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param {string} token - The token\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakWords(_token: string, breakWords: boolean): boolean\n {\n return breakWords;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param {string} char - The character\n * @param {string} nextChar - The next character\n * @param {string} token - The token/word the characters are from\n * @param {number} index - The index in the token of the char\n * @param {boolean} breakWords - The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number,\n _breakWords: boolean): boolean\n {\n return true;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param {string} token - The token to split\n * @return {string[]} The characters of the token\n */\n static wordWrapSplit(token: string): string[]\n {\n return token.split('');\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.IFontMetrics} Font properties object\n */\n public static measureFont(font: string): IFontMetrics\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties: IFontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n public static clearMetrics(font = ''): void\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nconst canvas = ((): HTMLCanvasElement|OffscreenCanvas =>\n{\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext('2d');\n\n if (context && context.measureText)\n {\n return c;\n }\n\n return document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n","/* eslint max-depth: [2, 8] */\nimport { Sprite } from '@pixi/sprite';\nimport { Texture } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { Rectangle } from '@pixi/math';\nimport { sign, trimCanvas, hex2rgb, string2hex } from '@pixi/utils';\nimport { TEXT_GRADIENT } from './const';\nimport { TextStyle } from './TextStyle';\nimport { TextMetrics } from './TextMetrics';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Renderer } from '@pixi/core';\nimport type { ITextStyle } from './TextStyle';\n\nconst defaultDestroyOptions: IDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text.\n *\n * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).\n *\n * The primary advantage of this class over BitmapText is that you have great control over the style of the next,\n * which you can change at runtime.\n *\n * The primary disadvantages is that each piece of text has it's own texture, which can use more memory.\n * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time.\n *\n * To split a line you can use '\\n' in your text string, or, on the `style` object,\n * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class Text extends Sprite\n{\n public canvas: HTMLCanvasElement;\n public context: CanvasRenderingContext2D;\n public localStyleID: number;\n public dirty: boolean;\n\n _resolution: number;\n _autoResolution: boolean;\n protected _text: string;\n protected _font: string;\n protected _style: TextStyle;\n protected _styleListener: () => void;\n private _ownCanvas: boolean;\n\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n constructor(text: string, style: Partial|TextStyle, canvas: HTMLCanvasElement)\n {\n let ownCanvas = false;\n\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n ownCanvas = true;\n }\n\n canvas.width = 3;\n canvas.height = 3;\n\n const texture = Texture.from(canvas);\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n super(texture);\n\n /**\n * Keep track if this Text object created it's own canvas\n * element (`true`) or uses the constructor argument (`false`).\n * Used to workaround a GC issues with Safari < 13 when\n * destroying Text. See `destroy` for more info.\n *\n * @member {boolean}\n * @private\n */\n this._ownCanvas = ownCanvas;\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n this._resolution = settings.RESOLUTION;\n this._autoResolution = true;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n /**\n * Renders text to its canvas, and updates its texture.\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n *\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n public updateText(respectDirty: boolean): void\n {\n const style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n const context = this.context;\n const measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas);\n const width = measured.width;\n const height = measured.height;\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution);\n\n context.scale(this._resolution, this._resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n let linePositionX: number;\n let linePositionY: number;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n const passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (let i = 0; i < passesCount; ++i)\n {\n const isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n const dsOffsetShadow = dsOffsetText * this._resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines, measured);\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n context.strokeStyle = style.stroke as string;\n\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n\n this.updateTexture();\n }\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n private drawLetterSpacing(text: string, x: number, y: number, isStroke = false): void\n {\n const style = this._style;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n let currentPosition = x;\n\n // Using Array.from correctly splits characters whilst keeping emoji together.\n // This is not supported on IE as it requires ES6, so regular text splitting occurs.\n // This also doesn't account for emoji that are multiple emoji put together to make something else.\n // Handling all of this would require a big library itself.\n // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516\n // https://github.com/orling/grapheme-splitter\n const stringArray = Array.from ? Array.from(text) : text.split('');\n let previousWidth = this.context.measureText(text).width;\n let currentWidth = 0;\n\n for (let i = 0; i < stringArray.length; ++i)\n {\n const currentChar = stringArray[i];\n\n if (isStroke)\n {\n this.context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n this.context.fillText(currentChar, currentPosition, y);\n }\n currentWidth = this.context.measureText(text.substring(i + 1)).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n private updateTexture(): void\n {\n const canvas = this.canvas;\n\n if (this._style.trim)\n {\n const trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n const texture = this._texture;\n const style = this._style;\n const padding = style.trim ? 0 : style.padding;\n const baseTexture = texture.baseTexture;\n\n texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution);\n texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution);\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.setRealSize(canvas.width, canvas.height, this._resolution);\n\n // Recursively updates transform of all objects from the root to this one\n this._recursivePostUpdateTransform();\n\n this.dirty = false;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super._render(renderer);\n }\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n this.updateText(true);\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n }\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n private _generateFillStyle(style: TextStyle, lines: string[], metrics: TextMetrics): string|CanvasGradient|CanvasPattern\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n }\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n super.destroy(options);\n\n // set canvas width and height to 0 to workaround memory leak in Safari < 13\n // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12\n if (this._ownCanvas)\n {\n this.canvas.height = this.canvas.width = 0;\n }\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n }\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n this.updateText(true);\n\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get style(): TextStyle|Partial\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle\n // since the setter creates the TextStyle. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n return this._style;\n }\n\n set style(style: TextStyle|Partial)\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n }\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get text(): string\n {\n return this._text;\n }\n\n set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The resolution / device pixel ratio of the canvas.\n * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.\n * @member {number}\n * @default 1\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._autoResolution = false;\n\n if (this._resolution === value)\n {\n return;\n }\n\n this._resolution = value;\n this.dirty = true;\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\nexport { settings };\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class CountLimiter\n{\n public maxItemsPerFrame: number;\n public itemsLeft: number;\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame: number)\n {\n /**\n * The maximum number of items that can be prepared each frame.\n * @type {number}\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return this.itemsLeft-- > 0;\n }\n}\n","import { Texture, BaseTexture } from '@pixi/core';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\nimport { CountLimiter } from './CountLimiter';\n\nimport type { AbstractRenderer } from '@pixi/core';\n\ninterface IArrowFunction {\n (): void;\n}\ninterface IUploadHook {\n (helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean;\n}\n\ninterface IFindHook {\n (item: any, queue: Array): boolean;\n}\n\nexport interface IDisplayObjectExtended extends DisplayObject {\n _textures?: Array;\n _texture?: Texture;\n style?: TextStyle;\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\n\nfunction findMultipleBaseTextures(item: IDisplayObjectExtended, queue: Array): boolean\n{\n let result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param {PIXI.Texture} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item: Texture, queue: Array): boolean\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n const texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item._texture && item._texture instanceof Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof TextStyle)\n {\n const font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item: TextStyle, queue: Array): boolean\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI\n */\nexport class BasePrepare\n{\n private limiter: CountLimiter;\n protected renderer: AbstractRenderer;\n protected uploadHookHelper: any;\n protected queue: Array;\n public addHooks: Array;\n public uploadHooks: Array;\n public completes: Array;\n public ticking: boolean;\n private delayedTick: IArrowFunction;\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer)\n {\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.AbstractRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {object}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = (): void =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item: IDisplayObjectExtended | IUploadHook | IFindHook | (() => void), done: () => void): void\n {\n if (typeof item === 'function')\n {\n done = item as () => void;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item as IDisplayObjectExtended | IUploadHook | IFindHook);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick(): void\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems(): void\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {this} Instance of plugin for chaining.\n */\n registerFindHook(addHook: IFindHook): this\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {this} Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook: IUploadHook): this\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {this} Instance of plugin for chaining.\n */\n add(item: IDisplayObjectExtended | IUploadHook | IFindHook): this\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy(): void\n {\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { BasePrepare, IDisplayObjectExtended } from './BasePrepare';\n\nimport type { AbstractRenderer, Renderer } from '@pixi/core';\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.BaseTexture} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])\n {\n (renderer as Renderer).texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.Renderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n const { geometry } = item;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n const { batches } = geometry;\n\n // upload all textures found in styles\n for (let i = 0; i < batches.length; i++)\n {\n const { texture } = batches[i].style;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n (renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class Prepare extends BasePrepare\n{\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n public maxMilliseconds: number;\n public frameStart: number;\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n constructor(maxMilliseconds: number)\n {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @type {number}\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame(): void\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { getResolutionOfUrl } from '@pixi/utils';\nimport type { Dict } from '@pixi/utils';\nimport type { resources } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n */\nexport interface ISpritesheetFrameData {\n frame: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n w: number;\n h: number;\n };\n spriteSourceSize?: {\n x: number;\n y: number;\n };\n anchor?: IPointData;\n}\n\n/**\n * Atlas format.\n */\nexport interface ISpritesheetData {\n frames: Dict;\n animations?: Dict;\n meta: {\n scale: string;\n };\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nexport class Spritesheet\n{\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n static readonly BATCH_SIZE = 1000;\n\n public baseTexture: BaseTexture;\n public textures: Dict;\n public animations: Dict;\n public data: ISpritesheetData;\n public resolution: number;\n\n private _texture: Texture;\n private _frames: Dict;\n private _frameKeys: string[];\n private _batchIndex: number;\n private _callback: (textures: Dict) => void;\n\n /**\n * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(texture: BaseTexture | Texture, data: ISpritesheetData, resolutionFilename: string = null)\n {\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n * @type {PIXI.Texture}\n * @private\n */\n this._texture = texture instanceof Texture ? texture : null;\n\n /**\n * Reference to ths source texture.\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n const resource = this.baseTexture.resource as resources.ImageResource;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n private _updateResolution(resolutionFilename: string = null): number\n {\n const { scale } = this.data.meta;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n public parse(callback: () => void): void\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n private _processFrames(initialFrameIndex: number): void\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /**\n * Parse animations config\n *\n * @private\n */\n private _processAnimations(): void\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++)\n {\n const frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /**\n * The parse has completed.\n *\n * @private\n */\n private _parseComplete(): void\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n private _nextBatch(): void\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n public destroy(destroyBase = false): void\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this._texture?.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n }\n}\n","import { url } from '@pixi/utils';\nimport { Spritesheet } from './Spritesheet';\nimport { LoaderResource } from '@pixi/loaders';\nimport type { Loader, ILoaderResource } from '@pixi/loaders';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class SpritesheetLoader\n{\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(resource: ILoaderResource, next: (...args: unknown[]) => void): void\n {\n // because this is middleware, it execute in loader context. `this` = loader\n const loader = (this as any) as Loader;\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res: ILoaderResource)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n }\n\n /**\n * Get the spritesheets root path\n * @param {PIXI.LoaderResource} resource - Resource to check path\n * @param {string} baseUrl - Base root url\n */\n static getResourcePath(resource: ILoaderResource, baseUrl: string): string\n {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n }\n}\n","import { Texture, TextureMatrix } from '@pixi/core';\nimport { Point, Rectangle, Transform } from '@pixi/math';\nimport { Sprite } from '@pixi/sprite';\nimport { deprecation } from '@pixi/utils';\nimport type { Renderer, IBaseTextureOptions, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPoint, IPointData, ISize, ObservablePoint } from '@pixi/math';\n\nconst tempPoint = new Point();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface TilingSprite extends GlobalMixins.TilingSprite {}\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class TilingSprite extends Sprite\n{\n public tileTransform: Transform;\n public uvMatrix: TextureMatrix;\n public uvRespectAnchor: boolean;\n\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n constructor(texture: Texture, width = 100, height = 100)\n {\n super(texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.Transform}\n */\n this.tileTransform = new Transform();\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = this.texture.uvMatrix || new TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get clampMargin(): number\n {\n return this.uvMatrix.clampMargin;\n }\n\n set clampMargin(value: number)\n {\n this.uvMatrix.clampMargin = value;\n this.uvMatrix.update(true);\n }\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tileScale(): ObservablePoint\n {\n return this.tileTransform.scale;\n }\n\n set tileScale(value: ObservablePoint)\n {\n this.tileTransform.scale.copyFrom(value as IPoint);\n }\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tilePosition(): ObservablePoint\n {\n return this.tileTransform.position;\n }\n\n set tilePosition(value: ObservablePoint)\n {\n this.tileTransform.position.copyFrom(value as IPoint);\n }\n\n /**\n * @protected\n */\n protected _onTextureUpdate(): void\n {\n if (this.uvMatrix)\n {\n this.uvMatrix.texture = this._texture;\n }\n this._cachedTint = 0xFFFFFF;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n // tweak our texture temporarily..\n const texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvMatrix.update();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n const minX = this._width * -this._anchor._x;\n const minY = this._height * -this._anchor._y;\n const maxX = this._width * (1 - this._anchor._x);\n const maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n public getLocalBounds(rect: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.IPointData} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._width;\n const height = this._height;\n const x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n const y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.tileTransform = null;\n this.uvMatrix = null;\n }\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {number} options.width - required width of the tiling sprite\n * @param {number} options.height - required height of the tiling sprite\n * @return {PIXI.TilingSprite} The newly created texture\n */\n static from(source: TextureSource, options: ISize & IBaseTextureOptions): TilingSprite\n {\n // Deprecated\n if (typeof options === 'number')\n {\n deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args');\n // eslint-disable-next-line prefer-rest-params\n options = { width: options, height: arguments[2] } as ISize;\n }\n\n return new TilingSprite(\n Texture.from(source, options),\n options.width,\n options.height\n );\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n }\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n }\n}\n","import { ObjectRenderer, Shader, State, QuadUv } from '@pixi/core';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\n\nimport vertex from './tilingSprite.vert';\nimport fragment from './tilingSprite.frag';\nimport fragmentSimple from './tilingSprite_simple.frag';\n\nimport type { Renderer } from '@pixi/core';\nimport type { TilingSprite } from './TilingSprite';\n\nconst tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class TilingSpriteRenderer extends ObjectRenderer\n{\n public shader: Shader;\n public simpleShader: Shader;\n public quad: QuadUv;\n public readonly state: State;\n\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n const uniforms = { globals: this.renderer.globalUniforms };\n\n this.shader = Shader.from(vertex, fragment, uniforms);\n\n this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);\n\n this.quad = new QuadUv();\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n *\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n public render(ts: TilingSprite): void\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.invalidate();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvMatrix;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode as any);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n\n this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode as any);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n","import type { TextureMatrix, Buffer } from '@pixi/core';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nexport class MeshBatchUvs\n{\n public readonly data: Float32Array;\n public uvBuffer: Buffer;\n public uvMatrix: TextureMatrix;\n\n private _bufferUpdateId: number;\n private _textureUpdateId: number;\n\n // Internal-only properties\n _updateID: number;\n\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n constructor(uvBuffer: Buffer, uvMatrix: TextureMatrix)\n {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n }\n\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n public update(forceUpdate?: boolean): void\n {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID\n )\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n const data = this.uvBuffer.data as Float32Array;\n\n if (!this.data || this.data.length !== data.length)\n {\n (this.data as any) = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n }\n}\n","import { State } from '@pixi/core';\nimport { Point, Polygon } from '@pixi/math';\nimport { BLEND_MODES, DRAW_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { MeshBatchUvs } from './MeshBatchUvs';\nimport { MeshMaterial } from './MeshMaterial';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Texture, Renderer, Geometry, Buffer } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst tempPolygon = new Polygon();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Mesh extends GlobalMixins.Mesh {}\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make you life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Mesh extends Container\n{\n public readonly geometry: Geometry;\n public shader: MeshMaterial;\n public state: State;\n public drawMode: DRAW_MODES;\n public start: number;\n public size: number;\n\n private vertexData: Float32Array;\n private vertexDirty: number;\n private _transformID: number;\n private _roundPixels: boolean;\n private batchUvs: MeshBatchUvs;\n\n // Internal-only properties\n uvs: Float32Array;\n indices: Uint16Array;\n _tintRGB: number;\n _texture: Texture;\n\n /**\n * @param {PIXI.Geometry} geometry - the geometry the mesh will use\n * @param {PIXI.MeshMaterial} shader - the shader the mesh will use\n * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts\n */\n constructor(geometry: Geometry, shader: MeshMaterial, state?: State, drawMode = DRAW_MODES.TRIANGLES)\n {\n super();\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n * @member {PIXI.Geometry}\n * @readonly\n */\n this.geometry = geometry;\n\n geometry.refCount++;\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n * @member {PIXI.Shader|PIXI.MeshMaterial}\n */\n this.shader = shader;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n * @member {PIXI.State}\n */\n this.state = state || State.for2d();\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants.\n *\n * @member {number}\n * @see PIXI.DRAW_MODES\n */\n this.drawMode = drawMode;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n * @member {number}\n * @default 0\n */\n this.start = 0;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n * @member {number}\n * @default 0\n */\n this.size = 0;\n\n /**\n * thease are used as easy access for batching\n * @member {Float32Array}\n * @private\n */\n this.uvs = null;\n\n /**\n * thease are used as easy access for batching\n * @member {Uint16Array}\n * @private\n */\n this.indices = null;\n\n /**\n * this is the caching layer used by the batcher\n * @member {Float32Array}\n * @private\n */\n this.vertexData = new Float32Array(1);\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n * @member {number}\n * @private\n */\n this.vertexDirty = 0;\n\n this._transformID = -1;\n\n /**\n * Internal roundPixels field\n *\n * @member {boolean}\n * @private\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Batched UV's are cached for atlas textures\n * @member {PIXI.MeshBatchUvs}\n * @private\n */\n this.batchUvs = null;\n }\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get uvBuffer(): Buffer\n {\n return this.geometry.buffers[1];\n }\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n * @member {PIXI.Buffer}\n * @readonly\n */\n get verticesBuffer(): Buffer\n {\n return this.geometry.buffers[0];\n }\n\n /**\n * Alias for {@link PIXI.Mesh#shader}.\n * @member {PIXI.MeshMaterial}\n */\n set material(value: MeshMaterial)\n {\n this.shader = value;\n }\n\n get material(): MeshMaterial\n {\n return this.shader;\n }\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this.shader.tint;\n }\n\n set tint(value: number)\n {\n this.shader.tint = value;\n }\n\n /**\n * The texture that the Mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n set texture(value: Texture)\n {\n this.shader.texture = value;\n }\n\n /**\n * Standard renderer draw.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _render(renderer: Renderer): void\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n const vertices = this.geometry.buffers[0].data;\n\n // TODO benchmark check for attribute size..\n if (\n this.shader.batchable\n && this.drawMode === DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2\n )\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n }\n\n /**\n * Standard non-batching way of rendering.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderDefault(renderer: Renderer): void\n {\n const shader = this.shader;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n if (shader.program.uniformData.translationMatrix)\n {\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n }\n\n // bind and sync uniforms..\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n }\n\n /**\n * Rendering by using the Batch system.\n * @protected\n * @param {PIXI.Renderer} renderer - Instance to renderer.\n */\n protected _renderToBatch(renderer: Renderer): void\n {\n const geometry = this.geometry;\n\n if (this.shader.uvMatrix)\n {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data as Uint16Array;\n this._tintRGB = this.shader._tintRGB;\n this._texture = this.shader.texture;\n\n const pluginName = this.material.pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n }\n\n /**\n * Updates vertexData field based on transform and vertices\n */\n public calculateVertices(): void\n {\n const geometry = this.geometry;\n const vertices = geometry.buffers[0].data;\n\n if ((geometry as any).vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const vertexData = this.vertexData;\n\n for (let i = 0; i < vertexData.length / 2; i++)\n {\n const x = vertices[(i * 2)];\n const y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n\n this.vertexDirty = (geometry as any).vertexDirtyId;\n }\n\n /**\n * Updates uv field based on from geometry uv's or batchUvs\n */\n public calculateUvs(): void\n {\n const geomUvs = this.geometry.buffers[1];\n\n if (!this.shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data as Float32Array;\n }\n }\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n const points = tempPolygon.points;\n const indices = this.geometry.getIndex().data;\n const len = indices.length;\n const step = this.drawMode === 4 ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this.geometry.refCount--;\n if (this.geometry.refCount === 0)\n {\n this.geometry.dispose();\n }\n\n (this as any).geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n }\n\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n * @memberof PIXI.Mesh\n * @static\n * @member {number} BATCHABLE_SIZE\n */\n public static BATCHABLE_SIZE = 100;\n}\n\n","import { Program, Shader, TextureMatrix } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba } from '@pixi/utils';\nimport fragment from './shader/mesh.frag';\nimport vertex from './shader/mesh.vert';\n\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IMeshMaterialOptions {\n alpha?: number;\n tint?: number;\n pluginName?: string;\n program?: Program;\n uniforms?: Dict;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MeshMaterial extends GlobalMixins.MeshMaterial {}\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class MeshMaterial extends Shader\n{\n public readonly uvMatrix: TextureMatrix;\n\n public batchable: boolean;\n public pluginName: string;\n\n // Internal-only properties\n _tintRGB: number;\n\n private _colorDirty: boolean;\n private _alpha: number;\n private _tint: number;\n\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n constructor(uSampler: Texture, options?: IMeshMaterialOptions)\n {\n const uniforms = {\n uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n super(options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.uniforms.uSampler;\n }\n set texture(value: Texture)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n }\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set alpha(value: number)\n {\n if (value === this._alpha) return;\n\n this._alpha = value;\n this._colorDirty = true;\n }\n get alpha(): number\n {\n return this._alpha;\n }\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set tint(value: number)\n {\n if (value === this._tint) return;\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n }\n get tint(): number\n {\n return this._tint;\n }\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n public update(): void\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n const baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(\n this._tint, this._alpha, this.uniforms.uColor, (baseTexture.alphaMode as unknown as boolean)\n );\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Buffer, Geometry } from '@pixi/core';\n\nimport type { IArrayBuffer } from '@pixi/core';\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2);\n * geometry.addIndex([0,1,2,1,3,2]);\n *\n * ```\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class MeshGeometry extends Geometry\n{\n // Internal-only properties\n _updateId: number;\n\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n constructor(vertices?: IArrayBuffer, uvs?: IArrayBuffer, index?: IArrayBuffer)\n {\n super();\n\n const verticesBuffer = new Buffer(vertices);\n const uvsBuffer = new Buffer(uvs, true);\n const indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get vertexDirtyId(): number\n {\n return this.buffers[0]._updateID;\n }\n}\n","/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n public info: IBitmapFontDataInfo[];\n public common: IBitmapFontDataCommon[];\n public page: IBitmapFontDataPage[];\n public char: IBitmapFontDataChar[];\n public kerning: IBitmapFontDataKerning[];\n\n constructor()\n {\n /**\n * @member {PIXI.IBitmapFontDataInfo[]}\n * @readOnly\n */\n this.info = [];\n\n /**\n * @member {PIXI.IBitmapFontDataCommon[]}\n * @readOnly\n */\n this.common = [];\n\n /**\n * @member {PIXI.IBitmapFontDataPage[]}\n * @readOnly\n */\n this.page = [];\n\n /**\n * @member {PIXI.IBitmapFontDataChar[]}\n * @readOnly\n */\n this.char = [];\n\n /**\n * @member {PIXI.IBitmapFontDataKerning[]}\n * @readOnly\n */\n this.kerning = [];\n }\n}\n\nexport interface IBitmapFontDataInfo {\n face: string;\n size: number;\n}\n\nexport interface IBitmapFontDataCommon {\n lineHeight: number;\n}\n\nexport interface IBitmapFontDataPage {\n id: number;\n file: string;\n}\n\nexport interface IBitmapFontDataChar {\n id: number;\n page: number;\n x: number;\n y: number;\n width: number;\n height: number;\n xoffset: number;\n yoffset: number;\n xadvance: number;\n}\n\nexport interface IBitmapFontDataKerning {\n first: number;\n second: number;\n amount: number;\n}\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataInfo\n * @property {string} face\n * @property {number} size\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataCommon\n * @property {number} lineHeight\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataPage\n * @property {number} id\n * @property {string} file\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataChar\n * @property {string} id\n * @property {number} page\n * @property {number} x\n * @property {number} y\n * @property {number} width\n * @property {number} height\n * @property {number} xoffset\n * @property {number} yoffset\n * @property {number} xadvance\n */\n\n/**\n * @memberof PIXI\n * @typedef {object} IBitmapFontDataKerning\n * @property {number} first\n * @property {number} second\n * @property {number} amount\n */\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * Internal data format used to convert to BitmapFontData.\n * @private\n */\ninterface IBitmapFontRawData {\n info: {\n face: string;\n size: string;\n }[];\n common: { lineHeight: string }[];\n page: {\n id: string;\n file: string;\n }[];\n chars: {\n count: number;\n }[];\n char: {\n id: string;\n page: string;\n x: string;\n y: string;\n width: string;\n height: string;\n xoffset: string;\n yoffset: string;\n xadvance: string;\n }[];\n kernings?: {\n count: number;\n }[];\n kerning?: {\n first: string;\n second: string;\n amount: string;\n }[];\n}\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @class\n * @private\n */\nexport class TextFormat\n{\n /**\n * Check if resource refers to txt font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n }\n\n /**\n * Convert text font data to a javascript object.\n *\n * @static\n * @private\n * @param {string} txt - Raw string data to be converted\n * @return {PIXI.BitmapFontData} Parsed font data\n */\n static parse(txt: string): BitmapFontData\n {\n // Retrieve data item\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData: IBitmapFontRawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n };\n\n for (const i in items)\n {\n // Extract item name\n const name = items[i].match(/^[a-z]+/gm)[0] as keyof BitmapFontData;\n\n // Extract item attribute list as string ex.: \"width=10\"\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n\n // Convert attribute list into an object\n const itemData: any = {};\n\n for (const i in attributeList)\n {\n // Split key-value pairs\n const split = attributeList[i].split('=');\n const key = split[0];\n\n // Remove eventual quotes from value\n const strValue = split[1].replace(/\"/gm, '');\n\n // Try to convert value into float\n const floatValue = parseFloat(strValue);\n\n // Use string value case float value is NaN\n const value = isNaN(floatValue) ? strValue : floatValue;\n\n itemData[key] = value;\n }\n\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n\n const font = new BitmapFontData();\n\n rawData.info.forEach((info) => font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }));\n\n rawData.common.forEach((common) => font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }));\n\n rawData.page.forEach((page) => font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }));\n\n rawData.char.forEach((char) => font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }));\n\n rawData.kerning.forEach((kerning) => font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }));\n\n return font;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLFormat\n{\n /**\n * Check if resource refers to xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n }\n\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {XMLDocument} xml\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xml: XMLDocument): BitmapFontData\n {\n const data = new BitmapFontData();\n const info = xml.getElementsByTagName('info');\n const common = xml.getElementsByTagName('common');\n const page = xml.getElementsByTagName('page');\n const char = xml.getElementsByTagName('char');\n const kerning = xml.getElementsByTagName('kerning');\n\n for (let i = 0; i < info.length; i++)\n {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n\n for (let i = 0; i < common.length; i++)\n {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n\n for (let i = 0; i < page.length; i++)\n {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n\n for (let i = 0; i < char.length; i++)\n {\n const letter = char[i];\n\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n\n for (let i = 0; i < kerning.length; i++)\n {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n\n return data;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\nimport { XMLFormat } from './XMLFormat';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @class\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n *\n * @static\n * @private\n * @param {any} data\n * @return {boolean} True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n if (typeof data === 'string' && data.indexOf('') > -1)\n {\n const xml = new self.DOMParser().parseFromString(data, 'text/xml');\n\n return XMLFormat.test(xml);\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @static\n * @private\n * @param {string} xmlTxt\n * @return {BitmapFontData} Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n const xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml');\n\n return XMLFormat.parse(xml);\n }\n}\n","import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nexport function autoDetectFormat(data: unknown): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n","import { TextStyle, TextMetrics, TEXT_GRADIENT } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nexport function generateFillStyle(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n style: TextStyle,\n resolution: number,\n lines: string[],\n metrics: TextMetrics\n): string|CanvasGradient|CanvasPattern\n{\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n const height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n}\n","import { generateFillStyle } from './generateFillStyle';\nimport { hex2rgb, string2hex } from '@pixi/utils';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n if (style.dropShadow)\n {\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n","import { getResolutionOfUrl } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { TextStyle, TextMetrics } from '@pixi/text';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFontData } from './BitmapFontData';\nimport { resolveCharacters, drawGlyph } from './utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITextStyle } from '@pixi/text';\n\nexport interface IBitmapFontCharacter\n{\n xOffset: number;\n yOffset: number;\n xAdvance: number;\n texture: Texture;\n page: number;\n kerning: Dict;\n}\n\nexport interface IBitmapFontOptions\n{\n chars?: string | (string | string[])[];\n resolution?: number;\n padding?: number;\n textureWidth?: number;\n textureHeight?: number;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @class\n * @memberof PIXI\n */\nexport class BitmapFont\n{\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n public static readonly ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n\n /**\n * This character set includes all decimal digits (from 0 to 9).\n * @readonly\n * @static\n * @member {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n public static readonly NUMERIC = [['0', '9']];\n\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n * @readonly\n * @static\n * @member {string[][]}\n */\n public static readonly ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n\n /**\n * This character set consists of all the ASCII table.\n * @readonly\n * @static\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n public static readonly ASCII = [[' ', '~']];\n\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @readonly\n * @static\n * @member {PIXI.IBitmapFontOptions}\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC\n */\n public static readonly defaultOptions: IBitmapFontOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n\n /**\n * Collection of available/installed fonts.\n *\n * @readonly\n * @static\n * @member {Object.}\n */\n public static readonly available: Dict = {};\n public readonly font: string;\n public readonly size: number;\n public readonly lineHeight: number;\n public readonly chars: Dict;\n public readonly pageTextures: Dict;\n\n /**\n * @param {PIXI.BitmapFontData} data\n * @param {PIXI.Texture[]|Object.} textures\n */\n constructor(data: BitmapFontData, textures: Texture[]|Dict)\n {\n const [info] = data.info;\n const [common] = data.common;\n const [page] = data.page;\n const res = getResolutionOfUrl(page.file);\n const pageTextures: Dict = {};\n\n /**\n * The name of the font face.\n *\n * @member {string}\n * @readonly\n */\n this.font = info.face;\n\n /**\n * The size of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.size = info.size;\n\n /**\n * The line-height of the font face in pixels.\n *\n * @member {number}\n * @readonly\n */\n this.lineHeight = common.lineHeight / res;\n\n /**\n * The map of characters by character code.\n *\n * @member {object}\n * @readonly\n */\n this.chars = {};\n\n /**\n * The map of base page textures (i.e., sheets of glyphs).\n *\n * @member {object}\n * @readonly\n * @private\n */\n this.pageTextures = pageTextures;\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < data.page.length; i++)\n {\n const { id, file } = data.page[i];\n\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n }\n\n // parse letters\n for (let i = 0; i < data.char.length; i++)\n {\n const { id, page } = data.char[i];\n let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];\n\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n\n const rect = new Rectangle(\n x + (pageTextures[page].frame.x / res),\n y + (pageTextures[page].frame.y / res),\n width,\n height\n );\n\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new Texture(\n pageTextures[page].baseTexture,\n rect\n ),\n page,\n };\n }\n\n // parse kernings\n for (let i = 0; i < data.kerning.length; i++)\n {\n let { first, second, amount } = data.kerning[i];\n\n first /= res;\n second /= res;\n amount /= res;\n\n if (this.chars[second])\n {\n this.chars[second].kerning[first] = amount;\n }\n }\n }\n\n /**\n * Remove references to created glyph textures.\n */\n public destroy(): void\n {\n for (const id in this.chars)\n {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n\n for (const id in this.pageTextures)\n {\n this.pageTextures[id].destroy(true);\n this.pageTextures[id] = null;\n }\n\n // Set readonly null.\n (this as any).chars = null;\n (this as any).pageTextures = null;\n }\n\n /**\n * Register a new bitmap font.\n *\n * @static\n * @param {XMLDocument|string|PIXI.BitmapFontData} data - The\n * characters map that could be provided as xml or raw string.\n * @param {Object.|PIXI.Texture|PIXI.Texture[]}\n * textures - List of textures for each page.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n public static install(\n data: string|XMLDocument|BitmapFontData,\n textures: Texture|Texture[]|Dict\n ): BitmapFont\n {\n let fontData;\n\n if (data instanceof BitmapFontData)\n {\n fontData = data;\n }\n else\n {\n const format = autoDetectFormat(data);\n\n if (!format)\n {\n throw new Error('Unrecognized data format for font.');\n }\n\n fontData = format.parse(data as any);\n }\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n const font = new BitmapFont(fontData, textures);\n\n BitmapFont.available[font.font] = font;\n\n return font;\n }\n\n /**\n * Remove bitmap font by name.\n *\n * @static\n * @param {string} name\n */\n public static uninstall(name: string): void\n {\n const font = BitmapFont.available[name];\n\n if (!font)\n {\n throw new Error(`No font found named '${name}'`);\n }\n\n font.destroy();\n delete BitmapFont.available[name];\n }\n\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param {string} name - The name of the custom font to use with BitmapText.\n * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont.\n * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return {PIXI.BitmapFont} Font generated by style options.\n * @static\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n public static from(name: string, textStyle?: TextStyle | Partial, options?: IBitmapFontOptions): BitmapFont\n {\n if (!name)\n {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n\n const {\n chars,\n padding,\n resolution,\n textureWidth,\n textureHeight } = Object.assign(\n {}, BitmapFont.defaultOptions, options);\n\n const charsList = resolveCharacters(chars);\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const lineWidth = textureWidth;\n const fontData = new BitmapFontData();\n\n fontData.info[0] = {\n face: style.fontFamily as string,\n size: style.fontSize as number,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize as number,\n };\n\n let positionX = 0;\n let positionY = 0;\n\n let canvas;\n let context;\n let baseTexture;\n let maxCharHeight = 0;\n const baseTextures = [];\n const textures: Texture[] = [];\n\n for (let i = 0; i < charsList.length; i++)\n {\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n\n context = canvas.getContext('2d');\n baseTexture = new BaseTexture(canvas, { resolution });\n\n baseTextures.push(baseTexture);\n textures.push(new Texture(baseTexture));\n\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n\n // Measure glyph dimensions\n const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);\n const width = metrics.width;\n const height = Math.ceil(metrics.height);\n\n // This is ugly - but italics are given more space so they don't overlap\n const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution))\n {\n if (positionY === 0)\n {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is `\n + `too small for ${style.fontSize}px fonts`);\n }\n\n --i;\n\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth)\n {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n\n // Unique (numeric) ID mapping to this glyph\n const id = metrics.text.charCodeAt(0);\n\n // Create a texture holding just the glyph\n fontData.char.push({\n id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n\n const font = new BitmapFont(fontData, textures);\n\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined)\n {\n BitmapFont.uninstall(name);\n }\n\n BitmapFont.available[name] = font;\n\n return font;\n }\n}\n\n/**\n * @memberof PIXI\n * @interface IBitmapFontOptions\n * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate\n * @property {number} [resolution=1] - the resolution for rendering\n * @property {number} [padding=4] - the padding between glyphs in the atlas\n * @property {number} [textureWidth=512] - the width of the texture atlas\n * @property {number} [textureHeight=512] - the height of the texture atlas\n */\n\n","/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...item.split(''));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n","import { ObservablePoint, Point } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { removeItems, deprecation } from '@pixi/utils';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { Dict } from '@pixi/utils';\nimport type { Rectangle } from '@pixi/math';\nimport { Texture } from '@pixi/core';\nimport type { IBitmapTextStyle } from './BitmapTextStyle';\nimport type { TextStyleAlign } from '@pixi/text';\nimport type { BitmapFontData } from './BitmapFontData';\nimport { Container } from '@pixi/display';\nimport type { IDestroyOptions } from '@pixi/display';\n\ninterface PageMeshData {\n index: number;\n indexCount: number;\n vertexCount: number;\n uvsCount: number;\n total: number;\n mesh: Mesh;\n vertices?: Float32Array;\n uvs?: Float32Array;\n indices?: Uint16Array;\n}\ninterface CharRenderData {\n texture: Texture;\n line: number;\n charCode: number;\n position: Point;\n}\n\nconst pageMeshDataPool: PageMeshData[] = [];\nconst charRenderDataPool: CharRenderData[] = [];\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class BitmapText extends Container\n{\n public static styleDefaults: Partial = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n public dirty: boolean;\n protected _textWidth: number;\n protected _textHeight: number;\n protected _text: string;\n protected _maxWidth: number;\n protected _maxLineHeight: number;\n protected _letterSpacing: number;\n protected _anchor: ObservablePoint;\n protected _fontName: string;\n protected _fontSize: number;\n protected _align: TextStyleAlign;\n protected _activePagesMeshData: PageMeshData[];\n protected _tint = 0xFFFFFF;\n protected _roundPixels: boolean;\n private _textureCache: Record;\n\n /**\n * @param {string} text - A string that you would like the text to display.\n * @param {object} style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n constructor(text: string, style: Partial = {})\n {\n super();\n\n if (style.font)\n {\n deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.');\n\n this._upgradeStyle(style);\n }\n\n // Apply the defaults\n const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(\n {}, BitmapText.styleDefaults, style);\n\n if (!BitmapFont.available[fontName])\n {\n throw new Error(`Missing BitmapFont \"${fontName}\"`);\n }\n\n /**\n * Collection of page mesh data.\n *\n * @member {object}\n * @private\n */\n this._activePagesMeshData = [];\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the current text align.\n *\n * @member {string}\n * @private\n */\n this._align = align;\n\n /**\n * Private tracker for the current tint.\n *\n * @member {number}\n * @private\n */\n this._tint = tint;\n\n /**\n * Private tracker for the current font name.\n *\n * @member {string}\n * @private\n */\n this._fontName = fontName;\n\n /**\n * Private tracker for the current font size.\n *\n * @member {number}\n * @private\n */\n this._fontSize = fontSize || BitmapFont.available[fontName].size;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = maxWidth;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = letterSpacing;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint((): void => { this.dirty = true; }, this, 0, 0);\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n this._roundPixels = settings.ROUND_PIXELS;\n\n /**\n * Set to `true` if the BitmapText needs to be redrawn.\n *\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * Cached char texture is destroyed when BitmapText is destroyed\n * @member {Record}\n * @private\n */\n this._textureCache = {};\n }\n\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n public updateText(): void\n {\n const data = BitmapFont.available[this._fontName];\n const scale = this._fontSize / data.size;\n const pos = new Point();\n const chars: CharRenderData[] = [];\n const lineWidths = [];\n const text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n const textLength = text.length;\n const maxWidth = this._maxWidth * data.size / this._fontSize;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n\n for (let i = 0; i < textLength; i++)\n {\n const charCode = text.charCodeAt(i);\n const char = text.charAt(i);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n const charRenderData = charRenderDataPool.pop() || {\n texture: Texture.EMPTY,\n line: 0,\n charCode: 0,\n position: new Point(),\n };\n\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n\n chars.push(charRenderData);\n\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n const lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n\n const pagesMeshData: Record = {};\n\n const newPagesMeshData: PageMeshData[] = [];\n\n const activePagesMeshData = this._activePagesMeshData;\n\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const texture = chars[i].texture;\n const baseTextureUid = texture.baseTexture.uid;\n\n if (!pagesMeshData[baseTextureUid])\n {\n let pageMeshData = pageMeshDataPool.pop();\n\n if (!pageMeshData)\n {\n const geometry = new MeshGeometry();\n const material = new MeshMaterial(Texture.EMPTY);\n\n const mesh = new Mesh(geometry, material);\n\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n\n // TODO need to get page texture here somehow..\n const { _textureCache } = this;\n\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n\n pageMeshData.mesh.tint = this._tint;\n\n newPagesMeshData.push(pageMeshData);\n\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n\n pagesMeshData[baseTextureUid].total++;\n }\n\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1)\n {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (let i = 0; i < newPagesMeshData.length; i++)\n {\n if (newPagesMeshData[i].mesh.parent !== this)\n {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n const total = pageMeshData.total;\n\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else\n {\n const total = pageMeshData.total;\n const vertices = pageMeshData.vertices;\n\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (let i = total * 4 * 2; i < vertices.length; i++)\n {\n vertices[i] = 0;\n }\n }\n\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const char = chars[i];\n let offset = char.position.x + lineAlignOffsets[char.line];\n\n if (this._roundPixels)\n {\n offset = Math.round(offset);\n }\n\n const xPos = offset * scale;\n const yPos = char.position.y * scale;\n const texture = char.texture;\n\n const pageMesh = pagesMeshData[texture.baseTexture.uid];\n\n const textureFrame = texture.frame;\n const textureUvs = texture._uvs;\n\n const index = pageMesh.index++;\n\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n let vertexCount = 0;\n\n const anchorOffsetX = this._textWidth * this.anchor.x;\n const anchorOffsetY = this._textHeight * this.anchor.y;\n\n for (let i = 0; i < pageMeshData.total; i++)\n {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n\n this._maxLineHeight = maxLineHeight * scale;\n\n const vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n const textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n const indexBuffer = pageMeshData.mesh.geometry.getIndex();\n\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n\n for (let i = 0; i < chars.length; i++)\n {\n charRenderDataPool.push(chars[i]);\n }\n }\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n updateTransform(): void\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n public getLocalBounds(): Rectangle\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n protected validate(): void\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object.\n *\n * @member {number}\n * @default 0xffffff\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n if (this._tint === value) return;\n\n this._tint = value;\n\n for (let i = 0; i < this._activePagesMeshData.length; i++)\n {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n }\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n public get align(): TextStyleAlign\n {\n return this._align;\n }\n\n public set align(value: TextStyleAlign)\n {\n if (this._align !== value)\n {\n this._align = value;\n this.dirty = true;\n }\n }\n\n /**\n * The name of the BitmapFont.\n *\n * @member {string}\n */\n public get fontName(): string\n {\n return this._fontName;\n }\n\n public set fontName(value: string)\n {\n if (!BitmapFont.available[value])\n {\n throw new Error(`Missing BitmapFont \"${value}\"`);\n }\n\n if (this._fontName !== value)\n {\n this._fontName = value;\n this.dirty = true;\n }\n }\n\n /**\n * The size of the font to display.\n *\n * @member {number}\n */\n public get fontSize(): number\n {\n return this._fontSize;\n }\n\n public set fontSize(value: number)\n {\n if (this._fontSize !== value)\n {\n this._fontSize = value;\n this.dirty = true;\n }\n }\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n *\n * @member {PIXI.Point | number}\n */\n public get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n public set anchor(value: ObservablePoint)\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n }\n\n /**\n * The text of the BitmapText object.\n *\n * @member {string}\n */\n public get text(): string\n {\n return this._text;\n }\n\n public set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n *\n * @member {number}\n */\n public get maxWidth(): number\n {\n return this._maxWidth;\n }\n\n public set maxWidth(value: number)\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n public get maxLineHeight(): number\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textWidth(): number\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n public get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n\n public set letterSpacing(value: number)\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @member {boolean}\n * @default PIXI.settings.ROUND_PIXELS\n */\n public get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n public set roundPixels(value: boolean)\n {\n if (value !== this._roundPixels)\n {\n this._roundPixels = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @member {number}\n * @readonly\n */\n public get textHeight(): number\n {\n this.validate();\n\n return this._textHeight;\n }\n\n /**\n * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties.\n *\n * @private\n * @deprecated since 5.3.0\n */\n _upgradeStyle(style: Partial): void\n {\n if (typeof style.font === 'string')\n {\n const valueSplit = style.font.split(' ');\n\n style.fontName = valueSplit.length === 1\n ? valueSplit[0]\n : valueSplit.slice(1).join(' ');\n\n if (valueSplit.length >= 2)\n {\n style.fontSize = parseInt(valueSplit[0], 10);\n }\n }\n else\n {\n style.fontName = style.font.name;\n style.fontSize = typeof style.font.size === 'number'\n ? style.font.size\n : parseInt(style.font.size, 10);\n }\n }\n\n destroy(options?: boolean | IDestroyOptions): void\n {\n const { _textureCache } = this;\n\n for (const id in _textureCache)\n {\n const texture = _textureCache[id];\n\n texture.destroy();\n delete _textureCache[id];\n }\n\n this._textureCache = null;\n\n super.destroy(options);\n }\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @deprecated since 5.3.0\n * @see PIXI.BitmapFont.install\n * @static\n */\n static registerFont(data: string|XMLDocument|BitmapFontData, textures: Texture|Texture[]|Dict): BitmapFont\n {\n deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install');\n\n return BitmapFont.install(data, textures);\n }\n\n /**\n * Get the list of installed fonts.\n *\n * @see PIXI.BitmapFont.available\n * @deprecated since 5.3.0\n * @static\n * @readonly\n * @member {Object.}\n */\n static get fonts(): Dict\n {\n deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available');\n\n return BitmapFont.available;\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { ILoaderResource } from '@pixi/loaders';\nimport type { Dict } from '@pixi/utils';\nimport type { Loader } from '@pixi/loaders';\nimport type { Texture } from '@pixi/core';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class BitmapFontLoader\n{\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n public static add(): void\n {\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(this: Loader, resource: ILoaderResource, next: (...args: any[]) => void): void\n {\n const format = autoDetectFormat(resource.data);\n\n // Resource was not recognised as any of the expected font data format\n if (!format)\n {\n next();\n\n return;\n }\n\n const baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n const data = format.parse(resource.data);\n const textures: Dict = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page: ILoaderResource): void =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === data.page.length)\n {\n resource.bitmapFont = BitmapFont.install(data, textures);\n next();\n }\n };\n\n for (let i = 0; i < data.page.length; ++i)\n {\n const pageFile = data.page[i].file;\n const url = baseUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource: ILoaderResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n }\n\n /**\n * Get folder path from a resource\n * @private\n * @param {PIXI.Loader} loader\n * @param {PIXI.LoaderResource} resource\n * @return {string}\n */\n private static getBaseUrl(loader: Loader, resource: ILoaderResource): string\n {\n let resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (resUrl === '.')\n {\n resUrl = '';\n }\n\n if (loader.baseUrl && resUrl)\n {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/')\n {\n resUrl += '/';\n }\n }\n }\n\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/')\n {\n resUrl += '/';\n }\n\n return resUrl;\n }\n\n /**\n * Replacement for NodeJS's path.dirname\n * @private\n * @param {string} url - Path to get directory for\n */\n private static dirname(url: string): string\n {\n const dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n }\n}\n","import { Filter, defaultVertex } from '@pixi/core';\nimport fragment from './alpha.frag';\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class AlphaFilter extends Filter\n{\n /**\n * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n","const vertTemplate = `\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }`;\n\nexport function generateBlurVertSource(kernelSize: number, x: boolean): string\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n\n return vertSource;\n}\n","interface IGAUSSIAN_VALUES {\n [x: number]: number[];\n}\nconst GAUSSIAN_VALUES: IGAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport function generateBlurFragSource(kernelSize: number): string\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value: number;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value].toString());\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n\n return fragSource;\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { generateBlurVertSource } from './generateBlurVertSource';\nimport { generateBlurFragSource } from './generateBlurFragSource';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilterPass extends Filter\n{\n public horizontal: boolean;\n public strength: number;\n public passes: number;\n\n private _quality: number;\n\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(horizontal: boolean, strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n const vertSrc = generateBlurVertSource(kernelSize, horizontal);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution;\n\n this._quality = 0;\n\n this.quality = quality;\n\n this.blur = strength;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else\n {\n const renderTarget = filterManager.getFilterTexture();\n const renderer = filterManager.renderer;\n\n let flip = input;\n let flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n\n for (let i = 1; i < this.passes - 1; i++)\n {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n\n this.uniforms.uSampler = flop;\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n }\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur(): number\n {\n return this.strength;\n }\n\n set blur(value: number)\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality(): number\n {\n return this._quality;\n }\n\n set quality(value: number)\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { BlurFilterPass } from './BlurFilterPass';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { RenderTexture, systems } from '@pixi/core';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilter extends Filter\n{\n public blurXFilter: BlurFilterPass;\n public blurYFilter: BlurFilterPass;\n\n private _repeatEdgePixels: boolean;\n\n /**\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n super();\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution;\n this.quality = quality;\n this.blur = strength;\n\n this.repeatEdgePixels = false;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n apply(filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const xStrength = Math.abs(this.blurXFilter.strength);\n const yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n const renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n }\n\n protected updatePadding(): void\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get blur(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value: number)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get quality(): number\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value: number)\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get blurX(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value: number)\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get blurY(): number\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value: number)\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.blurYFilter.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blurYFilter.blendMode = value;\n }\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @member {boolean}\n * @default false\n */\n get repeatEdgePixels(): boolean\n {\n return this._repeatEdgePixels;\n }\n\n set repeatEdgePixels(value: boolean)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './colorMatrix.frag';\n\nimport type { ArrayFixed } from '@pixi/utils';\n\nexport type ColorMatrix = ArrayFixed;\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class ColorMatrixFilter extends Filter\n{\n public grayscale: (scale: number, multiply: boolean) => void;\n\n constructor()\n {\n const uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n super(defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n private _loadMatrix(matrix: ColorMatrix, multiply = false): void\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix) as any;\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n private _multiply(out: ColorMatrix, a: ColorMatrix, b: ColorMatrix): ColorMatrix\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n private _colorMatrix(matrix: ColorMatrix): ColorMatrix\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m as any;\n }\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public brightness(b: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public greyscale(scale: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public blackAndWhite(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public hue(rotation: number, multiply: boolean): void\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix: ColorMatrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public contrast(amount: number, multiply: boolean): void\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix: ColorMatrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public saturate(amount = 0, multiply?: boolean): void\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix: ColorMatrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n public desaturate(): void // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public negative(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public sepia(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public technicolor(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public polaroid(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public toBGR(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public kodachrome(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public browni(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public vintage(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {number} lightColor - Tone values, example: `0xFFE580`\n * @param {number} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean): void\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix: ColorMatrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public night(intensity: number, multiply: boolean): void\n {\n intensity = intensity || 0.1;\n\n const matrix: ColorMatrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public predator(amount: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public lsd(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n public reset(): void\n {\n const matrix: ColorMatrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix(): ColorMatrix\n {\n return this.uniforms.m;\n }\n\n set matrix(value: ColorMatrix)\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\nimport fragment from './displacement.frag';\nimport vertex from './displacement.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { RenderTexture, systems, Texture, ISpriteMaskTarget } from '@pixi/core';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class DisplacementFilter extends Filter\n{\n public maskSprite: ISpriteMaskTarget;\n public maskMatrix: Matrix;\n public scale: Point;\n\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} [scale] - The scale of the displacement\n */\n constructor(sprite: ISpriteMaskTarget, scale: number)\n {\n const maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n super(vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.systems.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - clearMode.\n */\n public apply(\n filterManager: systems.FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n const wt = this.maskSprite.worldTransform;\n const lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n const lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n }\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get map(): Texture\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value: Texture)\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport vertex from './fxaa.vert';\nimport fragment from './fxaa.frag';\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nexport class FXAAFilter extends Filter\n{\n constructor()\n {\n // TODO - needs work\n super(vertex, fragment);\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './noise.frag';\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class NoiseFilter extends Filter\n{\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get noise(): number\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value: number)\n {\n this.uniforms.uNoise = value;\n }\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get seed(): number\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value: number)\n {\n this.uniforms.uSeed = value;\n }\n}\n","import { Texture, BaseTexture, RenderTexture, Renderer, MaskData } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Container, DisplayObject, IDestroyOptions } from '@pixi/display';\nimport { IPointData, Matrix, Rectangle } from '@pixi/math';\nimport { uid } from '@pixi/utils';\nimport { settings } from '@pixi/settings';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\n\nconst _tempMatrix = new Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = null;\n\n// figured there's no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nexport class CacheData\n{\n public textureCacheId: string;\n public originalRender: (renderer: Renderer) => void;\n public originalRenderCanvas: (renderer: CanvasRenderer) => void;\n public originalCalculateBounds: () => void;\n public originalGetLocalBounds: (rect?: Rectangle) => Rectangle;\n public originalUpdateTransform: () => void;\n public originalDestroy: (options?: IDestroyOptions|boolean) => void;\n public originalMask: Container|MaskData;\n public originalFilterArea: Rectangle;\n public originalContainsPoint: (point: IPointData) => boolean;\n public sprite: Sprite;\n\n constructor()\n {\n this.textureCacheId = null;\n\n this.originalRender = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.originalContainsPoint = null;\n this.sprite = null;\n }\n}\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to `false`\n *\n * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get(): CacheData\n {\n return this._cacheAsBitmap;\n },\n set(value: CacheData): void\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n let data: CacheData;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRender = this.render;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.render = this._renderCached;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.render = data.originalRender;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @function _renderCached\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCached = function _renderCached(renderer: Renderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._render(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObject\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Renderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer: Renderer): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.batch.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n const bounds = (this as Container).getLocalBounds(null, true).clone();\n\n // add some padding!\n if (this.filters)\n {\n const padding = this.filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the WebGL renderer is currently using.\n // this could be more elegant..\n const cachedRenderTexture = renderer.renderTexture.current;\n const cachedSourceFrame = renderer.renderTexture.sourceFrame.clone();\n const cachedProjectionTransform = renderer.projection.transform;\n\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n // const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y);\n\n // set all properties to there original so we can render to a texture\n this.render = this._cacheData.originalRender;\n\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.projection.transform = cachedProjectionTransform;\n renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame);\n\n // renderer.filterManager.filterStack = stack;\n\n this.render = this._renderCached;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.enableTempParent();\n this.updateTransform();\n this.disableTempParent(null);\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @function _renderCachedCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n (this._cacheData.sprite as any)._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @function _initCachedDisplayObjectCanvas\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(\n renderer: CanvasRenderer\n): void\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n const bounds = (this as Container).getLocalBounds(null, true);\n\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n const cachedRenderTarget = renderer.context;\n const cachedProjectionTransform = (renderer as any)._projTransform;\n\n bounds.ceil(settings.RESOLUTION);\n\n const renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height });\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n this.transform.localTransform.copyTo(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n renderer.render(this, renderTexture, true, m, false);\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n (renderer as any)._projTransform = cachedProjectionTransform;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = (renderer as any)._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n (this as Sprite).containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds(): void\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n (this._cacheData.sprite as any)._calculateBounds();\n this._bounds.updateID = (this as any)._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds(): Rectangle\n{\n return this._cacheData.sprite.getLocalBounds(null);\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject(): void\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options: IDestroyOptions|boolean): void\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n","import { DisplayObject, Container } from '@pixi/display';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\nDisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container.\n *\n * Recursive searches are done in a preorder traversal.\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - Instance name.\n * @param {boolean}[deep=false] - Whether to search recursively\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\nContainer.prototype.getChildByName = function getChildByName(name: string, deep?: boolean): DisplayObject\n{\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n if (deep)\n {\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n const child = (this.children[i] as Container);\n\n if (!child.getChildByName)\n {\n continue;\n }\n\n const target = (this.children[i] as Container).getChildByName(name, true);\n\n if (target)\n {\n return target;\n }\n }\n }\n\n return null;\n};\n","import { DisplayObject } from '@pixi/display';\nimport { Point } from '@pixi/math';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.\n * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @return {PIXI.Point} The updated point.\n */\nDisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point: Point = new Point(), skipUpdate = false): Point\n{\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","import { deprecation } from '@pixi/utils';\nimport type {\n systems,\n resources,\n Renderer,\n ImageSource,\n BaseTexture,\n RenderTexture,\n Texture,\n State,\n AbstractRenderer } from '@pixi/core';\nimport type { DisplayObject, Container } from '@pixi/display';\nimport type { TilingSprite } from '@pixi/sprite-tiling';\nimport type {\n Point,\n ObservablePoint,\n IPoint,\n Rectangle,\n Transform,\n groupD8,\n Matrix } from '@pixi/math';\nimport type { InteractionManager, InteractionData, InteractionEvent } from '@pixi/interaction';\nimport type { AccessibilityManager } from '@pixi/accessibility';\nimport type { Ticker } from '@pixi/ticker';\nimport type { Graphics, GraphicsData } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\nimport type { BitmapText, BitmapFontLoader } from '@pixi/text-bitmap';\nimport type { CanvasRenderTarget } from '@pixi/utils';\nimport type { Loader, LoaderResource } from '@pixi/loaders';\nimport type { BasePrepare, Prepare } from '@pixi/prepare';\nimport type { Extract } from '@pixi/extract';\nimport type { AnimatedSprite } from '@pixi/sprite-animated';\nimport type { Mesh } from '@pixi/mesh';\nimport type { ParticleContainer } from '@pixi/particles';\nimport type { SpritesheetLoader } from '@pixi/spritesheet';\nimport type {\n SimpleRope,\n NineSlicePlane,\n SimpleMesh,\n SimplePlane } from '@pixi/mesh-extras';\n\nconst v5 = '5.0.0';\n\n// Canvas deprecations needs to get moved\n// to the legacy package, but for now, we'll\n// ad this reminder\ntype $FixLegacy = any;\n\n/**\n * Deprecations (backward compatibilities) are automatically applied for browser bundles\n * in the UMD module format. If using Webpack or Rollup, you'll need to apply these\n * deprecations manually by doing something like this:\n * @example\n * import * as PIXI from 'pixi.js';\n * PIXI.useDeprecated(); // MUST be bound to namespace\n * @memberof PIXI\n * @function useDeprecated\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useDeprecated(this: any): void\n{\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const PIXI = this;\n\n Object.defineProperties(PIXI, {\n /**\n * @constant {RegExp|string} SVG_SIZE\n * @memberof PIXI\n * @see PIXI.resources.SVGResource.SVG_SIZE\n * @deprecated since 5.0.0\n */\n SVG_SIZE: {\n get(): RegExp\n {\n deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE');\n\n return PIXI.SVGResource.SVG_SIZE;\n },\n },\n\n /**\n * @class PIXI.TransformStatic\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformStatic: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * @class PIXI.TransformBase\n * @deprecated since 5.0.0\n * @see PIXI.Transform\n */\n TransformBase: {\n get(): Transform\n {\n deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform');\n\n return PIXI.Transform;\n },\n },\n\n /**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @enum {number}\n * @deprecated since 5.0.0\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\n TRANSFORM_MODE: {\n get(): {[name: string]: number}\n {\n deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed');\n\n return { STATIC: 0, DYNAMIC: 1 };\n },\n },\n\n /**\n * @class PIXI.WebGLRenderer\n * @see PIXI.Renderer\n * @deprecated since 5.0.0\n */\n WebGLRenderer: {\n get(): typeof Renderer\n {\n deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer');\n\n return PIXI.Renderer;\n },\n },\n\n /**\n * @class PIXI.CanvasRenderTarget\n * @see PIXI.utils.CanvasRenderTarget\n * @deprecated since 5.0.0\n */\n CanvasRenderTarget: {\n get(): CanvasRenderTarget\n {\n deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget');\n\n return PIXI.utils.CanvasRenderTarget;\n },\n },\n\n /**\n * @memberof PIXI\n * @name loader\n * @type {PIXI.Loader}\n * @see PIXI.Loader.shared\n * @deprecated since 5.0.0\n */\n loader: {\n get(): Loader\n {\n deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared');\n\n return PIXI.Loader.shared;\n },\n },\n\n /**\n * @class PIXI.FilterManager\n * @see PIXI.systems.FilterSystem\n * @deprecated since 5.0.0\n */\n FilterManager: {\n get(): systems.FilterSystem\n {\n deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem');\n\n return PIXI.systems.FilterSystem;\n },\n },\n\n /**\n * @namespace PIXI.CanvasTinter\n * @see PIXI.canvasUtils\n * @deprecated since 5.2.0\n */\n CanvasTinter: {\n get(): $FixLegacy\n {\n deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils');\n\n return PIXI.canvasUtils;\n },\n },\n\n /**\n * @namespace PIXI.GroupD8\n * @see PIXI.groupD8\n * @deprecated since 5.2.0\n */\n GroupD8: {\n get(): typeof groupD8\n {\n deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8');\n\n return PIXI.groupD8;\n },\n },\n });\n\n /**\n * @namespace PIXI.accessibility\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.accessibility = {};\n\n Object.defineProperties(PIXI.accessibility, {\n /**\n * @class PIXI.accessibility.AccessibilityManager\n * @deprecated since 5.3.0\n * @see PIXI.AccessibilityManager\n */\n AccessibilityManager: {\n get(): typeof AccessibilityManager\n {\n deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager');\n\n return PIXI.AccessibilityManager;\n },\n },\n });\n\n /**\n * @namespace PIXI.interaction\n * @see PIXI\n * @deprecated since 5.3.0\n */\n PIXI.interaction = {};\n\n Object.defineProperties(PIXI.interaction, {\n /**\n * @class PIXI.interaction.InteractionManager\n * @deprecated since 5.3.0\n * @see PIXI.InteractionManager\n */\n InteractionManager: {\n get(): typeof InteractionManager\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager');\n\n return PIXI.InteractionManager;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionData\n * @deprecated since 5.3.0\n * @see PIXI.InteractionData\n */\n InteractionData: {\n get(): typeof InteractionData\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData');\n\n return PIXI.InteractionData;\n },\n },\n\n /**\n * @class PIXI.interaction.InteractionEvent\n * @deprecated since 5.3.0\n * @see PIXI.InteractionEvent\n */\n InteractionEvent: {\n get(): typeof InteractionEvent\n {\n deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent');\n\n return PIXI.InteractionEvent;\n },\n },\n });\n\n /**\n * @namespace PIXI.prepare\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.prepare = {};\n\n Object.defineProperties(PIXI.prepare, {\n /**\n * @class PIXI.prepare.BasePrepare\n * @deprecated since 5.2.1\n * @see PIXI.BasePrepare\n */\n BasePrepare: {\n get(): typeof BasePrepare\n {\n deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare');\n\n return PIXI.BasePrepare;\n },\n },\n /**\n * @class PIXI.prepare.Prepare\n * @deprecated since 5.2.1\n * @see PIXI.Prepare\n */\n Prepare: {\n get(): typeof Prepare\n {\n deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n },\n /**\n * @class PIXI.prepare.CanvasPrepare\n * @deprecated since 5.2.1\n * @see PIXI.CanvasPrepare\n */\n CanvasPrepare: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare');\n\n return PIXI.CanvasPrepare;\n },\n },\n });\n\n /**\n * @namespace PIXI.extract\n * @see PIXI\n * @deprecated since 5.2.1\n */\n PIXI.extract = {};\n\n Object.defineProperties(PIXI.extract, {\n /**\n * @class PIXI.extract.Extract\n * @deprecated since 5.2.1\n * @see PIXI.Extract\n */\n Extract: {\n get(): typeof Extract\n {\n deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n },\n /**\n * @class PIXI.extract.CanvasExtract\n * @deprecated since 5.2.1\n * @see PIXI.CanvasExtract\n */\n CanvasExtract: {\n get(): $FixLegacy\n {\n deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract');\n\n return PIXI.CanvasExtract;\n },\n },\n });\n\n /**\n * This namespace has been removed. All classes previous nested\n * under this namespace have been moved to the top-level `PIXI` object.\n * @namespace PIXI.extras\n * @deprecated since 5.0.0\n */\n PIXI.extras = {};\n\n Object.defineProperties(PIXI.extras, {\n /**\n * @class PIXI.extras.TilingSprite\n * @see PIXI.TilingSprite\n * @deprecated since 5.0.0\n */\n TilingSprite: {\n get(): typeof TilingSprite\n {\n deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite');\n\n return PIXI.TilingSprite;\n },\n },\n /**\n * @class PIXI.extras.TilingSpriteRenderer\n * @see PIXI.TilingSpriteRenderer\n * @deprecated since 5.0.0\n */\n TilingSpriteRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer');\n\n return PIXI.TilingSpriteRenderer;\n },\n },\n /**\n * @class PIXI.extras.AnimatedSprite\n * @see PIXI.AnimatedSprite\n * @deprecated since 5.0.0\n */\n AnimatedSprite: {\n get(): typeof AnimatedSprite\n {\n deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite');\n\n return PIXI.AnimatedSprite;\n },\n },\n /**\n * @class PIXI.extras.BitmapText\n * @see PIXI.BitmapText\n * @deprecated since 5.0.0\n */\n BitmapText: {\n get(): typeof BitmapText\n {\n deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText');\n\n return PIXI.BitmapText;\n },\n },\n });\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromFrame\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromFrame = function fromFrame(frameId: string, width: number, height: number): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from');\n\n return PIXI.TilingSprite.from(frameId, { width, height });\n };\n\n /**\n * @static\n * @method PIXI.TilingSprite.fromImage\n * @deprecated since 5.3.0\n * @see PIXI.TilingSprite.from\n */\n PIXI.TilingSprite.fromImage = function fromImage(\n imageId: string,\n width: number,\n height: number,\n options: any = {}): TilingSprite\n {\n deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from');\n\n // Fallback support for crossorigin, scaleMode parameters\n if (options && typeof options !== 'object')\n {\n options = {\n // eslint-disable-next-line prefer-rest-params\n scaleMode: arguments[4],\n resourceOptions: {\n // eslint-disable-next-line prefer-rest-params\n crossorigin: arguments[3],\n },\n };\n }\n\n options.width = width;\n options.height = height;\n\n return PIXI.TilingSprite.from(imageId, options);\n };\n\n Object.defineProperties(PIXI.utils, {\n /**\n * @function PIXI.utils.getSvgSize\n * @see PIXI.resources.SVGResource.getSize\n * @deprecated since 5.0.0\n */\n getSvgSize: {\n get(): typeof resources.SVGResource.getSize\n {\n deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize');\n\n return PIXI.resources.SVGResource.getSize;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.mesh\n * @deprecated since 5.0.0\n */\n PIXI.mesh = {};\n\n Object.defineProperties(PIXI.mesh, {\n /**\n * @class PIXI.mesh.Mesh\n * @see PIXI.SimpleMesh\n * @deprecated since 5.0.0\n */\n Mesh: {\n get(): typeof SimpleMesh\n {\n deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh');\n\n return PIXI.SimpleMesh;\n },\n },\n /**\n * @class PIXI.mesh.NineSlicePlane\n * @see PIXI.NineSlicePlane\n * @deprecated since 5.0.0\n */\n NineSlicePlane: {\n get(): typeof NineSlicePlane\n {\n deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane');\n\n return PIXI.NineSlicePlane;\n },\n },\n /**\n * @class PIXI.mesh.Plane\n * @see PIXI.SimplePlane\n * @deprecated since 5.0.0\n */\n Plane: {\n get(): typeof SimplePlane\n {\n deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane');\n\n return PIXI.SimplePlane;\n },\n },\n /**\n * @class PIXI.mesh.Rope\n * @see PIXI.SimpleRope\n * @deprecated since 5.0.0\n */\n Rope: {\n get(): typeof SimpleRope\n {\n deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope');\n\n return PIXI.SimpleRope;\n },\n },\n /**\n * @class PIXI.mesh.RawMesh\n * @see PIXI.Mesh\n * @deprecated since 5.0.0\n */\n RawMesh: {\n get(): typeof Mesh\n {\n deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh');\n\n return PIXI.Mesh;\n },\n },\n /**\n * @class PIXI.mesh.CanvasMeshRenderer\n * @see PIXI.CanvasMeshRenderer\n * @deprecated since 5.0.0\n */\n CanvasMeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer');\n\n return PIXI.CanvasMeshRenderer;\n },\n },\n /**\n * @class PIXI.mesh.MeshRenderer\n * @see PIXI.MeshRenderer\n * @deprecated since 5.0.0\n */\n MeshRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer');\n\n return PIXI.MeshRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.particles\n * @deprecated since 5.0.0\n */\n PIXI.particles = {};\n\n Object.defineProperties(PIXI.particles, {\n /**\n * @class PIXI.particles.ParticleContainer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleContainer\n */\n ParticleContainer: {\n get(): typeof ParticleContainer\n {\n deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer');\n\n return PIXI.ParticleContainer;\n },\n },\n /**\n * @class PIXI.particles.ParticleRenderer\n * @deprecated since 5.0.0\n * @see PIXI.ParticleRenderer\n */\n ParticleRenderer: {\n get(): $FixLegacy\n {\n deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer');\n\n return PIXI.ParticleRenderer;\n },\n },\n });\n\n /**\n * This namespace has been removed and items have been moved to\n * the top-level `PIXI` object.\n * @namespace PIXI.ticker\n * @deprecated since 5.0.0\n */\n PIXI.ticker = {};\n\n Object.defineProperties(PIXI.ticker, {\n /**\n * @class PIXI.ticker.Ticker\n * @deprecated since 5.0.0\n * @see PIXI.Ticker\n */\n Ticker: {\n get(): typeof Ticker\n {\n deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker');\n\n return PIXI.Ticker;\n },\n },\n /**\n * @name PIXI.ticker.shared\n * @type {PIXI.Ticker}\n * @deprecated since 5.0.0\n * @see PIXI.Ticker.shared\n */\n shared: {\n get(): Ticker\n {\n deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared');\n\n return PIXI.Ticker.shared;\n },\n },\n });\n\n /**\n * All classes on this namespace have moved to the high-level `PIXI` object.\n * @namespace PIXI.loaders\n * @deprecated since 5.0.0\n */\n PIXI.loaders = {};\n\n Object.defineProperties(PIXI.loaders, {\n /**\n * @class PIXI.loaders.Loader\n * @see PIXI.Loader\n * @deprecated since 5.0.0\n */\n Loader: {\n get(): typeof Loader\n {\n deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader');\n\n return PIXI.Loader;\n },\n },\n /**\n * @class PIXI.loaders.Resource\n * @see PIXI.LoaderResource\n * @deprecated since 5.0.0\n */\n Resource: {\n get(): typeof LoaderResource\n {\n deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource');\n\n return PIXI.LoaderResource;\n },\n },\n /**\n * @function PIXI.loaders.bitmapFontParser\n * @see PIXI.BitmapFontLoader.use\n * @deprecated since 5.0.0\n */\n bitmapFontParser: {\n get(): typeof BitmapFontLoader.use\n {\n deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use');\n\n return PIXI.BitmapFontLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.parseBitmapFontData\n * @deprecated since 5.0.0\n */\n parseBitmapFontData: {\n get(): void\n {\n deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed');\n },\n },\n /**\n * @function PIXI.loaders.spritesheetParser\n * @see PIXI.SpritesheetLoader.use\n * @deprecated since 5.0.0\n */\n spritesheetParser: {\n get(): typeof SpritesheetLoader.use\n {\n deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use');\n\n return PIXI.SpritesheetLoader.use;\n },\n },\n /**\n * @function PIXI.loaders.getResourcePath\n * @see PIXI.SpritesheetLoader.getResourcePath\n * @deprecated since 5.0.0\n */\n getResourcePath: {\n get(): typeof SpritesheetLoader.getResourcePath\n {\n deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath');\n\n return PIXI.SpritesheetLoader.getResourcePath;\n },\n },\n });\n\n /**\n * @function PIXI.loaders.Loader.addPixiMiddleware\n * @see PIXI.Loader.registerPlugin\n * @deprecated since 5.0.0\n * @param {function} middleware\n */\n PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware: any): typeof Loader\n {\n deprecation(v5,\n 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'\n );\n\n return PIXI.loaders.Loader.registerPlugin({ use: middleware() });\n };\n\n // convenience for converting event name to signal name\n const eventToSignal = (event: any): string =>\n `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n\n Object.assign(PIXI.Loader.prototype,\n {\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#on\n * @deprecated since 5.0.0\n */\n on(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#on is completely deprecated, use PIXI.Loader#${signal}.add`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#once\n * @deprecated since 5.0.0\n */\n once(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#once is completely deprecated, use PIXI.Loader#${signal}.once`);\n },\n /**\n * Use the corresponding signal, e.g., event `start`` is signal `onStart`.\n * @method PIXI.Loader#off\n * @deprecated since 5.0.0\n */\n off(event: any)\n {\n const signal = eventToSignal(event);\n\n deprecation(v5, `PIXI.Loader#off is completely deprecated, use PIXI.Loader#${signal}.detach`);\n },\n });\n\n /**\n * @class PIXI.extract.WebGLExtract\n * @deprecated since 5.0.0\n * @see PIXI.Extract\n */\n Object.defineProperty(PIXI.extract, 'WebGLExtract', {\n get(): typeof Extract\n {\n deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract');\n\n return PIXI.Extract;\n },\n });\n\n /**\n * @class PIXI.prepare.WebGLPrepare\n * @deprecated since 5.0.0\n * @see PIXI.Prepare\n */\n Object.defineProperty(PIXI.prepare, 'WebGLPrepare', {\n get(): typeof Prepare\n {\n deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare');\n\n return PIXI.Prepare;\n },\n });\n\n /**\n * @method PIXI.Container#_renderWebGL\n * @private\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype._renderWebGL = function _renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render');\n\n this._render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderWebGL = function renderWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.DisplayObject#renderWebGL\n * @deprecated since 5.0.0\n * @see PIXI.DisplayObject#render\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(this: DisplayObject, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render');\n\n this.render(renderer);\n };\n\n /**\n * @method PIXI.Container#renderAdvancedWebGL\n * @deprecated since 5.0.0\n * @see PIXI.Container#renderAdvanced\n * @param {PIXI.Renderer} renderer Instance of renderer\n */\n PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(this: Container, renderer: Renderer): void\n {\n deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced');\n\n this.renderAdvanced(renderer);\n };\n\n Object.defineProperties(PIXI.settings, {\n /**\n * Default transform type.\n *\n * @static\n * @deprecated since 5.0.0\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: {\n get(): number\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n\n return 0;\n },\n set(): void\n {\n deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed');\n },\n },\n });\n\n const { BaseTexture: BaseTextureAny } = PIXI;\n\n /**\n * @method loadSource\n * @memberof PIXI.BaseTexture#\n * @deprecated since 5.0.0\n */\n BaseTextureAny.prototype.loadSource = function loadSource(image: string | HTMLImageElement): void\n {\n deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated');\n\n const resource = PIXI.resources.autoDetectResource(image);\n\n resource.internal = true;\n\n this.setResource(resource);\n this.update();\n };\n\n let baseTextureIdDeprecation = false;\n\n Object.defineProperties(BaseTextureAny.prototype, {\n /**\n * @name PIXI.BaseTexture#hasLoaded\n * @type {boolean}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.BaseTexture#valid\n */\n hasLoaded: {\n get(): boolean\n {\n deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid');\n\n return this.valid;\n },\n },\n /**\n * @name PIXI.BaseTexture#imageUrl\n * @type {string}\n * @deprecated since 5.0.0\n * @see PIXI.resources.ImageResource#url\n */\n imageUrl: {\n get(this: BaseTexture): string\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n return (this.resource as resources.ImageResource)?.url;\n },\n\n set(this: BaseTexture, imageUrl: string): void\n {\n deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url');\n\n if (this.resource)\n {\n (this.resource as resources.ImageResource).url = imageUrl;\n }\n },\n },\n /**\n * @name PIXI.BaseTexture#source\n * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @deprecated since 5.0.0\n * @readonly\n * @see PIXI.resources.BaseImageResource#source\n */\n source: {\n get(this: BaseTexture): ImageSource\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`');\n\n return (this.resource as resources.BaseImageResource).source;\n },\n set(this: BaseTexture, source: ImageSource): void\n {\n deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` '\n + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.');\n\n if (this.resource)\n {\n (this.resource as resources.BaseImageResource).source = source;\n }\n },\n },\n\n /**\n * @name PIXI.BaseTexture#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.BaseTexture#alphaMode\n */\n premultiplyAlpha: {\n get(this: BaseTexture): boolean\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: BaseTexture, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`'\n + ', see `PIXI.ALPHA_MODES`');\n\n this.alphaMode = Number(value);\n },\n },\n /**\n * Batch local field, stores current texture location\n *\n * @name PIXI.BaseTexture#_id\n * @deprecated since 5.2.0\n * @type {number}\n * @see PIXI.BaseTexture#_batchLocation\n */\n _id: {\n get(this: BaseTexture): number\n {\n if (!baseTextureIdDeprecation)\n {\n // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible\n deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`');\n baseTextureIdDeprecation = true;\n }\n\n return this._batchLocation;\n },\n set(this: BaseTexture, value: number): void\n {\n this._batchLocation = value;\n },\n },\n });\n\n /**\n * @method fromImage\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromImage = function fromImage(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n /**\n * @method fromCanvas\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromCanvas = function fromCanvas(canvas: HTMLCanvasElement, scaleMode: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from');\n\n return BaseTextureAny.from(canvas, { scaleMode });\n };\n\n /**\n * @method fromSVG\n * @static\n * @memberof PIXI.BaseTexture\n * @deprecated since 5.0.0\n * @see PIXI.BaseTexture.from\n */\n BaseTextureAny.fromSVG = function fromSVG(\n canvas: HTMLCanvasElement,\n crossorigin: string | boolean,\n scaleMode: number,\n scale: number): BaseTexture\n {\n deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from');\n\n const resourceOptions = { scale, crossorigin };\n\n return BaseTextureAny.from(canvas, { scaleMode, resourceOptions });\n };\n\n Object.defineProperties(PIXI.resources.ImageResource.prototype, {\n /**\n * @name PIXI.resources.ImageResource#premultiplyAlpha\n * @type {boolean}\n * @deprecated since 5.2.0\n * @readonly\n * @see PIXI.resources.ImageResource#alphaMode\n */\n premultiplyAlpha: {\n get(this: resources.ImageResource): boolean\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n\n return this.alphaMode !== 0;\n },\n set(this: resources.ImageResource, value: boolean): void\n {\n deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property '\n + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`');\n this.alphaMode = Number(value);\n },\n },\n });\n\n /**\n * @method PIXI.Point#copy\n * @deprecated since 5.0.0\n * @see PIXI.Point#copyFrom\n */\n PIXI.Point.prototype.copy = function copy(this: Point, p: IPoint): Point\n {\n deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.ObservablePoint#copy\n * @deprecated since 5.0.0\n * @see PIXI.ObservablePoint#copyFrom\n */\n PIXI.ObservablePoint.prototype.copy = function copy(this: ObservablePoint, p: IPoint): ObservablePoint\n {\n deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Rectangle#copy\n * @deprecated since 5.0.0\n * @see PIXI.Rectangle#copyFrom\n */\n PIXI.Rectangle.prototype.copy = function copy(this: Rectangle, p: Rectangle): Rectangle\n {\n deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom');\n\n return this.copyFrom(p);\n };\n\n /**\n * @method PIXI.Matrix#copy\n * @deprecated since 5.0.0\n * @see PIXI.Matrix#copyTo\n */\n PIXI.Matrix.prototype.copy = function copy(this: Matrix, p: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo');\n\n return this.copyTo(p);\n };\n\n /**\n * @method PIXI.systems.StateSystem#setState\n * @deprecated since 5.1.0\n * @see PIXI.systems.StateSystem#set\n */\n PIXI.systems.StateSystem.prototype.setState = function setState(this: systems.StateSystem, s: State): void\n {\n deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set');\n\n return this.set(s);\n };\n\n Object.assign(PIXI.systems.FilterSystem.prototype, {\n /**\n * @method PIXI.FilterManager#getRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#getFilterTexture\n */\n getRenderTarget(this: systems.FilterSystem, _clear: boolean, resolution: number)\n {\n deprecation(v5,\n 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'\n );\n\n return this.getFilterTexture(null, resolution);\n },\n\n /**\n * @method PIXI.FilterManager#returnRenderTarget\n * @deprecated since 5.0.0\n * @see PIXI.systems.FilterSystem#returnFilterTexture\n */\n returnRenderTarget(this: systems.FilterSystem, renderTexture: any)\n {\n deprecation(v5,\n 'PIXI.FilterManager.returnRenderTarget method has been replaced with '\n + 'PIXI.systems.FilterSystem.returnFilterTexture'\n );\n\n this.returnFilterTexture(renderTexture);\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: any)\n {\n deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, '\n + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead');\n\n const mappedMatrix = outputMatrix.identity();\n const { sourceFrame, destinationFrame } = this.activeState;\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n mappedMatrix.scale(destinationFrame.width, destinationFrame.height);\n\n return mappedMatrix;\n },\n\n /**\n * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix\n * @deprecated since 5.0.0\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix(this: systems.FilterSystem, outputMatrix: Matrix): Matrix\n {\n deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, '\n + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.');\n\n const { sourceFrame, destinationFrame } = this.activeState;\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height);\n\n const translateScaleX = (destinationFrame.width / sourceFrame.width);\n const translateScaleY = (destinationFrame.height / sourceFrame.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n },\n });\n\n Object.defineProperties(PIXI.RenderTexture.prototype, {\n /**\n * @name PIXI.RenderTexture#sourceFrame\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n sourceFrame: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed');\n\n return this.filterFrame;\n },\n },\n /**\n * @name PIXI.RenderTexture#size\n * @type {PIXI.Rectangle}\n * @deprecated since 5.0.0\n * @readonly\n */\n size: {\n get(this: RenderTexture): Rectangle\n {\n deprecation(v5, 'PIXI.RenderTexture.size property has been removed');\n\n return this._frame;\n },\n },\n });\n\n /**\n * @class BlurXFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurXFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(true, strength, quality, resolution, kernelSize);\n }\n }\n\n /**\n * @class BlurYFilter\n * @memberof PIXI.filters\n * @deprecated since 5.0.0\n * @see PIXI.filters.BlurFilterPass\n */\n class BlurYFilter extends PIXI.filters.BlurFilterPass\n {\n constructor(strength: number, quality: number, resolution: number, kernelSize: number)\n {\n deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass');\n\n super(false, strength, quality, resolution, kernelSize);\n }\n }\n\n Object.assign(PIXI.filters, {\n BlurXFilter,\n BlurYFilter,\n });\n\n const {\n Sprite: SpriteAny,\n Texture: TextureAny,\n Graphics: GraphicsAny } = PIXI;\n\n // Support for pixi.js-legacy bifurcation\n // give users a friendly assist to use legacy\n if (!GraphicsAny.prototype.generateCanvasTexture)\n {\n GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture(): void\n {\n deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in \"pixi.js-legacy\"');\n };\n }\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.Graphics} PIXI.Graphics#graphicsData\n * @see PIXI.Graphics#geometry\n * @readonly\n */\n Object.defineProperty(GraphicsAny.prototype, 'graphicsData', {\n get(this: Graphics): GraphicsData[]\n {\n deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData');\n\n return this.geometry.graphicsData;\n },\n });\n\n // Use these to deprecate all the Sprite from* methods\n function spriteFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Sprite\n {\n deprecation(v5, `PIXI.Sprite.${name} method is deprecated, use PIXI.Sprite.from`);\n\n return SpriteAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @see PIXI.Sprite.from\n * @method PIXI.Sprite.fromImage\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromSVG\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromCanvas\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromVideo\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Sprite.fromFrame\n * @see PIXI.Sprite.from\n * @return {PIXI.Sprite}\n */\n SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame');\n\n // Use these to deprecate all the Texture from* methods\n function textureFrom(name: string, source: string, crossorigin: string | boolean, scaleMode: number): Texture\n {\n deprecation(v5, `PIXI.Texture.${name} method is deprecated, use PIXI.Texture.from`);\n\n return TextureAny.from(source, {\n resourceOptions: {\n scale: scaleMode,\n crossorigin,\n },\n });\n }\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromImage\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromImage = textureFrom.bind(null, 'fromImage');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromSVG\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromCanvas\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromVideo\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo');\n\n /**\n * @deprecated since 5.0.0\n * @method PIXI.Texture.fromFrame\n * @see PIXI.Texture.from\n * @return {PIXI.Texture}\n */\n TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame');\n\n /**\n * @deprecated since 5.0.0\n * @member {boolean} PIXI.AbstractRenderer#autoResize\n * @see PIXI.AbstractRenderer#autoDensity\n */\n Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', {\n get(this: AbstractRenderer): boolean\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n return this.autoDensity;\n },\n set(this: any, value: boolean): void\n {\n deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, '\n + 'use PIXI.AbstractRenderer.autoDensity');\n\n this.autoDensity = value;\n },\n });\n\n /**\n * @deprecated since 5.0.0\n * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager\n * @see PIXI.Renderer#texture\n */\n Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', {\n get(this: Renderer)\n {\n deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture');\n\n return this.texture;\n },\n });\n\n /**\n * @namespace PIXI.utils.mixins\n * @deprecated since 5.0.0\n */\n PIXI.utils.mixins = {\n /**\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @deprecated since 5.0.0\n */\n mixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @deprecated since 5.0.0\n */\n delayMixin(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available');\n },\n /**\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @deprecated since 5.0.0\n */\n performMixins(): void\n {\n deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available');\n },\n };\n\n /**\n * @memberof PIXI.BitmapText\n * @member {object} font\n * @deprecated since 5.3.0\n */\n Object.defineProperty(PIXI.BitmapText.prototype, 'font', {\n get(this: BitmapText): any\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n return {\n name: this._fontName,\n size: this._fontSize,\n tint: this._tint,\n align: this._align,\n };\n },\n set(this: BitmapText, value: any)\n {\n deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, '\n + 'use fontName, fontSize, tint or align properties');\n\n if (!value)\n {\n return;\n }\n\n const style: any = { font: value };\n\n this._upgradeStyle(style);\n\n style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size;\n\n this._fontName = style.fontName;\n this._fontSize = style.fontSize;\n\n this.dirty = true;\n },\n });\n}\n","import { MeshGeometry } from '@pixi/mesh';\n\nexport class PlaneGeometry extends MeshGeometry\n{\n public segWidth: number;\n public segHeight: number;\n public width: number;\n public height: number;\n\n constructor(width = 100, height = 100, segWidth = 10, segHeight = 10)\n {\n super();\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n build(): void\n {\n const total = this.segWidth * this.segHeight;\n const verts = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.segWidth - 1;\n const segmentsY = this.segHeight - 1;\n\n const sizeX = (this.width) / segmentsX;\n const sizeY = (this.height) / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.segWidth);\n const y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.segWidth) + xpos;\n const value2 = (ypos * this.segWidth) + xpos + 1;\n const value3 = ((ypos + 1) * this.segWidth) + xpos;\n const value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nexport class RopeGeometry extends MeshGeometry\n{\n public points: IPoint[];\n public readonly textureScale: number;\n _width: number;\n\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n constructor(width = 200, points: IPoint[], textureScale = 0)\n {\n super(new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this._width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n private build(): void\n {\n const points = this.points;\n\n if (!points) return;\n\n const vertexBuffer = this.getBuffer('aVertexPosition');\n const uvBuffer = this.getBuffer('aTextureCoord');\n const indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n const uvs = uvBuffer.data;\n const indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n let amount = 0;\n let prev = points[0];\n const textureWidth = this._width * this.textureScale;\n const total = points.length; // - 1;\n\n for (let i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n const index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n const dx = prev.x - points[i].x;\n const dy = prev.y - points[i].y;\n const distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n let indexCount = 0;\n\n for (let i = 0; i < total - 1; i++)\n {\n const index = i * 2;\n\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n public updateVertices(): void\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n const vertices = this.buffers[0].data;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n }\n\n public update(): void\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n }\n}\n","import { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { RopeGeometry } from './geometry/RopeGeometry';\n\nimport type { Texture, Renderer } from '@pixi/core';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimpleRope extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be streched instead.\n */\n constructor(texture: Texture, points: IPoint[], textureScale = 0)\n {\n const ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n const meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n super(ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n _render(renderer: Renderer): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.shader.texture.height)\n {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { PlaneGeometry } from './geometry/PlaneGeometry';\n\nimport type{ Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n *\n */\nexport class SimplePlane extends Mesh\n{\n protected _textureID: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the SimplePlane.\n * @param {number} verticesX - The number of vertices in the x-axis\n * @param {number} verticesY - The number of vertices in the y-axis\n */\n constructor(texture: Texture, verticesX: number, verticesY: number)\n {\n const planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n const meshMaterial = new MeshMaterial(Texture.WHITE);\n\n super(planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n\n const geometry: PlaneGeometry = this.geometry as any;\n\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n\n geometry.build();\n }\n\n set texture(value: Texture)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n }\n\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n _render(renderer: Renderer): void\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n super._render(renderer);\n }\n\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.shader.texture.off('update', this.textureUpdated, this);\n super.destroy(options);\n }\n}\n","import { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { Texture } from '@pixi/core';\n\nimport type { ITypedArray, IArrayBuffer, Renderer } from '@pixi/core';\nimport type { DRAW_MODES } from '@pixi/constants';\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @class\n * @extends PIXI.Mesh\n * @memberof PIXI\n */\nexport class SimpleMesh extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(\n texture = Texture.EMPTY,\n vertices?: IArrayBuffer,\n uvs?: IArrayBuffer,\n indices?: IArrayBuffer,\n drawMode?: DRAW_MODES\n )\n {\n const geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n const meshMaterial = new MeshMaterial(texture);\n\n super(geometry, meshMaterial, null, drawMode);\n\n /**\n * upload vertices buffer each frame\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n /**\n * Collection of vertices data.\n * @member {Float32Array}\n */\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n _render(renderer: Renderer): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SimplePlane } from './SimplePlane';\n\nimport type { ITypedArray } from '@pixi/core';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface NineSlicePlane extends GlobalMixins.NineSlicePlane {}\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *

\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @class\n * @extends PIXI.SimplePlane\n * @memberof PIXI\n *\n */\nexport class NineSlicePlane extends SimplePlane\n{\n private _origWidth: number;\n private _origHeight: number;\n _leftWidth: number;\n _rightWidth: number;\n _topHeight: number;\n _bottomHeight: number;\n\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n constructor(\n texture: Texture,\n leftWidth = DEFAULT_BORDER_SIZE,\n topHeight = DEFAULT_BORDER_SIZE,\n rightWidth = DEFAULT_BORDER_SIZE,\n bottomHeight = DEFAULT_BORDER_SIZE\n )\n {\n super(Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @private\n */\n this._leftWidth = leftWidth;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @private\n */\n this._rightWidth = rightWidth;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @private\n */\n this._topHeight = topHeight;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @private\n */\n this._bottomHeight = bottomHeight;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n }\n\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n /**\n * Updates the horizontal vertices.\n *\n */\n public updateHorizontalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /**\n * Updates the vertical vertices.\n *\n */\n public updateVerticalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return {number} Smaller number of vertical and horizontal scale.\n * @private\n */\n private _getMinScale(): number\n {\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this._width > w ? 1.0 : this._width / w;\n\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this._height > h ? 1.0 : this._height / h;\n\n const scale = Math.min(scaleW, scaleH);\n\n return scale;\n }\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n this._refresh();\n }\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n this._refresh();\n }\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get leftWidth(): number\n {\n return this._leftWidth;\n }\n\n set leftWidth(value: number)\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get rightWidth(): number\n {\n return this._rightWidth;\n }\n\n set rightWidth(value: number)\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get topHeight(): number\n {\n return this._topHeight;\n }\n\n set topHeight(value: number)\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get bottomHeight(): number\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value: number)\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n private _refresh(): void\n {\n const texture = this.texture;\n\n const uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport class AnimatedSprite extends Sprite\n{\n public animationSpeed: number;\n public loop: boolean;\n public updateAnchor: boolean;\n public onComplete: () => void;\n public onFrameChange: (currentFrame: number) => void;\n public onLoop: () => void;\n\n private _playing: boolean;\n private _textures: Texture[];\n private _durations: number[];\n private _autoUpdate: boolean;\n private _isConnectedToTicker: boolean;\n private _currentTime: number;\n private _previousFrame: number;\n\n /**\n * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n constructor(textures: Texture[]|FrameObject[], autoUpdate = true)\n {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n /**\n * @type {PIXI.Texture[]}\n * @private\n */\n this._textures = null;\n\n /**\n * @type {number[]}\n * @private\n */\n this._durations = null;\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @type {boolean}\n * @default false\n * @private\n */\n this._isConnectedToTicker = false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture.\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n this._playing = false;\n\n /**\n * The texture index that was displayed last time\n *\n * @member {number}\n * @private\n */\n this._previousFrame = null;\n\n this.textures = textures;\n }\n\n /**\n * Stops the AnimatedSprite.\n *\n */\n public stop(): void\n {\n if (!this._playing)\n {\n return;\n }\n\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /**\n * Plays the AnimatedSprite.\n *\n */\n public play(): void\n {\n if (this._playing)\n {\n return;\n }\n\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param {number} frameNumber - Frame index to stop at.\n */\n public gotoAndStop(frameNumber: number): void\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param {number} frameNumber - Frame index to start at.\n */\n public gotoAndPlay(frameNumber: number): void\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @param {number} deltaTime - Time since last tick.\n */\n update(deltaTime: number): void\n {\n if (!this._playing)\n {\n return;\n }\n\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /**\n * Updates the displayed texture to match the current frame index.\n *\n * @private\n */\n private updateTexture(): void\n {\n const currentFrame = this.currentFrame;\n\n if (this._previousFrame === currentFrame)\n {\n return;\n }\n\n this._previousFrame = currentFrame;\n\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n public destroy(options: IDestroyOptions|boolean): void\n {\n this.stop();\n super.destroy(options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @static\n * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames.\n */\n public static fromFrames(frames: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @static\n * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n public static fromImages(images: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get totalFrames(): number\n {\n return this._textures.length;\n }\n\n /**\n * The array of textures used for this AnimatedSprite.\n *\n * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]}\n */\n get textures(): Texture[]|FrameObject[]\n {\n return this._textures;\n }\n\n set textures(value: Texture[]|FrameObject[])\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value as Texture[];\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push((value[i] as FrameObject).texture);\n this._durations.push((value[i] as FrameObject).time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @member {number}\n * @readonly\n */\n get currentFrame(): number\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @member {boolean}\n * @readonly\n */\n get playing(): boolean\n {\n return this._playing;\n }\n\n /**\n * Whether to use PIXI.Ticker.shared to auto update animation time\n *\n * @member {boolean}\n */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\nexport interface FrameObject {\n texture: Texture;\n time: number;\n}\n\n/**\n * @memberof PIXI.AnimatedSprite\n * @typedef {object} FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n","import '@pixi/polyfill';\n\nimport * as utils from '@pixi/utils';\nimport { AccessibilityManager } from '@pixi/accessibility';\nimport { InteractionManager } from '@pixi/interaction';\nimport { Application } from '@pixi/app';\nimport { Renderer, BatchRenderer } from '@pixi/core';\nimport { Extract } from '@pixi/extract';\nimport { Loader, AppLoaderPlugin } from '@pixi/loaders';\nimport { ParticleRenderer } from '@pixi/particles';\nimport { Prepare } from '@pixi/prepare';\nimport { SpritesheetLoader } from '@pixi/spritesheet';\nimport { TilingSpriteRenderer } from '@pixi/sprite-tiling';\nimport { BitmapFontLoader } from '@pixi/text-bitmap';\nimport { TickerPlugin } from '@pixi/ticker';\nimport { AlphaFilter } from '@pixi/filter-alpha';\nimport { BlurFilter, BlurFilterPass } from '@pixi/filter-blur';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { DisplacementFilter } from '@pixi/filter-displacement';\nimport { FXAAFilter } from '@pixi/filter-fxaa';\nimport { NoiseFilter } from '@pixi/filter-noise';\nimport '@pixi/mixin-cache-as-bitmap';\nimport '@pixi/mixin-get-child-by-name';\nimport '@pixi/mixin-get-global-position';\n\n// Export deprecations so Rollup can call it\n// in the footer after global is defined\n// other module must call this manually\nimport { useDeprecated } from './useDeprecated';\n\n// Install renderer plugins\nRenderer.registerPlugin('accessibility', AccessibilityManager);\nRenderer.registerPlugin('extract', Extract);\nRenderer.registerPlugin('interaction', InteractionManager);\nRenderer.registerPlugin('particle', ParticleRenderer);\nRenderer.registerPlugin('prepare', Prepare);\nRenderer.registerPlugin('batch', BatchRenderer);\nRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n\nLoader.registerPlugin(BitmapFontLoader);\nLoader.registerPlugin(SpritesheetLoader);\n\nApplication.registerPlugin(TickerPlugin);\nApplication.registerPlugin(AppLoaderPlugin);\n\n/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nexport const VERSION = '__VERSION__';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters\n * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the\n * PixiJS Filters repository.\n *\n * All filters must extend {@link PIXI.Filter}.\n *\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nexport const filters = {\n AlphaFilter,\n BlurFilter,\n BlurFilterPass,\n ColorMatrixFilter,\n DisplacementFilter,\n FXAAFilter,\n NoiseFilter,\n};\n\n// Export ES for those importing specifically by name,\nexport * from '@pixi/accessibility';\nexport * from '@pixi/app';\nexport * from '@pixi/constants';\nexport * from '@pixi/core';\nexport * from '@pixi/display';\nexport * from '@pixi/extract';\nexport * from '@pixi/graphics';\nexport * from '@pixi/loaders';\nexport * from '@pixi/interaction';\nexport * from '@pixi/math';\nexport * from '@pixi/mesh';\nexport * from '@pixi/mesh-extras';\nexport * from '@pixi/particles';\nexport * from '@pixi/prepare';\nexport * from '@pixi/runner';\nexport * from '@pixi/sprite';\nexport * from '@pixi/spritesheet';\nexport * from '@pixi/sprite-animated';\nexport * from '@pixi/sprite-tiling';\nexport * from '@pixi/text';\nexport * from '@pixi/text-bitmap';\nexport * from '@pixi/ticker';\nexport * from '@pixi/settings';\nexport {\n utils,\n useDeprecated,\n};\n"],"names":["global","NativePromise","nativePromiseSupported","resolve","r","exports","Promise","PENDING","SEALED","FULFILLED","REJECTED","NOOP","isArray","value","Object","prototype","toString","call","asyncTimer","asyncSetTimer","setImmediate","setTimeout","asyncQueue","asyncFlush","i","length","asyncCall","callback","arg","push","invokeCallback","subscriber","owner","settled","state_","data_","promise","then","e","reject","handleThenable","resolved","TypeError","val","fulfill","reason","publishFulfillment","publishRejection","publish","callbacks","then_","undefined","resolver","this","rejectPromise","invokeResolver","constructor","onFulfillment","onRejection","fulfilled","rejected","catch","all","promises","results","remaining","index","race","window","self","getOwnPropertySymbols","hasOwnProperty","propIsEnumerable","propertyIsEnumerable","assign","test1","String","getOwnPropertyNames","test2","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","toObject","s","arguments","key","Polyfill","objectAssign","Date","now","getTime","performance","startTime_1","lastTime","vendors","x","requestAnimationFrame","p","cancelAnimationFrame","currentTime","delay","id","clearTimeout","Math","sign","Number","isNaN","isInteger","isFinite","floor","ArrayBuffer","Array","Float32Array","Uint32Array","Uint16Array","Uint8Array","Int32Array","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","navigator","platform","maxTouchPoints","MSStream","isMobile","param","nav","userAgent","tmp","match","regex","test","createMatch","result","apple","phone","ipod","tablet","universal","device","amazon","android","windows","other","blackberry","blackberry10","opera","firefox","chrome","any","isMobileCall","settings","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","RESOLUTION","FILTER_RESOLUTION","SPRITE_MAX_TEXTURES","max","allowMax","parseInt","maxRecommendedTextures","SPRITE_BATCH_SIZE","RENDER_OPTIONS","view","antialias","autoDensity","transparent","backgroundColor","clearBeforeRender","preserveDrawingBuffer","width","height","legacy","GC_MODE","GC_MAX_IDLE","GC_MAX_CHECK_COUNT","WRAP_MODE","SCALE_MODE","PRECISION_VERTEX","PRECISION_FRAGMENT","CAN_UPLOAD_SAME_BUFFER","CREATE_IMAGE_BITMAP","ROUND_PIXELS","has","prefix","Events","EE","fn","context","once","addListener","emitter","event","listener","evt","_events","_eventsCount","clearEvent","EventEmitter","create","__proto__","eventNames","events","name","names","slice","concat","listeners","handlers","l","ee","listenerCount","emit","a1","a2","a3","a4","a5","args","len","removeListener","apply","j","on","removeAllListeners","off","prefixed","module","earcut","data","holeIndices","dim","minX","minY","maxX","maxY","y","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","next","prev","start","end","list","queue","steiner","getLeftmost","sort","compareX","eliminateHole","filterPoints","eliminateHoles","earcutLinked","clockwise","last","signedArea","insertNode","equals","removeNode","again","area","ear","pass","z","zOrder","prevZ","nextZ","q","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","stop","isEarHashed","isEar","cureLocalIntersections","splitEarcut","a","b","c","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","maxZ","intersects","locallyInside","isValidDiagonal","splitPolygon","hole","m","hx","hy","qx","Infinity","tan","mx","my","tanMin","abs","sectorContainsSector","findHoleBridge","leftmost","ax","ay","bx","by","cx","cy","px","py","intersectsPolygon","inside","middleInside","p1","p2","q1","q2","o1","o2","o3","o4","onSegment","min","num","Node","b2","an","bp","sum","deviation","polygonArea","trianglesArea","flatten","vertices","holes","dimensions","holeIndex","d","root","freeExports","nodeType","freeModule","freeGlobal","punycode","maxInt","base","tMin","tMax","skew","damp","initialBias","initialN","delimiter","regexPunycode","regexNonASCII","regexSeparators","errors","overflow","not-basic","invalid-input","baseMinusTMin","stringFromCharCode","error","type","RangeError","array","mapDomain","string","parts","replace","ucs2decode","extra","output","counter","charCodeAt","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","k","decode","input","out","basic","oldi","w","t","baseMinusT","codePoint","inputLength","bias","lastIndexOf","splice","encode","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","version","ucs2","toASCII","toUnicode","toLowerCase","isString","isObject","isNull","isNullOrUndefined","obj","prop","qs","sep","eq","options","regexp","maxKeys","kstr","vstr","v","idx","indexOf","substr","decodeURIComponent","stringifyPrimitive","ks","encodeURIComponent","require$$0","require$$1","urlParse","relative","resolveObject","util","Url","format","protocol","slashes","auth","host","port","hostname","hash","search","query","pathname","path","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","javascript","javascript:","hostlessProtocol","slashedProtocol","http","https","ftp","gopher","file","http:","https:","ftp:","gopher:","file:","url","parseQueryString","slashesDenoteHost","u","parse","queryIndex","splitter","uSplit","rest","trim","simplePath","exec","querystring","proto","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","part","newpart","validParts","notHost","bit","unshift","h","ae","esc","escape","qm","stringify","charAt","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","shift","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","pop","authInHost","hasTrailingSlash","up","isAbsolute","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","VERSION","sayHello","_a","console","log","isWebGLSupported","contextOptions","stencil","failIfMajorPerformanceCaveat","WebGLRenderingContext","canvas","document","createElement","gl","getContext","success","getContextAttributes","loseContext","getExtension","hex2rgb","hex","hex2string","hexString","string2hex","premultiplyBlendMode","pm","npm","NORMAL_NPM","NORMAL","ADD_NPM","ADD","SCREEN_NPM","SCREEN","mapPremultipliedBlendModes","correctBlendMode","blendMode","premultiplied","premultiplyRgba","rgb","alpha","premultiply","premultiplyTint","tint","R","G","B","premultiplyTintToRgba","createIndicesForQuads","size","outBuffer","totalIndices","Error","getBufferType","BYTES_PER_ELEMENT","nextPow2","isPow2","log2","removeItems","arr","startIdx","removeCount","nextUid","uid","warnings","deprecation","message","ignoreDepth","stack","warn","groupCollapsed","groupEnd","ProgramCache","TextureCache","BaseTextureCache","resolution","resize","CanvasRenderTarget","setTransform","clearRect","trimCanvas","pixels","getImageData","bound","top","left","right","bottom","tempAnchor","DATA_URI","determineCrossOrigin","loc","location","parsedUrl","_url.parse","samePort","getResolutionOfUrl","defaultValue","parseFloat","SHAPES","dataUri","dataUriMatch","mediaType","subType","charset","encoding","destroy","arrays","sizes","outSize","stride","views","buffer","littleOffset","PI_2","PI","RAD_TO_DEG","DEG_TO_RAD","RECT","Rectangle","rectangle","paddingX","paddingY","x1","x2","y1","y2","eps","ceil","radius","CIRC","Circle","r2","dx","dy","halfWidth","halfHeight","ELIP","Ellipse","normx","normy","_i","points","flat","il","POLY","closeStroke","Polygon","polygon","xi","yi","xj","yj","RREC","RoundedRectangle","radius2","Point","set","cb","scope","_x","_y","ObservablePoint","tx","ty","Matrix","transpose","pos","newPos","angle","cos","sin","c1","tx1","matrix","b1","d1","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","transform","atan2","scale","sqrt","position","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","mat","init","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","add","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","append","worldTransform","localTransform","onChange","pivot","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","Transform","lt","parentTransform","pt","wt","decompose","SORTABLE_CHILDREN","rect","updateID","Bounds","EMPTY","point","x0","y0","addFrameMatrix","vertexData","beginOffset","endOffset","addVerticesMatrix","padX","padY","rawX","rawY","bounds","mask","_minX","_minY","_maxX","_maxY","isEmpty","extendStatics","setPrototypeOf","__extends","__","_super","_this","tempDisplayObjectParent","visible","renderable","parent","worldAlpha","_lastSortedIndex","_zIndex","filterArea","filters","_enabledFilters","_bounds","_localBounds","_boundsID","_boundsRect","_localBoundsRect","_mask","_destroyed","isSprite","isMask","DisplayObject","propertyName","defineProperty","getOwnPropertyDescriptor","_recursivePostUpdateTransform","updateTransform","_tempDisplayObjectParent","skipUpdate","calculateBounds","getRectangle","transformRef","parentRef","worldBounds","worldBoundsID","getBounds","displayObjectUpdateTransform","toGlobal","applyInverse","container","addChild","_options","removeChild","hitArea","interactive","interactiveChildren","TemporaryDisplayObject","myParent","cacheParent","copyFrom","sortDirty","item","maskObject","sortChildren","zIndex","children","sortableChildren","Container","_length","child","onChildrenChange","child2","index1","getChildIndex","index2","currentIndex","getChildAt","beginIndex","endIndex","removed","begin","range","sortRequired","clear","_calculateBounds","addBoundsMask","addBoundsArea","addBounds","skipChildrenUpdate","getLocalBounds","renderer","renderAdvanced","_render","render","batch","flush","enabled","filter","_renderer","destroyChildren","oldChildren","removeChildren","_width","_height","containerUpdateTransform","accessibleTarget","accessible","accessibleTitle","accessibleHint","tabIndex","_accessibleActive","_accessibleDiv","accessibleType","accessiblePointerEvents","accessibleChildren","renderId","mixin","UPDATE_PRIORITY","DIV_TOUCH_SIZE","DIV_TOUCH_POS_X","DIV_TOUCH_POS_Y","DIV_TOUCH_ZINDEX","_hookDiv","createTouchHook","div","style","pool","debug","_onKeyDown","bind","_onMouseMove","_isActive","_isMobileAccessibility","androidUpdateCount","androidUpdateFrequency","addEventListener","AccessibilityManager","hookDiv","DIV_HOOK_SIZE","DIV_HOOK_POS_X","DIV_HOOK_POS_Y","title","activate","destroyTouchHook","body","appendChild","removeEventListener","update","parentNode","displayObject","updateAccessibleObjects","renderingToScreen","_lastObjectRendered","getBoundingClientRect","sx","sy","capHitArea","getAttribute","setAttribute","updateDebugHTML","innerHTML","borderStyle","_onClick","_onFocus","_onFocusOut","pointerEvents","interactionManager","plugins","interaction","dispatchEvent","eventData","keyCode","movementX","movementY","deactivate","TARGET_FPMS","priority","previous","TickerListener","deltaTime","redirect","hard","_head","_requestId","_maxElapsedMS","_minElapsedMS","autoStart","deltaMS","elapsedMS","speed","started","_protected","_lastFrame","_tick","time","Ticker","_requestIfNeeded","_addListener","current","connect","_startIfPossible","_cancelIfNeeded","count","head","fps","minFPS","maxFPS","minFPMS","round","_shared","shared","_system","system","TickerPlugin","sharedTicker","ticker","_ticker","remove","LOW","get","oldTicker","originalEvent","identifier","isPrimary","button","buttons","tiltX","tiltY","pointerType","pressure","rotationAngle","twist","tangentialPressure","InteractionData","globalPos","which","stopped","stopsPropagatingAt","stopPropagationHint","currentTarget","InteractionEvent","pointerId","_pointerId","_flags","InteractionTrackingData","FLAGS","NONE","yn","flags","OVER","_doSet","RIGHT_DOWN","LEFT_DOWN","freeze","_tempPoint","TreeSearch","interactionEvent","func","hitTest","hit","interactiveParent","hitTestChildren","contains","containsPoint","childHit","recursiveFindHit","interactiveTarget","buttonMode","cursor","trackedPointers","_trackedPointers","MOUSE_POINTER_ID","hitTestEvent","autoPreventDefault","interactionFrequency","mouse","activeInteractionData","interactionDataPool","interactionDOMElement","moveWhenInside","eventsAdded","tickerAdded","mouseOverRenderer","supportsTouchEvents","supportsPointerEvents","PointerEvent","onPointerUp","processPointerUp","onPointerCancel","processPointerCancel","onPointerDown","processPointerDown","onPointerMove","processPointerMove","onPointerOut","processPointerOverOut","onPointerOver","cursorStyles","default","pointer","currentCursorMode","delayedEvents","_tempDisplayObject","_useSystemTicker","useSystemTicker","setTargetElement","InteractionManager","addTickerListener","removeTickerListener","globalPoint","lastObjectRendered","processInteractive","element","removeEvents","addEvents","tickerUpdate","INTERACTION","msPointerEnabled","msContentZooming","msTouchAction","touchAction","_deltaTime","_didMove","interactionData","configureInteractionEventForDOMEvent","setCursorMode","mode","eventString","parentElement","resolutionMultiplier","findHit","delayedLen","displayObject_1","normalizeToPointerData","isNormalized","cancelable","preventDefault","eventLen","getInteractionDataForPointerId","isRightButton","rightDown","leftDown","cancelled","eventAppend","releaseInteractionDataForPointerId","onPointerComplete","trackingData","isTouch","isMouse","isMouseTap","isDown","over","none","delayDispatchEvent","copyEvent","reset","pointerEvent","mapPositionToPoint","clientX","clientY","globalX","globalY","normalizedEvents","TouchEvent","li","changedTouches","touch","touches","radiusX","radiusY","force","layerX","offsetX","layerY","offsetY","MouseEvent","tempEvent","items","_name","_aliasCount","Runner","a0","a6","a7","ensureNonAliasedItems","removeAll","defineProperties","dispatch","run","PREFER_ENV","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","extension","ResourcePlugin","destroyed","internal","onResize","onUpdate","onError","Resource","baseTexture","_baseTexture","_glTexture","dispose","_source","_extension","BufferResource","glTexture","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","alphaMode","UNPACK","texSubImage2D","texImage2D","internalFormat","defaultBufferOptions","scaleMode","NEAREST","RGBA","NPM","resource","mipmap","anisotropicLevel","wrapMode","resourceOptions","UNSIGNED_BYTE","TEXTURE_2D","premultiplyAlpha","touched","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","valid","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","BaseTexture","dirty","realWidth","realHeight","oldResolution","unbind","removeFromCache","strict","isFrame","_pixiId","addToCache","FLOAT","baseTextureFromCache","itemDirtyIds","partTexture","_load","AbstractMultiResource","resources","castToBaseTexture","addBaseTextureAt","addResourceAt","load","urls","initFromArray","ArrayResource","TEXTURE_2D_ARRAY","texture","texImage3D","texSubImage3D","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","BaseImageResource","crossorigin","crossOrigin","CanvasResource","OffscreenCanvas","HTMLCanvasElement","autoLoad","linkBaseTexture","CubeResource","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","side","upload","HTMLImageElement","imageElement","Image","src","complete","_process","preserveBitmap","createBitmap","createImageBitmap","bitmap","ImageResource","completed","onload","onerror","process","glTextures","otherTex","close","sourceBase64","svg","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVGResource","btoa","unescape","_loadSvg","tempImage","svgWidth","svgHeight","drawImage","svgString","sizeMatch","SVG_SIZE","HTMLVideoElement","videoElement","firstSrc","sourceElement","mime","baseSrc","ext","VideoResource","MIME_TYPES","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","playbackRate","readyState","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","_onPlayStart","_onPlayStop","_isSourceReady","paused","ended","autoUpdate","_isSourcePlaying","play","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","System","DepthResource","webGLVersion","DEPTH_COMPONENT","DEPTH_COMPONENT16","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","Framebuffer","OFF","UNSIGNED_SHORT","setSize","clearColor","framebuffer","addColorTexture","maskStack","filterStack","BaseRenderTexture","destroyDepthTexture","x3","y3","uvsFloat32","TextureUvs","frame","baseFrame","rotate","tw","th","w2","h2","cX","cY","DEFAULT_UVS","orig","anchor","noFrame","Texture","_frame","_uvs","uvMatrix","_rotate","defaultAnchor","_updateID","onBaseTextureUpdated","updateUvs","destroyBase","clone","fromBuffer","imageUrl","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","removeAllHandlers","tex","WHITE","fillStyle","fillRect","createWhiteTexture","baseRenderTexture","_legacyRenderer","legacyRenderer","filterFrame","filterPoolKey","RenderTexture","resizeBaseTexture","setResolution","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","RenderTexturePool","minWidth","minHeight","SCREEN_KEY","renderTexture","createTexture","filterTexture","getOptimalTexture","returnTexture","destroyTextures","textures","screenKey","normalized","instance","Attribute","UID","_static","_glBuffers","static","Buffer","byteSizeMap","5126","5123","5121","buffers","attributes","indexBuffer","glVertexArrayObjects","instanced","instanceCount","refCount","Geometry","ids","addAttribute","bufferIndex","interleavedBuffer","attribute","interleaveTypedArrays","geometry","attrib","geometries","geometryOut","offsets","offset","offset2","bufferIndexToCount","indexBufferData","addIndex","uvs","vertexBuffer","uvBuffer","QuadUv","targetTextureFrame","destinationFrame","invalidate","uniforms","group","syncUniforms","UniformGroup","sourceFrame","FilterState","defaultFilterStack","setScreenSize","statePool","quad","Quad","quadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterClamp","forceClear","useMaxPadding","FilterSystem","state","padding","autoFit","pad","fit","getOptimalFilterTexture","lastState","blit","BLEND","returnFilterTexture","flip","flop","CLEAR","clearMode","BLIT","bindAndClear","uSampler","filterGlobals","shader","draw","TRIANGLES","TRIANGLE_STRIP","outputMatrix","sprite","_texture","mappedMatrix","copyTo","TEMP_MATRIX","invert","prepend","translate","swap","ObjectRenderer","_object","emptyRenderer","currentRenderer","BatchSystem","objectRenderer","setObjectRenderer","maxTextures","boundTextures","texArray","batchId","elements","CONTEXT_UID_COUNTER","extensions","supports","uint32Indices","handleContextLost","handleContextRestored","ContextSystem","isContextLost","CONTEXT_UID","restoreContext","validateContext","runners","contextChange","createContext","initFromContext","getExtensions","drawBuffers","vertexArrayObject","anisotropicFiltering","uint32ElementIndex","floatTexture","floatTextureLinear","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","useProgram","isWebGl2","WebGL2RenderingContext","hasuint32","msaaBuffer","blitFramebuffer","tempRectangle","managedFramebuffers","unknownFramebuffer","msaaSamples","FramebufferSystem","viewport","hasMRT","writeDepthTexture","disposeAll","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","setViewport","g","COLOR","DEPTH","GLFramebuffer","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorage","DEPTH_STENCIL","createRenderbuffer","renderbufferStorageMultisample","framebufferRenderbuffer","COLOR_ATTACHMENT0","parentTexture","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","res","sourcePixels","destPixels","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","LINEAR","contextLost","deleteFramebuffer","deleteRenderbuffer","disposeFramebuffer","enableStencil","byteLength","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","managedBuffers","GeometrySystem","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","program","initGeometryVao","activateVao","updateBuffers","glBuffer","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","bindBuffer","_boundBuffer","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","geometryAttributes","shaderAttributes","attributeData","attribs","strings","checkCompatibility","signature","getSignature","vaoObjectHash","tempStride","tempStart","attribSize","GLBuffer","createBuffer","deleteBuffer","buf","disposeBuffer","vaoId","disposeGeometry","lastBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","glType","UNSIGNED_INT","drawElements","getSize","drawArrays","autoDetect","pooled","isMaskData","_stencilCounter","_scissorCounter","_scissorRect","_target","MaskData","maskAbove","compileShader","createShader","shaderSource","compileProgram","vertexSrc","fragmentSrc","attributeLocations","glVertShader","VERTEX_SHADER","glFragShader","FRAGMENT_SHADER","createProgram","attachShader","bindAttribLocation","linkProgram","getProgramParameter","LINK_STATUS","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","VALIDATE_STATUS","getError","getProgramInfoLog","deleteProgram","deleteShader","booleanArray","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","substring","precision","HIGH","MEDIUM","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","nameCache","Program","defaultVertexSrc","defaultFragmentSrc","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","extractData","glPrograms","getAttributeData","uniformData","getUniformData","attributesArray","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","uniformGroup","Shader","checkUniformExists","polygonOffset","blend","State","_blendMode","_polygonOffset","depthTest","Filter","aTextureCoord","filterManager","_currentState","applyFilter","tempMat","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","clampOffset","isSimple","TextureMatrix","forceUpdate","texBase","margin","maskMatrix","vertex","fragment","maskSprite","SpriteMaskFilter","npmAlpha","otherMatrix","calculateSpriteMatrix","maskClamp","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","MaskSystem","scissor","setMaskStack","maskDataOrTarget","maskData","detect","copyCountersOrReset","SCISSOR","STENCIL","SPRITE","pushSpriteMask","popSpriteMask","isFastRect","rotX","rotXY","alphaMaskFilter","stashFilterArea","glConst","AbstractMaskSystem","curStackLen","getStackLength","newStackLen","disable","enable","_useCurrent","SCISSOR_TEST","ScissorSystem","prevData","rt","projection","STENCIL_TEST","StencilSystem","prevMaskCount","forceStencil","colorMask","stencilFunc","EQUAL","_getBitwiseMask","stencilOp","KEEP","INCR","STENCIL_BUFFER_BIT","clearStencil","DECR","defaultFrame","projectionMatrix","ProjectionSystem","calculateProjection","syncUniformGroup","globals","_destinationFrame","_resolution","identity","_matrix","tempRect2","viewportFrame","_backgroundColorRgba","defaultMaskStack","RenderTextureSystem","screen","uniformGroups","GLProgram","defaultSyncData","textureCount","systemCheck","cache","ShaderSystem","Function","unsafeEvalSupported","dontSync","glProgram","generateShader","syncData","getglProgram","createSyncGroups","funcFragments","parsed","template","generateUniformsSync","attribMap","shaderProgram","getUniformLocation","OFFSET","CULLING","DEPTH_TEST","WINDING","stateId","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","checks","defaultState","StateSystem","blendModes","ONE","ONE_MINUS_SRC_ALPHA","MULTIPLY","DST_COLOR","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","SRC_ALPHA","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","CULL_FACE","frontFace","blendFunc","blendFuncSeparate","blendEquationSeparate","UNPACK_FLIP_Y_WEBGL","forceState","setBlendMode","setPolygonOffset","checkCount","maxIdle","checkCountMax","TextureGCSystem","MANUAL","tm","managedTextures","wasRemoved","destroyTexture","unload","currentLocation","_unknownBoundTextures","unknownTexture","TextureSystem","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","GLTexture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","RGBA32F","HALF_FLOAT","RGBA16F","initTextureType","updateTextureStyle","skipRemove","deleteTexture","POW2","CLAMP","setStyle","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","tempMatrix","UNKNOWN","roundPixels","autoResize","_backgroundColor","_backgroundColorString","AbstractRenderer","staticMap","o","screenWidth","screenHeight","region","removeView","postrender","prerender","addSystem","initPlugins","Renderer","__plugins","initFromOptions","premultipliedAlpha","powerPreference","ClassRef","skipUpdateTransform","isLost","enableTempParent","disableTempParent","pluginName","ctor","autoDetectRenderer","BatchTextureArray","rawBinaryData","uint32View","float32View","ViewableBuffer","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","shaderGenerator","geometryClass","vertexSize","for2d","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","AbstractBatchRenderer","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","BatchDrawCall","indices","textureArrays","TICK","_globalBatch","countTexArrays","copyBoundTextures","boundArray","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","packInterleavedGeometry","textureSystem","packedGeometries","attributeBuffer","_buffer","dcCount","stateSystem","curTexArray","_b","bindAndClearTexArray","getAttributeBuffer","getIndexBuffer","buildTexturesAndDrawCalls","updateGeometry","drawBatches","roundedP2","roundedSizeIndex","roundedSize","packedVertices","indicies","textureId","argb","_tintRGB","programCache","defaultGroupCache","BatchShaderGenerator","sampleValues","uSamplers","generateSampleSrc","translationMatrix","BatchPluginFactory","defaultVertex","defaultFragment","BatchGeometry","BatchRenderer","forceCanvas","stage","Application","_plugins","plugin","stageOptions","reverse","ResizePlugin","dom","queueResize","_resizeTo","cancelResize","_resizeId","innerWidth","innerHeight","resizeTo","registerPlugin","TEMP_RECT","extract","Extract","quality","image","base64","toDataURL","flipY","generated","generateTexture","canvasBuffer","webglPixels","readPixels","canvasData","arrayPostDivide","putImageData","target_1","str","opts","parser","loose","strictMode","uri","$0","$1","$2","_createClass","props","descriptor","enumerable","configurable","writable","Constructor","protoProps","staticProps","_classCallCheck","MiniSignalBinding","thisArg","_fn","_once","_thisArg","_next","_prev","_owner","detach","_addMiniSignalBinding","node","_tail","MiniSignal","exists","_noop","eachSeries","iterator","deferNext","onlyOnce","callFn","worker","concurrency","workers","_tasks","saturated","unsaturated","empty","drain","_insert","kill","task","running","idle","resume","insertAtFront","useXdr","XDomainRequest","XMLHttpRequest","_setFlag","STATUS_FLAGS","DATA_URL","_getExtension","timeout","loadType","_determineLoadType","xhrType","metadata","xhr","TYPE","progressChunk","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_onProgress","_boundOnTimeout","_onTimeout","_boundXhrOnError","_xhrOnError","_boundXhrOnTimeout","_xhrOnTimeout","_boundXhrOnAbort","_xhrOnAbort","_boundXhrOnLoad","_xhrOnLoad","onStart","Signal","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","extname","setExtMap","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","_clearEvents","_finish","abort","xdr","EMPTY_GIF","firstChild","isLoading","isComplete","LOADING","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","_loadXdr","_loadXhr","_hasFlag","ontimeout","onprogress","COMPLETE","loadElement","skipSource","Audio","isCocoonJS","mimeTypes","mimeType","_createSource","_determineXhrType","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","nodeName","lengthComputable","loaded","total","reqType","status","statusText","text","responseText","BUFFER","DOMParser","domparser","parseFromString","XML","response","responseURL","origin","parseUri","isDataUrl","slashIndex","queryStart","hashStart","_getMimeFromXhrType","BLOB","DEFAULT","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","_keyStr","URL","webkitURL","Blob","createObjectURL","blob","revokeObjectURL","getResponseHeader","inx","bytebuffer","encodedCharIndexes","jnx","encodeBinary","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","_loadResource","_queue","async","onLoad","_defaultBeforeMiddleware","pre","_defaultAfterMiddleware","use","parentResource","_prepareUrl","incompleteChildren","eachChunk","_onStart","_onComplete","chunk","dequeue","_this2","_onLoad","_this3","LoaderResource","TextureLoader","fromLoader","ResourceLoader","middleware","parsing","AppLoaderPlugin","sharedLoader","loader","LINE_JOIN","LINE_CAP","maxSize","properties","batchSize","_properties","_maxSize","_batchSize","_buffers","_bufferUpdateIDs","setProperties","_tint","tintRgb","ParticleContainer","particle","smallestChildIndex","dynamicPropertyFlags","dynamicProperties","staticProperties","property","attributeName","uploadFunction","staticStride","staticBuffer","staticData","staticDataUint32","dynamicStride","dynamicBuffer","dynamicData","dynamicDataUint32","initBuffers","ParticleBuffer","dynamicOffset","dynBuffer","staticOffset","statBuffer","startIndex","amount","uploadVertices","uploadPosition","uploadRotation","uploadUvs","uploadTint","ParticleRenderer","totalChildren","generateBuffers","toArray","uColor","updateStatic","_generateOneMoreBuffer","uploadDynamic","bid","uploadStatic","w0","w1","h0","h1","spritePosition","spriteRotation","textureUvs","GRAPHICS_CURVES","adaptive","maxLength","minSegments","maxSegments","epsilon","_segmentsCount","defaultSegments","FillStyle","color","buildPoly","build","graphicsData","shape","triangulate","graphicsGeometry","verts","holeArray","vertPos","buildCircle","circleData","ellipseData","totalSegs","seg","center","circle","buildRectangle","rectData","getPt","n1","n2","perc","quadraticBezierCurve","fromX","fromY","cpX","cpY","toX","toY","xa","ya","xb","yb","buildRoundedRectangle","rrectData","vecPos","square","nx","ny","innerWeight","outerWeight","exx","eyy","eix","eiy","eox","eoy","ex","ey","cx2p0x","cy2p0y","angle0","angle1","startAngle","angleDiff","absAngleDiff","segCount","angleInc","buildLine","lineStyle","native","closedShape","buildNativeLine","closePointEps","firstPoint","lastPoint","closedPath","midPointX","midPointY","indexCount","indexStart","widthSquared","miterLimitSquared","miterLimit","perpx","perpy","perp1x","perp1y","dist","ratio","alignment","cap","ROUND","SQUARE","dx0","dy0","dx1","dy1","cross","c2","pdist","imx","imy","omx","omy","insideWeight","BEVEL","eps2","buildNonNativeLine","innerRadius","ArcUtils","mm","dd","cc","tt","k1","k2","j1","j2","qy","endAngle","anticlockwise","_startX","_startY","_anticlockwise","sweep","theta","theta2","cTheta","sTheta","segMinus","remainder","BezierUtils","cpX2","cpY2","t2","t3","nt","nt2","nt3","prevX","prevY","curveLength","dt","dt2","dt3","QuadraticUtils","a32","ba","BatchPart","attribStart","endAttrib","FILL_COMMANDS","BATCH_POOL","DRAW_CALL_POOL","GraphicsData","tmpPoint","tmpBounds","colors","textureIds","batchDirty","cacheDirty","clearDirty","batches","shapeIndex","boundsDirty","boundsPadding","batchable","indicesUint16","GraphicsGeometry","batchPart","lastShape","hitHole","i_1","allow32Indices","validateBatching","currentStyle","transformPoints","nextTexture","index_1","attribIndex","REPEAT","processFill","processLine","_compareStyles","addUvs","need32","isBatchable","packBatches","styleA","styleB","fill","line","BATCHABLE_SIZE","currentGroup","currentTexture","drawMode","LINES","addColors","addTextureIds","packAttributes","glPoints","f32","u32","processHoles","sequenceBounds","curMatrix","IDENTITY","nextMatrix","lineWidth","addBoundsMatrix","addFramePad","ellipse","poly","rgba","uvsStart","adjustUvs","BUTT","MITER","LineStyle","temp","DEFAULT_SHADERS","_geometry","_fillStyle","_lineStyle","_holeMode","currentPath","batchTint","_transformID","Graphics","finishPoly","lineTextureStyle","startPoly","drawShape","moveTo","_initCurve","curveTo","radius_1","arc","startX","startY","xDiff","yDiff","beginTextureFill","drawHole","drawPolygon","Star","updateBatches","_populateBatches","_renderBatched","_renderDirect","gI","_batchRGB","calculateVertices","calculateTints","_resolveDirectShader","_renderDrawCallDirect","groupTextureCount","addFrame","_TEMP_POINT","tintRGB","wtID","TEXT_GRADIENT","tempPoint","_anchor","_onAnchorUpdate","_cachedTint","vertexTrimmedData","_transformTrimmedID","_textureTrimmedID","_roundPixels","Sprite","addQuad","calculateTrimmedVertices","_onTextureUpdate","destroyBaseTexture","defaultStyle","align","breakWords","dropShadow","dropShadowAlpha","dropShadowAngle","dropShadowBlur","dropShadowColor","dropShadowDistance","fillGradientType","LINEAR_VERTICAL","fillGradientStops","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","letterSpacing","lineHeight","lineJoin","stroke","strokeThickness","textBaseline","whiteSpace","wordWrap","wordWrapWidth","leading","genericFontFamilies","styleID","deepCopyProperties","TextStyle","clonedProperties","_align","_breakWords","_dropShadow","_dropShadowAlpha","_dropShadowAngle","_dropShadowBlur","_dropShadowColor","outputColor","getColor","_dropShadowDistance","_fill","_fillGradientType","_fillGradientStops","array1","array2","areArraysEqual","_fontFamily","_fontSize","_fontStyle","_fontVariant","_fontWeight","_letterSpacing","_lineHeight","_leading","_lineJoin","_miterLimit","_padding","_stroke","_strokeThickness","_textBaseline","_trim","_whiteSpace","_wordWrap","_wordWrapWidth","fontSizeString","fontFamilies","getSingleColor","propertyObj","lines","lineWidths","maxLineWidth","fontProperties","TextMetrics","_canvas","font","toFontString","measureFont","ascent","measureText","collapseSpaces","collapseNewlines","canPrependSpaces","tokens","tokenize","token","isNewline","addLine","currIsBreakingSpace","isBreakingSpace","lastIsBreakingSpace","tokenWidth","getFromCache","canBreakWords","characters","wordWrapSplit","char","nextChar","lastChar","canBreakChars","characterWidth","isLastToken","newLine","trimRight","spacing","_newlines","_breakingSpaces","_token","_char","_nextChar","_index","_fonts","descent","_context","metricsString","METRICS_STRING","BASELINE_SYMBOL","baseline","BASELINE_MULTIPLIER","fillText","imagedata","defaultDestroyOptions","ownCanvas","_ownCanvas","_autoResolution","_text","_style","_styleListener","_font","localStyleID","Text","respectDirty","linePositionX","linePositionY","measured","passesCount","isShadowPass","dsOffsetText","dsOffsetShadow","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","_generateFillStyle","drawLetterSpacing","isStroke","currentPosition","stringArray","previousWidth","currentWidth","currentChar","strokeText","trimmed","setRealSize","updateText","metrics","gradient","dropShadowCorrection","lengthPlus1","createLinearGradient","lastIterationStop","gradStopLineHeight","thisLineTop","globalStop","clampedStop","addColorStop","totalIterations","currentIteration","UPLOADS_PER_FRAME","maxItemsPerFrame","itemsLeft","CountLimiter","findMultipleBaseTextures","_textures","findBaseTexture","findTexture","drawText","_helper","calculateTextStyle","findText","findTextStyle","limiter","uploadHookHelper","addHooks","uploadHooks","completes","ticking","delayedTick","prepareItems","registerFindHook","registerUploadHook","BasePrepare","done","addOnce","tick","UTILITY","beginFrame","allowedToUpload","uploaded","addHook","uploadHook","uploadBaseTextures","uploadGraphics","findGraphics","maxMilliseconds","frameStart","TimeLimiter","resolutionFilename","animations","_updateResolution","_frames","frames","_frameKeys","_batchIndex","_callback","Spritesheet","meta","BATCH_SIZE","_processFrames","_processAnimations","_parseComplete","_nextBatch","initialFrameIndex","frameIndex","maxFrames","sourceSize","rotated","spriteSourceSize","animName","frameName","SpritesheetLoader","imageResourceName","loadOptions","imageMetadata","resourcePath","getResourcePath","spritesheet","tileTransform","uvRespectAnchor","TilingSprite","updateLocalTransform","simpleShader","fragmentSimple","TilingSpriteRenderer","ts","baseTex","uv","H","uMapCoord","uTransform","_bufferUpdateId","_textureUpdateId","MeshBatchUvs","multiplyUvs","tempPolygon","vertexDirty","batchUvs","Mesh","_renderToBatch","_renderDefault","calculateUvs","material","vertexDirtyId","geomUvs","addVertexData","getBuffer","getIndex","step","ind0","ind1","ind2","uTextureMatrix","_colorDirty","MeshMaterial","_alpha","verticesBuffer","uvsBuffer","_updateId","MeshGeometry","info","common","page","kerning","TextFormat","rawData","chars","kernings","attributeList","itemData","strValue","floatValue","BitmapFontData","face","xoffset","yoffset","xadvance","first","second","XMLFormat","XMLDocument","getElementsByTagName","XMLStringFormat","xmlTxt","formats","autoDetectFormat","generateFillStyle","drawGlyph","pageTextures","page_1","_c","xOffset","yOffset","xAdvance","_d","BitmapFont","fontData","available","textStyle","defaultOptions","textureWidth","textureHeight","charsList","startCode","endCode","j_1","resolveCharacters","positionX","positionY","maxCharHeight","textureGlyphWidth","uninstall","ALPHANUMERIC","pageMeshDataPool","charRenderDataPool","_upgradeStyle","BitmapText","styleDefaults","maxWidth","fontName","_activePagesMeshData","_textWidth","_textHeight","_fontName","_maxWidth","_maxLineHeight","_textureCache","textLength","prevCharCode","lastLineWidth","lastBreakPos","lastBreakWidth","spacesRemoved","maxLineHeight","charCode","charData","charRenderData","lineAlignOffsets","alignOffset","lenChars","pagesMeshData","newPagesMeshData","activePagesMeshData","baseTextureUid","pageMeshData","vertexCount","uvsCount","mesh","total_1","xPos","yPos","pageMesh","textureFrame","anchorOffsetX","anchorOffsetY","i_2","textureBuffer","validate","valueSplit","install","BitmapFontLoader","getBaseUrl","pageFile","bitmapFont","bitmapResource","resUrl","dirname","dir","uAlpha","AlphaFilter","vertTemplate","GAUSSIAN_VALUES","5","7","9","11","13","15","horizontal","strength","kernelSize","vertSrc","halfLength","vertSource","blurLoop","blur","generateBlurVertSource","fragSrc","kernel","fragSource","generateBlurFragSource","_quality","BlurFilterPass","passes","renderTarget","getFilterTexture","blurXFilter","blurYFilter","repeatEdgePixels","BlurFilter","xStrength","yStrength","_repeatEdgePixels","updatePadding","defaultFilterVertex","ColorMatrixFilter","multiply","newMatrix","_multiply","_colorMatrix","_loadMatrix","cosR","sinR","sqrW","saturate","desaturation","toned","lightColor","darkColor","lR","lG","lB","dR","dG","dB","intensity","grayscale","greyscale","mapSampler","filterMatrix","DisplacementFilter","lenX","lenY","noise","seed","random","uNoise","uSeed","NoiseFilter","_tempMatrix","_cacheAsBitmap","_cacheData","textureCacheId","originalRender","originalRenderCanvas","originalCalculateBounds","originalGetLocalBounds","originalUpdateTransform","originalDestroy","originalMask","originalFilterArea","originalContainsPoint","cacheAsBitmap","CacheData","renderCanvas","_renderCached","_renderCachedCanvas","_cacheAsBitmapDestroy","_destroyCachedDisplayObject","_initCachedDisplayObject","cacheAlpha","cachedRenderTexture","cachedSourceFrame","cachedProjectionTransform","_calculateCachedBounds","_getCachedLocalBounds","cachedSprite","_initCachedDisplayObjectCanvas","_renderCanvas","cachedRenderTarget","_projTransform","getChildByName","deep","getGlobalPosition","v5","segWidth","segHeight","PlaneGeometry","segmentsX","segmentsY","sizeX","sizeY","totalSub","xpos","ypos","value2","value3","value4","textureScale","RopeGeometry","distance","updateVertices","nextPoint","perpX","perpY","perpLength","ropeGeometry","meshMaterial","SimpleRope","verticesX","verticesY","planeGeometry","SimplePlane","textureUpdated","SimpleMesh","DEFAULT_BORDER_SIZE","leftWidth","topHeight","rightWidth","bottomHeight","_origWidth","_origHeight","_leftWidth","_rightWidth","_topHeight","_bottomHeight","NineSlicePlane","_refresh","_getMinScale","scaleW","scaleH","_uvw","_uvh","updateHorizontalVertices","updateVerticalVertices","_durations","animationSpeed","loop","updateAnchor","onFrameChange","onLoop","_currentTime","_playing","_previousFrame","AnimatedSprite","frameNumber","previousFrame","currentFrame","elapsed","lag","gotoAndStop","images","Prepare","FXAAFilter","PIXI","TransformStatic","TransformBase","TRANSFORM_MODE","STATIC","DYNAMIC","WebGLRenderer","utils","FilterManager","systems","CanvasTinter","canvasUtils","GroupD8","accessibility","prepare","CanvasPrepare","CanvasExtract","extras","fromFrame","frameId","fromImage","imageId","getSvgSize","Plane","Rope","RawMesh","CanvasMeshRenderer","MeshRenderer","particles","loaders","bitmapFontParser","parseBitmapFontData","spritesheetParser","addPixiMiddleware","eventToSignal","toUpperCase","signal","_renderWebGL","renderWebGL","renderAdvancedWebGL","BaseTextureAny","loadSource","baseTextureIdDeprecation","hasLoaded","_id","fromCanvas","fromSVG","copy","setState","getRenderTarget","_clear","returnRenderTarget","calculateScreenSpaceMatrix","calculateNormalizedScreenSpaceMatrix","translateScaleX","translateScaleY","BlurXFilter","BlurYFilter","SpriteAny","TextureAny","GraphicsAny","spriteFrom","textureFrom","generateCanvasTexture","fromVideo","mixins","delayMixin","performMixins"],"mappings":";;;;;;;2QAAA,SAAUA,GAMV,IAAIC,EAA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,iBAAkB,CAC7DiiC,IAAA,WAII,OAFAva,GAAY2oF,GAAI,kFAET/tG,KAAKsvC,WAQpB+iE,EAAKO,MAAM0D,OAAS,CAMhBl9E,MAAA,WAEIhU,GAAY2oF,GAAI,4DAOpBwI,WAAA,WAEInxF,GAAY2oF,GAAI,iEAOpByI,cAAA,WAEIpxF,GAAY2oF,GAAI,qEASxBtwG,OAAOw2B,eAAeo+E,EAAKpO,WAAWvmG,UAAW,OAAQ,CACrDiiC,IAAA,WAKI,OAHAva,GAAY,QAAS,iGAGd,CACHpa,KAAMhL,KAAKwkG,UACXpgF,KAAMpkB,KAAKiyF,UACXnuE,KAAM9jB,KAAK26E,MACXsU,MAAOjvF,KAAKgxF,SAGpBhmE,IAAA,SAAsBxtB,GAKlB,GAHA4nB,GAAY,QAAS,iGAGhB5nB,EAAL,CAKA,IAAMq8B,EAAa,CAAE+5D,KAAMp2F,GAE3BwC,KAAKgkG,cAAcnqE,GAEnBA,EAAMg2D,SAAWh2D,EAAMg2D,UAAYwiB,EAAKzP,WAAWE,UAAUjpE,EAAMuqE,UAAUhgF,KAE7EpkB,KAAKwkG,UAAY3qE,EAAMuqE,SACvBpkG,KAAKiyF,UAAYp4D,EAAMg2D,SAEvB7vF,KAAK6tC,OAAQ"} \ No newline at end of file diff --git a/www/js/plugins/Archeia_CoreChanges.js b/www/js/plugins/Archeia_CoreChanges.js index b4e1213..52b4685 100644 --- a/www/js/plugins/Archeia_CoreChanges.js +++ b/www/js/plugins/Archeia_CoreChanges.js @@ -51,7 +51,7 @@ AEL.Archeia_CoreChanges = AEL.Archeia_CoreChanges || {}; //----------------------------------------------------------------------------- // * Pixi Texture Fix //----------------------------------------------------------------------------- -PIXI.GLTexture.prototype.upload = function(source) +PIXI.glCore.GLTexture.prototype.upload = function(source) { this.bind(); diff --git a/www/js/plugins/GTP_OmoriFixes.js b/www/js/plugins/GTP_OmoriFixes.js index 60c2bb9..c03b019 100644 --- a/www/js/plugins/GTP_OmoriFixes.js +++ b/www/js/plugins/GTP_OmoriFixes.js @@ -1902,13 +1902,7 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {}; for (let obj of mainWindows) { obj.filters = []; } } else { - let hasToneFilter; - if (objects[0].filters !== null) { - hasToneFilter = objects[0].filters.length > 0; - } else { - hasToneFilter = false; - } - + let hasToneFilter = objects[0].filters.length > 0; if (!hasToneFilter) { for (let obj of mainWindows) { obj.filters = [this._spriteset.getToneFilter()]; } this._usingToneFilter = true; diff --git a/www/js/plugins/Omori Title Screen.js b/www/js/plugins/Omori Title Screen.js index b02c1d0..8ac682a 100644 --- a/www/js/plugins/Omori Title Screen.js +++ b/www/js/plugins/Omori Title Screen.js @@ -413,7 +413,7 @@ Scene_OmoriTitleScreen.prototype.createTitleCommands = function () { Scene_OmoriTitleScreen.prototype.createOptionWindowsContainer = function () { // Create Help Window Container this._optionsWindowsContainer = new Sprite(); - this._optionsWindowsContainer.x = 0; + this._optionsWindowsContainer.x = 10; this._optionsWindowsContainer.y = -406; this._optionsWindowsContainer.opacity = 255; this.addChild(this._optionsWindowsContainer); @@ -424,7 +424,7 @@ Scene_OmoriTitleScreen.prototype.createOptionWindowsContainer = function () { Scene_OmoriTitleScreen.prototype.createHelpWindow = function () { // Create Help Window this._helpWindow = new Window_OmoMenuOptionsHelp(); - this._helpWindow.x = 10; + this._helpWindow.x = 0; this._helpWindow.y = Graphics.height - this._helpWindow.height - 10; this._optionsWindowsContainer.addChild(this._helpWindow); }; @@ -434,8 +434,6 @@ Scene_OmoriTitleScreen.prototype.createHelpWindow = function () { Scene_OmoriTitleScreen.prototype.createOptionCategoriesWindow = function () { // Create Options Categories Window this._optionCategoriesWindow = new Window_OmoMenuOptionsCategory(); - this._optionCategoriesWindow.x = 10; - this._optionCategoriesWindow.y = 37; this._optionCategoriesWindow.deactivate(); this._optionCategoriesWindow.setHandler('ok', this.onCategoryOk.bind(this)); @@ -462,8 +460,6 @@ Scene_OmoriTitleScreen.prototype.createOptionCategoriesWindow = function () { Scene_OmoriTitleScreen.prototype.createGeneralOptionsWindow = function () { // Create General Options Window this._generalOptionsWindow = new Window_OmoMenuOptionsGeneral(); - this._generalOptionsWindow.x = 10; - this._generalOptionsWindow.y = 37; this._generalOptionsWindow.setHandler('cancel', this.onOptionWindowCancel.bind(this)); this._generalOptionsWindow.deactivate() // Set Help Window Position @@ -478,8 +474,6 @@ Scene_OmoriTitleScreen.prototype.createGeneralOptionsWindow = function () { Scene_OmoriTitleScreen.prototype.createAudioOptionsWindow = function () { // Create Audio Options Window this._audioOptionsWindow = new Window_OmoMenuOptionsAudio(); - this._audioOptionsWindow.x = 10; - this._audioOptionsWindow.y = 37; this._audioOptionsWindow.setHandler('cancel', this.onOptionWindowCancel.bind(this)); this._audioOptionsWindow.visible = false; this._optionsWindowsContainer.addChild(this._audioOptionsWindow); @@ -490,8 +484,6 @@ Scene_OmoriTitleScreen.prototype.createAudioOptionsWindow = function () { Scene_OmoriTitleScreen.prototype.createControllerOptionsWindow = function () { // Create Control Options Window this._controlOptionsWindow = new Window_OmoMenuOptionsControls(); - this._controlOptionsWindow.x = 10; - this._controlOptionsWindow.y = 37; this._controlOptionsWindow.setHandler('cancel', this.onOptionWindowCancel.bind(this)); this._controlOptionsWindow.visible = false; this._optionsWindowsContainer.addChild(this._controlOptionsWindow); @@ -502,8 +494,6 @@ Scene_OmoriTitleScreen.prototype.createControllerOptionsWindow = function () { Scene_OmoriTitleScreen.prototype.createSystemOptionsWindow = function () { // Create System Option Window this._systemOptionsWindow = new Window_OmoMenuOptionsSystem(); - this._systemOptionsWindow.x = 10; - this._systemOptionsWindow.y = 37; this._systemOptionsWindow.setHandler('restoreConfig', () => { ConfigManager.restoreDefaultConfig(); this._controlOptionsWindow.makeOptionsList() @@ -598,12 +588,7 @@ Scene_OmoriTitleScreen.prototype.start = function () { this._lightBulbLinesSprite.opacity = 255; for (var i = 0; i < this._titleCommands.length; i++) { var win = this._titleCommands[i]; - var patch = 40; win.y = (Graphics.height - win.height) - 15; - win.x = win.x - patch; - win.width = win.width + patch; - win.pivot.x = win.pivot.x - patch; - win.children[0].width = win.children[0].width - patch; win.opacity = 255; win.contentsOpacity = 255; }; @@ -1011,7 +996,7 @@ Scene_OmoriTitleScreen.prototype.commandOptions = function () { // Set Duration var duration = 35; var obj = this._optionsWindowsContainer; - var data = { obj: obj, properties: ['y', 'opacity'], from: { y: obj.y, opacity: obj.opacity }, to: { y: 0, opacity: 255 }, durations: { y: duration, opacity: duration } } + var data = { obj: obj, properties: ['y', 'opacity'], from: { y: obj.y, opacity: obj.opacity }, to: { y: 37, opacity: 255 }, durations: { y: duration, opacity: duration } } data.easing = Object_Movement.easeOutCirc; this.move.startMove(data); }.bind(this)) diff --git a/www/js/rpg_core.js b/www/js/rpg_core.js index 9ba9f82..b50fd61 100644 --- a/www/js/rpg_core.js +++ b/www/js/rpg_core.js @@ -1,5 +1,5 @@ //============================================================================= -// rpg_core.js v1.6.2.2 +// rpg_core.js v1.6.1 //============================================================================= //----------------------------------------------------------------------------- @@ -180,7 +180,7 @@ Utils.RPGMAKER_NAME = 'MV'; * @type String * @final */ -Utils.RPGMAKER_VERSION = "1.6.2.2"; +Utils.RPGMAKER_VERSION = "1.6.1"; /** * Checks whether the option is in the query string. @@ -191,8 +191,8 @@ Utils.RPGMAKER_VERSION = "1.6.2.2"; * @return {Boolean} True if the option is in the query string */ Utils.isOptionValid = function (name) { - if (location.search.slice(1).split('&').contains(name)) { return 1; } - if (typeof nw !== "undefined" && nw.App.argv.length > 0 && nw.App.argv[0].split('&').contains(name)) { return 1; } + if (location.search.slice(1).split('&').contains(name)) { return 1; }; + if (typeof nw !== "undefined" && nw.App.argv.length > 0 && nw.App.argv[0].split('&').contains(name)) { return 1; }; return 0; }; @@ -216,13 +216,7 @@ Utils.isNwjs = function () { */ Utils.isMobileDevice = function () { var r = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i; - if (!!navigator.userAgent.match(r)) { - Utils.isMobileDevice = function () { return true; }; - return true; - } - - Utils.isMobileDevice = function () { return false; }; - return false; + return !!navigator.userAgent.match(r); }; /** @@ -234,13 +228,8 @@ Utils.isMobileDevice = function () { */ Utils.isMobileSafari = function () { var agent = navigator.userAgent; - if (!!(agent.match(/iPhone|iPad|iPod/) && agent.match(/AppleWebKit/) && - !agent.match('CriOS'))) { - Utils.isMobileSafari = function () { return true; }; - return true; - } - Utils.isMobileSafari = function () { return false; }; - return false; + return !!(agent.match(/iPhone|iPad|iPod/) && agent.match(/AppleWebKit/) && + !agent.match('CriOS')); }; /** @@ -267,7 +256,7 @@ Utils.canReadGameFiles = function () { var lastScript = scripts[scripts.length - 1]; var xhr = new XMLHttpRequest(); try { - xhr.open('GET', CS_URL.MapURL(lastScript.src)); + xhr.open('GET', lastScript.src); xhr.overrideMimeType('text/javascript'); xhr.send(); return true; @@ -319,7 +308,7 @@ Utils.isSupportPassiveEvent = function () { window.addEventListener("test", null, options); Utils._supportPassiveEvent = passive; return passive; -}; +} //----------------------------------------------------------------------------- /** @@ -381,8 +370,8 @@ CacheEntry.prototype.setTimeToLive = function (ticks, seconds) { CacheEntry.prototype.isStillAlive = function () { var cache = this.cache; - return ((this.ttlTicks === 0) || (this.touchTicks + this.ttlTicks < cache.updateTicks)) && - ((this.ttlSeconds === 0) || (this.touchSeconds + this.ttlSeconds < cache.updateSeconds)); + return ((this.ttlTicks == 0) || (this.touchTicks + this.ttlTicks < cache.updateTicks)) && + ((this.ttlSeconds == 0) || (this.touchSeconds + this.ttlSeconds < cache.updateSeconds)); }; /** @@ -545,13 +534,13 @@ ImageCache.prototype._truncateCache = function () { }; ImageCache.prototype._mustBeHeld = function (item) { - // request only is weak so it can be purged + // request only is weak so It's purgeable if (item.bitmap.isRequestOnly()) return false; // reserved item must be held if (item.reservationId) return true; // not ready bitmap must be held (because of checking isReady()) if (!item.bitmap.isReady()) return true; - // then the item may purged + // then the item may purgeable return false; }; @@ -1172,8 +1161,7 @@ Bitmap.prototype.blt = function (source, sx, sy, sw, sh, dx, dy, dw, dh) { }; /** - * Performs a block transfer, using assumption that original image was - * not modified (no hue) + * Performs a block transfer, using assumption that original image was not modified (no hue) * * @method blt * @param {Bitmap} source The bitmap to draw @@ -1415,17 +1403,17 @@ Bitmap.prototype.adjustTone = function (r, g, b) { */ Bitmap.prototype.rotateHue = function (offset) { function rgbToHsl(r, g, b) { - var c_min = Math.min(r, g, b); - var c_max = Math.max(r, g, b); + var cmin = Math.min(r, g, b); + var cmax = Math.max(r, g, b); var h = 0; var s = 0; - var l = (c_min + c_max) / 2; - var delta = c_max - c_min; + var l = (cmin + cmax) / 2; + var delta = cmax - cmin; if (delta > 0) { - if (r === c_max) { + if (r === cmax) { h = 60 * (((g - b) / delta + 6) % 6); - } else if (g === c_max) { + } else if (g === cmax) { h = 60 * ((b - r) / delta + 2); } else { h = 60 * ((r - g) / delta + 4); @@ -1516,13 +1504,13 @@ Bitmap.prototype.blur = function () { * Add a callback function that will be called when the bitmap is loaded. * * @method addLoadListener - * @param {Function} listener The callback function + * @param {Function} listner The callback function */ -Bitmap.prototype.addLoadListener = function (listener) { +Bitmap.prototype.addLoadListener = function (listner) { if (!this.isReady()) { - this._loadListeners.push(listener); + this._loadListeners.push(listner); } else { - listener(this); + listner(this); } }; @@ -1677,7 +1665,6 @@ Bitmap.request = function (url) { }; Bitmap.prototype._requestImage = function (url) { - url = CS_URL.MapURL(url); if (Bitmap._reuseImages.length !== 0) { this._image = Bitmap._reuseImages.pop(); } else { @@ -1699,7 +1686,7 @@ Bitmap.prototype._requestImage = function (url) { this._loadingState = 'decrypting'; Decrypter.decryptImg(url, this); } else { - this._image.src = CS_URL.MapURL(url); + this._image.src = encodeURI(url); this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this)); this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this)); @@ -1761,9 +1748,6 @@ Graphics.initialize = function (width, height, type) { this._errorPrinter = null; this._canvas = null; this._video = null; - // Before bringing in 1.6.2 this was: - // this._videoUnlocked = !Utils.isMobileDevice(); - // From 1.6.2 this._videoUnlocked = false; this._videoLoading = false; this._upperCanvas = null; @@ -1771,7 +1755,6 @@ Graphics.initialize = function (width, height, type) { this._fpsMeter = null; this._modeBox = null; this._skipCount = 0; - this._gcCount = 0; this._maxSkip = 3; this._rendered = false; this._loadingImage = null; @@ -1893,9 +1876,10 @@ Graphics.render = function (stage) { var startTime = Date.now(); if (stage) { this._renderer.render(stage); - // No need to flush here, let PixiJS5 handle it + if (this._renderer.gl && this._renderer.gl.flush) { + this._renderer.gl.flush(); + } } - this.callGC(); var endTime = Date.now(); var elapsed = endTime - startTime; this._skipCount = Math.min(Math.floor(elapsed / 15), this._maxSkip); @@ -1964,7 +1948,7 @@ Graphics.canUseSaturationBlend = function () { */ Graphics.setLoadingImage = function (src) { this._loadingImage = new Image(); - this._loadingImage.src = CS_URL.MapURL(src); + this._loadingImage.src = src; }; /** @@ -2013,7 +1997,7 @@ Graphics.printLoadingError = function (url) { var button = document.createElement('button'); button.innerHTML = 'Retry'; button.style.fontSize = '24px'; - button.style.color = '#ffffff'; + button.style.color = '#000000'; button.style.backgroundColor = '#000000'; button.onmousedown = button.ontouchstart = function (event) { ResourceHandler.retry(); @@ -2136,7 +2120,6 @@ Graphics.isFontLoaded = function (name) { * @param {String} src */ Graphics.playVideo = function (src) { - src = CS_URL.MapURL(src); this._videoLoader = ResourceHandler.createLoader(null, this._playVideo.bind(this, src), this._onVideoError.bind(this)); this._playVideo(src); }; @@ -2148,7 +2131,6 @@ Graphics.playVideo = function (src) { * @private */ Graphics._playVideo = function (src) { - src = CS_URL.MapURL(src); this._video.src = src; this._video.onloadeddata = this._onVideoLoad.bind(this); this._video.onerror = this._videoLoader; @@ -2248,10 +2230,7 @@ Graphics.isInsideCanvas = function (x, y) { */ Graphics.callGC = function () { if (Graphics.isWebGL()) { - //if(this._gcCount++ > 30){ Graphics._renderer.textureGC.run(); - //} - //this._gcCount %= 30; } }; @@ -2601,29 +2580,26 @@ Graphics._paintUpperCanvas = function () { * @private */ Graphics._createRenderer = function () { - PIXI.utils.skipHello(); - // Map the textures - PIXI.settings.MIPMAP_TEXTURES = PIXI.MIPMAP_MODES.ON; - // Cleanup garbage at the correct time rather than automatically - PIXI.settings.GC_MODE = PIXI.GC_MODES.AUTO; - // PIXI.settings.GC_MAX_IDLE = 60; - // Do some things to make is look better, may cause problems - PIXI.settings.ROUND_PIXELS = true; - PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.LINEAR; - - var options = { - view: this._canvas, - width: this._width, - height: this._height, - clearBeforeRender: false, - resolution: window.devicePixelRatio, - - antialias: false, - autoDensity: false, - powerPreference: 'high-performance' - }; + PIXI.dontSayHello = true; + var width = this._width; + var height = this._height; + var options = { view: this._canvas }; try { - this._renderer = new PIXI.Renderer(options); + switch (this._rendererType) { + case 'canvas': + this._renderer = new PIXI.CanvasRenderer(width, height, options); + break; + case 'webgl': + this._renderer = new PIXI.WebGLRenderer(width, height, options); + break; + default: + this._renderer = PIXI.autoDetectRenderer(width, height, options); + break; + } + + if (this._renderer && this._renderer.textureGC) + this._renderer.textureGC.maxIdle = 1; + } catch (e) { this._renderer = null; } @@ -2857,8 +2833,6 @@ Graphics._onWindowResize = function () { */ Graphics._onKeyDown = function (event) { if (!event.ctrlKey && !event.altKey) { - // Replace with key and update codes to strings - // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode switch (event.keyCode) { case 113: // F2 event.preventDefault(); @@ -2892,23 +2866,23 @@ Graphics._onTouchEnd = function (event) { } }; -/** - * @static - * @method _switchFPSMeter - * @private - */ -Graphics._switchFPSMeter = function () { - if (this._fpsMeter.isPaused) { - this.showFps(); - this._fpsMeter.showFps(); - this._fpsMeterToggled = false; - } else if (!this._fpsMeterToggled) { - this._fpsMeter.showDuration(); - this._fpsMeterToggled = true; - } else { - this.hideFps(); - } -}; +///** +// * @static +// * @method _switchFPSMeter +// * @private +// */ +//Graphics._switchFPSMeter = function() { +// if (this._fpsMeter.isPaused) { +// this.showFps(); +// this._fpsMeter.showFps(); +// this._fpsMeterToggled = false; +// } else if (!this._fpsMeterToggled) { +// this._fpsMeter.showDuration(); +// this._fpsMeterToggled = true; +// } else { +// this.hideFps(); +// } +//}; /** * @static @@ -2927,11 +2901,7 @@ Graphics._switchStretchMode = function () { * @private */ Graphics._switchFullScreen = function () { - if (this._isFullScreen()) { - this._requestFullScreen(); - } else { - this._cancelFullScreen(); - } + this._requestFullScreen(); }; /** @@ -2941,6 +2911,7 @@ Graphics._switchFullScreen = function () { * @private */ Graphics._isFullScreen = function () { + return true; return ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitFullscreenElement && !document.msFullscreenElement)); @@ -2952,15 +2923,19 @@ Graphics._isFullScreen = function () { * @private */ Graphics._requestFullScreen = function () { - var element = document.body; - if (element.requestFullScreen) { - element.requestFullScreen(); - } else if (element.mozRequestFullScreen) { - element.mozRequestFullScreen(); - } else if (element.webkitRequestFullScreen) { - element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); - } else if (element.msRequestFullscreen) { - element.msRequestFullscreen(); + try { + var element = document.body; + if (element.requestFullScreen) { + element.requestFullScreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullScreen) { + element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } + } catch (e) { + console.log(`Fullscreen request denied! %s`, e) } }; @@ -3029,7 +3004,6 @@ Input.keyRepeatInterval = 6; * @type Object */ Input.keyMapper = { - // Original Keycodes 9: 'tab', // tab 13: 'ok', // enter 16: 'shift', // shift @@ -3053,10 +3027,7 @@ Input.keyMapper = { 100: 'left', // numpad 4 102: 'right', // numpad 6 104: 'up', // numpad 8 - 120: 'debug', // F9 - // Additional keycodes - // Move out to a plugin? - 8: "backspace", 19: "pause", 35: "end", 36: "home", 46: "delete", 48: "0", 49: "1", 50: "2", 51: "3", 52: "4", 53: "5", 54: "6", 55: "7", 56: "8", 57: "9", 59: ";", 65: "a", 66: "b", 67: "c", 68: "d", 69: "e", 70: "f", 71: "g", 72: "h", 73: "i", 74: "j", 75: "k", 76: "l", 77: "m", 78: "n", 79: "o", 80: "p", 82: "r", 83: "s", 84: "t", 85: "u", 86: "v", 89: "y", 97: "numpad_1", 99: "numpad_3", 101: "numpad_5", 103: "numpad_7", 105: "numpad_9", 106: "numpad_star", 107: "numpad_plus", 109: "numpad_minus", 110: "numpad_dot", 111: "numpad_divide", 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 121: "f10", 122: "f11", 123: "f12", 173: "minus", 187: "equals", 188: "comma", 190: "dot", 191: "forward_slash", 192: "backtick", 219: "left_bracket", 220: "backslash", 221: "right_bracket", 222: "single_quote" + 120: 'debug' // F9 }; /** @@ -3241,7 +3212,7 @@ Input._wrapNwjsAlert = function () { var _alert = window.alert; window.alert = function () { var gui = require('nw.gui'); - var win = gui.Window.get(); + var win = gui.window; _alert.apply(this, arguments); win.focus(); Input.clear(); @@ -3257,7 +3228,7 @@ Input._wrapNwjsAlert = function () { Input._setupEventHandlers = function () { document.addEventListener('keydown', this._onKeyDown.bind(this)); document.addEventListener('keyup', this._onKeyUp.bind(this)); - window.addEventListener('blur', this._onLostFocus.bind(this)); + //window.addEventListener('blur', this._onLostFocus.bind(this)); }; /** @@ -3546,6 +3517,7 @@ TouchInput.clear = function () { * @method update */ TouchInput.update = function () { + return; this._triggered = this._events.triggered; this._cancelled = this._events.cancelled; this._moved = this._events.moved; @@ -3979,15 +3951,15 @@ function Sprite() { this.initialize.apply(this, arguments); } -Sprite.prototype = Object.create(PIXI.picture.Sprite.prototype); +Sprite.prototype = Object.create(PIXI.Sprite.prototype); Sprite.prototype.constructor = Sprite; -Sprite.voidFilter = new PIXI.filters.AlphaFilter(); +Sprite.voidFilter = new PIXI.filters.VoidFilter(); Sprite.prototype.initialize = function (bitmap) { var texture = new PIXI.Texture(new PIXI.BaseTexture()); - PIXI.picture.Sprite.call(this, texture); + PIXI.Sprite.call(this, texture); this._bitmap = null; this._frame = new Rectangle(); @@ -4033,9 +4005,7 @@ Object.defineProperty(Sprite.prototype, 'bitmap', { value.addLoadListener(this._onBitmapLoad.bind(this)); } else { this._refreshFrame = false; - try { - this.texture.frame = Rectangle.emptyRectangle; - } catch (ex) { } + this.texture.frame = Rectangle.emptyRectangle; } } }, @@ -4118,7 +4088,7 @@ Sprite.prototype.move = function (x, y) { }; /** - * Sets the rectangle of the bitmap that the sprite displays. + * Sets the rectagle of the bitmap that the sprite displays. * * @method setFrame * @param {Number} x The x coordinate of the frame @@ -4239,11 +4209,7 @@ Sprite.prototype._refresh = function () { this.texture.frame = new Rectangle(0, 0, realW, realH); } else { if (this._bitmap) { - let oldTexture = this.texture.baseTexture; this.texture.baseTexture = this._bitmap.baseTexture; - if (oldTexture && oldTexture.dispose && oldTexture !== this.texture.baseTexture) { - oldTexture.dispose(); - } } this.texture.frame = this._realFrame; } @@ -4367,7 +4333,7 @@ Sprite.prototype._executeTint = function (x, y, w, h) { }; Sprite.prototype._renderCanvas_PIXI = PIXI.Sprite.prototype._renderCanvas; -Sprite.prototype._render_PIXI = PIXI.Sprite.prototype._render; +Sprite.prototype._renderWebGL_PIXI = PIXI.Sprite.prototype._renderWebGL; /** * @method _renderCanvas @@ -4388,20 +4354,61 @@ Sprite.prototype._renderCanvas = function (renderer) { }; /** - * @method _render + * checks if we need to speed up custom blendmodes + * @param renderer + * @private + */ +Sprite.prototype._speedUpCustomBlendModes = function (renderer) { + var picture = renderer.plugins.picture; + var blend = this.blendMode; + if (renderer.renderingToScreen && renderer._activeRenderTarget.root) { + if (picture.drawModes[blend]) { + var stage = renderer._lastObjectRendered; + var f = stage._filters; + if (!f || !f[0]) { + setTimeout(function () { + var f = stage._filters; + if (!f || !f[0]) { + stage.filters = [Sprite.voidFilter]; + stage.filterArea = new PIXI.Rectangle(0, 0, Graphics.width, Graphics.height); + } + }, 0); + } + } + } +}; + +/** + * @method _renderWebGL * @param {Object} renderer * @private */ -Sprite.prototype._render = function (renderer) { +Sprite.prototype._renderWebGL = function (renderer) { if (this.bitmap) { - // Keep the bitmap in cache this.bitmap.touch(); } + if (this.bitmap && !this.bitmap.isReady()) { + return; + } if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { if (this._bitmap) { this._bitmap.checkDirty(); } - this._render_PIXI(renderer); + + //copy of pixi-v4 internal code + this.calculateVertices(); + + if (this.pluginName === 'sprite' && this._isPicture) { + // use heavy renderer, which reduces artifacts and applies corrent blendMode, + // but does not use multitexture optimization + this._speedUpCustomBlendModes(renderer); + renderer.setObjectRenderer(renderer.plugins.picture); + renderer.plugins.picture.render(this); + } else { + // use pixi super-speed renderer + renderer.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + } } }; @@ -4736,15 +4743,8 @@ Tilemap.prototype.refreshTileset = function () { * @private */ Tilemap.prototype.updateTransform = function () { - var ox; - var oy; - if (this.roundPixels) { - ox = Math.floor(this.origin.x); - oy = Math.floor(this.origin.y); - } else { - ox = this.origin.x; - oy = this.origin.y; - } + var ox = Math.floor(this.origin.x); + var oy = Math.floor(this.origin.y); var startX = Math.floor((ox - this._margin) / this._tileWidth); var startY = Math.floor((oy - this._margin) / this._tileHeight); this._updateLayerPositions(startX, startY); @@ -4869,23 +4869,21 @@ Tilemap.prototype._paintAllTiles = function (startX, startY) { * @private */ Tilemap.prototype._paintTiles = function (startX, startY, x, y) { - const tableEdgeVirtualId = 10000; - const mx = startX + x; - const my = startY + y; - const dx = (mx * this._tileWidth).mod(this._layerWidth); - const dy = (my * this._tileHeight).mod(this._layerHeight); - const lx = dx / this._tileWidth; - const ly = dy / this._tileHeight; - const tileId0 = this._readMapData(mx, my, 0); - const tileId1 = this._readMapData(mx, my, 1); - const tileId2 = this._readMapData(mx, my, 2); - const tileId3 = this._readMapData(mx, my, 3); - const shadowBits = this._readMapData(mx, my, 4); - const upperTileId1 = this._readMapData(mx, my - 1, 1); - const lowerTiles = []; - const upperTiles = []; - const lowerLayer = this._lowerBitmap; - const upperLayer = this._upperBitmap; + var tableEdgeVirtualId = 10000; + var mx = startX + x; + var my = startY + y; + var dx = (mx * this._tileWidth).mod(this._layerWidth); + var dy = (my * this._tileHeight).mod(this._layerHeight); + var lx = dx / this._tileWidth; + var ly = dy / this._tileHeight; + var tileId0 = this._readMapData(mx, my, 0); + var tileId1 = this._readMapData(mx, my, 1); + var tileId2 = this._readMapData(mx, my, 2); + var tileId3 = this._readMapData(mx, my, 3); + var shadowBits = this._readMapData(mx, my, 4); + var upperTileId1 = this._readMapData(mx, my - 1, 1); + var lowerTiles = []; + var upperTiles = []; if (this._isHigherTile(tileId0)) { upperTiles.push(tileId0); @@ -4922,18 +4920,18 @@ Tilemap.prototype._paintTiles = function (startX, startY, x, y) { } } - const lastLowerTiles = this._readLastTiles(0, lx, ly); + var lastLowerTiles = this._readLastTiles(0, lx, ly); if (!lowerTiles.equals(lastLowerTiles) || (Tilemap.isTileA1(tileId0) && this._frameUpdated)) { this._lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight); - for (let i = 0; i < lowerTiles.length; i++) { - let lowerTileId = lowerTiles[i]; + for (var i = 0; i < lowerTiles.length; i++) { + var lowerTileId = lowerTiles[i]; if (lowerTileId < 0) { - this._drawShadow(lowerLayer, shadowBits, dx, dy); + this._drawShadow(this._lowerBitmap, shadowBits, dx, dy); } else if (lowerTileId >= tableEdgeVirtualId) { - this._drawTableEdge(lowerLayer, upperTileId1, dx, dy); + this._drawTableEdge(this._lowerBitmap, upperTileId1, dx, dy); } else { - this._drawTile(lowerLayer, lowerTileId, dx, dy); + this._drawTile(this._lowerBitmap, lowerTileId, dx, dy); } } this._writeLastTiles(0, lx, ly, lowerTiles); @@ -4942,8 +4940,8 @@ Tilemap.prototype._paintTiles = function (startX, startY, x, y) { var lastUpperTiles = this._readLastTiles(1, lx, ly); if (!upperTiles.equals(lastUpperTiles)) { this._upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight); - for (let i = 0; i < upperTiles.length; i++) { - this._drawTile(upperLayer, upperTiles[i], dx, dy); + for (var j = 0; j < upperTiles.length; j++) { + this._drawTile(this._upperBitmap, upperTiles[j], dx, dy); } this._writeLastTiles(1, lx, ly, upperTiles); } @@ -4992,18 +4990,18 @@ Tilemap.prototype._writeLastTiles = function (i, x, y, tiles) { /** * @method _drawTile - * @param {Object} layer (bitmap or proper layer object) + * @param {Bitmap} bitmap * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ -Tilemap.prototype._drawTile = function (layer, tileId, dx, dy) { +Tilemap.prototype._drawTile = function (bitmap, tileId, dx, dy) { if (Tilemap.isVisibleTile(tileId)) { if (Tilemap.isAutotile(tileId)) { - this._drawAutotile(layer, tileId, dx, dy); + this._drawAutotile(bitmap, tileId, dx, dy); } else { - this._drawNormalTile(layer, tileId, dx, dy); + this._drawNormalTile(bitmap, tileId, dx, dy); } } }; @@ -5266,13 +5264,13 @@ Tilemap.prototype._sortChildren = function () { * @private */ Tilemap.prototype._compareChildOrder = function (a, b) { - if (a.z === b.z) { - if (a.y === b.y) { - return a.spriteId - b.spriteId; - } + if (a.z !== b.z) { + return a.z - b.z; + } else if (a.y !== b.y) { return a.y - b.y; + } else { + return a.spriteId - b.spriteId; } - return a.z - b.z; }; // Tile type checkers @@ -5486,9 +5484,9 @@ Tilemap.WATERFALL_AUTOTILE_TABLE = [ //----------------------------------------------------------------------------- /** - * The shader tilemap which displays 2D tile-based game map using shaders + * The tilemap which displays 2D tile-based game map using shaders * - * @class ShaderTilemap + * @class Tilemap * @constructor */ function ShaderTilemap() { @@ -5499,16 +5497,11 @@ function ShaderTilemap() { ShaderTilemap.prototype = Object.create(Tilemap.prototype); ShaderTilemap.prototype.constructor = ShaderTilemap; - -// Note: May cause issues with plugins if they are overriding some of the -// ShaderTilemap APIs // we need this constant for some platforms (Samsung S4, S5, Tab4, HTC One H8) -/* Disabled for PixiJS5 on Desktop: needs mobile testings -PIXI.VertexArrayObject.FORCE_NATIVE = true; +PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true; PIXI.settings.GC_MODE = PIXI.GC_MODES.AUTO; PIXI.tilemap.TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; PIXI.tilemap.TileRenderer.DO_CLEAR = true; -*/ /** * Uploads animation state in renderer @@ -5518,7 +5511,7 @@ PIXI.tilemap.TileRenderer.DO_CLEAR = true; */ ShaderTilemap.prototype._hackRenderer = function (renderer) { var af = this.animationFrame % 4; - if (af === 3) af = 1; + if (af == 3) af = 1; renderer.plugins.tilemap.tileAnim[0] = af * this._tileWidth; renderer.plugins.tilemap.tileAnim[1] = (this.animationFrame % 3) * this._tileHeight; return renderer; @@ -5539,12 +5532,12 @@ ShaderTilemap.prototype.renderCanvas = function (renderer) { /** * PIXI render method * - * @method render + * @method renderWebGL * @param {Object} pixi renderer */ -ShaderTilemap.prototype.render = function (renderer) { +ShaderTilemap.prototype.renderWebGL = function (renderer) { this._hackRenderer(renderer); - PIXI.Container.prototype.render.call(this, renderer); + PIXI.Container.prototype.renderWebGL.call(this, renderer); }; /** @@ -5556,7 +5549,7 @@ ShaderTilemap.prototype.refresh = function () { if (this._lastBitmapLength !== this.bitmaps.length) { this._lastBitmapLength = this.bitmaps.length; this.refreshTileset(); - } + }; this._needsRepaint = true; }; @@ -5576,14 +5569,15 @@ ShaderTilemap.prototype.refreshTileset = function () { * @private */ ShaderTilemap.prototype.updateTransform = function () { - let ox = this.origin.x; - let oy = this.origin.y; if (this.roundPixels) { - ox = Math.floor(this.origin.x); - oy = Math.floor(this.origin.y); + var ox = Math.floor(this.origin.x); + var oy = Math.floor(this.origin.y); + } else { + ox = this.origin.x; + oy = this.origin.y; } - const startX = Math.floor((ox - this._margin) / this._tileWidth); - const startY = Math.floor((oy - this._margin) / this._tileHeight); + var startX = Math.floor((ox - this._margin) / this._tileWidth); + var startY = Math.floor((oy - this._margin) / this._tileHeight); this._updateLayerPositions(startX, startY); if (this._needsRepaint || this._lastStartX !== startX || this._lastStartY !== startY) { @@ -5601,25 +5595,26 @@ ShaderTilemap.prototype.updateTransform = function () { * @private */ ShaderTilemap.prototype._createLayers = function () { - const width = this._width; - const height = this._height; - const margin = this._margin; - const tileCols = Math.ceil(width / this._tileWidth) + 1; - const tileRows = Math.ceil(height / this._tileHeight) + 1; - const layerWidth = this._layerWidth = tileCols * this._tileWidth; - const layerHeight = this._layerHeight = tileRows * this._tileHeight; + var width = this._width; + var height = this._height; + var margin = this._margin; + var tileCols = Math.ceil(width / this._tileWidth) + 1; + var tileRows = Math.ceil(height / this._tileHeight) + 1; + var layerWidth = this._layerWidth = tileCols * this._tileWidth; + var layerHeight = this._layerHeight = tileRows * this._tileHeight; this._needsRepaint = true; if (!this.lowerZLayer) { //@hackerham: create layers only in initialization. Doesn't depend on width/height this.addChild(this.lowerZLayer = new PIXI.tilemap.ZLayer(this, 0)); - - this.lowerZLayer.addChild(this.lowerLayer = new PIXI.tilemap.CompositeRectTileLayer(0, [])); - this.lowerLayer.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - this.addChild(this.upperZLayer = new PIXI.tilemap.ZLayer(this, 4)); - this.upperZLayer.addChild(this.upperLayer = new PIXI.tilemap.CompositeRectTileLayer(0, [])); + var parameters = PluginManager.parameters('ShaderTilemap'); + var useSquareShader = Number(parameters.hasOwnProperty('squareShader') ? parameters['squareShader'] : 0); + + this.lowerZLayer.addChild(this.lowerLayer = new PIXI.tilemap.CompositeRectTileLayer(0, [], useSquareShader)); + this.lowerLayer.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + this.upperZLayer.addChild(this.upperLayer = new PIXI.tilemap.CompositeRectTileLayer(4, [], useSquareShader)); } }; @@ -5630,11 +5625,12 @@ ShaderTilemap.prototype._createLayers = function () { * @private */ ShaderTilemap.prototype._updateLayerPositions = function (startX, startY) { - let ox = this.origin.x; - let oy = this.origin.y; if (this.roundPixels) { - ox = Math.floor(this.origin.x); - oy = Math.floor(this.origin.y); + var ox = Math.floor(this.origin.x); + var oy = Math.floor(this.origin.y); + } else { + ox = this.origin.x; + oy = this.origin.y; } this.lowerZLayer.position.x = startX * this._tileWidth - ox; this.lowerZLayer.position.y = startY * this._tileHeight - oy; @@ -5649,12 +5645,12 @@ ShaderTilemap.prototype._updateLayerPositions = function (startX, startY) { * @private */ ShaderTilemap.prototype._paintAllTiles = function (startX, startY) { - this.lowerZLayer.children[0].clear(); - this.upperZLayer.children[0].clear(); - let tileCols = Math.ceil(this._width / this._tileWidth) + 1; - let tileRows = Math.ceil(this._height / this._tileHeight) + 1; - for (let y = 0; y < tileRows; y++) { - for (let x = 0; x < tileCols; x++) { + this.lowerZLayer.clear(); + this.upperZLayer.clear(); + var tileCols = Math.ceil(this._width / this._tileWidth) + 1; + var tileRows = Math.ceil(this._height / this._tileHeight) + 1; + for (var y = 0; y < tileRows; y++) { + for (var x = 0; x < tileCols; x++) { this._paintTiles(startX, startY, x, y); } } @@ -5669,71 +5665,69 @@ ShaderTilemap.prototype._paintAllTiles = function (startX, startY) { * @private */ ShaderTilemap.prototype._paintTiles = function (startX, startY, x, y) { - const tableEdgeVirtualId = 10000; - const mx = startX + x; - const my = startY + y; - const dx = x * this._tileWidth; - const dy = y * this._tileHeight; - const tileId0 = this._readMapData(mx, my, 0); - const tileId1 = this._readMapData(mx, my, 1); - const tileId2 = this._readMapData(mx, my, 2); - const tileId3 = this._readMapData(mx, my, 3); - const shadowBits = this._readMapData(mx, my, 4); - const upperTileId1 = this._readMapData(mx, my - 1, 1); - const lowerTiles = []; - const upperTiles = []; - const lowerLayer = this.lowerLayer.children[0]; - const upperLayer = this.upperLayer.children[0]; + var mx = startX + x; + var my = startY + y; + var dx = x * this._tileWidth, dy = y * this._tileHeight; + var tileId0 = this._readMapData(mx, my, 0); + var tileId1 = this._readMapData(mx, my, 1); + var tileId2 = this._readMapData(mx, my, 2); + var tileId3 = this._readMapData(mx, my, 3); + var shadowBits = this._readMapData(mx, my, 4); + var upperTileId1 = this._readMapData(mx, my - 1, 1); + var lowerLayer = this.lowerLayer.children[0]; + var upperLayer = this.upperLayer.children[0]; if (this._isHigherTile(tileId0)) { - upperTiles.push(tileId0); + this._drawTile(upperLayer, tileId0, dx, dy); } else { - lowerTiles.push(tileId0); + this._drawTile(lowerLayer, tileId0, dx, dy); } if (this._isHigherTile(tileId1)) { - upperTiles.push(tileId1); + this._drawTile(upperLayer, tileId1, dx, dy); } else { - lowerTiles.push(tileId1); + this._drawTile(lowerLayer, tileId1, dx, dy); } - lowerTiles.push(-1 * shadowBits); - + this._drawShadow(lowerLayer, shadowBits, dx, dy); if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) { if (!Tilemap.isShadowingTile(tileId0)) { - lowerTiles.push(tableEdgeVirtualId + upperTileId1); + this._drawTableEdge(lowerLayer, upperTileId1, dx, dy); } } if (this._isOverpassPosition(mx, my)) { - upperTiles.push(tileId2); - upperTiles.push(tileId3); + this._drawTile(upperLayer, tileId2, dx, dy); + this._drawTile(upperLayer, tileId3, dx, dy); } else { if (this._isHigherTile(tileId2)) { - upperTiles.push(tileId2); + this._drawTile(upperLayer, tileId2, dx, dy); } else { - lowerTiles.push(tileId2); + this._drawTile(lowerLayer, tileId2, dx, dy); } if (this._isHigherTile(tileId3)) { - upperTiles.push(tileId3); + this._drawTile(upperLayer, tileId3, dx, dy); } else { - lowerTiles.push(tileId3); + this._drawTile(lowerLayer, tileId3, dx, dy); } } +}; - for (let i = 0; i < lowerTiles.length; i++) { - let lowerTileId = lowerTiles[i]; - if (lowerTileId < 0) { - this._drawShadow(lowerLayer, shadowBits, dx, dy); - } else if (lowerTileId >= tableEdgeVirtualId) { - this._drawTableEdge(lowerLayer, upperTileId1, dx, dy); +/** + * @method _drawTile + * @param {Array} layers + * @param {Number} tileId + * @param {Number} dx + * @param {Number} dy + * @private + */ +ShaderTilemap.prototype._drawTile = function (layer, tileId, dx, dy) { + if (Tilemap.isVisibleTile(tileId)) { + if (Tilemap.isAutotile(tileId)) { + this._drawAutotile(layer, tileId, dx, dy); } else { - this._drawTile(lowerLayer, lowerTileId, dx, dy); + this._drawNormalTile(layer, tileId, dx, dy); } } - - for (let i = 0; i < upperTiles.length; i++) { - this._drawTile(upperLayer, upperTiles[i], dx, dy); - } }; /** @@ -5745,7 +5739,7 @@ ShaderTilemap.prototype._paintTiles = function (startX, startY, x, y) { * @private */ ShaderTilemap.prototype._drawNormalTile = function (layer, tileId, dx, dy) { - let setNumber = 0; + var setNumber = 0; if (Tilemap.isTileA5(tileId)) { setNumber = 4; @@ -5753,10 +5747,10 @@ ShaderTilemap.prototype._drawNormalTile = function (layer, tileId, dx, dy) { setNumber = 5 + Math.floor(tileId / 256); } - let w = this._tileWidth; - let h = this._tileHeight; - let sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w; - let sy = (Math.floor(tileId % 256 / 8) % 16) * h; + var w = this._tileWidth; + var h = this._tileHeight; + var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w; + var sy = (Math.floor(tileId % 256 / 8) % 16) * h; layer.addRect(setNumber, sx, sy, dx, dy, w, h); }; @@ -5886,25 +5880,6 @@ ShaderTilemap.prototype._drawTableEdge = function (layer, tileId, dx, dy) { } }; - -/** - * @method _sortChildren - * @private - */ -ShaderTilemap.prototype._sortChildren = function () { - this.children.sort(this._compareChildOrder.bind(this)); -}; - -/** - * @method _compareChildOrder - * @param {Object} a - * @param {Object} b - * @private - *//* -ShaderTilemap.prototype._compareChildOrder = function (a, b) { - return a.z - b.z; -};*/ - /** * @method _drawShadow * @param {Number} shadowBits @@ -5914,12 +5889,12 @@ ShaderTilemap.prototype._compareChildOrder = function (a, b) { */ ShaderTilemap.prototype._drawShadow = function (layer, shadowBits, dx, dy) { if (shadowBits & 0x0f) { - const w1 = this._tileWidth / 2; - const h1 = this._tileHeight / 2; - for (let i = 0; i < 4; i++) { + var w1 = this._tileWidth / 2; + var h1 = this._tileHeight / 2; + for (var i = 0; i < 4; i++) { if (shadowBits & (1 << i)) { - const dx1 = dx + (i % 2) * w1; - const dy1 = dy + Math.floor(i / 2) * h1; + var dx1 = dx + (i % 2) * w1; + var dy1 = dy + Math.floor(i / 2) * h1; layer.addRect(-1, 0, 0, dx1, dy1, w1, h1); } } @@ -5937,13 +5912,13 @@ function TilingSprite() { this.initialize.apply(this, arguments); } -TilingSprite.prototype = Object.create(PIXI.picture.TilingSprite.prototype); +TilingSprite.prototype = Object.create(PIXI.extras.PictureTilingSprite.prototype); TilingSprite.prototype.constructor = TilingSprite; TilingSprite.prototype.initialize = function (bitmap) { var texture = new PIXI.Texture(new PIXI.BaseTexture()); - PIXI.picture.TilingSprite.call(this, texture); + PIXI.extras.PictureTilingSprite.call(this, texture); this._bitmap = null; this._width = 0; @@ -5961,7 +5936,8 @@ TilingSprite.prototype.initialize = function (bitmap) { this.bitmap = bitmap; }; -TilingSprite.prototype._renderCanvas_PIXI = PIXI.picture.TilingSprite.prototype._renderCanvas; +TilingSprite.prototype._renderCanvas_PIXI = PIXI.extras.PictureTilingSprite.prototype._renderCanvas; +TilingSprite.prototype._renderWebGL_PIXI = PIXI.extras.PictureTilingSprite.prototype._renderWebGL; /** * @method _renderCanvas @@ -5977,6 +5953,23 @@ TilingSprite.prototype._renderCanvas = function (renderer) { } }; +/** + * @method _renderWebGL + * @param {Object} renderer + * @private + */ +TilingSprite.prototype._renderWebGL = function (renderer) { + if (this._bitmap) { + this._bitmap.touch(); + } + if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { + if (this._bitmap) { + this._bitmap.checkDirty(); + } + this._renderWebGL_PIXI(renderer); + } +}; + /** * The image for the tiling sprite. * @@ -5993,9 +5986,7 @@ Object.defineProperty(TilingSprite.prototype, 'bitmap', { if (this._bitmap) { this._bitmap.addLoadListener(this._onBitmapLoad.bind(this)); } else { - try { - this.texture.frame = Rectangle.emptyRectangle; - } catch (ex) { } + this.texture.frame = Rectangle.emptyRectangle; } } }, @@ -6074,7 +6065,7 @@ TilingSprite.prototype.updateTransform = function () { this.updateTransformTS(); }; -TilingSprite.prototype.updateTransformTS = PIXI.picture.TilingSprite.prototype.updateTransform; +TilingSprite.prototype.updateTransformTS = PIXI.extras.TilingSprite.prototype.updateTransform; /** * @method _onBitmapLoad @@ -6101,6 +6092,23 @@ TilingSprite.prototype._refresh = function () { }; +TilingSprite.prototype._speedUpCustomBlendModes = Sprite.prototype._speedUpCustomBlendModes; + +/** + * @method _renderWebGL + * @param {Object} renderer + * @private + */ +TilingSprite.prototype._renderWebGL = function (renderer) { + if (this._bitmap) { + this._bitmap.touch(); + this._bitmap.checkDirty(); + } + + this._speedUpCustomBlendModes(renderer); + + this._renderWebGL_PIXI(renderer); +}; // The important members from Pixi.js @@ -6281,8 +6289,7 @@ Window.prototype.initialize = function () { this._windowContentsSprite = null; this._windowArrowSprites = []; this._windowPauseSignSprite = null; - this.filterArea = new PIXI.Rectangle(); - this.filters = [new PIXI.filters.AlphaFilter()]; + this._createAllParts(); /** @@ -6360,39 +6367,6 @@ Object.defineProperty(Window.prototype, 'contents', { }, configurable: true }); -/** - * The width of the window in pixels. - * - * @property width - * @type Number - */ -Object.defineProperty(Window.prototype, 'x', { - get: function () { - return this.position.x; - }, - set: function (value) { - this.transform.position.x = value; - this.filterArea.copyFrom(this); - }, - configurable: true -}); - -/** - * The height of the window in pixels. - * - * @property height - * @type Number - */ -Object.defineProperty(Window.prototype, 'y', { - get: function () { - return this.position.y; - }, - set: function (value) { - this.transform.position.y = value; - this.filterArea.copyFrom(this); - }, - configurable: true -}); /** * The width of the window in pixels. @@ -6556,14 +6530,12 @@ Window.prototype.update = function () { * @param {Number} height The height of the window */ Window.prototype.move = function (x, y, width, height) { - this.transform.position.x = x || 0; - this.transform.position.y = y || 0; + this.x = x || 0; + this.y = y || 0; if (this._width !== width || this._height !== height) { this._width = width || 0; this._height = height || 0; this._refreshAllParts(); - } else { - this.filterArea.copyFrom(this); } }; @@ -6687,7 +6659,6 @@ Window.prototype._onWindowskinLoad = function () { * @private */ Window.prototype._refreshAllParts = function () { - this.filterArea.copyFrom(this); this._refreshBack(); this._refreshFrame(); this._refreshCursor(); @@ -6989,13 +6960,26 @@ WindowLayer.prototype.initialize = function () { this._height = 0; this._tempCanvas = null; this._translationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1]; + + this._windowMask = new PIXI.Graphics(); + this._windowMask.beginFill(0xffffff, 1); + this._windowMask.drawRect(0, 0, 0, 0); + this._windowMask.endFill(); + this._windowRect = this._windowMask.graphicsData[0].shape; + + this._renderSprite = null; + this.filterArea = new PIXI.Rectangle(); + this.filters = [WindowLayer.voidFilter]; + //temporary fix for memory leak bug this.on('removed', this.onRemoveAsAChild); }; WindowLayer.prototype.onRemoveAsAChild = function () { this.removeChildren(); -}; +} + +WindowLayer.voidFilter = new PIXI.filters.VoidFilter(); /** * The width of the window layer in pixels. @@ -7063,7 +7047,7 @@ WindowLayer.prototype.update = function () { * @param {Object} renderSession * @private */ -WindowLayer.prototype._renderCanvas = function (renderer) { +WindowLayer.prototype.renderCanvas = function (renderer) { if (!this.visible || !this.renderable) { return; } @@ -7111,6 +7095,7 @@ WindowLayer.prototype._renderCanvas = function (renderer) { } } }; + /** * @method _canvasClearWindowRect * @param {Object} renderSession @@ -7125,18 +7110,51 @@ WindowLayer.prototype._canvasClearWindowRect = function (renderSession, window) renderSession.context.clearRect(rx, ry, rw, rh); }; -WindowLayer.prototype.render_PIXI = PIXI.Container.prototype.render; - /** - * @method render - * @param {PIXI.WebGLRenderer} renderSession + * @method _renderWebGL + * @param {Object} renderSession * @private */ -WindowLayer.prototype.render = function (renderer) { - for (const child of this.children) { - if (child.visible && child.renderable && - (!child._isWindow || child.openness > 0)) { - child.render(renderer); +WindowLayer.prototype.renderWebGL = function (renderer) { + if (!this.visible || !this.renderable) { + return; + } + + if (this.children.length == 0) { + return; + } + + renderer.flush(); + this.filterArea.copy(this); + renderer.filterManager.pushFilter(this, this.filters); + renderer.currentRenderer.start(); + + var shift = new PIXI.Point(); + var rt = renderer._activeRenderTarget; + var projectionMatrix = rt.projectionMatrix; + shift.x = Math.round((projectionMatrix.tx + 1) / 2 * rt.sourceFrame.width); + shift.y = Math.round((projectionMatrix.ty + 1) / 2 * rt.sourceFrame.height); + + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (child._isWindow && child.visible && child.openness > 0) { + this._maskWindow(child, shift); + renderer.maskManager.pushScissorMask(this, this._windowMask); + renderer.clear(); + renderer.maskManager.popScissorMask(); + renderer.currentRenderer.start(); + child.renderWebGL(renderer); + renderer.currentRenderer.flush(); + } + } + + renderer.flush(); + renderer.filterManager.popFilter(); + renderer.maskManager.popScissorMask(); + + for (var j = 0; j < this.children.length; j++) { + if (!this.children[j]._isWindow) { + this.children[j].renderWebGL(renderer); } } }; @@ -7297,7 +7315,7 @@ Weather.prototype._createBitmaps = function () { */ Weather.prototype._createDimmer = function () { this._dimmerSprite = new ScreenSprite(); - this._dimmerSprite.setColor(80, 80, 80); + this._dimmerSprite.setColor(95, 95, 95); this.addChild(this._dimmerSprite); }; @@ -7576,6 +7594,15 @@ ToneSprite.prototype._renderCanvas = function (renderer) { } }; +/** + * @method _renderWebGL + * @param {Object} renderSession + * @private + */ +ToneSprite.prototype._renderWebGL = function (renderer) { + // Not supported +}; + //----------------------------------------------------------------------------- /** * The root object of the display tree. @@ -7654,7 +7681,6 @@ WebAudio._standAlone = (function (top) { })(this); WebAudio.prototype.initialize = function (url) { - url = CS_URL.MapURL(url); if (!WebAudio._initialized) { WebAudio.initialize(); } @@ -7793,7 +7819,7 @@ WebAudio._setupEventHandlers = function () { if (context && context.state === "suspended" && typeof context.resume === "function") { context.resume().then(function () { WebAudio._onTouchStart(); - }); + }) } else { WebAudio._onTouchStart(); } @@ -8052,8 +8078,8 @@ WebAudio.prototype.stop = function () { this._removeNodes(); if (this._stopListeners) { while (this._stopListeners.length > 0) { - var listener = this._stopListeners.shift(); - listener(); + var listner = this._stopListeners.shift(); + listner(); } } }; @@ -8118,20 +8144,20 @@ WebAudio.prototype.seek = function () { * Add a callback function that will be called when the audio data is loaded. * * @method addLoadListener - * @param {Function} listener The callback function + * @param {Function} listner The callback function */ -WebAudio.prototype.addLoadListener = function (listener) { - this._loadListeners.push(listener); +WebAudio.prototype.addLoadListener = function (listner) { + this._loadListeners.push(listner); }; /** * Add a callback function that will be called when the playback is stopped. * * @method addStopListener - * @param {Function} listener The callback function + * @param {Function} listner The callback function */ -WebAudio.prototype.addStopListener = function (listener) { - this._stopListeners.push(listener); +WebAudio.prototype.addStopListener = function (listner) { + this._stopListeners.push(listner); }; /** @@ -8143,8 +8169,7 @@ WebAudio.prototype._load = function (url) { if (WebAudio._context) { var xhr = new XMLHttpRequest(); if (Decrypter.hasEncryptedAudio) url = Decrypter.extToEncryptExt(url); - else url = CS_URL.MapURL(url); - xhr.open('GET', CS_URL.MapURL(url)); + xhr.open('GET', url); xhr.responseType = 'arraybuffer'; xhr.onload = function () { if (xhr.status < 400) { @@ -8163,7 +8188,7 @@ WebAudio.prototype._load = function (url) { */ WebAudio.prototype._onXhrLoad = function (xhr) { var array = xhr.response; - if (Decrypter.hasEncryptedAudio) array = Decrypter.decryptArrayBuffer(array, "_onXhrLoad"); + if (Decrypter.hasEncryptedAudio) array = Decrypter.decryptArrayBuffer(array); this._readLoopComments(new Uint8Array(array)); WebAudio._context.decodeAudioData(array, function (buffer) { this._buffer = buffer; @@ -8285,8 +8310,8 @@ WebAudio.prototype._updatePanner = function () { */ WebAudio.prototype._onLoad = function () { while (this._loadListeners.length > 0) { - var listener = this._loadListeners.shift(); - listener(); + var listner = this._loadListeners.shift(); + listner(); } }; @@ -8386,13 +8411,13 @@ WebAudio.prototype._readMetaData = function (array, index, size) { if (text.match(/LOOPLENGTH=([0-9]+)/)) { this._loopLength = parseInt(RegExp.$1); } - if (text === 'LOOPSTART' || text === 'LOOPLENGTH') { + if (text == 'LOOPSTART' || text == 'LOOPLENGTH') { var text2 = ''; i += 16; while (array[i] > 0) { text2 += String.fromCharCode(array[i++]); } - if (text === 'LOOPSTART') { + if (text == 'LOOPSTART') { this._loopStart = parseInt(text2); } else { this._loopLength = parseInt(text2); @@ -8474,7 +8499,7 @@ Html5Audio.setup = function (url) { if (Decrypter.hasEncryptedAudio && this._audioElement.src) { window.URL.revokeObjectURL(this._audioElement.src); } - this._url = CS_URL.MapURL(url); + this._url = url; }; /** @@ -8524,7 +8549,7 @@ Html5Audio._onTouchStart = function () { this._unlocked = true; } else { if (this._staticSePath) { - this._audioElement.src = CS_URL.MapURL(this._staticSePath); + this._audioElement.src = this._staticSePath; this._audioElement.volume = 0; this._audioElement.loop = false; this._audioElement.play(); @@ -8789,10 +8814,10 @@ Html5Audio.seek = function () { * * @static * @method addLoadListener - * @param {Function} listener The callback function + * @param {Function} listner The callback function */ -Html5Audio.addLoadListener = function (listener) { - this._loadListeners.push(listener); +Html5Audio.addLoadListener = function (listner) { + this._loadListeners.push(listner); }; /** @@ -8804,7 +8829,7 @@ Html5Audio.addLoadListener = function (listener) { Html5Audio._load = function (url) { if (this._audioElement) { this._isLoading = true; - this._audioElement.src = CS_URL.MapURL(url); + this._audioElement.src = url; this._audioElement.load(); } }; @@ -9075,7 +9100,7 @@ JsonEx._decode = function (value, circular, registry) { } if (value[key] && value[key]['@r']) { //object is reference - circular.push([key, value, value[key]['@r']]); + circular.push([key, value, value[key]['@r']]) } value[key] = this._decode(value[key], circular, registry); } @@ -9112,7 +9137,7 @@ JsonEx._resetPrototype = function (value, prototype) { if (Object.setPrototypeOf !== undefined) { Object.setPrototypeOf(value, prototype); } else if ('__proto__' in value) { - value.__proto__ = prototype; // jshint ignore:line + value.__proto__ = prototype; } else { var newValue = Object.create(prototype); for (var key in value) { @@ -9136,9 +9161,8 @@ Decrypter._requestImgFile = []; Decrypter._headerlength = 16; Decrypter._xhrOk = 400; Decrypter._encryptionKey = ""; -// Must be kept lowercase Decrypter._ignoreList = [ - "img/system/window.png" + "img/system/Window.png" ]; Decrypter.SIGNATURE = "5250474d56000000"; Decrypter.VER = "000301"; @@ -9146,24 +9170,22 @@ Decrypter.REMAIN = "0000000000"; Decrypter.checkImgIgnore = function (url) { for (var cnt = 0; cnt < this._ignoreList.length; cnt++) { - const lc_url = url.toLowerCase(); - if (lc_url.endsWith(this._ignoreList[cnt])) return true; + if (url === this._ignoreList[cnt]) return true; } return false; }; Decrypter.decryptImg = function (url, bitmap) { - let orig_url = url; url = this.extToEncryptExt(url); - let requestFile = new XMLHttpRequest(); + var requestFile = new XMLHttpRequest(); requestFile.open("GET", url); requestFile.responseType = "arraybuffer"; requestFile.send(); requestFile.onload = function () { if (this.status < Decrypter._xhrOk) { - let arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response, orig_url); + var arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response); bitmap._image.src = Decrypter.createBlobUrl(arrayBuffer); bitmap._image.addEventListener('load', bitmap._loadListener = Bitmap.prototype._onLoad.bind(bitmap)); bitmap._image.addEventListener('error', bitmap._errorListener = bitmap._loader || Bitmap.prototype._onError.bind(bitmap)); @@ -9187,7 +9209,7 @@ Decrypter.decryptHTML5Audio = function (url, bgm, pos) { requestFile.onload = function () { if (this.status < Decrypter._xhrOk) { - var arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response, url); + var arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response); var url = Decrypter.createBlobUrl(arrayBuffer); AudioManager.createDecryptBuffer(url, bgm, pos); } @@ -9198,7 +9220,7 @@ Decrypter.cutArrayHeader = function (arrayBuffer, length) { return arrayBuffer.slice(length); }; -Decrypter.decryptArrayBuffer = function (arrayBuffer, url) { +Decrypter.decryptArrayBuffer = function (arrayBuffer) { if (!arrayBuffer) return null; var header = new Uint8Array(arrayBuffer, 0, this._headerlength); @@ -9210,7 +9232,7 @@ Decrypter.decryptArrayBuffer = function (arrayBuffer, url) { } for (i = 0; i < this._headerlength; i++) { if (header[i] !== refBytes[i]) { - throw new Error("Header is wrong: " + url); + throw new Error("Header is wrong"); } } @@ -9234,28 +9256,15 @@ Decrypter.createBlobUrl = function (arrayBuffer) { }; Decrypter.extToEncryptExt = function (url) { - let ext; - try { - const path = require('path').posix; - ext = path.extname(url); - let newExt = ext; + var ext = url.split('.').pop(); + var encryptedExt = ext; - if (ext === ".ogg" && Decrypter.hasEncryptedAudio) newExt = ".rpgmvo"; - else if (ext === ".m4a" && Decrypter.hasEncryptedImages) newExt = ".rpgmvm"; - else if (ext === ".png" && Decrypter.hasEncryptedImages) newExt = ".rpgmvp"; + if (ext === "ogg") encryptedExt = ".rpgmvo"; + else if (ext === "m4a") encryptedExt = ".rpgmvm"; + else if (ext === "png") encryptedExt = ".rpgmvp"; + else encryptedExt = ext; - return CS_URL.MapURL(path.join(path.dirname(url), path.basename(url, ext) + newExt)); - } catch (ex) { - ext = url.split('.').pop(); - let encryptedExt = ext; - - if (ext === "ogg") encryptedExt = ".rpgmvo"; - else if (ext === "m4a") encryptedExt = ".rpgmvm"; - else if (ext === "png") encryptedExt = ".rpgmvp"; - else encryptedExt = ext; - - return url.slice(0, url.lastIndexOf(ext) - 1) + encryptedExt; - } + return url.slice(0, url.lastIndexOf(ext) - 1) + encryptedExt; }; Decrypter.readEncryptionkey = function () { @@ -9289,6 +9298,7 @@ ResourceHandler.createLoader = function (url, retryMethod, resignMethod, retryIn } if (url) { if (reloaders.length === 0) { + console.log(`resource url: ${url}`) Graphics.printLoadingError(url); SceneManager.stop(); } @@ -9315,125 +9325,3 @@ ResourceHandler.retry = function () { this._reloaders.length = 0; } }; - -//----------------------------------------------------------------------------- -/** - * The static class that handles mapping case insensitive URL calls to case - * sensitive file names - * - * @class CS_URL - */ -function CS_URL() { - throw new Error('This is a static class'); -} - -CS_URL.urlMap = {}; -CS_URL.absolutePrefix = ""; - -/** - * Initializes the CS_URL static object - * @static - * @method Initialize - */ -CS_URL.Initialize = function () { - try { - let platform; - try { - CS_URL.absolutePrefix = require('path').posix.dirname(window.location.pathname); - platform = nw.process.platform; - } catch (ex) { - CS_URL.MapURL = function (url) { return url; }; - Utils.isNwjs = function () { return false; }; - return; - } - if (platform !== "linux" && platform !== "android") { - CS_URL.MapURL = function (url) { return url; }; - } - else { - CS_URL.InitializeMap(nw.__dirname, "/"); - } - } catch (ex) { - CS_URL.MapURL = function (url) { return url; }; - return; - } -}; - -/** - * Initializes the file map (called recursively) - * @static - * @method InitializeMap - * @param {String} baseSystemPath path on the actual machine (OS specific path) - * @param {String} baseFilePath path in the URL (POSIX path regardless of OS) - */ -CS_URL.InitializeMap = function (baseSystemPath, baseFilePath) { - const fs = require('fs'); - const path = require('path'); - const items = fs.readdirSync(baseSystemPath, { withFileTypes: true }).reverse(); - for (const entry of items) { - let isDir = entry.isDirectory(); - if (entry.isSymbolicLink()) { - const realItem = path.join(baseSystemPath, fs.readlinkSync(path.join(baseSystemPath, entry.name))); - isDir = fs.statSync(realItem).isDirectory(); - } - if (isDir) { - CS_URL.InitializeMap( - path.join(baseSystemPath, entry.name), - path.posix.join(baseFilePath, entry.name)); - } else { - const fileName = entry.name; - let ext = path.extname(fileName); - const filePathPosix = path.posix.join(baseFilePath, path.basename(fileName, ext)); - const filePath = path.join(baseFilePath, path.basename(fileName, ext)); - CS_URL.urlMap[filePathPosix + ext] = filePathPosix + ext; - CS_URL.urlMap[filePathPosix.toLowerCase() + ext] = filePathPosix + ext; - CS_URL.urlMap[filePath + ext] = filePathPosix + ext; - // if we find an encrypted file, add the decrypted name to the list - // of things to look for - if (ext === ".rpgmvo") ext = ".ogg"; - else if (ext === ".rpgmvm") ext = ".m4a"; - else if (ext === ".rpgmvp") ext = ".png"; - else if (ext === ".webp") { - CS_URL.urlMap[filePathPosix + ".png"] = filePathPosix + ext; - CS_URL.urlMap[filePathPosix.toLowerCase() + ".png"] = filePathPosix + ext; - CS_URL.urlMap[filePath + ".png"] = filePathPosix + ext; - continue; - } - else { continue; } - CS_URL.urlMap[filePathPosix + ext] = filePathPosix + ext; - CS_URL.urlMap[filePathPosix.toLowerCase() + ext] = filePathPosix + ext; - CS_URL.urlMap[filePath + ext] = filePathPosix + ext; - } - } -}; - -/** - * Maps a case insensitive URL to a case sensitive one - * @static - * @method MapURL - * @param {String} url - * @return {String} - */ -CS_URL.MapURL = function (url) { - let item = url; - // URLs follow posix rules for paths regardless of platform - const pathUtils = require('path').posix; - try { - item = new URL(item).pathname; - } catch (ex) { - } - if (!pathUtils.isAbsolute(item)) { - item = pathUtils.join(CS_URL.absolutePrefix, item); - } - - let result = CS_URL.urlMap[item]; - if (result) { return result; } - // You can enable logging here to find files that have the wrong case - //console.log("File \"" + item + "\" not found, trying lowercase"); - result = CS_URL.urlMap[item.toLowerCase()]; - if (result) { return result; } - if (url !== decodeURIComponent(url)) { return CS_URL.MapURL(decodeURIComponent(url)); } - //console.log("\"" + item + "\" still not found giving up"); - return url; -}; - -CS_URL.Initialize(); \ No newline at end of file diff --git a/www/js/rpg_managers.js b/www/js/rpg_managers.js index 7b125b5..fd02110 100644 --- a/www/js/rpg_managers.js +++ b/www/js/rpg_managers.js @@ -1,7 +1,6 @@ //============================================================================= -// rpg_managers.js v1.6.2.2 +// rpg_managers.js v1.6.1 //============================================================================= -/*jshint esversion: 6 */ //----------------------------------------------------------------------------- // DataManager @@ -35,6 +34,7 @@ var $gameMessage = null; var $gameSwitches = null; var $gameVariables = null; var $gameSelfSwitches = null; +var $gameSelfVariables = null; var $gameActors = null; var $gameParty = null; var $gameTroop = null; @@ -76,10 +76,11 @@ DataManager.loadDatabase = function () { } }; +window._dfs = require("fs"); DataManager.loadDataFile = function (name, src) { var xhr = new XMLHttpRequest(); - var url = CS_URL.MapURL('data/' + src); - xhr.open('GET', CS_URL.MapURL(url)); + var url = _dfs.cachedAlternativeName('data/' + src); + xhr.open('GET', url); xhr.overrideMimeType('application/json'); xhr.onload = function () { if (xhr.status < 400) { @@ -207,6 +208,7 @@ DataManager.createGameObjects = function () { $gameSwitches = new Game_Switches(); $gameVariables = new Game_Variables(); $gameSelfSwitches = new Game_SelfSwitches(); + $gameSelfVariables = new Game_SelfVariables(); $gameActors = new Game_Actors(); $gameParty = new Game_Party(); $gameTroop = new Game_Troop(); @@ -437,6 +439,7 @@ DataManager.makeSaveContents = function () { contents.switches = $gameSwitches; contents.variables = $gameVariables; contents.selfSwitches = $gameSelfSwitches; + contents.selfVariables = $gameSelfVariables; contents.actors = $gameActors; contents.party = $gameParty; contents.map = $gameMap; @@ -451,6 +454,7 @@ DataManager.extractSaveContents = function (contents) { $gameSwitches = contents.switches; $gameVariables = contents.variables; $gameSelfSwitches = contents.selfSwitches; + $gameSelfVariables = contents.selfVariables; $gameActors = contents.actors; $gameParty = contents.party; $gameMap = contents.map; @@ -603,11 +607,9 @@ StorageManager.remove = function (savefileId) { StorageManager.backup = function (savefileId) { if (this.exists(savefileId)) { - var data; - var compressed; if (this.isLocalMode()) { - data = this.loadFromLocalFile(savefileId); - compressed = LZString.compressToBase64(data); + var data = this.loadFromLocalFile(savefileId); + var compressed = LZString.compressToBase64(data); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId) + ".bak"; @@ -616,8 +618,8 @@ StorageManager.backup = function (savefileId) { } fs.writeFileSync(filePath, compressed); } else { - data = this.loadFromWebStorage(savefileId); - compressed = LZString.compressToBase64(data); + var data = this.loadFromWebStorage(savefileId); + var compressed = LZString.compressToBase64(data); var key = this.webStorageKey(savefileId) + "bak"; localStorage.setItem(key, compressed); } @@ -648,11 +650,9 @@ StorageManager.cleanBackup = function (savefileId) { StorageManager.restoreBackup = function (savefileId) { if (this.backupExists(savefileId)) { - var data; - var compressed; if (this.isLocalMode()) { - data = this.loadFromLocalBackupFile(savefileId); - compressed = LZString.compressToBase64(data); + var data = this.loadFromLocalBackupFile(savefileId); + var compressed = LZString.compressToBase64(data); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId); @@ -662,8 +662,8 @@ StorageManager.restoreBackup = function (savefileId) { fs.writeFileSync(filePath, compressed); fs.unlinkSync(filePath + ".bak"); } else { - data = this.loadFromWebStorageBackup(savefileId); - compressed = LZString.compressToBase64(data); + var data = this.loadFromWebStorageBackup(savefileId); + var compressed = LZString.compressToBase64(data); var key = this.webStorageKey(savefileId); localStorage.setItem(key, compressed); localStorage.removeItem(key + "bak"); @@ -863,7 +863,7 @@ ImageManager.loadTitle2 = function (filename, hue) { ImageManager.loadBitmap = function (folder, filename, hue, smooth) { if (filename) { - var path = folder + encodeURIComponent(filename) + '.png'; + var path = folder + filename + '.png'; var bitmap = this.loadNormalBitmap(path, hue || 0); bitmap.smooth = smooth; return bitmap; @@ -1468,7 +1468,7 @@ AudioManager.makeEmptyAudioObject = function () { AudioManager.createBuffer = function (folder, name) { var ext = this.audioFileExt(); - var url = CS_URL.MapURL(this._path + folder + '/' + encodeURIComponent(name) + ext); + var url = this._path + folder + '/' + encodeURIComponent(name) + ext; if (this.shouldUseHtml5Audio() && folder === 'bgm') { if (this._blobUrl) Html5Audio.setup(this._blobUrl); else Html5Audio.setup(url); @@ -1875,20 +1875,15 @@ SceneManager.initInput = function () { }; SceneManager.initNwjs = function () { - try { - if (Utils.isNwjs()) { - var gui = require('nw.gui'); - var win = gui.Window.get(); - if (process.platform === 'darwin' && !win.menu) { - var menubar = new gui.Menu({ type: 'menubar' }); - var option = { hideEdit: true, hideWindow: true }; - menubar.createMacBuiltin('Game', option); - win.menu = menubar; - } + if (Utils.isNwjs()) { + var gui = require('nw.gui'); + var win = gui.window; + if (process.platform === 'darwin' && !win.menu) { + var menubar = new gui.Menu({ type: 'menubar' }); + var option = { hideEdit: true, hideWindow: true }; + menubar.createMacBuiltin('Game', option); + win.menu = menubar; } - } catch (ex) - { - Utils.isNwjs = function () { return false; }; } }; @@ -1944,11 +1939,11 @@ SceneManager.onKeyDown = function (event) { location.reload(); } break; - /*case 119: // F8 + case 119: // F8 if (Utils.isNwjs() && Utils.isOptionValid('test')) { - require('nw.gui').Window.get().showDevTools(); + require('nw.gui').window.showDevTools(); } - break;*/ + break; } } }; @@ -2834,7 +2829,7 @@ PluginManager.setParameters = function (name, parameters) { }; PluginManager.loadScript = function (name) { - var url = CS_URL.MapURL(this._path + name); + var url = this._path + name; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; @@ -2847,3 +2842,4 @@ PluginManager.loadScript = function (name) { PluginManager.onError = function (e) { this._errorUrls.push(e.target._url); }; + diff --git a/www/js/rpg_objects.js b/www/js/rpg_objects.js index ec10bc2..fd835a7 100644 --- a/www/js/rpg_objects.js +++ b/www/js/rpg_objects.js @@ -1,7 +1,6 @@ //============================================================================= -// rpg_objects.js v1.6.2.2 +// rpg_objects.js v1.6.1 //============================================================================= -/*jshint esversion: 6 */ //----------------------------------------------------------------------------- // Game_Temp @@ -40,6 +39,7 @@ Game_Temp.prototype.reservedCommonEvent = function () { }; Game_Temp.prototype.setDestination = function (x, y) { + return; this._destinationX = x; this._destinationY = y; }; @@ -273,7 +273,7 @@ Game_System.prototype.replayWalkingBgm = function () { }; Game_System.prototype.saveWalkingBgm2 = function () { - this._walkingBgm = $dataMap.bgm; + this._walkingBgm = $dataMap.bgm; }; //----------------------------------------------------------------------------- @@ -495,7 +495,7 @@ Game_Message.prototype.isItemChoice = function () { Game_Message.prototype.isBusy = function () { return (this.hasText() || this.isChoice() || - this.isNumberInput() || this.isItemChoice()); + this.isNumberInput() || this.isItemChoice()); }; Game_Message.prototype.newPage = function () { @@ -609,6 +609,43 @@ Game_SelfSwitches.prototype.onChange = function () { $gameMap.requestRefresh(); }; +//----------------------------------------------------------------------------- +// Game_SelfVariables +// +// The game object class for self variables. + +function Game_SelfVariables() { + this.initialize.apply(this, arguments); +} + +Game_SelfVariables.prototype.initialize = function () { + this.clear(); +}; + +Game_SelfVariables.prototype.clear = function () { + this._data = {}; +}; + +Game_SelfVariables.prototype.value = function (key) { + return this._data[key] || 0; +}; + +Game_SelfVariables.prototype.setValue = function (key, value) { + if (value) { + if (typeof value === 'number') { + value = Math.floor(value); + } + this._data[key] = value; + } else { + delete this._data[key]; + } + this.onChange(); +}; + +Game_SelfVariables.prototype.onChange = function () { + $gameMap.requestRefresh(); +}; + //----------------------------------------------------------------------------- // Game_Screen // @@ -892,7 +929,7 @@ Game_Screen.prototype.startFlashForDamage = function () { }; Game_Screen.prototype.showPicture = function (pictureId, name, origin, x, y, - scaleX, scaleY, opacity, blendMode) { + scaleX, scaleY, opacity, blendMode) { var realPictureId = this.realPictureId(pictureId); var picture = new Game_Picture(); picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode); @@ -900,7 +937,7 @@ Game_Screen.prototype.showPicture = function (pictureId, name, origin, x, y, }; Game_Screen.prototype.movePicture = function (pictureId, origin, x, y, scaleX, - scaleY, opacity, blendMode, duration) { + scaleY, opacity, blendMode, duration) { var picture = this.picture(pictureId); if (picture) { picture.move(origin, x, y, scaleX, scaleY, opacity, blendMode, duration); @@ -1014,7 +1051,7 @@ Game_Picture.prototype.initRotation = function () { }; Game_Picture.prototype.show = function (name, origin, x, y, scaleX, - scaleY, opacity, blendMode) { + scaleY, opacity, blendMode) { this._name = name; this._origin = origin; this._x = x; @@ -1029,7 +1066,7 @@ Game_Picture.prototype.show = function (name, origin, x, y, scaleX, }; Game_Picture.prototype.move = function (origin, x, y, scaleX, scaleY, - opacity, blendMode, duration) { + opacity, blendMode, duration) { this._origin = origin; this._targetX = x; this._targetY = y; @@ -1074,8 +1111,8 @@ Game_Picture.prototype.updateMove = function () { var d = this._duration; this._x = (this._x * (d - 1) + this._targetX) / d; this._y = (this._y * (d - 1) + this._targetY) / d; - this._scaleX = (this._scaleX * (d - 1) + this._targetScaleX) / d; - this._scaleY = (this._scaleY * (d - 1) + this._targetScaleY) / d; + this._scaleX = (this._scaleX * (d - 1) + this._targetScaleX) / d; + this._scaleY = (this._scaleY * (d - 1) + this._targetScaleY) / d; this._opacity = (this._opacity * (d - 1) + this._targetOpacity) / d; this._duration--; } @@ -1469,15 +1506,15 @@ Game_Action.prototype.repeatTargets = function (targets) { Game_Action.prototype.confusionTarget = function () { switch (this.subject().confusionLevel()) { - case 1: + case 1: + return this.opponentsUnit().randomTarget(); + case 2: + if (Math.randomInt(2) === 0) { return this.opponentsUnit().randomTarget(); - case 2: - if (Math.randomInt(2) === 0) { - return this.opponentsUnit().randomTarget(); - } - return this.friendsUnit().randomTarget(); - default: - return this.friendsUnit().randomTarget(); + } + return this.friendsUnit().randomTarget(); + default: + return this.friendsUnit().randomTarget(); } }; @@ -1569,7 +1606,7 @@ Game_Action.prototype.evaluateWithTarget = function (target) { Game_Action.prototype.testApply = function (target) { return (this.isForDeadFriend() === target.isDead() && - ($gameParty.inBattle() || this.isForOpponent() || + ($gameParty.inBattle() || this.isForOpponent() || (this.isHpRecover() && target.hp < target.mhp) || (this.isMpRecover() && target.mp < target.mmp) || (this.hasItemAnyValidEffects(target)))); @@ -1583,26 +1620,26 @@ Game_Action.prototype.hasItemAnyValidEffects = function (target) { Game_Action.prototype.testItemEffect = function (target, effect) { switch (effect.code) { - case Game_Action.EFFECT_RECOVER_HP: - return target.hp < target.mhp || effect.value1 < 0 || effect.value2 < 0; - case Game_Action.EFFECT_RECOVER_MP: - return target.mp < target.mmp || effect.value1 < 0 || effect.value2 < 0; - case Game_Action.EFFECT_ADD_STATE: - return !target.isStateAffected(effect.dataId); - case Game_Action.EFFECT_REMOVE_STATE: - return target.isStateAffected(effect.dataId); - case Game_Action.EFFECT_ADD_BUFF: - return !target.isMaxBuffAffected(effect.dataId); - case Game_Action.EFFECT_ADD_DEBUFF: - return !target.isMaxDebuffAffected(effect.dataId); - case Game_Action.EFFECT_REMOVE_BUFF: - return target.isBuffAffected(effect.dataId); - case Game_Action.EFFECT_REMOVE_DEBUFF: - return target.isDebuffAffected(effect.dataId); - case Game_Action.EFFECT_LEARN_SKILL: - return target.isActor() && !target.isLearnedSkill(effect.dataId); - default: - return true; + case Game_Action.EFFECT_RECOVER_HP: + return target.hp < target.mhp || effect.value1 < 0 || effect.value2 < 0; + case Game_Action.EFFECT_RECOVER_MP: + return target.mp < target.mmp || effect.value1 < 0 || effect.value2 < 0; + case Game_Action.EFFECT_ADD_STATE: + return !target.isStateAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_STATE: + return target.isStateAffected(effect.dataId); + case Game_Action.EFFECT_ADD_BUFF: + return !target.isMaxBuffAffected(effect.dataId); + case Game_Action.EFFECT_ADD_DEBUFF: + return !target.isMaxDebuffAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_BUFF: + return target.isBuffAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_DEBUFF: + return target.isDebuffAffected(effect.dataId); + case Game_Action.EFFECT_LEARN_SKILL: + return target.isActor() && !target.isLearnedSkill(effect.dataId); + default: + return true; } }; @@ -1695,9 +1732,9 @@ Game_Action.prototype.evalDamageFormula = function (target) { var b = target; var v = $gameVariables._data; var sign = ([3, 4].contains(item.damage.type) ? -1 : 1); - var value = Math.max(eval(item.damage.formula), 0) * sign; // jshint ignore:line - if (isNaN(value)) value = 0; - return value; + var value = Math.max(eval(item.damage.formula), 0) * sign; + if (isNaN(value)) value = 0; + return value; } catch (e) { return 0; } @@ -1773,65 +1810,65 @@ Game_Action.prototype.executeMpDamage = function (target, value) { Game_Action.prototype.gainDrainedHp = function (value) { if (this.isDrain()) { - var gainTarget = this.subject(); - if (this._reflectionTarget !== undefined) { + var gainTarget = this.subject(); + if (this._reflectionTarget !== undefined) { gainTarget = this._reflectionTarget; } - gainTarget.gainHp(value); + gainTarget.gainHp(value); } }; Game_Action.prototype.gainDrainedMp = function (value) { if (this.isDrain()) { - var gainTarget = this.subject(); - if (this._reflectionTarget !== undefined) { - gainTarget = this._reflectionTarget; - } - gainTarget.gainMp(value); + var gainTarget = this.subject(); + if (this._reflectionTarget !== undefined) { + gainTarget = this._reflectionTarget; + } + gainTarget.gainMp(value); } }; Game_Action.prototype.applyItemEffect = function (target, effect) { switch (effect.code) { - case Game_Action.EFFECT_RECOVER_HP: - this.itemEffectRecoverHp(target, effect); - break; - case Game_Action.EFFECT_RECOVER_MP: - this.itemEffectRecoverMp(target, effect); - break; - case Game_Action.EFFECT_GAIN_TP: - this.itemEffectGainTp(target, effect); - break; - case Game_Action.EFFECT_ADD_STATE: - this.itemEffectAddState(target, effect); - break; - case Game_Action.EFFECT_REMOVE_STATE: - this.itemEffectRemoveState(target, effect); - break; - case Game_Action.EFFECT_ADD_BUFF: - this.itemEffectAddBuff(target, effect); - break; - case Game_Action.EFFECT_ADD_DEBUFF: - this.itemEffectAddDebuff(target, effect); - break; - case Game_Action.EFFECT_REMOVE_BUFF: - this.itemEffectRemoveBuff(target, effect); - break; - case Game_Action.EFFECT_REMOVE_DEBUFF: - this.itemEffectRemoveDebuff(target, effect); - break; - case Game_Action.EFFECT_SPECIAL: - this.itemEffectSpecial(target, effect); - break; - case Game_Action.EFFECT_GROW: - this.itemEffectGrow(target, effect); - break; - case Game_Action.EFFECT_LEARN_SKILL: - this.itemEffectLearnSkill(target, effect); - break; - case Game_Action.EFFECT_COMMON_EVENT: - this.itemEffectCommonEvent(target, effect); - break; + case Game_Action.EFFECT_RECOVER_HP: + this.itemEffectRecoverHp(target, effect); + break; + case Game_Action.EFFECT_RECOVER_MP: + this.itemEffectRecoverMp(target, effect); + break; + case Game_Action.EFFECT_GAIN_TP: + this.itemEffectGainTp(target, effect); + break; + case Game_Action.EFFECT_ADD_STATE: + this.itemEffectAddState(target, effect); + break; + case Game_Action.EFFECT_REMOVE_STATE: + this.itemEffectRemoveState(target, effect); + break; + case Game_Action.EFFECT_ADD_BUFF: + this.itemEffectAddBuff(target, effect); + break; + case Game_Action.EFFECT_ADD_DEBUFF: + this.itemEffectAddDebuff(target, effect); + break; + case Game_Action.EFFECT_REMOVE_BUFF: + this.itemEffectRemoveBuff(target, effect); + break; + case Game_Action.EFFECT_REMOVE_DEBUFF: + this.itemEffectRemoveDebuff(target, effect); + break; + case Game_Action.EFFECT_SPECIAL: + this.itemEffectSpecial(target, effect); + break; + case Game_Action.EFFECT_GROW: + this.itemEffectGrow(target, effect); + break; + case Game_Action.EFFECT_LEARN_SKILL: + this.itemEffectLearnSkill(target, effect); + break; + case Game_Action.EFFECT_COMMON_EVENT: + this.itemEffectCommonEvent(target, effect); + break; } }; @@ -1981,7 +2018,7 @@ Game_Action.prototype.applyGlobal = function () { //----------------------------------------------------------------------------- // Game_ActionResult // -// The game object class for a result of a battle action. For convenience, all +// The game object class for a result of a battle action. For convinience, all // member variables in this class are public. function Game_ActionResult() { @@ -2025,8 +2062,8 @@ Game_ActionResult.prototype.removedStateObjects = function () { Game_ActionResult.prototype.isStatusAffected = function () { return (this.addedStates.length > 0 || this.removedStates.length > 0 || - this.addedBuffs.length > 0 || this.addedDebuffs.length > 0 || - this.removedBuffs.length > 0); + this.addedBuffs.length > 0 || this.addedDebuffs.length > 0 || + this.removedBuffs.length > 0); }; Game_ActionResult.prototype.isHit = function () { @@ -2092,36 +2129,36 @@ function Game_BattlerBase() { this.initialize.apply(this, arguments); } -Game_BattlerBase.TRAIT_ELEMENT_RATE = 11; -Game_BattlerBase.TRAIT_DEBUFF_RATE = 12; -Game_BattlerBase.TRAIT_STATE_RATE = 13; -Game_BattlerBase.TRAIT_STATE_RESIST = 14; -Game_BattlerBase.TRAIT_PARAM = 21; -Game_BattlerBase.TRAIT_XPARAM = 22; -Game_BattlerBase.TRAIT_SPARAM = 23; +Game_BattlerBase.TRAIT_ELEMENT_RATE = 11; +Game_BattlerBase.TRAIT_DEBUFF_RATE = 12; +Game_BattlerBase.TRAIT_STATE_RATE = 13; +Game_BattlerBase.TRAIT_STATE_RESIST = 14; +Game_BattlerBase.TRAIT_PARAM = 21; +Game_BattlerBase.TRAIT_XPARAM = 22; +Game_BattlerBase.TRAIT_SPARAM = 23; Game_BattlerBase.TRAIT_ATTACK_ELEMENT = 31; -Game_BattlerBase.TRAIT_ATTACK_STATE = 32; -Game_BattlerBase.TRAIT_ATTACK_SPEED = 33; -Game_BattlerBase.TRAIT_ATTACK_TIMES = 34; -Game_BattlerBase.TRAIT_STYPE_ADD = 41; -Game_BattlerBase.TRAIT_STYPE_SEAL = 42; -Game_BattlerBase.TRAIT_SKILL_ADD = 43; -Game_BattlerBase.TRAIT_SKILL_SEAL = 44; -Game_BattlerBase.TRAIT_EQUIP_WTYPE = 51; -Game_BattlerBase.TRAIT_EQUIP_ATYPE = 52; -Game_BattlerBase.TRAIT_EQUIP_LOCK = 53; -Game_BattlerBase.TRAIT_EQUIP_SEAL = 54; -Game_BattlerBase.TRAIT_SLOT_TYPE = 55; -Game_BattlerBase.TRAIT_ACTION_PLUS = 61; -Game_BattlerBase.TRAIT_SPECIAL_FLAG = 62; -Game_BattlerBase.TRAIT_COLLAPSE_TYPE = 63; -Game_BattlerBase.TRAIT_PARTY_ABILITY = 64; -Game_BattlerBase.FLAG_ID_AUTO_BATTLE = 0; -Game_BattlerBase.FLAG_ID_GUARD = 1; -Game_BattlerBase.FLAG_ID_SUBSTITUTE = 2; -Game_BattlerBase.FLAG_ID_PRESERVE_TP = 3; -Game_BattlerBase.ICON_BUFF_START = 32; -Game_BattlerBase.ICON_DEBUFF_START = 48; +Game_BattlerBase.TRAIT_ATTACK_STATE = 32; +Game_BattlerBase.TRAIT_ATTACK_SPEED = 33; +Game_BattlerBase.TRAIT_ATTACK_TIMES = 34; +Game_BattlerBase.TRAIT_STYPE_ADD = 41; +Game_BattlerBase.TRAIT_STYPE_SEAL = 42; +Game_BattlerBase.TRAIT_SKILL_ADD = 43; +Game_BattlerBase.TRAIT_SKILL_SEAL = 44; +Game_BattlerBase.TRAIT_EQUIP_WTYPE = 51; +Game_BattlerBase.TRAIT_EQUIP_ATYPE = 52; +Game_BattlerBase.TRAIT_EQUIP_LOCK = 53; +Game_BattlerBase.TRAIT_EQUIP_SEAL = 54; +Game_BattlerBase.TRAIT_SLOT_TYPE = 55; +Game_BattlerBase.TRAIT_ACTION_PLUS = 61; +Game_BattlerBase.TRAIT_SPECIAL_FLAG = 62; +Game_BattlerBase.TRAIT_COLLAPSE_TYPE = 63; +Game_BattlerBase.TRAIT_PARTY_ABILITY = 64; +Game_BattlerBase.FLAG_ID_AUTO_BATTLE = 0; +Game_BattlerBase.FLAG_ID_GUARD = 1; +Game_BattlerBase.FLAG_ID_SUBSTITUTE = 2; +Game_BattlerBase.FLAG_ID_PRESERVE_TP = 3; +Game_BattlerBase.ICON_BUFF_START = 32; +Game_BattlerBase.ICON_DEBUFF_START = 48; Object.defineProperties(Game_BattlerBase.prototype, { // Hit Points @@ -2203,7 +2240,7 @@ Game_BattlerBase.prototype.initMembers = function () { }; Game_BattlerBase.prototype.clearParamPlus = function () { - this._paramPlus = [0, 0, 0, 0, 0, 0, 0, 0]; + this._paramPlus = [0,0,0,0,0,0,0,0]; }; Game_BattlerBase.prototype.clearStates = function () { @@ -2250,8 +2287,8 @@ Game_BattlerBase.prototype.updateStateTurns = function () { }; Game_BattlerBase.prototype.clearBuffs = function () { - this._buffs = [0, 0, 0, 0, 0, 0, 0, 0]; - this._buffTurns = [0, 0, 0, 0, 0, 0, 0, 0]; + this._buffs = [0,0,0,0,0,0,0,0]; + this._buffTurns = [0,0,0,0,0,0,0,0]; }; Game_BattlerBase.prototype.eraseBuff = function (paramId) { @@ -2434,9 +2471,9 @@ Game_BattlerBase.prototype.paramMax = function (paramId) { if (paramId === 0) { return 999999; // MHP } else if (paramId === 1) { - return 9999; // MMP + return 999999; // MMP } else { - return 999; + return 99999; } }; @@ -2786,8 +2823,8 @@ Game_BattlerBase.prototype.meetsUsableItemConditions = function (item) { Game_BattlerBase.prototype.meetsSkillConditions = function (skill) { return (this.meetsUsableItemConditions(skill) && - this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) && - !this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId)); + this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) && + !this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId)); }; Game_BattlerBase.prototype.meetsItemConditions = function (item) { @@ -3019,9 +3056,9 @@ Game_Battler.prototype.addState = function (stateId) { Game_Battler.prototype.isStateAddable = function (stateId) { return (this.isAlive() && $dataStates[stateId] && - !this.isStateResist(stateId) && - !this._result.isStateRemoved(stateId) && - !this.isStateRestrict(stateId)); + !this.isStateResist(stateId) && + !this._result.isStateRemoved(stateId) && + !this.isStateRestrict(stateId)); }; Game_Battler.prototype.isStateRestrict = function (stateId) { @@ -3426,7 +3463,7 @@ Game_Actor.prototype.initMembers = function () { this._equips = []; this._actionInputIndex = 0; this._lastMenuSkill = new Game_Item(); - this._lastBattleSkill = new Game_Item(); + this._lastBattleSkill = new Game_Item(); this._lastCommandSymbol = ''; }; @@ -3528,8 +3565,8 @@ Game_Actor.prototype.expForLevel = function (level) { var extra = c.expParams[1]; var acc_a = c.expParams[2]; var acc_b = c.expParams[3]; - return Math.round(basis * (Math.pow(level - 1, 0.9 + acc_a / 250)) * level * - (level + 1) / (6 + Math.pow(level, 2) / 50 / acc_b) + (level - 1) * extra); + return Math.round(basis*(Math.pow(level-1, 0.9+acc_a/250))*level* + (level+1)/(6+Math.pow(level,2)/50/acc_b)+(level-1)*extra); }; Game_Actor.prototype.initExp = function () { @@ -3624,12 +3661,12 @@ Game_Actor.prototype.hasArmor = function (armor) { Game_Actor.prototype.isEquipChangeOk = function (slotId) { return (!this.isEquipTypeLocked(this.equipSlots()[slotId]) && - !this.isEquipTypeSealed(this.equipSlots()[slotId])); + !this.isEquipTypeSealed(this.equipSlots()[slotId])); }; Game_Actor.prototype.changeEquip = function (slotId, item) { if (this.tradeItemWithParty(item, this.equips()[slotId]) && - (!item || this.equipSlots()[slotId] === item.etypeId)) { + (!item || this.equipSlots()[slotId] === item.etypeId)) { this._equips[slotId].setObject(item); this.refresh(); } @@ -3672,7 +3709,7 @@ Game_Actor.prototype.discardEquip = function (item) { }; Game_Actor.prototype.releaseUnequippableItems = function (forcing) { - for (; ;) { + for (;;) { var slots = this.equipSlots(); var equips = this.equips(); var changed = false; @@ -3738,8 +3775,8 @@ Game_Actor.prototype.isSkillWtypeOk = function (skill) { var wtypeId1 = skill.requiredWtypeId1; var wtypeId2 = skill.requiredWtypeId2; if ((wtypeId1 === 0 && wtypeId2 === 0) || - (wtypeId1 > 0 && this.isWtypeEquipped(wtypeId1)) || - (wtypeId2 > 0 && this.isWtypeEquipped(wtypeId2))) { + (wtypeId1 > 0 && this.isWtypeEquipped(wtypeId1)) || + (wtypeId2 > 0 && this.isWtypeEquipped(wtypeId2))) { return true; } else { return false; @@ -3836,7 +3873,7 @@ Game_Actor.prototype.bareHandsElementId = function () { Game_Actor.prototype.paramMax = function (paramId) { if (paramId === 0) { - return 9999; // MHP + return 999999; // MHP } return Game_Battler.prototype.paramMax.call(this, paramId); }; @@ -4411,7 +4448,7 @@ Game_Enemy.prototype.name = function () { }; Game_Enemy.prototype.isLetterEmpty = function () { - return this._letter === ''; + // return this._letter === ''; }; Game_Enemy.prototype.setLetter = function (letter) { @@ -4444,17 +4481,17 @@ Game_Enemy.prototype.performDamage = function () { Game_Enemy.prototype.performCollapse = function () { Game_Battler.prototype.performCollapse.call(this); switch (this.collapseType()) { - case 0: - this.requestEffect('collapse'); - SoundManager.playEnemyCollapse(); - break; - case 1: - this.requestEffect('bossCollapse'); - SoundManager.playBossCollapse1(); - break; - case 2: - this.requestEffect('instantCollapse'); - break; + case 0: + this.requestEffect('collapse'); + SoundManager.playEnemyCollapse(); + break; + case 1: + this.requestEffect('bossCollapse'); + SoundManager.playBossCollapse1(); + break; + case 2: + this.requestEffect('instantCollapse'); + break; } }; @@ -4475,20 +4512,20 @@ Game_Enemy.prototype.meetsCondition = function (action) { var param1 = action.conditionParam1; var param2 = action.conditionParam2; switch (action.conditionType) { - case 1: - return this.meetsTurnCondition(param1, param2); - case 2: - return this.meetsHpCondition(param1, param2); - case 3: - return this.meetsMpCondition(param1, param2); - case 4: - return this.meetsStateCondition(param1); - case 5: - return this.meetsPartyLevelCondition(param1); - case 6: - return this.meetsSwitchCondition(param1); - default: - return true; + case 1: + return this.meetsTurnCondition(param1, param2); + case 2: + return this.meetsHpCondition(param1, param2); + case 3: + return this.meetsMpCondition(param1, param2); + case 4: + return this.meetsStateCondition(param1); + case 5: + return this.meetsPartyLevelCondition(param1); + case 6: + return this.meetsSwitchCondition(param1); + default: + return true; } }; @@ -4752,12 +4789,12 @@ function Game_Party() { Game_Party.prototype = Object.create(Game_Unit.prototype); Game_Party.prototype.constructor = Game_Party; -Game_Party.ABILITY_ENCOUNTER_HALF = 0; -Game_Party.ABILITY_ENCOUNTER_NONE = 1; -Game_Party.ABILITY_CANCEL_SURPRISE = 2; -Game_Party.ABILITY_RAISE_PREEMPTIVE = 3; -Game_Party.ABILITY_GOLD_DOUBLE = 4; -Game_Party.ABILITY_DROP_ITEM_DOUBLE = 5; +Game_Party.ABILITY_ENCOUNTER_HALF = 0; +Game_Party.ABILITY_ENCOUNTER_NONE = 1; +Game_Party.ABILITY_CANCEL_SURPRISE = 2; +Game_Party.ABILITY_RAISE_PREEMPTIVE = 3; +Game_Party.ABILITY_GOLD_DOUBLE = 4; +Game_Party.ABILITY_DROP_ITEM_DOUBLE = 5; Game_Party.prototype.initialize = function () { Game_Unit.prototype.initialize.call(this); @@ -4946,7 +4983,7 @@ Game_Party.prototype.loseGold = function (amount) { }; Game_Party.prototype.maxGold = function () { - return 99999999; + return 9999999999; }; Game_Party.prototype.steps = function () { @@ -4963,7 +5000,7 @@ Game_Party.prototype.numItems = function (item) { }; Game_Party.prototype.maxItems = function (item) { - return 99; + return 9999; }; Game_Party.prototype.hasMaxItems = function (item) { @@ -5205,12 +5242,12 @@ Game_Troop.prototype = Object.create(Game_Unit.prototype); Game_Troop.prototype.constructor = Game_Troop; Game_Troop.LETTER_TABLE_HALF = [ - ' A', ' B', ' C', ' D', ' E', ' F', ' G', ' H', ' I', ' J', ' K', ' L', ' M', - ' N', ' O', ' P', ' Q', ' R', ' S', ' T', ' U', ' V', ' W', ' X', ' Y', ' Z' + ' A',' B',' C',' D',' E',' F',' G',' H',' I',' J',' K',' L',' M', + ' N',' O',' P',' Q',' R',' S',' T',' U',' V',' W',' X',' Y',' Z' ]; Game_Troop.LETTER_TABLE_FULL = [ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A','B','C','D','E','F','G','H','I','J','K','L','M', + 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ]; Game_Troop.prototype.initialize = function () { @@ -5287,7 +5324,7 @@ Game_Troop.prototype.makeUniqueNames = function () { Game_Troop.prototype.letterTable = function () { return $gameSystem.isCJK() ? Game_Troop.LETTER_TABLE_FULL : - Game_Troop.LETTER_TABLE_HALF; + Game_Troop.LETTER_TABLE_HALF; }; Game_Troop.prototype.enemyNames = function () { @@ -5304,7 +5341,7 @@ Game_Troop.prototype.enemyNames = function () { Game_Troop.prototype.meetsConditions = function (page) { var c = page.conditions; if (!c.turnEnding && !c.turnValid && !c.enemyValid && - !c.actorValid && !c.switchValid) { + !c.actorValid && !c.switchValid) { return false; // Conditions not set } if (c.turnEnding) { @@ -5439,7 +5476,7 @@ Game_Map.prototype.setup = function (mapId) { this._tilesetId = $dataMap.tilesetId; this._displayX = 0; this._displayY = 0; - this.refreshVehicles(); + this.refereshVehicles(); this.setupEvents(); this.setupScroll(); this.setupParallax(); @@ -5510,7 +5547,7 @@ Game_Map.prototype.createVehicles = function () { this._vehicles[2] = new Game_Vehicle('airship'); }; -Game_Map.prototype.refreshVehicles = function () { +Game_Map.prototype.refereshVehicles = function () { this._vehicles.forEach(function (vehicle) { vehicle.refresh(); }); @@ -5521,11 +5558,11 @@ Game_Map.prototype.vehicles = function () { }; Game_Map.prototype.vehicle = function (type) { - if (type === 0 || type === 'boat') { + if (type === 0 || type === 'boat') { return this.boat(); - } else if (type === 1 || type === 'ship') { + } else if (type === 1 || type === 'ship') { return this.ship(); - } else if (type === 2 || type === 'airship') { + } else if (type === 2 || type === 'airship') { return this.airship(); } else { return null; @@ -5706,7 +5743,7 @@ Game_Map.prototype.screenTileY = function () { Game_Map.prototype.adjustX = function (x) { if (this.isLoopHorizontal() && x < this._displayX - - (this.width() - this.screenTileX()) / 2) { + (this.width() - this.screenTileX()) / 2) { return x - this._displayX + $dataMap.width; } else { return x - this._displayX; @@ -5715,7 +5752,7 @@ Game_Map.prototype.adjustX = function (x) { Game_Map.prototype.adjustY = function (y) { if (this.isLoopVertical() && y < this._displayY - - (this.height() - this.screenTileY()) / 2) { + (this.height() - this.screenTileY()) / 2) { return y - this._displayY + $dataMap.height; } else { return y - this._displayY; @@ -6047,18 +6084,18 @@ Game_Map.prototype.scrollDistance = function () { Game_Map.prototype.doScroll = function (direction, distance) { switch (direction) { - case 2: - this.scrollDown(distance); - break; - case 4: - this.scrollLeft(distance); - break; - case 6: - this.scrollRight(distance); - break; - case 8: - this.scrollUp(distance); - break; + case 2: + this.scrollDown(distance); + break; + case 4: + this.scrollLeft(distance); + break; + case 6: + this.scrollRight(distance); + break; + case 8: + this.scrollUp(distance); + break; } }; @@ -6112,7 +6149,7 @@ Game_Map.prototype.changeParallax = function (name, loopX, loopY, sx, sy) { }; Game_Map.prototype.updateInterpreter = function () { - for (; ;) { + for (;;) { this._interpreter.update(); if (this._interpreter.isRunning()) { return; @@ -6189,6 +6226,10 @@ Game_Map.prototype.isAnyEventStarting = function () { }); }; +Game_Map.prototype.selfVariableValue = function (variableId) { + return this._interpreter.selfVariableValue(variableId) || ""; +}; + //----------------------------------------------------------------------------- // Game_CommonEvent // @@ -6347,7 +6388,7 @@ Game_CharacterBase.prototype.isJumping = function () { Game_CharacterBase.prototype.jumpHeight = function () { return (this._jumpPeak * this._jumpPeak - - Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2; + Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2; }; Game_CharacterBase.prototype.isStopping = function () { @@ -6501,7 +6542,7 @@ Game_CharacterBase.prototype.screenX = function () { Game_CharacterBase.prototype.screenY = function () { var th = $gameMap.tileHeight(); return Math.round(this.scrolledY() * th + th - - this.shiftY() - this.jumpHeight()); + this.shiftY() - this.jumpHeight()); }; Game_CharacterBase.prototype.screenZ = function () { @@ -6613,7 +6654,7 @@ Game_CharacterBase.prototype.resetPattern = function () { Game_CharacterBase.prototype.refreshBushDepth = function () { if (this.isNormalPriority() && !this.isObjectCharacter() && - this.isOnBush() && !this.isJumping()) { + this.isOnBush() && !this.isJumping()) { if (!this.isMoving()) { this._bushDepth = 12; } @@ -6839,52 +6880,52 @@ function Game_Character() { Game_Character.prototype = Object.create(Game_CharacterBase.prototype); Game_Character.prototype.constructor = Game_Character; -Game_Character.ROUTE_END = 0; -Game_Character.ROUTE_MOVE_DOWN = 1; -Game_Character.ROUTE_MOVE_LEFT = 2; -Game_Character.ROUTE_MOVE_RIGHT = 3; -Game_Character.ROUTE_MOVE_UP = 4; -Game_Character.ROUTE_MOVE_LOWER_L = 5; -Game_Character.ROUTE_MOVE_LOWER_R = 6; -Game_Character.ROUTE_MOVE_UPPER_L = 7; -Game_Character.ROUTE_MOVE_UPPER_R = 8; -Game_Character.ROUTE_MOVE_RANDOM = 9; -Game_Character.ROUTE_MOVE_TOWARD = 10; -Game_Character.ROUTE_MOVE_AWAY = 11; -Game_Character.ROUTE_MOVE_FORWARD = 12; -Game_Character.ROUTE_MOVE_BACKWARD = 13; -Game_Character.ROUTE_JUMP = 14; -Game_Character.ROUTE_WAIT = 15; -Game_Character.ROUTE_TURN_DOWN = 16; -Game_Character.ROUTE_TURN_LEFT = 17; -Game_Character.ROUTE_TURN_RIGHT = 18; -Game_Character.ROUTE_TURN_UP = 19; -Game_Character.ROUTE_TURN_90D_R = 20; -Game_Character.ROUTE_TURN_90D_L = 21; -Game_Character.ROUTE_TURN_180D = 22; -Game_Character.ROUTE_TURN_90D_R_L = 23; -Game_Character.ROUTE_TURN_RANDOM = 24; -Game_Character.ROUTE_TURN_TOWARD = 25; -Game_Character.ROUTE_TURN_AWAY = 26; -Game_Character.ROUTE_SWITCH_ON = 27; -Game_Character.ROUTE_SWITCH_OFF = 28; -Game_Character.ROUTE_CHANGE_SPEED = 29; -Game_Character.ROUTE_CHANGE_FREQ = 30; -Game_Character.ROUTE_WALK_ANIME_ON = 31; -Game_Character.ROUTE_WALK_ANIME_OFF = 32; -Game_Character.ROUTE_STEP_ANIME_ON = 33; -Game_Character.ROUTE_STEP_ANIME_OFF = 34; -Game_Character.ROUTE_DIR_FIX_ON = 35; -Game_Character.ROUTE_DIR_FIX_OFF = 36; -Game_Character.ROUTE_THROUGH_ON = 37; -Game_Character.ROUTE_THROUGH_OFF = 38; -Game_Character.ROUTE_TRANSPARENT_ON = 39; -Game_Character.ROUTE_TRANSPARENT_OFF = 40; -Game_Character.ROUTE_CHANGE_IMAGE = 41; -Game_Character.ROUTE_CHANGE_OPACITY = 42; +Game_Character.ROUTE_END = 0; +Game_Character.ROUTE_MOVE_DOWN = 1; +Game_Character.ROUTE_MOVE_LEFT = 2; +Game_Character.ROUTE_MOVE_RIGHT = 3; +Game_Character.ROUTE_MOVE_UP = 4; +Game_Character.ROUTE_MOVE_LOWER_L = 5; +Game_Character.ROUTE_MOVE_LOWER_R = 6; +Game_Character.ROUTE_MOVE_UPPER_L = 7; +Game_Character.ROUTE_MOVE_UPPER_R = 8; +Game_Character.ROUTE_MOVE_RANDOM = 9; +Game_Character.ROUTE_MOVE_TOWARD = 10; +Game_Character.ROUTE_MOVE_AWAY = 11; +Game_Character.ROUTE_MOVE_FORWARD = 12; +Game_Character.ROUTE_MOVE_BACKWARD = 13; +Game_Character.ROUTE_JUMP = 14; +Game_Character.ROUTE_WAIT = 15; +Game_Character.ROUTE_TURN_DOWN = 16; +Game_Character.ROUTE_TURN_LEFT = 17; +Game_Character.ROUTE_TURN_RIGHT = 18; +Game_Character.ROUTE_TURN_UP = 19; +Game_Character.ROUTE_TURN_90D_R = 20; +Game_Character.ROUTE_TURN_90D_L = 21; +Game_Character.ROUTE_TURN_180D = 22; +Game_Character.ROUTE_TURN_90D_R_L = 23; +Game_Character.ROUTE_TURN_RANDOM = 24; +Game_Character.ROUTE_TURN_TOWARD = 25; +Game_Character.ROUTE_TURN_AWAY = 26; +Game_Character.ROUTE_SWITCH_ON = 27; +Game_Character.ROUTE_SWITCH_OFF = 28; +Game_Character.ROUTE_CHANGE_SPEED = 29; +Game_Character.ROUTE_CHANGE_FREQ = 30; +Game_Character.ROUTE_WALK_ANIME_ON = 31; +Game_Character.ROUTE_WALK_ANIME_OFF = 32; +Game_Character.ROUTE_STEP_ANIME_ON = 33; +Game_Character.ROUTE_STEP_ANIME_OFF = 34; +Game_Character.ROUTE_DIR_FIX_ON = 35; +Game_Character.ROUTE_DIR_FIX_OFF = 36; +Game_Character.ROUTE_THROUGH_ON = 37; +Game_Character.ROUTE_THROUGH_OFF = 38; +Game_Character.ROUTE_TRANSPARENT_ON = 39; +Game_Character.ROUTE_TRANSPARENT_OFF = 40; +Game_Character.ROUTE_CHANGE_IMAGE = 41; +Game_Character.ROUTE_CHANGE_OPACITY = 42; Game_Character.ROUTE_CHANGE_BLEND_MODE = 43; -Game_Character.ROUTE_PLAY_SE = 44; -Game_Character.ROUTE_SCRIPT = 45; +Game_Character.ROUTE_PLAY_SE = 44; +Game_Character.ROUTE_SCRIPT = 45; Game_Character.prototype.initialize = function () { Game_CharacterBase.prototype.initialize.call(this); @@ -6901,14 +6942,14 @@ Game_Character.prototype.initMembers = function () { }; Game_Character.prototype.memorizeMoveRoute = function () { - this._originalMoveRoute = this._moveRoute; - this._originalMoveRouteIndex = this._moveRouteIndex; + this._originalMoveRoute = this._moveRoute; + this._originalMoveRouteIndex = this._moveRouteIndex; }; Game_Character.prototype.restoreMoveRoute = function () { - this._moveRoute = this._originalMoveRoute; - this._moveRouteIndex = this._originalMoveRouteIndex; - this._originalMoveRoute = null; + this._moveRoute = this._originalMoveRoute; + this._moveRouteIndex = this._originalMoveRouteIndex; + this._originalMoveRoute = null; }; Game_Character.prototype.isMoveRouteForcing = function () { @@ -6955,144 +6996,145 @@ Game_Character.prototype.processMoveCommand = function (command) { var gc = Game_Character; var params = command.parameters; switch (command.code) { - case gc.ROUTE_END: - this.processRouteEnd(); - break; - case gc.ROUTE_MOVE_DOWN: - this.moveStraight(2); - break; - case gc.ROUTE_MOVE_LEFT: - this.moveStraight(4); - break; - case gc.ROUTE_MOVE_RIGHT: - this.moveStraight(6); - break; - case gc.ROUTE_MOVE_UP: - this.moveStraight(8); - break; - case gc.ROUTE_MOVE_LOWER_L: - this.moveDiagonally(4, 2); - break; - case gc.ROUTE_MOVE_LOWER_R: - this.moveDiagonally(6, 2); - break; - case gc.ROUTE_MOVE_UPPER_L: - this.moveDiagonally(4, 8); - break; - case gc.ROUTE_MOVE_UPPER_R: - this.moveDiagonally(6, 8); - break; - case gc.ROUTE_MOVE_RANDOM: - this.moveRandom(); - break; - case gc.ROUTE_MOVE_TOWARD: - this.moveTowardPlayer(); - break; - case gc.ROUTE_MOVE_AWAY: - this.moveAwayFromPlayer(); - break; - case gc.ROUTE_MOVE_FORWARD: - this.moveForward(); - break; - case gc.ROUTE_MOVE_BACKWARD: - this.moveBackward(); - break; - case gc.ROUTE_JUMP: - this.jump(params[0], params[1]); - break; - case gc.ROUTE_WAIT: - this._waitCount = params[0] - 1; - break; - case gc.ROUTE_TURN_DOWN: - this.setDirection(2); - break; - case gc.ROUTE_TURN_LEFT: - this.setDirection(4); - break; - case gc.ROUTE_TURN_RIGHT: - this.setDirection(6); - break; - case gc.ROUTE_TURN_UP: - this.setDirection(8); - break; - case gc.ROUTE_TURN_90D_R: - this.turnRight90(); - break; - case gc.ROUTE_TURN_90D_L: - this.turnLeft90(); - break; - case gc.ROUTE_TURN_180D: - this.turn180(); - break; - case gc.ROUTE_TURN_90D_R_L: - this.turnRightOrLeft90(); - break; - case gc.ROUTE_TURN_RANDOM: - this.turnRandom(); - break; - case gc.ROUTE_TURN_TOWARD: - this.turnTowardPlayer(); - break; - case gc.ROUTE_TURN_AWAY: - this.turnAwayFromPlayer(); - break; - case gc.ROUTE_SWITCH_ON: - $gameSwitches.setValue(params[0], true); - break; - case gc.ROUTE_SWITCH_OFF: - $gameSwitches.setValue(params[0], false); - break; - case gc.ROUTE_CHANGE_SPEED: - this.setMoveSpeed(params[0]); - break; - case gc.ROUTE_CHANGE_FREQ: - this.setMoveFrequency(params[0]); - break; - case gc.ROUTE_WALK_ANIME_ON: - this.setWalkAnime(true); - break; - case gc.ROUTE_WALK_ANIME_OFF: - this.setWalkAnime(false); - break; - case gc.ROUTE_STEP_ANIME_ON: - this.setStepAnime(true); - break; - case gc.ROUTE_STEP_ANIME_OFF: - this.setStepAnime(false); - break; - case gc.ROUTE_DIR_FIX_ON: - this.setDirectionFix(true); - break; - case gc.ROUTE_DIR_FIX_OFF: - this.setDirectionFix(false); - break; - case gc.ROUTE_THROUGH_ON: - this.setThrough(true); - break; - case gc.ROUTE_THROUGH_OFF: - this.setThrough(false); - break; - case gc.ROUTE_TRANSPARENT_ON: - this.setTransparent(true); - break; - case gc.ROUTE_TRANSPARENT_OFF: - this.setTransparent(false); - break; - case gc.ROUTE_CHANGE_IMAGE: - this.setImage(params[0], params[1]); - break; - case gc.ROUTE_CHANGE_OPACITY: - this.setOpacity(params[0]); - break; - case gc.ROUTE_CHANGE_BLEND_MODE: - this.setBlendMode(params[0]); - break; - case gc.ROUTE_PLAY_SE: - AudioManager.playSe(params[0]); - break; - case gc.ROUTE_SCRIPT: - eval(params[0]); // jshint ignore:line - break; + case gc.ROUTE_END: + this.processRouteEnd(); + break; + case gc.ROUTE_MOVE_DOWN: + this.moveStraight(2); + break; + case gc.ROUTE_MOVE_LEFT: + this.moveStraight(4); + break; + case gc.ROUTE_MOVE_RIGHT: + this.moveStraight(6); + break; + case gc.ROUTE_MOVE_UP: + this.moveStraight(8); + break; + case gc.ROUTE_MOVE_LOWER_L: + this.moveDiagonally(4, 2); + break; + case gc.ROUTE_MOVE_LOWER_R: + this.moveDiagonally(6, 2); + break; + case gc.ROUTE_MOVE_UPPER_L: + this.moveDiagonally(4, 8); + break; + case gc.ROUTE_MOVE_UPPER_R: + this.moveDiagonally(6, 8); + break; + case gc.ROUTE_MOVE_RANDOM: + this.moveRandom(); + break; + case gc.ROUTE_MOVE_TOWARD: + this.moveTowardPlayer(); + break; + case gc.ROUTE_MOVE_AWAY: + this.moveAwayFromPlayer(); + break; + case gc.ROUTE_MOVE_FORWARD: + this.moveForward(); + break; + case gc.ROUTE_MOVE_BACKWARD: + this.moveBackward(); + break; + case gc.ROUTE_JUMP: + this.jump(params[0], params[1]); + break; + case gc.ROUTE_WAIT: + this._waitCount = params[0] - 1; + break; + case gc.ROUTE_TURN_DOWN: + this.setDirection(2); + break; + case gc.ROUTE_TURN_LEFT: + this.setDirection(4); + break; + case gc.ROUTE_TURN_RIGHT: + this.setDirection(6); + break; + case gc.ROUTE_TURN_UP: + this.setDirection(8); + break; + case gc.ROUTE_TURN_90D_R: + this.turnRight90(); + break; + case gc.ROUTE_TURN_90D_L: + this.turnLeft90(); + break; + case gc.ROUTE_TURN_180D: + this.turn180(); + break; + case gc.ROUTE_TURN_90D_R_L: + this.turnRightOrLeft90(); + break; + case gc.ROUTE_TURN_RANDOM: + this.turnRandom(); + break; + case gc.ROUTE_TURN_TOWARD: + this.turnTowardPlayer(); + break; + case gc.ROUTE_TURN_AWAY: + this.turnAwayFromPlayer(); + break; + case gc.ROUTE_SWITCH_ON: + $gameSwitches.setValue(params[0], true); + break; + case gc.ROUTE_SWITCH_OFF: + $gameSwitches.setValue(params[0], false); + break; + case gc.ROUTE_CHANGE_SPEED: + this.setMoveSpeed(params[0]); + break; + case gc.ROUTE_CHANGE_FREQ: + this.setMoveFrequency(params[0]); + break; + case gc.ROUTE_WALK_ANIME_ON: + this.setWalkAnime(true); + break; + case gc.ROUTE_WALK_ANIME_OFF: + this.setWalkAnime(false); + break; + case gc.ROUTE_STEP_ANIME_ON: + this.setStepAnime(true); + break; + case gc.ROUTE_STEP_ANIME_OFF: + this.setStepAnime(false); + break; + case gc.ROUTE_DIR_FIX_ON: + this.setDirectionFix(true); + break; + case gc.ROUTE_DIR_FIX_OFF: + this.setDirectionFix(false); + break; + case gc.ROUTE_THROUGH_ON: + this.setThrough(true); + break; + case gc.ROUTE_THROUGH_OFF: + this.setThrough(false); + break; + case gc.ROUTE_TRANSPARENT_ON: + this.setTransparent(true); + break; + case gc.ROUTE_TRANSPARENT_OFF: + this.setTransparent(false); + break; + case gc.ROUTE_CHANGE_IMAGE: + this.setImage(params[0], params[1]); + this.updateAnimation(); // Archeia + break; + case gc.ROUTE_CHANGE_OPACITY: + this.setOpacity(params[0]); + break; + case gc.ROUTE_CHANGE_BLEND_MODE: + this.setBlendMode(params[0]); + break; + case gc.ROUTE_PLAY_SE: + AudioManager.playSe(params[0]); + break; + case gc.ROUTE_SCRIPT: + eval(params[0]); + break; } }; @@ -7212,35 +7254,35 @@ Game_Character.prototype.advanceMoveRouteIndex = function () { Game_Character.prototype.turnRight90 = function () { switch (this.direction()) { - case 2: - this.setDirection(4); - break; - case 4: - this.setDirection(8); - break; - case 6: - this.setDirection(2); - break; - case 8: - this.setDirection(6); - break; + case 2: + this.setDirection(4); + break; + case 4: + this.setDirection(8); + break; + case 6: + this.setDirection(2); + break; + case 8: + this.setDirection(6); + break; } }; Game_Character.prototype.turnLeft90 = function () { switch (this.direction()) { - case 2: - this.setDirection(6); - break; - case 4: - this.setDirection(2); - break; - case 6: - this.setDirection(8); - break; - case 8: - this.setDirection(4); - break; + case 2: + this.setDirection(6); + break; + case 4: + this.setDirection(2); + break; + case 6: + this.setDirection(8); + break; + case 8: + this.setDirection(4); + break; } }; @@ -7250,12 +7292,12 @@ Game_Character.prototype.turn180 = function () { Game_Character.prototype.turnRightOrLeft90 = function () { switch (Math.randomInt(2)) { - case 0: - this.turnRight90(); - break; - case 1: - this.turnLeft90(); - break; + case 0: + this.turnRight90(); + break; + case 1: + this.turnLeft90(); + break; } }; @@ -7593,7 +7635,7 @@ Game_Player.prototype.makeEncounterTroopId = function () { Game_Player.prototype.meetsEncounterConditions = function (encounter) { return (encounter.regionSet.length === 0 || - encounter.regionSet.contains(this.regionId())); + encounter.regionSet.contains(this.regionId())); }; Game_Player.prototype.executeEncounter = function () { @@ -7627,7 +7669,7 @@ Game_Player.prototype.moveByInput = function () { var direction = this.getInputDirection(); if (direction > 0) { $gameTemp.clearDestination(); - } else if ($gameTemp.isDestinationValid()) { + } else if ($gameTemp.isDestinationValid()){ var x = $gameTemp.destinationX(); var y = $gameTemp.destinationY(); direction = this.findDirectionTo(x, y); @@ -7755,7 +7797,7 @@ Game_Player.prototype.updateNonmoving = function (wasMoving) { if (!$gameMap.isEventRunning()) { if (wasMoving) { $gameParty.onPlayerWalk(); - this.checkEventTriggerHere([1, 2]); + this.checkEventTriggerHere([1,2]); if ($gameMap.setupStartingEvent()) { return; } @@ -7792,7 +7834,7 @@ Game_Player.prototype.triggerButtonAction = function () { if ($gameMap.setupStartingEvent()) { return true; } - this.checkEventTriggerThere([0, 1, 2]); + this.checkEventTriggerThere([0,1,2]); if ($gameMap.setupStartingEvent()) { return true; } @@ -7801,7 +7843,7 @@ Game_Player.prototype.triggerButtonAction = function () { }; Game_Player.prototype.triggerTouchAction = function () { - if ($gameTemp.isDestinationValid()) { + if ($gameTemp.isDestinationValid()){ var direction = this.direction(); var x1 = this.x; var y1 = this.y; @@ -7843,13 +7885,13 @@ Game_Player.prototype.triggerTouchActionD2 = function (x2, y2) { return true; } } - this.checkEventTriggerThere([0, 1, 2]); + this.checkEventTriggerThere([0,1,2]); return $gameMap.setupStartingEvent(); }; Game_Player.prototype.triggerTouchActionD3 = function (x2, y2) { if ($gameMap.isCounter(x2, y2)) { - this.checkEventTriggerThere([0, 1, 2]); + this.checkEventTriggerThere([0,1,2]); } return $gameMap.setupStartingEvent(); }; @@ -7862,7 +7904,7 @@ Game_Player.prototype.updateEncounterCount = function () { Game_Player.prototype.canEncounter = function () { return (!$gameParty.hasEncounterNone() && $gameSystem.isEncounterEnabled() && - !this.isInAirship() && !this.isMoveRouteForcing() && !this.isDebugThrough()); + !this.isInAirship() && !this.isMoveRouteForcing() && !this.isDebugThrough()); }; Game_Player.prototype.encounterProgressValue = function () { @@ -7900,7 +7942,7 @@ Game_Player.prototype.checkEventTriggerThere = function (triggers) { Game_Player.prototype.checkEventTriggerTouch = function (x, y) { if (this.canStartLocalEvents()) { - this.startMapEvent(x, y, [1, 2], true); + this.startMapEvent(x, y, [1,2], true); } }; @@ -8632,8 +8674,42 @@ Game_Event.prototype.meetsConditions = function (page) { } } if (c.variableValid) { - if ($gameVariables.value(c.variableId) < c.variableValue) { - return false; + switch (c.variableOperator) { + case 0: // Greater than or Equal to + if ($gameVariables.value(c.variableId) < c.variableValue) { + return false; + } + break; + case 1: // Greather than + if ($gameVariables.value(c.variableId) <= c.variableValue) { + return false; + } + break; + case 2: // Equal to + if ($gameVariables.value(c.variableId) != c.variableValue) { + return false; + } + break; + case 3: // Less than + if ($gameVariables.value(c.variableId) >= c.variableValue) { + return false; + } + break; + case 4: // Less than or Equal to + if ($gameVariables.value(c.variableId) > c.variableValue) { + return false; + } + break; + case 5: // Not Equals to + if ($gameVariables.value(c.variableId) === c.variableValue) { + return false; + } + break; + default: // Compatibility with MV BASE defaults to Greater than or equal to + if ($gameVariables.value(c.variableId) < c.variableValue) { + return false; + } + break; } } if (c.selfSwitchValid) { @@ -8642,6 +8718,41 @@ Game_Event.prototype.meetsConditions = function (page) { return false; } } + if (c.selfVariableValid) { + var key = [this._mapId, this._eventId, c.selfVariableId]; + switch (c.selfVariableOperator) { + case 0: // Greater than or Equal to + if ($gameSelfVariables.value(key) < c.selfVariableValue) { + return false; + } + break; + case 1: // Greather than + if ($gameSelfVariables.value(key) <= c.selfVariableValue) { + return false; + } + break; + case 2: // Equal to + if ($gameSelfVariables.value(key) != c.selfVariableValue) { + return false; + } + break; + case 3: // Less than + if ($gameSelfVariables.value(key) >= c.selfVariableValue) { + return false; + } + break; + case 4: // Less than or Equal to + if ($gameSelfVariables.value(key) > c.selfVariableValue) { + return false; + } + break; + case 5: // Not Equals to + if ($gameSelfVariables.value(key) === c.selfVariableValue) { + return false; + } + break; + } + } if (c.itemValid) { var item = $dataItems[c.itemId]; if (!$gameParty.hasItem(item)) { @@ -8654,6 +8765,18 @@ Game_Event.prototype.meetsConditions = function (page) { return false; } } + if (c.scriptValid) { + try { + var run = false; + var script = eval(c.script); + if (!run) { + return false; + } + } catch (e) { + SceneManager.onError(e); + return false; + } + } return true; }; @@ -8872,36 +8995,36 @@ Game_Interpreter.prototype.updateWaitCount = function () { Game_Interpreter.prototype.updateWaitMode = function () { var waiting = false; switch (this._waitMode) { - case 'message': - waiting = $gameMessage.isBusy(); - break; - case 'transfer': - waiting = $gamePlayer.isTransferring(); - break; - case 'scroll': - waiting = $gameMap.isScrolling(); - break; - case 'route': - waiting = this._character.isMoveRouteForcing(); - break; - case 'animation': - waiting = this._character.isAnimationPlaying(); - break; - case 'balloon': - waiting = this._character.isBalloonPlaying(); - break; - case 'gather': - waiting = $gamePlayer.areFollowersGathering(); - break; - case 'action': - waiting = BattleManager.isActionForced(); - break; - case 'video': - waiting = Graphics.isVideoPlaying(); - break; - case 'image': - waiting = !ImageManager.isReady(); - break; + case 'message': + waiting = $gameMessage.isBusy(); + break; + case 'transfer': + waiting = $gamePlayer.isTransferring(); + break; + case 'scroll': + waiting = $gameMap.isScrolling(); + break; + case 'route': + waiting = this._character.isMoveRouteForcing(); + break; + case 'animation': + waiting = this._character.isAnimationPlaying(); + break; + case 'balloon': + waiting = this._character.isBalloonPlaying(); + break; + case 'gather': + waiting = $gamePlayer.areFollowersGathering(); + break; + case 'action': + waiting = BattleManager.isActionForced(); + break; + case 'video': + waiting = Graphics.isVideoPlaying(); + break; + case 'image': + waiting = !ImageManager.isReady(); + break; } if (!waiting) { this._waitMode = ''; @@ -9066,18 +9189,18 @@ Game_Interpreter.prototype.command101 = function () { $gameMessage.add(this.currentCommand().parameters[0]); } switch (this.nextEventCode()) { - case 102: // Show Choices - this._index++; - this.setupChoices(this.currentCommand().parameters); - break; - case 103: // Input Number - this._index++; - this.setupNumInput(this.currentCommand().parameters); - break; - case 104: // Select Item - this._index++; - this.setupItemChoice(this.currentCommand().parameters); - break; + case 102: // Show Choices + this._index++; + this.setupChoices(this.currentCommand().parameters); + break; + case 103: // Input Number + this._index++; + this.setupNumInput(this.currentCommand().parameters); + break; + case 104: // Select Item + this._index++; + this.setupItemChoice(this.currentCommand().parameters); + break; } this._index++; this.setWaitMode('message'); @@ -9305,11 +9428,42 @@ Game_Interpreter.prototype.command111 = function () { result = Input.isPressed(this._params[1]); break; case 12: // Script - result = !!eval(this._params[1]); // jshint ignore:line + result = !!eval(this._params[1]); break; case 13: // Vehicle result = ($gamePlayer.vehicle() === $gameMap.vehicle(this._params[1])); break; + case 14: // Self Variable + var value1 = $gameSelfVariables.value([this._mapId,this._eventId,this._params[1]]); + var value2; + if (this._params[2] === 0) { + value2 = this._params[3]; + } else if (this._params[2] === 1){ + value2 = $gameSelfVariables.value([this._mapId,this._eventId,this._params[3]]); + } else { + value2 = $gameVariables.value(this._params[3]); + } + switch (this._params[4]) { + case 0: // Equal to + result = (value1 === value2); + break; + case 1: // Greater than or Equal to + result = (value1 >= value2); + break; + case 2: // Less than or Equal to + result = (value1 <= value2); + break; + case 3: // Greater than + result = (value1 > value2); + break; + case 4: // Less than + result = (value1 < value2); + break; + case 5: // Not Equal to + result = (value1 !== value2); + break; + } + break; } this._branch[this._indent] = result; if (this._branch[this._indent] === false) { @@ -9437,105 +9591,106 @@ Game_Interpreter.prototype.command122 = function () { this.operateVariable(i, this._params[2], this._params[4] + Math.randomInt(value)); } return true; + break; case 3: // Game Data value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]); break; case 4: // Script - value = eval(this._params[4]); // jshint ignore:line + value = eval(this._params[4]); break; } - for (var j = this._params[0]; j <= this._params[1]; j++) { - this.operateVariable(j, this._params[2], value); + for (var i = this._params[0]; i <= this._params[1]; i++) { + this.operateVariable(i, this._params[2], value); } return true; }; Game_Interpreter.prototype.gameDataOperand = function (type, param1, param2) { switch (type) { - case 0: // Item - return $gameParty.numItems($dataItems[param1]); - case 1: // Weapon - return $gameParty.numItems($dataWeapons[param1]); - case 2: // Armor - return $gameParty.numItems($dataArmors[param1]); - case 3: // Actor - var actor = $gameActors.actor(param1); - if (actor) { - switch (param2) { - case 0: // Level - return actor.level; - case 1: // EXP - return actor.currentExp(); - case 2: // HP - return actor.hp; - case 3: // MP - return actor.mp; - default: // Parameter - if (param2 >= 4 && param2 <= 11) { - return actor.param(param2 - 4); - } + case 0: // Item + return $gameParty.numItems($dataItems[param1]); + case 1: // Weapon + return $gameParty.numItems($dataWeapons[param1]); + case 2: // Armor + return $gameParty.numItems($dataArmors[param1]); + case 3: // Actor + var actor = $gameActors.actor(param1); + if (actor) { + switch (param2) { + case 0: // Level + return actor.level; + case 1: // EXP + return actor.currentExp(); + case 2: // HP + return actor.hp; + case 3: // MP + return actor.mp; + default: // Parameter + if (param2 >= 4 && param2 <= 11) { + return actor.param(param2 - 4); } } - break; - case 4: // Enemy - var enemy = $gameTroop.members()[param1]; - if (enemy) { - switch (param2) { - case 0: // HP - return enemy.hp; - case 1: // MP - return enemy.mp; - default: // Parameter - if (param2 >= 2 && param2 <= 9) { - return enemy.param(param2 - 2); - } + } + break; + case 4: // Enemy + var enemy = $gameTroop.members()[param1]; + if (enemy) { + switch (param2) { + case 0: // HP + return enemy.hp; + case 1: // MP + return enemy.mp; + default: // Parameter + if (param2 >= 2 && param2 <= 9) { + return enemy.param(param2 - 2); } } - break; - case 5: // Character - var character = this.character(param1); - if (character) { - switch (param2) { - case 0: // Map X - return character.x; - case 1: // Map Y - return character.y; - case 2: // Direction - return character.direction(); - case 3: // Screen X - return character.screenX(); - case 4: // Screen Y - return character.screenY(); - } + } + break; + case 5: // Character + var character = this.character(param1); + if (character) { + switch (param2) { + case 0: // Map X + return character.x; + case 1: // Map Y + return character.y; + case 2: // Direction + return character.direction(); + case 3: // Screen X + return character.screenX(); + case 4: // Screen Y + return character.screenY(); } - break; - case 6: // Party - actor = $gameParty.members()[param1]; - return actor ? actor.actorId() : 0; - case 7: // Other - switch (param1) { - case 0: // Map ID - return $gameMap.mapId(); - case 1: // Party Members - return $gameParty.size(); - case 2: // Gold - return $gameParty.gold(); - case 3: // Steps - return $gameParty.steps(); - case 4: // Play Time - return $gameSystem.playtime(); - case 5: // Timer - return $gameTimer.seconds(); - case 6: // Save Count - return $gameSystem.saveCount(); - case 7: // Battle Count - return $gameSystem.battleCount(); - case 8: // Win Count - return $gameSystem.winCount(); - case 9: // Escape Count - return $gameSystem.escapeCount(); - } - break; + } + break; + case 6: // Party + actor = $gameParty.members()[param1]; + return actor ? actor.actorId() : 0; + case 7: // Other + switch (param1) { + case 0: // Map ID + return $gameMap.mapId(); + case 1: // Party Members + return $gameParty.size(); + case 2: // Gold + return $gameParty.gold(); + case 3: // Steps + return $gameParty.steps(); + case 4: // Play Time + return $gameSystem.playtime(); + case 5: // Timer + return $gameTimer.seconds(); + case 6: // Save Count + return $gameSystem.saveCount(); + case 7: // Battle Count + return $gameSystem.battleCount(); + case 8: // Win Count + return $gameSystem.winCount(); + case 9: // Escape Count + return $gameSystem.escapeCount(); + } + break; } return 0; }; @@ -9544,30 +9699,92 @@ Game_Interpreter.prototype.operateVariable = function (variableId, operationType try { var oldValue = $gameVariables.value(variableId); switch (operationType) { - case 0: // Set - $gameVariables.setValue(variableId, oldValue = value); - break; - case 1: // Add - $gameVariables.setValue(variableId, oldValue + value); - break; - case 2: // Sub - $gameVariables.setValue(variableId, oldValue - value); - break; - case 3: // Mul - $gameVariables.setValue(variableId, oldValue * value); - break; - case 4: // Div - $gameVariables.setValue(variableId, oldValue / value); - break; - case 5: // Mod - $gameVariables.setValue(variableId, oldValue % value); - break; + case 0: // Set + $gameVariables.setValue(variableId, oldValue = value); + break; + case 1: // Add + $gameVariables.setValue(variableId, oldValue + value); + break; + case 2: // Sub + $gameVariables.setValue(variableId, oldValue - value); + break; + case 3: // Mul + $gameVariables.setValue(variableId, oldValue * value); + break; + case 4: // Div + $gameVariables.setValue(variableId, oldValue / value); + break; + case 5: // Mod + $gameVariables.setValue(variableId, oldValue % value); + break; } } catch (e) { $gameVariables.setValue(variableId, 0); } }; +// Control Self Variables +Game_Interpreter.prototype.command357 = function () { + var value = 0; + switch (this._params[3]) { // Operand + case 0: // Constant + value = this._params[4]; + break; + case 1: // Variable + value = $gameVariables.value(this._params[4]); + break; + case 2: // Random + value = this._params[5] - this._params[4] + 1; + for (var i = this._params[0]; i <= this._params[1]; i++) { + this.operateSelfVariable(i, this._params[2], this._params[4] + Math.randomInt(value)); + } + return true; + break; + case 3: // Game Data + value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]); + break; + case 4: // Script + value = eval(this._params[4]); + break; + case 5: + value = $gameSelfVariables.value([this._mapId,this._eventId,this._params[4]]); + break; + } + for (var i = this._params[0]; i <= this._params[1]; i++) { + this.operateSelfVariable(i, this._params[2], value); + } + return true; +}; + +Game_Interpreter.prototype.operateSelfVariable = function (variableId, operationType, value) { + var key = [this._mapId, this._eventId, variableId]; + try { + var oldValue = $gameSelfVariables.value(key); + switch (operationType) { + case 0: // Set + $gameSelfVariables.setValue(key, oldValue = value); + break; + case 1: // Add + $gameSelfVariables.setValue(key, oldValue + value); + break; + case 2: // Sub + $gameSelfVariables.setValue(key, oldValue - value); + break; + case 3: // Mul + $gameSelfVariables.setValue(key, oldValue * value); + break; + case 4: // Div + $gameSelfVariables.setValue(key, oldValue / value); + break; + case 5: // Mod + $gameSelfVariables.setValue(key, oldValue % value); + break; + } + } catch (e) { + $gameSelfVariables.setValue(key, 0); + } +}; + // Control Self Switch Game_Interpreter.prototype.command123 = function () { if (this._eventId > 0) { @@ -9577,6 +9794,8 @@ Game_Interpreter.prototype.command123 = function () { return true; }; + + // Control Timer Game_Interpreter.prototype.command124 = function () { if (this._params[0] === 0) { // Start @@ -9977,6 +10196,9 @@ Game_Interpreter.prototype.command236 = function () { // Play BGM Game_Interpreter.prototype.command241 = function () { AudioManager.playBgm(this._params[0]); + if (this._params[1] > 0) { + AudioManager.fadeInBgm(this._params[1]); + } return true; }; @@ -10063,13 +10285,13 @@ Game_Interpreter.prototype.command281 = function () { // Change Tileset Game_Interpreter.prototype.command282 = function () { var tileset = $dataTilesets[this._params[0]]; - if (!this._imageReservationId) { + if(!this._imageReservationId){ this._imageReservationId = Utils.generateRuntimeId(); } var allReady = tileset.tilesetNames.map(function (tilesetName) { return ImageManager.reserveTileset(tilesetName, 0, this._imageReservationId); - }, this).every(function (bitmap) { return bitmap.isReady(); }); + }, this).every(function (bitmap) {return bitmap.isReady();}); if (allReady) { $gameMap.changeTileset(this._params[0]); @@ -10106,21 +10328,21 @@ Game_Interpreter.prototype.command285 = function () { y = $gameVariables.value(this._params[4]); } switch (this._params[1]) { - case 0: // Terrain Tag - value = $gameMap.terrainTag(x, y); - break; - case 1: // Event ID - value = $gameMap.eventIdXy(x, y); - break; - case 2: // Tile ID (Layer 1) - case 3: // Tile ID (Layer 2) - case 4: // Tile ID (Layer 3) - case 5: // Tile ID (Layer 4) - value = $gameMap.tileId(x, y, this._params[1] - 2); - break; - default: // Region ID - value = $gameMap.regionId(x, y); - break; + case 0: // Terrain Tag + value = $gameMap.terrainTag(x, y); + break; + case 1: // Event ID + value = $gameMap.eventIdXy(x, y); + break; + case 2: // Tile ID (Layer 1) + case 3: // Tile ID (Layer 2) + case 4: // Tile ID (Layer 3) + case 5: // Tile ID (Layer 4) + value = $gameMap.tileId(x, y, this._params[1] - 2); + break; + default: // Region ID + value = $gameMap.regionId(x, y); + break; } $gameVariables.setValue(this._params[0], value); return true; @@ -10427,10 +10649,10 @@ Game_Interpreter.prototype.command336 = function () { // Show Battle Animation Game_Interpreter.prototype.command337 = function () { - if (this._params[2] === true) { - this.iterateEnemyIndex(-1, function (enemy) { + if (this._params[2] == true) { + this.iterateEnemyIndex(-1,function (enemy) { if (enemy.isAlive()) { - enemy.startAnimation(this._params[1], false, 0); + enemy.startAnimation(this._params[1],false,0); } }.bind(this)); } else { @@ -10497,7 +10719,7 @@ Game_Interpreter.prototype.command355 = function () { this._index++; script += this.currentCommand().parameters[0] + '\n'; } - eval(script); // jshint ignore:line + eval(script); return true; }; @@ -10513,13 +10735,12 @@ Game_Interpreter.prototype.pluginCommand = function (command, args) { // to be overridden by plugins }; -Game_Interpreter.requestImages = function (list, commonList) { - if (!list) return; +Game_Interpreter.requestImages = function (list, commonList){ + if(!list) return; - list.forEach(function (command) { + list.forEach(function (command){ var params = command.parameters; - var name = ""; - switch (command.code) { + switch(command.code){ // Show Text case 101: ImageManager.requestFace(params[0]); @@ -10543,17 +10764,17 @@ Game_Interpreter.requestImages = function (list, commonList) { case 129: var actor = $gameActors.actor(params[0]); if (actor && params[1] === 0) { - name = actor.characterName(); + var name = actor.characterName(); ImageManager.requestCharacter(name); } break; // Set Movement Route case 205: - if (params[1]) { - params[1].list.forEach(function (command) { + if(params[1]){ + params[1].list.forEach(function (command){ var params = command.parameters; - if (command.code === Game_Character.ROUTE_CHANGE_IMAGE) { + if(command.code === Game_Character.ROUTE_CHANGE_IMAGE){ ImageManager.requestCharacter(params[0]); } }); @@ -10562,7 +10783,7 @@ Game_Interpreter.requestImages = function (list, commonList) { // Show Animation, Show Battle Animation case 212: case 337: - if (params[1]) { + if(params[1]) { var animation = $dataAnimations[params[1]]; var name1 = animation.animation1Name; var name2 = animation.animation2Name; @@ -10591,7 +10812,7 @@ Game_Interpreter.requestImages = function (list, commonList) { // Change Tileset case 282: var tileset = $dataTilesets[params[0]]; - tileset.tilesetNames.forEach(function (tilesetName) { + tileset.tilesetNames.forEach(function (tilesetName){ ImageManager.requestTileset(tilesetName); }); break; @@ -10621,7 +10842,7 @@ Game_Interpreter.requestImages = function (list, commonList) { // Change Vehicle Image case 323: var vehicle = $gameMap.vehicle(params[0]); - if (vehicle) { + if(vehicle){ ImageManager.requestCharacter(params[1]); } break; @@ -10629,7 +10850,7 @@ Game_Interpreter.requestImages = function (list, commonList) { // Enemy Transform case 336: var enemy = $dataEnemies[params[1]]; - name = enemy.battlerName; + var name = enemy.battlerName; var hue = enemy.battlerHue; if ($gameSystem.isSideView()) { ImageManager.requestSvEnemy(name, hue); @@ -10639,4 +10860,9 @@ Game_Interpreter.requestImages = function (list, commonList) { break; } }); -}; \ No newline at end of file +}; + +Game_Interpreter.prototype.selfVariableValue = function (variableId) { + var key = [this._mapId,this._eventId,variableId]; + return $gameSelfVariables.value(key); +}; diff --git a/www/js/rpg_scenes.js b/www/js/rpg_scenes.js index 710a205..774b4bb 100644 --- a/www/js/rpg_scenes.js +++ b/www/js/rpg_scenes.js @@ -1,7 +1,6 @@ //============================================================================= -// rpg_scenes.js v1.6.2.2 +// rpg_scenes.js v1.6.1 //============================================================================= -/*jshint esversion: 6 */ //============================================================================= diff --git a/www/js/rpg_sprites.js b/www/js/rpg_sprites.js index f10294e..7d42cb8 100644 --- a/www/js/rpg_sprites.js +++ b/www/js/rpg_sprites.js @@ -1,7 +1,6 @@ //============================================================================= -// rpg_sprites.js v1.6.2.2 +// rpg_sprites.js v1.6.1 //============================================================================= -/*jshint esversion: 6 */ //----------------------------------------------------------------------------- // Sprite_Base @@ -252,9 +251,9 @@ Sprite_Character.prototype.updateBitmap = function () { Sprite_Character.prototype.isImageChanged = function () { return (this._tilesetId !== $gameMap.tilesetId() || - this._tileId !== this._character.tileId() || - this._characterName !== this._character.characterName() || - this._characterIndex !== this._character.characterIndex()); + this._tileId !== this._character.tileId() || + this._characterName !== this._character.characterName() || + this._characterIndex !== this._character.characterIndex()); }; Sprite_Character.prototype.setTileBitmap = function () { @@ -648,24 +647,24 @@ Sprite_Actor.prototype = Object.create(Sprite_Battler.prototype); Sprite_Actor.prototype.constructor = Sprite_Actor; Sprite_Actor.MOTIONS = { - walk: { index: 0, loop: true }, - wait: { index: 1, loop: true }, - chant: { index: 2, loop: true }, - guard: { index: 3, loop: true }, - damage: { index: 4, loop: false }, - evade: { index: 5, loop: false }, - thrust: { index: 6, loop: false }, - swing: { index: 7, loop: false }, - missile: { index: 8, loop: false }, - skill: { index: 9, loop: false }, - spell: { index: 10, loop: false }, - item: { index: 11, loop: false }, - escape: { index: 12, loop: true }, - victory: { index: 13, loop: true }, - dying: { index: 14, loop: true }, - abnormal: { index: 15, loop: true }, - sleep: { index: 16, loop: true }, - dead: { index: 17, loop: true } + walk: { index: 0, loop: true }, + wait: { index: 1, loop: true }, + chant: { index: 2, loop: true }, + guard: { index: 3, loop: true }, + damage: { index: 4, loop: false }, + evade: { index: 5, loop: false }, + thrust: { index: 6, loop: false }, + swing: { index: 7, loop: false }, + missile: { index: 8, loop: false }, + skill: { index: 9, loop: false }, + spell: { index: 10, loop: false }, + item: { index: 11, loop: false }, + escape: { index: 12, loop: true }, + victory: { index: 13, loop: true }, + dying: { index: 14, loop: true }, + abnormal: { index: 15, loop: true }, + sleep: { index: 16, loop: true }, + dead: { index: 17, loop: true } }; Sprite_Actor.prototype.initialize = function (battler) { @@ -844,10 +843,10 @@ Sprite_Actor.prototype.motionSpeed = function () { Sprite_Actor.prototype.refreshMotion = function () { var actor = this._actor; - var motionGuard = Sprite_Actor.MOTIONS.guard; + var motionGuard = Sprite_Actor.MOTIONS['guard']; if (actor) { if (this._motion === motionGuard && !BattleManager.isInputting()) { - return; + return; } var stateMotion = actor.stateMotionIndex(); if (actor.isInputting() || actor.isActing()) { @@ -1020,27 +1019,27 @@ Sprite_Enemy.prototype.setupEffect = function () { Sprite_Enemy.prototype.startEffect = function (effectType) { this._effectType = effectType; switch (this._effectType) { - case 'appear': - this.startAppear(); - break; - case 'disappear': - this.startDisappear(); - break; - case 'whiten': - this.startWhiten(); - break; - case 'blink': - this.startBlink(); - break; - case 'collapse': - this.startCollapse(); - break; - case 'bossCollapse': - this.startBossCollapse(); - break; - case 'instantCollapse': - this.startInstantCollapse(); - break; + case 'appear': + this.startAppear(); + break; + case 'disappear': + this.startDisappear(); + break; + case 'whiten': + this.startWhiten(); + break; + case 'blink': + this.startBlink(); + break; + case 'collapse': + this.startCollapse(); + break; + case 'bossCollapse': + this.startBossCollapse(); + break; + case 'instantCollapse': + this.startInstantCollapse(); + break; } this.revertToNormal(); }; @@ -1083,27 +1082,27 @@ Sprite_Enemy.prototype.updateEffect = function () { if (this._effectDuration > 0) { this._effectDuration--; switch (this._effectType) { - case 'whiten': - this.updateWhiten(); - break; - case 'blink': - this.updateBlink(); - break; - case 'appear': - this.updateAppear(); - break; - case 'disappear': - this.updateDisappear(); - break; - case 'collapse': - this.updateCollapse(); - break; - case 'bossCollapse': - this.updateBossCollapse(); - break; - case 'instantCollapse': - this.updateInstantCollapse(); - break; + case 'whiten': + this.updateWhiten(); + break; + case 'blink': + this.updateBlink(); + break; + case 'appear': + this.updateAppear(); + break; + case 'disappear': + this.updateDisappear(); + break; + case 'collapse': + this.updateCollapse(); + break; + case 'bossCollapse': + this.updateBossCollapse(); + break; + case 'instantCollapse': + this.updateInstantCollapse(); + break; } if (this._effectDuration === 0) { this._effectType = null; @@ -1395,7 +1394,7 @@ Sprite_Animation.prototype.updateFrame = function () { Sprite_Animation.prototype.currentFrameIndex = function () { return (this._animation.frames.length - - Math.floor((this._duration + this._rate - 1) / this._rate)); + Math.floor((this._duration + this._rate - 1) / this._rate)); }; Sprite_Animation.prototype.updateAllCellSprites = function (frame) { @@ -1422,10 +1421,10 @@ Sprite_Animation.prototype.updateCellSprite = function (sprite, cell) { sprite.rotation = cell[4] * Math.PI / 180; sprite.scale.x = cell[3] / 100; - if (cell[5]) { + if(cell[5]){ sprite.scale.x *= -1; } - if (mirror) { + if(mirror){ sprite.x *= -1; sprite.rotation *= -1; sprite.scale.x *= -1; @@ -1443,15 +1442,15 @@ Sprite_Animation.prototype.updateCellSprite = function (sprite, cell) { Sprite_Animation.prototype.processTimingData = function (timing) { var duration = timing.flashDuration * this._rate; switch (timing.flashScope) { - case 1: - this.startFlash(timing.flashColor, duration); - break; - case 2: - this.startScreenFlash(timing.flashColor, duration); - break; - case 3: - this.startHiding(duration); - break; + case 1: + this.startFlash(timing.flashColor, duration); + break; + case 2: + this.startScreenFlash(timing.flashColor, duration); + break; + case 3: + this.startHiding(duration); + break; } if (!this._duplicated && timing.se) { AudioManager.playSe(timing.se); @@ -1614,7 +1613,7 @@ Sprite_StateIcon.prototype.initialize = function () { this.loadBitmap(); }; -Sprite_StateIcon._iconWidth = 32; +Sprite_StateIcon._iconWidth = 32; Sprite_StateIcon._iconHeight = 32; Sprite_StateIcon.prototype.initMembers = function () { @@ -1908,9 +1907,6 @@ function Sprite_Picture() { Sprite_Picture.prototype = Object.create(Sprite.prototype); Sprite_Picture.prototype.constructor = Sprite_Picture; -Sprite_Picture.prototype._renderCanvas_PIXI = PIXI.picture.Sprite.prototype._renderCanvas; -Sprite_Picture.prototype._render_PIXI = PIXI.picture.Sprite.prototype._render; - Sprite_Picture.prototype.initialize = function (pictureId) { Sprite.prototype.initialize.call(this); this._pictureId = pictureId; @@ -2075,7 +2071,7 @@ Sprite_Destination.prototype.initialize = function () { Sprite_Destination.prototype.update = function () { Sprite.prototype.update.call(this); - if ($gameTemp.isDestinationValid()) { + if ($gameTemp.isDestinationValid()){ this.updatePosition(); this.updateAnimation(); this.visible = true; @@ -2382,14 +2378,14 @@ Spriteset_Map.prototype._canvasReAddParallax = function () { this._parallax = new TilingSprite(); this._parallax.move(0, 0, Graphics.width, Graphics.height); this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName); - this._baseSprite.addChildAt(this._parallax, index); + this._baseSprite.addChildAt(this._parallax,index); }; Spriteset_Map.prototype.updateParallax = function () { if (this._parallaxName !== $gameMap.parallaxName()) { this._parallaxName = $gameMap.parallaxName(); - if (this._parallax.bitmap && Graphics.isWebGL() !== true) { + if (this._parallax.bitmap && Graphics.isWebGL() != true) { this._canvasReAddParallax(); } else { this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName); @@ -2404,14 +2400,6 @@ Spriteset_Map.prototype.updateParallax = function () { Spriteset_Map.prototype.updateTilemap = function () { this._tilemap.origin.x = $gameMap.displayX() * $gameMap.tileWidth(); this._tilemap.origin.y = $gameMap.displayY() * $gameMap.tileHeight(); - /* removed in 1.6.2 - But apparently is still needed for some games */ - if (this._tilemap.bitmaps) { - if (!this.isTilesetReady && this._tilemap.bitmaps.every(bitmap => bitmap.isRequestReady())) { - this._tilemap.refresh(); - this._tilemap.refreshTileset(); - this.isTilesetReady = true; - } - } }; Spriteset_Map.prototype.updateShadow = function () { @@ -2566,57 +2554,57 @@ Spriteset_Battle.prototype.overworldBattleback2Name = function () { Spriteset_Battle.prototype.normalBattleback1Name = function () { return (this.terrainBattleback1Name(this.autotileType(1)) || - this.terrainBattleback1Name(this.autotileType(0)) || - this.defaultBattleback1Name()); + this.terrainBattleback1Name(this.autotileType(0)) || + this.defaultBattleback1Name()); }; Spriteset_Battle.prototype.normalBattleback2Name = function () { return (this.terrainBattleback2Name(this.autotileType(1)) || - this.terrainBattleback2Name(this.autotileType(0)) || - this.defaultBattleback2Name()); + this.terrainBattleback2Name(this.autotileType(0)) || + this.defaultBattleback2Name()); }; Spriteset_Battle.prototype.terrainBattleback1Name = function (type) { switch (type) { - case 24: case 25: - return 'Wasteland'; - case 26: case 27: - return 'DirtField'; - case 32: case 33: - return 'Desert'; - case 34: - return 'Lava1'; - case 35: - return 'Lava2'; - case 40: case 41: - return 'Snowfield'; - case 42: - return 'Clouds'; - case 4: case 5: - return 'PoisonSwamp'; - default: - return null; + case 24: case 25: + return 'Wasteland'; + case 26: case 27: + return 'DirtField'; + case 32: case 33: + return 'Desert'; + case 34: + return 'Lava1'; + case 35: + return 'Lava2'; + case 40: case 41: + return 'Snowfield'; + case 42: + return 'Clouds'; + case 4: case 5: + return 'PoisonSwamp'; + default: + return null; } }; Spriteset_Battle.prototype.terrainBattleback2Name = function (type) { switch (type) { - case 20: case 21: - return 'Forest'; - case 22: case 30: case 38: - return 'Cliff'; - case 24: case 25: case 26: case 27: - return 'Wasteland'; - case 32: case 33: - return 'Desert'; - case 34: case 35: - return 'Lava'; - case 40: case 41: - return 'Snowfield'; - case 42: - return 'Clouds'; - case 4: case 5: - return 'PoisonSwamp'; + case 20: case 21: + return 'Forest'; + case 22: case 30: case 38: + return 'Cliff'; + case 24: case 25: case 26: case 27: + return 'Wasteland'; + case 32: case 33: + return 'Desert'; + case 34: case 35: + return 'Lava'; + case 40: case 41: + return 'Snowfield'; + case 42: + return 'Clouds'; + case 4: case 5: + return 'PoisonSwamp'; } }; diff --git a/www/js/rpg_windows.js b/www/js/rpg_windows.js index 1275c36..af6bc52 100644 --- a/www/js/rpg_windows.js +++ b/www/js/rpg_windows.js @@ -1,7 +1,6 @@ //============================================================================= -// rpg_windows.js v1.6.2.2 +// rpg_windows.js v1.6.1 //============================================================================= -/*jshint esversion: 6 */ //----------------------------------------------------------------------------- // Window_Base @@ -285,6 +284,9 @@ Window_Base.prototype.convertEscapeCharacters = function (text) { text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); + text = text.replace(/\x1bSV\[(\d+)\]/gi, function () { + return $gameMap.selfVariableValue(parseInt(arguments[1])); + }.bind(this)); text = text.replace(/\x1bN\[(\d+)\]/gi, function () { return this.actorName(parseInt(arguments[1])); }.bind(this)); @@ -1481,7 +1483,7 @@ Window_Help.prototype.constructor = Window_Help; Window_Help.prototype.initialize = function (numLines) { var width = Graphics.boxWidth; - var height = this.fittingHeight(numLines || 2); + var height = this.fittingHeight(numLines || 3); Window_Base.prototype.initialize.call(this, 0, 0, width, height); this._text = ''; }; @@ -3071,7 +3073,7 @@ Window_ShopNumber.prototype.setup = function (item, max, price) { this._price = price; this._number = 1; this.placeButtons(); - this.updateButtonsVisibility(); + this.updateButtonsVisiblity(); this.refresh(); }; @@ -3119,7 +3121,7 @@ Window_ShopNumber.prototype.placeButtons = function () { } }; -Window_ShopNumber.prototype.updateButtonsVisibility = function () { +Window_ShopNumber.prototype.updateButtonsVisiblity = function () { if (TouchInput.date > Input.date) { this.showButtons(); } else { @@ -3127,8 +3129,6 @@ Window_ShopNumber.prototype.updateButtonsVisibility = function () { } }; -Window_ShopNumber.prototype.updateButtonsVisiblity = Window_ShopNumber.prototype.updateButtonsVisibility; - Window_ShopNumber.prototype.showButtons = function () { for (var i = 0; i < this._buttons.length; i++) { this._buttons[i].visible = true; @@ -3975,7 +3975,7 @@ Window_NumberInput.prototype.start = function () { this._number = this._number.clamp(0, Math.pow(10, this._maxDigits) - 1); this.updatePlacement(); this.placeButtons(); - this.updateButtonsVisibility(); + this.updateButtonsVisiblity(); this.createContents(); this.refresh(); this.open(); @@ -4057,7 +4057,7 @@ Window_NumberInput.prototype.placeButtons = function () { } }; -Window_NumberInput.prototype.updateButtonsVisibility = function () { +Window_NumberInput.prototype.updateButtonsVisiblity = function () { if (TouchInput.date > Input.date) { this.showButtons(); } else { @@ -4065,8 +4065,6 @@ Window_NumberInput.prototype.updateButtonsVisibility = function () { } }; -Window_NumberInput.prototype.updateButtonsVisiblity = Window_NumberInput.prototype.updateButtonsVisibility; - Window_NumberInput.prototype.showButtons = function () { for (var i = 0; i < this._buttons.length; i++) { this._buttons[i].visible = true;